function show() { if (isset($_GET['Kontakt'])) { return $this->kontakt(); } if (isset($this->num_show_next_dates)) { return $this->next_dates(); } if (preg_match("/\\.ics\$/i", SELF_URL)) { $this->http_login(); $this->noframe(); $ical_output = true; } $this->cal = new CalendarLinked(); for ($i = 0; $i < count($this->uri_components); $i++) { if (preg_match('/^[0-9]{4}$/', $this->uri_components[$i])) { $year_offset = $i; } } $year_request = isset($year_offset) ? $this->uri_components[$year_offset] : Date::jahr(); $month_request = isset($this->uri_components[$year_offset + 1]) && preg_match('/^[0-9]{1,2}$/', $this->uri_components[$year_offset + 1]) ? Date::add_0($this->uri_components[$year_offset + 1]) : Date::monat(); $day_request = isset($this->uri_components[$year_offset + 2]) && preg_match('/^[0-9]{1,2}$/', $this->uri_components[$year_offset + 2]) ? Date::add_0($this->uri_components[$year_offset + 2]) : '01'; //Date::tag(); $page_root = '/' . rawurlencode($this->uri_components[0]) . '/' . rawurlencode($this->uri_components[1]); for ($i = 2; $i < ($year_offset ? $year_offset : count($this->uri_components)); $i++) { $page_root .= '/' . rawurlencode($this->uri_components[$i]); } $this->cal->root = $page_root; if ($this->check_right('KalenderIntern')) { $access = ''; } elseif ($this->check_right('KalenderExtern')) { $access = "AND `CLASS` = 'PUBLIC'"; } else { $allowed_categories = array(); foreach ($this->categories as $cat) { if ($cat['Access'] == 'PUBLIC') { $allowed_categories[] = "`CATEGORIES` = '" . $cat['Name'] . "'"; } } $access = "AND `CLASS` = 'PUBLIC'"; if ($allowed_categories) { $access .= " AND (" . implode(' OR ', $allowed_categories) . ")"; } } if (isset($_GET['Kategorie'])) { $cat_filter = array(); foreach ($_GET['Kategorie'] as $cat) { $cat_filter[] = "`CATEGORIES` = '" . rawurldecode($cat) . "'"; $filter = "AND (" . implode(' OR ', $cat_filter) . ")"; } } else { $filter = ''; } $show_sql = "SELECT * FROM `{$this->db_table}` WHERE `DTSTART` >= '" . Date::unify_timestamp($year_request . $month_request . $day_request) . "' {$access} {$filter} ORDER BY `DTSTART` ASC"; $overview_sql = "SELECT * FROM `{$this->db_table}` WHERE `DTSTART` >= NOW() {$access} {$filter} ORDER BY `DTSTART` ASC"; $overview = $this->connection->db_assoc($overview_sql); $this->cal->dates = array(); $this->cal->edit_enabled = $this->scaff->edit_enabled; foreach ($overview as $date) { $date['DTSTART'] = Date::unify_timestamp($date['DTSTART']); $day = Date::jahr($date['DTSTART']) . Date::monat($date['DTSTART']) . Date::tag($date['DTSTART']) . '000000'; $end = Date::jahr($date['DTEND']) . Date::monat($date['DTEND']) . Date::tag($date['DTEND']) . '000000'; $array = array(); $array['start'] = $day; $array['SUMMARY'] = ''; $array['SUMMARY'] .= intval(Date::stunde($date['DTSTART']) . Date::minute($date['DTSTART'])) != 0 ? Date::stunde($date['DTSTART']) . ':' . Date::minute($date['DTSTART']) : ''; $array['SUMMARY'] .= $day == $end ? '-' . Date::stunde($date['DTEND']) . ':' . Date::minute($date['DTEND']) . ' ' : ' '; $array['SUMMARY'] .= $date['SUMMARY']; $array['time'] = Date::stunde($date['DTSTART']) . ':' . Date::minute($date['DTSTART']); $array['id'] = $date['id']; $this->cal->dates[$day][] = $array; if ($day != $end) { while ($day < $end) { $day = Date::add($day, 'day', 1); $this->cal->dates[$day][] = $array; } } } $month[0] = $month_request; $year[0] = $year_request; $month[1] = $month[0] + 1 != 13 ? $month[0] + 1 : 1; $year[1] = $month[0] + 1 != 13 ? $year[0] : $year[0] + 1; $month[2] = $month[1] + 1 != 13 ? $month[1] + 1 : 1; $year[2] = $month[1] + 1 != 13 ? $year[1] : $year[0] + 1; $prev_month = $month[0] - 1 != 0 ? $month[0] - 1 : 12; $prev_year = $month[0] - 1 != 0 ? $year[0] : $year[0] - 1; $this->template = $this->template ? $this->template : INSTALL_PATH . '/Module/Kalender/Templates/KalenderTabelle.template.html'; $prev_month_link = Html::a($page_root . '/' . $prev_year . '/' . $prev_month . $this->cat_get(), '<< '); $next_month_link = Html::a($page_root . '/' . $year[1] . '/' . $month[1] . $this->cat_get(), ' >>'); $sidebar[] = $this->cat_select(); $sidebar[] = $this->cal->getMonthHTML($month[0], $year[0], 1, $prev_month_link, $next_month_link); $sidebar[] = $this->cal->getMonthHTML($month[1], $year[1]); $sidebar[] = $this->cal->getMonthHTML($month[2], $year[2]); $this->scaff->datumsformat = 'tag_kurz'; $result_table = $this->scaff->make_table($show_sql, $this->template); if ($ical_output) { $events = $this->connection->db_assoc($show_sql); if (!class_exists('iCal')) { include_once 'Kalender/iCalExport.php'; } //header("Content-Type: text/calendar"); $ical = new iCal($events); return mb_convert_encoding($ical->display_ical(), 'UTF-8', 'ISO-8859-15'); } $nav = array(); if ($prev = $this->scaff->prev_link()) { $nav[0] = Html::a(SELF . '?' . $prev, 'Zurück'); } if ($next = $this->scaff->next_link()) { $nav[1] = Html::a(SELF . '?' . $next, 'Weiter'); } $return_string = ''; $return_string .= Form::form_tag(SELF); $return_string .= $result_table; //$return_string .=implode(' | ',$nav); $return_string .= Form::close_form(); return Html::div($return_string, array('id' => 'box-mitte', 'class' => 'box-mitte')) . Html::div(implode("\n", $sidebar), array('id' => 'monatskalender')); }