WBCE Home | WBCE Hilfe | WBCE Addon Repository | Impressum | Datenschutz

WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 13.04.2018 22:51:59

sillar
Member

Eventcalendar

Ich habe mal eine Frage zum Eventcalendar:
Wenn man diesen auf mehreren Seiten verwendet, kann man beim Droplet EventMiniCal auf der entsprechenden Seite die entsprechende Section_ID angeben, Beispiel: [[EventMiniCal?section=25]], um nur die Events der Seite anzuzeigen. Funktioniert bei mir leider nicht. Oder verstehe ich da irgendetwas falsch? Bitte um Hilfe!

Offline

#2 14.04.2018 07:29:15

florian
Projektmanagement und Support WBCE CMS

Re: Eventcalendar

Das war wohl mal angedacht, ist aber nicht umgesetzt worden.
Ist aber einfach nachzurüsten.

Ergänze im Droplet nach

if(!isset($month)) {$month = date('n', time()); };

die Zeile

if(isset($section)) $sec = " AND section_id = '".$section."'";

Ändere die Zeile

$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'";

zu

$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'".$sec;

Man möchte dann eventuell auch noch den Veranstaltungstitel als Tooltip des Eintrages im Minical aufscheinen lassen, hier zu die Zeilen

if ( $result->numRows() > 0 ) {
    while( $row = $result->fetchRow() ) {
        if ( ! empty( $row['url'] ) ) {
            $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>" );
        }
        else {
            $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'>".$row['day']."</span>" );
        }
    }
}

ändern zu

if ( $result->numRows() > 0 ) {
    while( $row = $result->fetchRow() ) {
        if ( ! empty( $row['url'] ) ) {
            $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'><a title='".$row['descr']."' href='".$row['url']."' target='_blank'>".$row['day']."</a></span>" );
        }
        else {
            $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;' title='".$row['descr']."'>".$row['day']."</span>" );
        }
    }
}

Offline

#3 14.04.2018 09:42:55

sillar
Member

Re: Eventcalendar

Guten Morgen Florian,
dass wäre super und mehr als ich erhofft habe, wenn das klappen würde. Das mit dem Tooltip haut auch hin nur der "section-Teil" nicht. Mit "section" ist doch die section-id des Abschnittes der Seite gemeint, in der sich das Eventcalendar-Modul befindet?

Offline

#4 14.04.2018 09:46:12

florian
Projektmanagement und Support WBCE CMS

Re: Eventcalendar

Section ist die Abschnitts-ID (nicht: Page-ID).
Was genau klappt nicht?

Offline

#5 14.04.2018 10:07:12

sillar
Member

Re: Eventcalendar

Es wird auf den einzelnen Seiten immer noch die Events aller Seiten angezeigt.

Das ist der aktualisierte Dropletcode:

global $wb, $database;

$days = array();
$day_name_length = 2;
$month_href = NULL;
$first_day = 0;
$pn = array();

$oldlocale = setlocale(LC_TIME, NULL); #save current locale
setlocale(LC_TIME, 'de_DE');

if(!isset($year))  {$year  = date('Y', time()); };
if(!isset($month)) {$month = date('n', time()); };
if(isset($section)) $sec = " AND section_id = '".$section."'";

// 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; border: 1px solid #f00;'><a href='".$row['url']."' target='_blank'>".$row['day']."</a></span>" );
        }
        else {
            $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'><a href='http://...../'>".$row['day']."</a></span>" );
        }
    }
}
*/
if ( $result->numRows() > 0 ) {
    while( $row = $result->fetchRow() ) {
        if ( ! empty( $row['url'] ) ) {
            $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;'><a title='".$row['descr']."' href='".$row['url']."' target='_blank'>".$row['day']."</a></span>" );
        }
        else {
            $days[ $row['day'] ] = array( NULL, NULL, "<span style='font-weight: bold; border: 1px solid #f00;' title='".$row['descr']."'>".$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 locale
setlocale(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)).'&nbsp;'.$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>&nbsp;';
if($n) $n = '&nbsp;<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.'">&nbsp;</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).'">&nbsp;</td>'; #remaining "empty" days

return $calendar."</tr>\n</table>\n"; 

Offline

#6 14.04.2018 10:08:54

florian
Projektmanagement und Support WBCE CMS

Re: Eventcalendar

Du hast eine Änderung vergessen:

Ist:
$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'";

Soll:
$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'".$sec;

Offline

#7 14.04.2018 10:18:22

sillar
Member

Re: Eventcalendar

So was dämliches, vielen Dank für deine Hilfe und Geduld! Jetzt geht es...

Offline

Liked by:

florian

Board footer

Powered by FluxBB

up