diff --git a/lib/extern/modules/ExternModuleTemplatePersondetails.class.php b/lib/extern/modules/ExternModuleTemplatePersondetails.class.php index 6813e4715cc101ad88583fbbd1a8482d4e376794..5b90c96bb18d53bdea5195e00f811174fa54545e 100644 --- a/lib/extern/modules/ExternModuleTemplatePersondetails.class.php +++ b/lib/extern/modules/ExternModuleTemplatePersondetails.class.php @@ -606,30 +606,37 @@ class ExternModuleTemplatePersondetails extends ExternModule { private function getContentAppointments () { if (Config::get()->CALENDAR_ENABLE) { - $events = SingleCalendar::getEventList($this->user_id, time(), time() + 60 * 60 * 24 * 7, null, ['class' => 'PUBLIC'], ['CalendarEvent']); + $list_start = new DateTime(); + $list_end = clone $list_start; + $list_end = $list_end->add(new DateInterval('P7D')); + $events = CalendarDateAssignment::getEvents($list_start, $list_end, $this->user_id, ['PUBLIC']); $content['APPOINTMENTS']['LIST-START'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . ' %X', time())); $content['APPOINTMENTS']['LIST-END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . ' %X', time() + 60 * 60 * 24 * 7)); if (sizeof($events)) { $i = 0; foreach ($events as $event) { - if ($event->isDayEvent()) { - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat'), $event->getStart()) . ' (' . _("ganztägig") . ')'); + $event = $event->calendar_date; + if (!$event) { + continue; + } + if ($event->isWholeDay()) { + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat'), $event->begin) . ' (' . _("ganztägig") . ')'); } else { - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getStart())); - if (date("dmY", $event->getStart()) == date("dmY", $event->getEnd())) { - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] .= ExternModule::ExtHtmlReady(strftime(" - %X", $event->getEnd())); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->begin)); + if (date("dmY", $event->begin) == date("dmY", $event->end)) { + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] .= ExternModule::ExtHtmlReady(strftime(" - %X", $event->end)); } else { - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] .= ExternModule::ExtHtmlReady(strftime(" - " . $this->config->getValue('Main', 'dateformat') . " %X", $event->getEnd())); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] .= ExternModule::ExtHtmlReady(strftime(" - " . $this->config->getValue('Main', 'dateformat') . " %X", $event->end)); } } - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['TITLE'] = ExternModule::ExtHtmlReady($event->getTitle()); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DESCRIPTION'] = ExternModule::ExtHtmlReady($event->getDescription()); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['LOCATION'] = ExternModule::ExtHtmlReady($event->getLocation()); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['REPETITION'] = ExternModule::ExtHtmlReady($event->toStringRecurrence()); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['CATEGORY'] = ExternModule::ExtHtmlReady($event->toStringCategories()); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['PRIORITY'] = ExternModule::ExtHtmlReady($event->toStringPriority()); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['START'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getStart())); - $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getEnd())); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['TITLE'] = ExternModule::ExtHtmlReady($event->title); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DESCRIPTION'] = ExternModule::ExtHtmlReady($event->description); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['LOCATION'] = ExternModule::ExtHtmlReady($event->location); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['REPETITION'] = ExternModule::ExtHtmlReady($event->getRepetitionAsString()); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['CATEGORY'] = ExternModule::ExtHtmlReady($event->getCategoryAsString()); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['PRIORITY'] = ExternModule::ExtHtmlReady(_('Keine Angabe')); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['START'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->begin)); + $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->end)); $i++; } } else { diff --git a/lib/extern/modules/views/persondetails.inc.php b/lib/extern/modules/views/persondetails.inc.php index cc186170f31bdc83678abf5070c3b9b01768cb7b..16a649e9b11c6b1917be0b8d71a05cf4cf1a1dbd 100644 --- a/lib/extern/modules/views/persondetails.inc.php +++ b/lib/extern/modules/views/persondetails.inc.php @@ -266,9 +266,10 @@ function termine (&$module, $row, $alias_content, $text_div, $text_div_end) $subheadline_div_end = ""; } - $event_list = SingleCalendar::getEventList($row['user_id'], time(), - time() + 60 * 60 * 24 * 7, null, ['class' => 'PUBLIC'], - ['CalendarEvent']); + $list_start = new DateTime(); + $list_end = clone $list_start; + $list_end = $list_end->add(new DateInterval('P7D')); + $event_list = CalendarDateAssignment::getEvents($list_start, $list_end, $row['user_id'], ['PUBLIC']); if (sizeof($event_list)) { echo "<tr><td width=\"100%\">\n"; echo "<table" . $module->config->getAttributes("TableParagraph", "table") . ">\n"; @@ -278,22 +279,26 @@ function termine (&$module, $row, $alias_content, $text_div, $text_div_end) echo "$alias_content</font></td></tr>\n"; foreach ($event_list as $event) { + $event = $event->calendar_date; + if (!$event) { + continue; + } echo "<tr" . $module->config->getAttributes("TableParagraphSubHeadline", "tr") . ">"; echo "<td" . $module->config->getAttributes("TableParagraphSubHeadline", "td") . ">"; echo $subheadline_div; echo "<font" . $module->config->getAttributes("TableParagraphSubHeadline", "font") . ">"; - echo strftime($module->config->getValue("Main", "dateformat") . " %H:%M", $event->getStart()); - if (date("dmY", $event->getStart()) == date("dmY", $event->getEnd())) - echo strftime(" - %H:%M", $event->getEnd()); + echo strftime($module->config->getValue("Main", "dateformat") . " %H:%M", $event->begin); + if (date("dmY", $event->begin) == date("dmY", $event->end)) + echo strftime(" - %H:%M", $event->end); else - echo strftime(" - " . $module->config->getValue("Main", "dateformat") . " %H:%M", $event->getEnd()); - echo " " . htmlReady($event->getTitle()); + echo strftime(" - " . $module->config->getValue("Main", "dateformat") . " %H:%M", $event->end); + echo " " . htmlReady($event->title); echo "</font>$subheadline_div_end</td></tr>\n"; - if ($event->getDescription()) { + if ($event->description) { echo "<tr" . $module->config->getAttributes("TableParagraphText", "tr") . ">"; echo "<td" . $module->config->getAttributes("TableParagraphText", "td") . ">"; echo "$text_div<font" . $module->config->getAttributes("TableParagraphText", "font") . ">"; - echo htmlReady($event->getDescription()); + echo htmlReady($event->description); echo "</font>$text_div_end</td></tr>\n"; } }