We are currently working on our servers, so there may be outages on the domains.Zurzeit wird an unseren Servern gearbeitet, deshalb kann es zu Ausfällen bei den Domains kommen.
$content = stripslashes($fetch_content['code']);
$codedata = ($fetch_content['code']);
$days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'><a href='".$row['url']."' target='_blank'>".$row['day']."</a></span>" );
$days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'><a href='".$row['url']."' title='".$row['descr']."' target='_blank'>".$row['day']."</a></span>" );
- make previous and next-Links work
- automatically link (not hardcoded) to the page where the Event Calendar-Module is placed.
https://forum.WebsiteBaker.org/index.php/topic,15895.msg103993.html#msg103993
Hi Webbird,l like this Droplet a lot!
Quote from: taurus66 on January 17, 2010, 07:18:30 PMHi Webbird,l like this Droplet a lot!Thank you, but please note that the droplet was provided by "pcwacht". I only added the "Events" binding.
At that post there is an explanation how to set this droplet to work with German-time output
echo "Current locale setting: ", setlocale(LC_TIME, NULL), "<br />";
// reset localesetlocale(LC_TIME, $oldlocale);
$title = htmlentities(ucfirst($month_name)).' '.$year; #note that some locales don't capitalize month and day names
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";$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'] ) ) { $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'>" . "<a class='tooltip' href='".$row['url']."' target='_blank'>" . $text . "</a></span>" ); } else { $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'>" . "<a class='tooltip' href='#'>" . $text . "</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 namelist($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// reset localesetlocale(LC_TIME, $oldlocale);#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="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 = '<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><br />\n";if ( $events == 0 ) { $calendar .= 'Keine Termine für diesen Monat.<br />';}else { $calendar .= $events.' '.'Termin' . ( $events > 1 ? 'e' : '' ) . ' für diesen Monat.<br />';}return $calendar;
$pn = array('<'=>'[[evcal?year=$year&month=$month-1]]','>'=>'[[evcal?year=$year&month=$month+1]]');
You can try to check the correct locale setting adding this code AFTER the code you quoted above:Code: [Select]echo "Current locale setting: ", setlocale(LC_TIME, NULL), "<br />";
I found that the locale is resetted BEFORE the month name is generated. So do the following:FIND (~line 68)Code: [Select]// reset localesetlocale(LC_TIME, $oldlocale);CUT and INSERT AFTER:Code: [Select]$title = htmlentities(ucfirst($month_name)).' '.$year; #note that some locales don't capitalize month and day names(After cutting, about 4 lines later.)
Are you sure you did it right?
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";$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'] ) ) { $days[ $row['day'] ] = array(NULL,NULL,"<span style='font-weight: bold; border: 1px solid #f00;'>"."<a class='tooltip' href='http://www.sft98.de/pages/kalender.php'>".$row['day']."</a></span>" ); } else { $days[ $row['day'] ] = array(NULL,NULL,"<span style='font-weight: bold; border: 1px solid #f00;'>"."<a class='tooltip' href='http://www.sft98.de/pages/kalender.php'>".$row['day']."</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 namelist($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// reset localesetlocale(LC_TIME, $oldlocale);#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="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 = '<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><br />\n";if ( $events == 0 ) { $calendar .= 'Keine Termine für diesen Monat.<br /><br />';}else { $calendar .= $events.' '.'Termin' . ( $events > 1 ? 'e' : '' ) . ' für diesen Monat.<br /><br />';}return $calendar;
Hm, looks okay. And works for me. Don't know what's wrong. Maybe your webserver doesn't implement that locale. Just don't know.
global $wb, $database;$days = array();$day_name_length = 8;$month_href = NULL;$where = NULL;$first_day = 1;$pn = array();$events = 0;$oldlocale = setlocale(LC_TIME, NULL); #save current localesetlocale(LC_TIME, 'en_EN');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, date AS mesic, event_desc AS descr, evweb_url AS url FROM ".TABLE_PREFIX."mod_event_dates WHERE YEAR(date) = '$year' AND MONTH(date) = '$month' $where";$result = $database->query($sql);if ( $result->numRows() > 0 ) { while( $row = $result->fetchRow() ) { $text = $row['mesic']; $textMonth = $row['mesic']; if ( ! empty( $row['descr'] ) ) { $text .= ' <span>'.$row['descr'].'</span>'; } if ( ! empty( $row['url'] ) ) { $days[ $row['day'] ] = array( NULL, NULL, "<span class='menuCalendar'>" . "<a href='".$row['url']."' title='".$row['descr']."' target='_blank'>".$row['textMonth']."</a></span>" ); } else { $days[ $row['day'] ] = array( NULL, NULL, "<span class='menuCalendar'>" . "<a class='tooltip' href='#'>" . $text // . $textMonth . "</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 namelist($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// reset localesetlocale(LC_TIME, $oldlocale);#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="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 = '<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 class='calendar-month'>";}*//*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 .= '<tr><td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>'). ($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td></tr>'; }}#remaining "empty" days//if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'"> </td>'; $calendar .= "</tr>\n</table><br />\n";if ( $events == 0 ) { $calendar .= 'Nothing for this Month.<br />';}else { $calendar .= $events.' '.'Termins' . ( $events > 1 ? 'e' : '' ) . ' for this Month.<br />';}return $calendar;
global $wb, $database;$days = array();$day_name_length = 2; $month_href = NULL;$first_day = 1;$pn = array();$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()); };// 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'";$result = $database->query($sql);if ( $result->numRows() > 0 ) { while( $row = $result->fetchRow() ) { if ( ! empty( $row['url'] ) ) { $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; color: #006;'><a href='".$row['url']."' target='_blank'>".$row['day']."</a></span>" ); } else { $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; color: #006;'>".$row['day']."</span>" ); } }}$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 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 // reset localesetlocale(LC_TIME, $oldlocale);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="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 = '<table width=140 class="calendar">'."\n". '<caption class="calendar-month" style="font-weight: bold;">'.$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 style="font-size: 10px; font-weight: normal;" 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' 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>"; } 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 $month_events=array();$today=date('j')."<br>\n";$weekday=date('N');$days_de=array("Mo","Di","Mi","Do","Fr","Sa","So");$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'";$result=$database->query($sql);while($row=$result->fetchrow()){ $temp=date('N',mktime(0,0,0,$month,$row['day'],$year)); $weekday=$days_de[$temp-1]; $month_events[$row['day']].=substr("<tr><td>$weekday</td><td><span style='font-weight: bold;'> ".$row['descr'],0,75)."</span></td></tr>\n";}for($i=0;$i<7;$i++){ //get events for the next 7 days $week_events.=$month_events[$today+$i];}return $calendar."</tr>\n</table>\n"."\n<table width=140 cellpadding=0>$week_events\n</table>";