//:Dieses Droplet zeigt die Events aus dem Event Calendar Modul an//:Standardaufruf://: [[EventCal]]//:Zeigt alle Events des laufenden Monats. Alle bedeutet, daß bei mehrfacher Verwendung des Event Calendar Moduls auf verschiedenen Seiten die Termine von allen Sektionen verwendet werden.//:SectionID angeben (Beispiel)://: [[EventCal?section=25]]//:Monat explizit angeben (Beispiel)://: [[EventCal?month=5]]//:Jahr explizit angeben (Beispiel)://: [[EventCal?year=2010]]//:Alles kombinieren (Beispiel)://: [[EventCal?year=2010&month=5§ion=25]]global $wb, $database;$days = array();$day_name_length = 2;$month_href = NULL;$where = NULL;$first_day = 1;$pn = array();$events = 0;$oldlocale = setlocale(LC_TIME, NULL); #save current localesetlocale(LC_TIME, 'de_DE');if(!isset($year)) {$year = date('Y', time()); };if(!isset($month)) {$month = date('n', time()); };if ( isset( $section ) ) { $where = "AND section_id='$section'"; }$today = date('j',time());// Get Events from "Event Calendar" Module (1.8c)$sql = "SELECT DAY(date) AS day, event_desc AS descr, evweb_url AS url FROM ".TABLE_PREFIX."mod_event_dates WHERE YEAR(date) = '$year' AND MONTH(date) = '$month' $where ORDER BY date DESC";$result = $database->query($sql);if ( $result->numRows() > 0 ) { while( $row = $result->fetchRow() ) { $text = $row['day']; if ( ! empty( $row['descr'] ) ) { $text .= ' <span>'.$row['descr'].'</span>'; } if ( ! empty( $row['url'] ) ) { //eingefuegt falls mehrere Termine an einem Tag liegen und eine URL existiert if (isset($days[ $row['day'] ])) { $days[ $row['day'] ] = array( NULL, NULL, $days[ $row['day'] ][2] . "<span style='font-weight: bold; border: 1px solid #f00;'>" . "<a class='tooltip' href='#' // >" //".$row['url']."' target='_blank' //onmouseout='INFO.innerHTML=\" \"' //onmouseover='INFO.innerHTML=\"".$row['descr']."\"'>" . "<sup style='font-size:0.4em;'>*</sup>" //. $row['day'] . "<span><b>".$row['day'].".".$month.".".$year."</b><br />".$row['descr']."</span>" //eingefuegt . "</a></span>" ); } else { //urspruengliche Definition des Arrays $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'>" . "<a class='tooltip' href='#' >" //".$row['url']."' target='_blank' //onmouseout='INFO.innerHTML=\" \"' //onmouseover='INFO.innerHTML=\"".$row['descr']."\"'>" . "<span><b>".$row['day'].".".$month.".".$year."</b><br />".$row['descr']."</span>" // eingefuegt . $row['day'] . "</a></span>" ); }; } else { //eingefuegt falls mehrere Termine an einem Tag liegen und keine URL vorhanden ist if (isset($days[ $row['day'] ])) { $days[ $row['day'] ] = array( NULL, NULL, $days[ $row['day'] ][2] . "<span style='font-weight: bold; border: 1px solid #f00;'>" . "<a class='tooltip' href='#' >" //onmouseout='INFO.innerHTML=\" \"' //onmouseover='INFO.innerHTML=\"".$row['descr']."\"'>" . "<sup style='font-size:0.4em;'>*</sup>" //. $row['day'] . "<span><b>".$row['day'].".".$month.".".$year."</b><br />".$row['descr']."</span>" . "</a></span>" ); } else { //urspruengliche Definition des Arrays $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'>" . "<a class='tooltip' href='#' >"// onmouseout='INFO.innerHTML=\" \"'// onmouseover='INFO.innerHTML=\"".$row['descr']."\"'> . $row['day'] . "<span><b>".$row['day'].".".$month.".".$year."</b><br />".$row['descr']."</span>" . "</a></span>" ); }; } $events++; }}if ( ! isset( $days[$today] ) ) { $days[$today] = array( NULL, 'calendar-today' );}$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()$day_names = array(); #generate all the day names according to the current localefor($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 - deprec: gmstrftime// reset localesetlocale(LC_TIME, $oldlocale);list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month)); #%A deprec gmstrftime$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_dayswitch ($month_name) { case "January": $month_name="Januar"; break; case "February": $month_name="Februar"; break; case "March": $month_name="M\344rz"; break; case "May": $month_name="Mai"; break; case "June": $month_name="Juni"; break; case "July": $month_name="Juli"; break; case "October": $month_name="Oktober"; break; case "December": $month_name="Dezember"; break;}$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$p = key($pn);$pl = current($pn);$n = key($pn);$nl = current($pn);if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';if($n) $n = ' <span class="calendar-next">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';$calendar = '<div align="right" style="float:right;"><table class="calendar">'."\n". '<caption class="calendar-month">'.$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 abbr="'.htmlentities($d).'">'.htmlentities($day_name_length < 4 ? substr($d,0,$day_name_length) : $d).'</th>'; $calendar .= "</tr>\n<tr>";}if($weekday > 0) $calendar .= '<td 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>"; } 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>$day</td>";}if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days$calendar .= "</tr>\n</table><div id='INFO'> </div><br />\n";if ( $events == 0 ) { $calendar .= '<font class="INFO">Keine Termine für diesen Monat.<br /></font>';}else { $calendar .= '<font class="INFO">'.$events.' '.'Termin' . ( $events > 1 ? 'e' : '' ) . ' für diesen Monat.<br /></font>';}$calendar .="</div>";return $calendar;
so trotz des DEPRECATED genutzt
$day_names = array(); #generate all the day names according to the current localefor($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 - deprec: gmstrftime
$day_names = array('Mo','Di','Mi','Do','Fr','Sa','So');
list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
list($month, $year, $month_name, $weekday) = explode(',',date('n,Y,F,N',$first_of_month));