//Calender Elina Copy, Version 31-10-2008-2//The script take the Days from the SMF txt strings, so that normal the correct day and month name will be used :)//This skript show a small calender with Birthdays and Events on it.global $scripturl, $modSettings, $sourcedir, $txt;//Chanche this oly if it not work =Drequire_once(dirname(__FILE__) . '/../SSI.php');//With that you can start the calander on a other day//-1 = Start on Saturaday, 0 = Start on Sunday, 1 = Start on Monday, 2 = Start on Thusday...$first_day = 0;//How long should the day, if the number higher 3 than the complete dayname will be shown//0 is short 1 is full name :)$day_name_length = 0;//The Color of the background of days with Events or birthdays, you can use css colors$color_items = 'lightblue';//The Color of the background of days with Events or birthdays, you can use css colors$color_today = 'yellow';//The Textcolor for the days$color_text = 'steelblue';//If you have a diffrent calender you can change the link to it here$month_href = $scripturl . '?action=calendar';//Okay please don't do anything here if you not now what you do/**************************************************************/$now = mktime() + $modSettings['time_offset'] * 3600;$today = date('j',$now);$year = date("Y",$now);$month = date("n",$now);$days = array();$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 arrayforeach($events as $startdate => $event) {$cday = substr($startdate,8,2);$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');}foreach($birthdays as $startdate => $birth) {$cday = substr($startdate,8,2);$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</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: '.$color_text.'; 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: '.$color_text.'; font-weight: bold; border: solid 1px black; background-color: '.$color_today.'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');//Wellcome to the smf way of Day building with existing Language strings :D$day_names = $txt['days'];$day_names_short = $txt['days_short'];//So lets see $firstday = 0 means sunday this is the first day :)//if there is a higher number than i need to resort them//negativ values can also be used :)if(!empty($first_day)) {if($first_day < 0)$first_day = 7-(abs($first_day)%7); else$first_day = ($first_day%7); }if(!empty($first_day)) {$old = $day_names;$old_s = $day_names_short;$day_names = array();$day_names_short = array();//Create the new day order :)for($n=0; $n<7; $n++) {$c = (($first_day+$n)%7);$day_names[$n] = $old[$c];$day_names_short[$n] = $old_s[$c];}}list($month, $year, $weekday) = explode(',',gmstrftime('%m,%Y,%w',$first_of_month));$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day$title = $txt['months_titles'][$month].' '.$year; #This is the SMF Text string, so it should be corrected for ut8 or iso#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 applicableif($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>";//Put out the Daynames :)foreach($day_names as $k => $d)$calendar .= '<th class="smalltext" abbr="'.$d.'">'.(!empty($day_name_length) ? $d : $day_names_short[$k]).'</th>';$calendar .= "</tr>\n<tr style=\"text-align:right;\">";if($weekday > 0) $calendar .= '<td class="smalltext" colspan="'.$weekday.'"> </td>'; #initial 'empty' daysfor($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" daysecho $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>';
Last Change 31.10.08
http://simpleportal.net/index.php?topic=89.msg4322#msg4322 <- Take the latest VersionJust stick that in a php block. Then go to http://yoursite.com/forum/ssi_examples.php and copy the line that looks like this: require("/home/spadmin/public_html/SSI.php"); and replace that one with the second line in this code. If you have any errors or problems, let me know.
#if day_name_length is >3, the full name of the day will be printed
$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
$month = date("n",$now);
$days = array();
$day_name_length = 2;
$month_href = $scripturl . '?action=calendar';
$first_day = 0;
$pn = array();
EDIT again!: Okay, is it possible to add something to the code in order to remove the links for other, regular members and other who do not have the permission to edit events? ^^; Everyone on my forum are able to enter the edit page (and then get the error message "you can't edit events", of course), and they see it as a glitch. So do I. Or, a mere code slip.
8: Undefined variable: birth
File: /../.../.../.../.../Themes/default/SPortal1-1.template.php (main sub template - eval?)
Line: 34
8: Undefined variable: txt
File: /../.../.../.../.../Themes/default/SPortal1-1.template.php (main sub template - eval?)
Line: 99
8: Use of undefined constant Calendar - assumed 'Calendar'
File: /../.../.../.../.../Themes/default/SPortal1-1.template.php (main sub template - eval?)
Line: 3
Old one take the newest
I changed line 1, 3 and 42.8: Undefined variable: event
File: /../.../.../.../.../Themes/default/SPortal1-1.template.php (main sub template - eval?)
Line: 99
8: Undefined variable: start_date
File: /../.../.../.../.../Themes/default/SPortal1-1.template.php (main sub template - eval?)
Line: 99
global $scripturl, $modSettings, $sourcedir, $txt;
require_once(dirname(__FILE__) . '/../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 = 2;
$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: white; font-weight: bold; background-color: '.(substr($startdate,8)<$today ? '#FF3366' : '#FFFF00').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.substr($events['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: white; font-weight: bold; background-color: '.(substr($startdate,8)<$today ? '#FF3366' : '#FFFF00').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.substr($birthdays['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: white; font-weight: bold; border: solid 1px black; background-color: #3333FF; 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: black; font-weight: bold; border: solid 1px black; background-color: #FFFF00; 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: #FF3366">' . $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: #FFFF00">' . $txt['calendar4b'] . '</span><br /> ';
$events = $result['events'];
foreach ($events as $event)
{
echo '
'.substr($events['start_date'],8).'/'.substr($events['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>';
global $scripturl, $modSettings, $sourcedir;
toglobal $scripturl, $modSettings, $sourcedir, $txt;
Add the global txt vars, normal the index lang file is loaded on SPortal. And they hold the missing txt string datas of this calendar.require("/your/path/to/SSI.php");
torequire_once(dirname(__FILE__) . '/../SSI.php');
This is an unimportend change, it make it only more compatible ;)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>');
toforeach($events as $startdate => $event)
$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 => $birth)
$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>');
There i changed the $startdate => $birth and the same on the events...#add important days to the days array
foreach($events as $startdate => $event)
$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 => $birth)
$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>');
$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 />';
}
Old Version
Code last time Changed: 31.10.2008foreach($events as $startdate => $event)
$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 => $birth)
$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>');
#add important days to the days array
foreach($events as $startdate => $event) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; background-color: '.($cday < $today ? 'lightblue' : 'yellow').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
foreach($birthdays as $startdate => $birth) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; background-color: '.($cday < $today ? 'lightblue' : 'yellow').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
global $scripturl, $modSettings, $sourcedir, $txt;
require_once(dirname(__FILE__) . '/../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 = 2;
$month_href = $scripturl . '?action=calendar';
$first_day = 1;
$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 => $event) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; background-color: '.($cday < $today ? 'lightblue' : 'yellow').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
foreach($birthdays as $startdate => $birth) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: steelblue; font-weight: bold; background-color: '.($cday < $today ? 'lightblue' : 'yellow').'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</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>Events</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>';
//Calender Elina Copy, Version 31-10-2008-1
//The script take the Days from the SMF txt strings, so that normal the correct day and month name will be used :)
//This skript show a small calender with Birthdays and Events on it.
global $scripturl, $modSettings, $sourcedir, $txt;
//Chanche this oly if it not work =D
require_once(dirname(__FILE__) . '/../SSI.php');
//With that you can start the calander on a other day
//-1 = Start on Saturaday, 0 = Start on Sunday, 1 = Start on Monday, 2 = Start on Thusday...
$first_day = 0;
//How long should the day, if the number higher 3 than the complete dayname will be shown
$day_name_length = 2;
//The Color of the background of days with Events or birthdays, you can use css colors
$color_items = 'lightblue';
//The Color of the background of days with Events or birthdays, you can use css colors
$color_today = 'yellow';
//The Textcolor for the days
$color_text = 'steelblue';
//If you have a diffrent calender you can change the link to it here
$month_href = $scripturl . '?action=calendar';
//Okay please don't do anything here if you not now what you do
/**************************************************************/
$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
$month = date("n",$now);
$days = array();
$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 => $event) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
foreach($birthdays as $startdate => $birth) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</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: '.$color_text.'; 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: '.$color_text.'; font-weight: bold; border: solid 1px black; background-color: '.$color_today.'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');
//Wellcome to the smf way of Day building with existing Language strings :D
$day_names = array(); #generate all the day names according to the current locale
$day_names = $txt['days'];
//So lets see $firstday = 0 means sunday this is the first day :)
//if there is a higher number than i need to resort them
//negativ values can also be used :)
if(!empty($first_day)) {
if($first_day < 0)
$first_day = 7-(abs($first_day)%7);
else
$first_day = ($first_day%7);
}
if(!empty($first_day)) {
$old = $day_names;
$day_names = array();
//Create the new day order :)
for($n=0; $n<7; $n++) {
$c = (($first_day+$n)%7);
$day_names[$n] = $old[$c];
}
}
list($month, $year, $weekday) = explode(',',gmstrftime('%m,%Y,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title = $txt['months_titles'][$month].' '.$year; #This is the SMF Text string, so it should be corrected for ut8 or iso
#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>';
Code: [Select]//Calender Elina Copy, Version 31-10-2008-1
//The script take the Days from the SMF txt strings, so that normal the correct day and month name will be used :)
//This skript show a small calender with Birthdays and Events on it.
global $scripturl, $modSettings, $sourcedir, $txt;
//Chanche this oly if it not work =D
require_once(dirname(__FILE__) . '/../SSI.php');
//With that you can start the calander on a other day
//-1 = Start on Saturaday, 0 = Start on Sunday, 1 = Start on Monday, 2 = Start on Thusday...
$first_day = 0;
//How long should the day, if the number higher 3 than the complete dayname will be shown
$day_name_length = 2;
//The Color of the background of days with Events or birthdays, you can use css colors
$color_items = 'lightblue';
//The Color of the background of days with Events or birthdays, you can use css colors
$color_today = 'yellow';
//The Textcolor for the days
$color_text = 'steelblue';
//If you have a diffrent calender you can change the link to it here
$month_href = $scripturl . '?action=calendar';
//Okay please don't do anything here if you not now what you do
/**************************************************************/
$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
$month = date("n",$now);
$days = array();
$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 => $event) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
foreach($birthdays as $startdate => $birth) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</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: '.$color_text.'; 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: '.$color_text.'; font-weight: bold; border: solid 1px black; background-color: '.$color_today.'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');
//Wellcome to the smf way of Day building with existing Language strings :D
$day_names = array(); #generate all the day names according to the current locale
$day_names = $txt['days'];
//So lets see $firstday = 0 means sunday this is the first day :)
//if there is a higher number than i need to resort them
//negativ values can also be used :)
if(!empty($first_day)) {
if($first_day < 0)
$first_day = 7-(abs($first_day)%7);
else
$first_day = ($first_day%7);
}
if(!empty($first_day)) {
$old = $day_names;
$day_names = array();
//Create the new day order :)
for($n=0; $n<7; $n++) {
$c = (($first_day+$n)%7);
$day_names[$n] = $old[$c];
}
}
list($month, $year, $weekday) = explode(',',gmstrftime('%m,%Y,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title = $txt['months_titles'][$month].' '.$year; #This is the SMF Text string, so it should be corrected for ut8 or iso
#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>';
So now event the days and month will be use the smf text strings for building this.
Bye
DIN1031
//Calender Elina Copy, Version 31-10-2008-2
//The script take the Days from the SMF txt strings, so that normal the correct day and month name will be used :)
//This skript show a small calender with Birthdays and Events on it.
global $scripturl, $modSettings, $sourcedir, $txt;
//Chanche this oly if it not work =D
require_once(dirname(__FILE__) . '/../SSI.php');
//With that you can start the calander on a other day
//-1 = Start on Saturaday, 0 = Start on Sunday, 1 = Start on Monday, 2 = Start on Thusday...
$first_day = 0;
//How long should the day, if the number higher 3 than the complete dayname will be shown
//0 is short 1 is full name :)
$day_name_length = 0;
//The Color of the background of days with Events or birthdays, you can use css colors
$color_items = 'lightblue';
//The Color of the background of days with Events or birthdays, you can use css colors
$color_today = 'yellow';
//The Textcolor for the days
$color_text = 'steelblue';
//If you have a diffrent calender you can change the link to it here
$month_href = $scripturl . '?action=calendar';
//Okay please don't do anything here if you not now what you do
/**************************************************************/
$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
$month = date("n",$now);
$days = array();
$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 => $event) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
foreach($birthdays as $startdate => $birth) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</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: '.$color_text.'; 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: '.$color_text.'; font-weight: bold; border: solid 1px black; background-color: '.$color_today.'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');
//Wellcome to the smf way of Day building with existing Language strings :D
$day_names = $txt['days'];
$day_names_short = $txt['days_short'];
//So lets see $firstday = 0 means sunday this is the first day :)
//if there is a higher number than i need to resort them
//negativ values can also be used :)
if(!empty($first_day)) {
if($first_day < 0)
$first_day = 7-(abs($first_day)%7);
else
$first_day = ($first_day%7);
}
if(!empty($first_day)) {
$old = $day_names;
$old_s = $day_names_short;
$day_names = array();
$day_names_short = array();
//Create the new day order :)
for($n=0; $n<7; $n++) {
$c = (($first_day+$n)%7);
$day_names[$n] = $old[$c];
$day_names_short[$n] = $old_s[$c];
}
}
list($month, $year, $weekday) = explode(',',gmstrftime('%m,%Y,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title = $txt['months_titles'][$month].' '.$year; #This is the SMF Text string, so it should be corrected for ut8 or iso
#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>";
//Put out the Daynames :)
foreach($day_names as $k => $d)
$calendar .= '<th class="smalltext" abbr="'.$d.'">'.(!empty($day_name_length) ? $d : $day_names_short[$k]).'</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>';
So now even the short tags are taken by smf ;).Code: [Select]//Calender Elina Copy, Version 31-10-2008-2
So now even the short tags are taken by smf ;).
//The script take the Days from the SMF txt strings, so that normal the correct day and month name will be used :)
//This skript show a small calender with Birthdays and Events on it.
global $scripturl, $modSettings, $sourcedir, $txt;
//Chanche this oly if it not work =D
require_once(dirname(__FILE__) . '/../SSI.php');
//With that you can start the calander on a other day
//-1 = Start on Saturaday, 0 = Start on Sunday, 1 = Start on Monday, 2 = Start on Thusday...
$first_day = 0;
//How long should the day, if the number higher 3 than the complete dayname will be shown
//0 is short 1 is full name :)
$day_name_length = 0;
//The Color of the background of days with Events or birthdays, you can use css colors
$color_items = 'lightblue';
//The Color of the background of days with Events or birthdays, you can use css colors
$color_today = 'yellow';
//The Textcolor for the days
$color_text = 'steelblue';
//If you have a diffrent calender you can change the link to it here
$month_href = $scripturl . '?action=calendar';
//Okay please don't do anything here if you not now what you do
/**************************************************************/
$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
$month = date("n",$now);
$days = array();
$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 => $event) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</a>');
}
foreach($birthdays as $startdate => $birth) {
$cday = substr($startdate,8,2);
$days[$cday] = array(NULL,NULL,'<a class="smalltext" style="color: '.$color_text.'; font-weight: bold; background-color: '.($cday < $today ? $color_items : $color_today).'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday.'" target="_self">'.$cday.'</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: '.$color_text.'; 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: '.$color_text.'; font-weight: bold; border: solid 1px black; background-color: '.$color_today.'; padding: 0px 4px 0px 4px;" href="'.$scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today.'" target="_self">'.$today.'</a>');
//Wellcome to the smf way of Day building with existing Language strings :D
$day_names = $txt['days'];
$day_names_short = $txt['days_short'];
//So lets see $firstday = 0 means sunday this is the first day :)
//if there is a higher number than i need to resort them
//negativ values can also be used :)
if(!empty($first_day)) {
if($first_day < 0)
$first_day = 7-(abs($first_day)%7);
else
$first_day = ($first_day%7);
}
if(!empty($first_day)) {
$old = $day_names;
$old_s = $day_names_short;
$day_names = array();
$day_names_short = array();
//Create the new day order :)
for($n=0; $n<7; $n++) {
$c = (($first_day+$n)%7);
$day_names[$n] = $old[$c];
$day_names_short[$n] = $old_s[$c];
}
}
list($month, $year, $weekday) = explode(',',gmstrftime('%m,%Y,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
$title = $txt['months_titles'][$month].' '.$year; #This is the SMF Text string, so it should be corrected for ut8 or iso
#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>";
//Put out the Daynames :)
foreach($day_names as $k => $d)
$calendar .= '<th class="smalltext" abbr="'.$d.'">'.(!empty($day_name_length) ? $d : $day_names_short[$k]).'</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>';
So you can only choice short or full name :).
Bye
DIN1031
____Birthdays____
Upcoming Birthdays:
Nov 10 - test user (27)
Nov 12 - test user2 (19)
Nov 14 - test user3 (20)
Yes your right ;) there are no holidays in it.
It was never in the original code, but i think it will be no problem to add them, too ;).
/*
Calender DIN1031 Version 08-11-2008-1
This is a costumizable calendar php block
It will show a calendar, and add the Today Events, Holidays and Birthdays.
Normal it's programmed and tested for SMF 1.1.X
I don't use any SSI.php, because all data that needed is loaded.
*/
global $scripturl, $modSettings, $sourcedir, $txt;
//With that you can start the calander on a other day
//-1 = Start on Saturaday, 0 = Start on Sunday, 1 = Start on Monday, 2 = Start on Thusday...
$first_day = 1;
//How long should the day, if the number higher 3 than the complete dayname will be shown
$day_name_length = 0; //0 is short day name 1 is full day name :)
//The background color of days with Events, birthdays or holidays, you can use css colors
$color_background_items_mixed = 'lightblue';
$color_background_items_event = 'lightblue';
$color_background_items_birthday = 'lightblue';
$color_background_items_holiday = 'lightblue';
//The textcolor of days with Events, birthdays or holidays, you can use css colors
$color_text_items_mixed = 'steelblue';
$color_text_items_event = 'steelblue';
$color_text_items_birthday = 'steelblue';
$color_text_items_holiday = 'steelblue';
//The Color of the todays background / text
$color_background_today = 'white';
$color_text_today = 'green';
//The Textcolor for the standard days
$color_text = 'steelblue';
//The Textcolor for the Sundays
$color_text_sunday = '#C00000';
//If you have a diffrent calender you can change the link to it here
$month_href = $scripturl . '?action=calendar';
//What should the callendar show?
$show_events = 1; //0 No, 1 Yes
$show_birthdays = 1; //0 No, 1 Yes
$show_holidays = 1; //0 No, 1 Yes
//Show the single events and items of the day :)
$show_today = 1; //0 No, 1 Yes
//Okay please don't do anything here if you not now what you do
/**************************************************************/
// You can't do anything if the calendar is off!
if (empty($modSettings['cal_enabled']))
fatal_lang_error('calendar_off', false);
$now = mktime() + $modSettings['time_offset'] * 3600;
$today = date('j',$now);
$year = date("Y",$now);
$month = date("n",$now);
$days = array();
$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;
$can_post_calendar = allowedTo('calendar_post');
$calendarDataToday = array('events' => array(), 'birthdays' => array(), 'holidays' => array());
$todayDate = date("Y-m-d", time());
//add important days to the days array
if(!empty($show_events)) {
$events = calendarEventArray($low_date, $high_date);
foreach($events as $startdate => $event) {
//This insert the today events if they exist
if($todayDate == $startdate)
$calendarDataToday['events'] = $event;
$cday = (int) substr($startdate,8,2);
//We must select between create or only show!
$href_calendar = $can_post_calendar && $cday >= $today ? $scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday : $scripturl.'?action=calendar';
$days[$cday] = '<a class="smalltext" style="color: '.$color_text_items_event.'; font-weight: bold; background-color: '.$color_background_items_event.'; padding: 0px 4px 0px 4px;" href="'.$href_calendar.'" target="_self">'.$cday.'</a>';
}
}
//Add holidays into the day array?
if(!empty($show_birthdays)) {
$birthdays = calendarBirthdayArray($low_date, $high_date);
foreach($birthdays as $startdate => $birth) {
//This insert the today events if they exist
if($todayDate == $startdate)
$calendarDataToday['birthdays'] = $birth;
$cday = (int) substr($startdate,8,2);
//We must select between create or only show!
$href_calendar = $can_post_calendar && $cday >= $today ? $scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday : $scripturl.'?action=calendar';
//Mixed color?
$text_color = !empty($days[$cday]) ? $color_text_items_mixed : $color_text_items_birthday;
$background_color = !empty($days[$cday]) ? $color_background_items_mixed : $color_background_items_birthday;
$days[$cday] = '<a class="smalltext" style="color: '.$text_color.'; font-weight: bold; background-color: '.$background_color.'; padding: 0px 4px 0px 4px;" href="'.$href_calendar.'" target="_self">'.$cday.'</a>';
}
}
//Add holidays into the day array?
if(!empty($show_holidays)) {
$holidays = calendarHolidayArray($low_date, $high_date);
foreach($holidays as $startdate => $holiday) {
//This insert the today events if they exist
if($todayDate == $startdate)
$calendarDataToday['holidays'] = $holiday;
$cday = (int) substr($startdate,8,2);
//We must select between create or only show!
$text_color = !empty($days[$cday]) ? $color_text_items_mixed : $color_text_items_holiday;
$background_color = !empty($days[$cday]) ? $color_background_items_mixed : $color_background_items_holiday;
$href_calendar = $can_post_calendar && $cday >= $today ? $scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$cday : $scripturl.'?action=calendar';
$days[$cday] = '<a class="smalltext" style="color: '.$text_color.'; font-weight: bold; background-color: '.$background_color.'; padding: 0px 4px 0px 4px;" href="'.$href_calendar.'" target="_self">'.$cday.'</a>';
}
}
//So Todays it's an diffrent color :D
$href_calendar = $can_post_calendar ? $scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$today : $scripturl.'?action=calendar';
$days[$today] = '<a class="smalltext" style="color: '.$color_text_today.'; font-weight: bold; border: solid 1px black; background-color: '.$color_background_today.'; padding: 0px 4px 0px 4px;" href="'.$href_calendar.'" target="_self">'.$today.'</a>';
//Wellcome to the smf way of Day building with existing Language strings :D
$day_names = $txt['days'];
$day_names_short = $txt['days_short'];
//So lets see $firstday = 0 means sunday this is the first day :)
//if there is a higher number than i need to resort them
//negativ values can also be used :)
if(!empty($first_day)) {
if($first_day < 0)
$first_day = 7-(abs($first_day)%7);
else
$first_day = ($first_day%7);
}
if(!empty($first_day)) {
$old = $day_names;
$old_s = $day_names_short;
$day_names = array();
$day_names_short = array();
//Create the new day order :)
for($n=0; $n<7; $n++) {
$c = (($first_day+$n)%7);
$day_names[$n] = $old[$c];
$day_names_short[$n] = $old_s[$c];
}
}
list($month, $year, $weekday) = explode(',',gmstrftime('%m,%Y,%w',$first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; //adjust for $first_day
$title = $txt['months_titles'][$month].' '.$year; //This is the SMF Text string, so it should be corrected for ut8 or iso
/* Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03 */
$calendar = '
<table>
<caption>'.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title)."</caption>
<tr>";
//Put out the Daynames :)
foreach($day_names as $k => $d)
$calendar .= '
<th class="smalltext" abbr="'.$d.'">'.(!empty($day_name_length) ? $d : $day_names_short[$k]).'</th>';
$calendar .= "
</tr>
<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>
<tr style=\"text-align:right;\">";
}
if(isset($days[$day])){
$calendar .= '
<td>'.$days[$day].'</td>';
}
else
{
$href_calendar = $can_post_calendar && $day >= $today ? $scripturl.'?action=calendar;sa=post;month='.$month.';year='.$year.';day='.$day : $scripturl.'?action=calendar';
$calendar .= "
<td class=\"smalltext\" style=\"padding-right:4px;\"><a";
if(((($weekday+$first_day) % 7)==0))
{
$calendar .= ' style="color:'.$color_text_sunday.';"';
}
$calendar .= " href=\"".$href_calendar."\" target=\"_self\">$day</a></td>";
}
}
if($weekday != 7) $calendar .= '
<td class="smalltext" colspan="'.(7-$weekday).'"> </td>'; //remaining "empty" days
echo $calendar.'
</tr>';
if (!empty($show_today) && (!empty($calendarDataToday['events']) || !empty($calendarDataToday['birthdays']) || !empty($calendarDataToday['holidays']))) {
if(!empty($calendarDataToday['holidays'])){
echo '
<tr><td>
<hr />
</td>
<td colspan="5" class="smalltext" align="center" style="color: ' . $color_text_items_holiday . ';">
<b>Holidays</b>
</td><td>
<hr />
</td>
</tr>
<td colspan="7" class="smalltext">';
foreach( $calendarDataToday['holidays'] as $holiday )
echo '
', $holiday['name'], '<br />';
echo '
</td></tr>';
}
if(!empty($calendarDataToday['birthdays'])){
echo '
<tr><td>
<hr />
</td>
<td colspan="5" class="smalltext" align="center" style="color: ' . $color_text_items_birthday . ';">
<b>Birthdays</b>
</td><td>
<hr />
</td></tr>
<td colspan="7" class="smalltext">';
foreach( $calendarDataToday['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($calendarDataToday['events']))
{
echo '
<tr><td>
<hr />
</td>
<td colspan="5" class="smalltext" align="center" style="color: ' . $color_text_items_event . ';">
<b>Events</b>
</td><td>
<hr />
</td></tr>
<td colspan="7" class="smalltext">';
foreach ($calendarDataToday['events'] as $event)
{
if ($event['can_edit'])
echo '
<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ';
echo '
' . $event['link'] . '<br />';
}
}
echo '
</td></tr>';
}
echo '
</table>';
thats magic... thanks allot ;D
one thing .. what do i edit to let it show events in advance .. because for important events it will be good to give some amount of notice .. no notice is needed for holidays and birthdays as you have set it .
Yes, that was exactly what bugged me too >< Usually it gave a notice one week or so in advance. You think you can fix that? =/I changed this... because i thought it's not usfull to show information about the future...
* Only Today informations are shown under the Calendar (No Future, only todays!)You want select how many day in future it should show entries?
I changed this... because i thought it's not usfull to show information about the future...You want select how many day in future it should show entries?
I can try to make a java script version out of it, so that you can click on the day and it show the informations for that day, because the data is allready loaded and so i think i can use it without problem to create a calender with that feature ;).
Bye
DIN1031
Maybe move this one to blocks board.Thanks for mention this... i really did not see that it was in english support *drop*.
but only events need some notice days in advanceI don't understand this...
Thanks for mention this... i really did not see that it was in english support *drop*.
I don't understand this...
Yes i understand it now, i made allready a version where you can select how many day in the future the script should look for events :). (Not official at the moment).
! Error on today detection fix (not easy to understand xD)
! Fixed the bug on holidays
+ Add Javascript Changer, click on the day and the events, birthdays and holidays will be shown for that day
+ Add future events to the today output (you can set how many day in future it should look ;D, 0 = only today)
+ Add Weeks to the calendar
+ You can disable each of the new option
* Removed the edit link, i think this is not needed on such calendar
also .. we are asking much .. but when displaying event date .. could you make it show for example (Nov 11/08) instead of (11/11)You can disable the weeks ;). Than it will be smaller.
and i wish i could get the block just a little smaller .. its abit wide now, but i can live with it
;D
@???1031Nice site Manu! I can't wait to put this calendar up on my site
It works perfect and it looks perfect!!! :applause:
Example of the calendar you can find here: http://forum.arseniums.com
$title = $txt['months_titles'][$month].' '.$year; //This is the SMF Text string, so it should be corrected for ut8 or iso
to$title = $txt['months_titles'][(int)$month].' '.$year; //This is the SMF Text string, so it should be corrected for ut8 or iso
//Built Month low and high date :)
$low_date = $year.'-'.$month.'-01';
$high_date = $year.'-'.$month.'-'.$days_in_month;
//Built Month low and high date :)
$low_date = $year.'-'.sprintf('%02d', $month).'-01';
$high_date = $year.'-'.sprintf('%02d', $month).'-'.$days_in_month;
<?php
require(dirname(__FILE__) . '/SSI.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> << :: SMF SSI.php 1.1 :: >> </title><?php
echo '
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/style.css" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>
<style type="text/css">
body
{
margin: 1ex;
}';
if ($context['browser']['needs_size_fix'])
echo '
@import(', $settings['default_theme_url'], '/fonts-compat.css);';
echo '
</style>';
?>
</head>
<body>
<h1>SMF SSI.php Functions</h1>
Current Version: 1.1<br />
<br />
This file is used to demonstrate the capabilities of SSI.php using PHP include functions.<br />
The examples show the include tag, then the results of it. Examples are separated by horizontal rules.<br />
<hr />
<br />
To use SSI.php in your page add at the very top of your page before the <html> tag on line 1:<br />
<div style="font-family: monospace;">
<?php require("<?php echo addslashes($user_info['is_admin'] ? realpath($boarddir . '/SSI.php') : 'SSI.php'); ?>"); ?>
</div>
<br />
<hr />
<h3>Recent Topics Function: <?php ssi_recentTopics(); ?></h3>
<?php ssi_recentTopics(); flush(); ?>
<hr />
<h3>Recent Posts Function: <?php ssi_recentPosts(); ?></h3>
<?php ssi_recentPosts(); flush(); ?>
<hr />
<h3>Recent Poll Function: <?php ssi_recentPoll(); ?></h3>
<?php ssi_recentPoll(); flush(); ?>
<hr />
<h3>Top Boards Function: <?php ssi_topBoards(); ?></h3>
<?php ssi_topBoards(); flush(); ?>
<hr />
<h3>Top Topics by View Function: <?php ssi_topTopicsViews(); ?></h3>
<?php ssi_topTopicsViews(); flush(); ?>
<hr />
<h3>Top Topics by Replies Function: <?php ssi_topTopicsReplies(); ?></h3>
<?php ssi_topTopicsReplies(); flush(); ?>
<hr />
<h3>Top Poll Function: <?php ssi_topPoll(); ?></h3>
<?php ssi_topPoll(); flush(); ?>
<hr />
<h3>Top Poster Function: <?php ssi_topPoster(); ?></h3>
<?php ssi_topPoster(); flush(); ?>
<hr />
<h3>Topic's Poll Function: <?php ssi_showPoll($topic); ?></h3>
<?php ssi_showPoll(); flush(); ?>
<hr />
<h3>Latest Member Function: <?php ssi_latestMember(); ?></h3>
<?php ssi_latestMember(); flush(); ?>
<hr />
<h3>Board Stats: <?php ssi_boardStats(); ?></h3>
<?php ssi_boardStats(); flush(); ?>
<hr />
<h3>Who's Online Function: <?php ssi_whosOnline(); ?></h3>
<?php ssi_whosOnline(); flush(); ?>
<hr />
<h3>Log Online Presence + Who's Online Function: <?php ssi_logOnline(); ?></h3>
<?php ssi_logOnline(); flush(); ?>
<hr />
<h3>Welcome Function: <?php ssi_welcome(); ?></h3>
<?php ssi_welcome(); flush(); ?>
<hr />
<h3>News Function: <?php ssi_news(); ?></h3>
<?php ssi_news(); flush(); ?>
<hr />
<h3>Board News Function: <?php ssi_boardNews(); ?></h3>
<?php ssi_boardNews(); flush(); ?>
<hr />
<h3>Menubar Function: <?php ssi_menubar(); ?></h3>
<?php ssi_menubar(); flush(); ?>
<hr />
<h3>Quick Search Function: <?php ssi_quickSearch(); ?></h3>
<?php ssi_quickSearch(); flush(); ?>
<hr />
<h3>Login Function: <?php ssi_login(); ?></h3>
<?php ssi_login(); flush(); ?>
<hr />
<h3>Log Out Function: <?php ssi_logout(); ?></h3>
<?php ssi_logout(); flush(); ?>
<hr />
<h3>Today's Birthdays Function: <?php ssi_todaysBirthdays(); ?></h3>
<?php ssi_todaysBirthdays(); flush(); ?>
<hr />
<h3>Today's Holidays Function: <?php ssi_todaysHolidays(); ?></h3>
<?php ssi_todaysHolidays(); flush(); ?>
<hr />
<h3>Today's Events Function: <?php ssi_todaysEvents(); ?></h3>
<?php ssi_todaysEvents(); flush(); ?>
<hr />
<h3>Today's Calendar Function: <?php ssi_todaysCalendar(); ?></h3>
<?php ssi_todaysCalendar(); flush(); ?>
<hr />
<h3>Recent Calendar Events Function: <?php ssi_recentEvents(); ?></h3>
<?php ssi_recentEvents(); flush(); ?>
<hr />
<h3>Some notes on usage</h3>
All the functions have an output method parameter. This can either be "echo" (the default) or "array".<br />
If it is "echo", the function will act normally - otherwise, it will return an array containing information about the requested task.<br />
For example, it might return a list of topics for ssi_recentTopics.<br />
<br />
<span onclick="if (getInnerHTML(this).indexOf('Bird') == -1) setInnerHTML(this, getInnerHTML(this) + '<br /><img src="http://www.simplemachines.org/images/chocobo.jpg" title="Bird-san" alt="Chocobo!" />'); return false;">This functionality can be used to allow you to present the information in any way you wish.</span>
<hr />
<br />
<br />
<span style="color: #CCCCCC; font-size: smaller;">
<?php
echo 'This page took ', round(array_sum(explode(' ', microtime())) - array_sum(explode(' ', $time_start)), 4), ' seconds to load.<br />';
?>
*ssi_examples.php last modified on <?php echo date('m/j/y', filemtime(__FILE__)); ?>
</span>
</body>
</html>
?php
require(dirname(__FILE__) . '/SSI.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
?php
require(dirname(Calendar) . '/SSI.php');
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
I now have events working, but am wondering if another change is possible.
So this is V3 the most advanced Version
The code is attached to the post, i extend the post limit with the code ;P.
Sorry that the day order is not correct on the pic, but that is fixed xD.
8: Undefined index: calendar51
VegasJay -- Have a look in ssi_examples.php to see how to create a standalone file that can do SMF stuff.
Of course, writing standalone php files that don't do SimplePortal stuff is not really a SimplePortal issue. If you have any more questions, you'll probably get more and better SSI support over at simplemachines.org.
//Put out the Daynames :)
// th vs td
foreach($day_names as $k => $d)
$calendar .= '
<td class="smalltext" abbr="'.$d.'">'.(!empty($day_name_length) ? $d : $day_names_short[$k]).'</td>';
$calendar .= "
"What's the easiest way to get some of SMF's and SimplePortal's cool features integrated into my E-Zine, which is going to be tied into a SimplePortal/SMF site anyway?"
Error :Quote8: Undefined index: calendar51
Has anyone encounted this error while using din1031's DIN1031CalenderBlockV3.php file?
I don't think this block has been updated in some time.
Have you tried using the block that comes with SimplePortal?
Your best bet may be to start with what comes with SimplePortal, and add the features you need.