SimplePortal

Started by SimplePortal Team, March 10, 2008, 11:16:07 PM

Previous topic - Next topic

ke4obt

I have this code: global $scripturl, $modSettings, $sourcedir;

require_once("/****/html/hraus/SSI.php");

$now = mktime() + $modSettings['time_offset'] * 3600;
         $today = date('j',$now);
         $year = date("Y",$now);
         $month = date("n",$now);
         $days = array();

         $day_name_length = 3;
         $month_href = $scripturl . '?action=calendar';
         $first_day = 0;
         $pn = array();

$first_of_month = gmmktime(0,0,0,$month,1,$year);
#remember that mktime will automatically correct if invalid dates are entered
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
# this provides a built in "rounding" feature to generate_calendar()

#retrieve this month events, holydays and birthdays
$days_in_month = gmdate('t',$first_of_month);
include_once($sourcedir . '/Calendar.php');
$low_date = $year.'-'.$month.'-01';
$high_date = $year.'-'.$month.'-'.$days_in_month;
$events = calendarEventArray($low_date, $high_date);
$birthdays = calendarBirthdayArray($low_date, $high_date);

#add important days to the days array
foreach($events as $startdate => $value)
$days[substr($startdate,8)] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; background-color: '.(substr($startdate,8)<$today ? 'lightblue' : 'yellow').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.substr($event['start_date'],8).'" target="_self">'.substr($startdate,8).'</a>');

foreach($birthdays as $startdate => $value)
$days[substr($startdate,8)] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; background-color: '.(substr($startdate,8)<$today ? 'lightblue' : 'yellow').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.substr($birth['start_date'],8).'" target="_self">'.substr($startdate,8).'</a>');

$today_date = $year.'-'.($month<10 ? '0'.$month : $month).'-'.$today;

if(empty($events[$today_date]))
$days[$today] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; border: solid 1px black; background-color: white; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');
else
$days[$today] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; border: solid 1px black; background-color: yellow; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');


$day_names = array(); #generate all the day names according to the current locale
for($n=0,$t=(3+$first_day)*86400; $n<7; $n++,$t+=86400) #January 4, 1970 was a Sunday
$day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name

list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title   = htmlentities(ucfirst($month_name)).' '.$year;  #note that some locales don't capitalize month and day names

#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
if($p) $p = '<span class="smalltext">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
if($n) $n = ' <span class="smalltext">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table>'."\n".
'<caption >'.$p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."</caption>\n<tr>";

if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
#if day_name_length is >3, the full name of the day will be printed
foreach($day_names as $d)
$calendar .= '<th class="smalltext" abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>';
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}

if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' days
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
if($weekday == 7){
$weekday   = 0; #start a new week
$calendar .= "</tr>\n<tr style=\"text-align:right;\">";
}
if(isset($days[$day]) and is_array($days[$day])){
@list($link, $classes, $content) = $days[$day];
if(is_null($content))  $content  = $day;
$calendar .= '<td "'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
}
else
{
$calendar .= "<td class=\"smalltext\" style=\"padding-right:4px;\"><a";
if(((($weekday+$first_day) % 7)==0))
{
$calendar .= ' style="color:#C00000;"';
}
$calendar .= " href=\"".$scripturl."?action=calendar;sa=post;month=".$month.";year=".$year.";day=".$day."\" target=\"_self\">$day</a></td>";
}
}
if($weekday != 7) $calendar .= '<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days

echo $calendar.'</tr>';

#crate notice for the next N days events. N is set in Settings.
if (ssi_todaysCalendar('')) {
$result = ssi_todaysCalendar('');
if(!empty($result['birthdays'])){
echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center"><b>Birthdays</b></td><td><hr></td></tr><td colspan="7" class="smalltext">';
$birthdays = $result['birthdays'];
echo '
<span style="color: #' . $modSettings['cal_bdaycolor'] . ';">' . $txt['calendar3b'] . '</span><br />';
foreach( $birthdays as $member )
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['name'], isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', '<br />';
echo '</td></tr>';
}
if(!empty($result['events']))
{
echo '<tr><td><hr></td><td colspan="5" class="smalltext" align="center"><b>Upcomings</b></td><td><hr></td></tr><td colspan="7" class="smalltext">';
echo '
<span style="color: #' . $modSettings['cal_eventcolor'] . ';">' . $txt['calendar4b'] . '</span><br /> ';
$events = $result['events'];
foreach ($events as $event)
{
echo '
'.substr($event['start_date'],8).'/'.substr($event['start_date'],5 , 2).':';
if ($event['can_edit'])
echo '
<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
echo '
' . $event['link'] . '<br />';
}
}
  echo '</td></tr>';
}

echo '</table>';


it is to show the birthdays and events in the calendar block in simple portal. I would like to have it also show the holidays under the birthdays and events.
Can someone show me how to do that?
The code is not part of simple portal, I got it from someone else who was trying to help me.
Thanks in advance,
Flip
Thanks Much

Flip - KE4OBT
     The Blind Ham
Helping other blind hams
get on the air!


Yes I am really a BLIND user!

So, if a mod doesn't install properly, and I can't get help from your part of the forum,
I will come begging for YOUR help since you wrote it and know how it works
um, uh, well,
At least I would really, really hope you do!
HEE-HEE-HEE

BOS4O

#1421
:o

PAPABEAR

Is it possible to make this portal show when at forum list and not just on home page? I am testing on the latest version of SMF 2.0 beta,

Eliana Tamerin

That feature won't be available until SimplePortal 2.1. Thanks.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

BOS4O

#1424
Quote from: BOS4O on October 23, 2008, 06:31:21 PM
hey something go wrong whn i installed the new version... i have 2 copyrights now... how to remove one of them?  :o

where is the creator of this thing to help me ?

dgandy

Quote from: BOS4O on October 25, 2008, 10:56:48 AM
Quote from: BOS4O on October 23, 2008, 06:31:21 PM
hey something go wrong whn i installed the new version... i have 2 copyrights now... how to remove one of them? this is my forum seee the bottom http://lfs-bg.net  :o

where is the creator of this thing to help me ?

He's probably trying to get some sleep. LOL
There is a real simple fix....

You can search for sportal_vital(); code in Sources/Subs.php and delete one.


Burke ♞ Knight

Look, I understand and respect, the need for the copyright, but I don't understand the need of the extra space between it and the other copyrights in the version for SMF 2.0 Beta 4.

How would I remove the extra line space after the SimplePortal copyright, so it does not look like this?

SimplePortal Classic 2.0.5

Copyright © 2008 - BurkeKnight Enterprises.
Powered by SMF 2.0 Beta 4 | SMF © 2006–2008, Simple Machines LLC

I'd like it to look like:

SimplePortal Classic 2.0.5
Copyright © 2008 - BurkeKnight Enterprises.
Powered by SMF 2.0 Beta 4 | SMF © 2006–2008, Simple Machines LLC

Sudhakar Arjunan

yes you are Right, BurkeKnight.

I agree with your statement.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

dgandy

You're welcome Bos40

I'm not sure about that one BurkeKnight. I am running SMF 1.1.6. It looks like there may be a <br /> after sportal_vital(); or before your copyright (Copyright © 2008 - BurkeKnight Enterprises.) that can be removed. Just be careful not to delete anything in the SMF copyright code.

Burke ♞ Knight

#1430
Already looked for that.
Does not appear to be one in index.template.php or on subs.php...

I'm using the Custom Copyright code. Have tried without it, and the SimplePortal copyright still has the line break.

What file is the SimplePortal copyright in?

BOS4O

look too in the custom copyright thing for <br />  :-\

Burke ♞ Knight

I did. The only one is AFTER the custom.

I posted what the index.template.php has. The only <br /> is after the custom, so it's not on same line as the SMF one.

Nathaniel

@BurkeKnight, asudhakar, dgandy and BOS4O,
Unfortionately the copyright cannot be in the SMF copyright function (as it used to be), and putting it in the template means that people will have to perform another template edit. Because of that, it uses a different method that puts it above the SMF copyright, there actually isn't any 'br', its just padding on the 'footerarea' div.

Try this edit in your 'index.template.php' file. Find this code:
<div id="footerarea"
Replace with this code:
<div id="footerarea" style="padding-top:0px;"

That may work, although it will depend on your theme.

@BurkeKnight,
Could you please try to avoid posting important copyright sections of code? It may help some people to remove the copyright. I am more than happy to help people edit the style, but not remove it. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

dgandy

I don't understand why people want to remove the SMF copyright. I'm proud to display it on my site.   :)


The '<br />', before the theme copyright is what is causing the space. If that was removed, would it mess up the official copyright?

Burke ♞ Knight

@LHVWB

Nope, did not do it. I'm using the Default theme, which I had just edited images and the colors.

@dgandy

1. Not trying to remove the copyright, only the extra line space.
2.
QuoteThe
'<br />',
before the theme copyright is what is causing the space. If that was removed, would it mess up the official copyright?

Is NOT the problem. Like I said before, the '<br />', before the theme copyright, is for the custom copyright code. Which is located AFTER the SimplePortal one.
AQlso, just to be sure it was not it, I had tried without the custom copyright code, and the space was larger, 2 lines...

ccbtimewiz

By "custom copyright", are you referring to my mod?

Burke ♞ Knight

I do believe so. I know there's no line break above it, just at the end to make it so it's not on same line as the SMF one.

However, the code above did not move it down much, but it is ok, I guess. Just was curios to why the SimplePortal one was so high up. Seeing how things are coded in SMF 2.0, I can see how things are a bit harder for coders...

ccbtimewiz


Burke ♞ Knight

http://www.bkgta.co.cc

Right now, I got the SimplePortal copyright lowered a bit. Not like I wanted it, but better than it was.

Advertisement: