Skip to content
Snippets Groups Projects
Commit 66ac0dec authored by Elmar Ludwig's avatar Elmar Ludwig
Browse files

update calender API usage, picked from 41b3733f

parent f05211e3
Branches
No related tags found
No related merge requests found
...@@ -606,30 +606,37 @@ class ExternModuleTemplatePersondetails extends ExternModule { ...@@ -606,30 +606,37 @@ class ExternModuleTemplatePersondetails extends ExternModule {
private function getContentAppointments () { private function getContentAppointments () {
if (Config::get()->CALENDAR_ENABLE) { 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-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)); $content['APPOINTMENTS']['LIST-END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . ' %X', time() + 60 * 60 * 24 * 7));
if (sizeof($events)) { if (sizeof($events)) {
$i = 0; $i = 0;
foreach ($events as $event) { foreach ($events as $event) {
if ($event->isDayEvent()) { $event = $event->calendar_date;
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat'), $event->getStart()) . ' (' . _("ganztägig") . ')'); 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 { } else {
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->getStart())); $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DATE'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->begin));
if (date("dmY", $event->getStart()) == date("dmY", $event->getEnd())) { if (date("dmY", $event->begin) == date("dmY", $event->end)) {
$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(" - %X", $event->end));
} else { } 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]['TITLE'] = ExternModule::ExtHtmlReady($event->title);
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DESCRIPTION'] = ExternModule::ExtHtmlReady($event->getDescription()); $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['DESCRIPTION'] = ExternModule::ExtHtmlReady($event->description);
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['LOCATION'] = ExternModule::ExtHtmlReady($event->getLocation()); $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['LOCATION'] = ExternModule::ExtHtmlReady($event->location);
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['REPETITION'] = ExternModule::ExtHtmlReady($event->toStringRecurrence()); $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['REPETITION'] = ExternModule::ExtHtmlReady($event->getRepetitionAsString());
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['CATEGORY'] = ExternModule::ExtHtmlReady($event->toStringCategories()); $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['CATEGORY'] = ExternModule::ExtHtmlReady($event->getCategoryAsString());
$content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['PRIORITY'] = ExternModule::ExtHtmlReady($event->toStringPriority()); $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->getStart())); $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->getEnd())); $content['APPOINTMENTS']['ALL-APPOINTMENTS']['SINGLE-APPOINTMENT'][$i]['END'] = ExternModule::ExtHtmlReady(strftime($this->config->getValue('Main', 'dateformat') . " %X", $event->end));
$i++; $i++;
} }
} else { } else {
......
...@@ -266,9 +266,10 @@ function termine (&$module, $row, $alias_content, $text_div, $text_div_end) ...@@ -266,9 +266,10 @@ function termine (&$module, $row, $alias_content, $text_div, $text_div_end)
$subheadline_div_end = ""; $subheadline_div_end = "";
} }
$event_list = SingleCalendar::getEventList($row['user_id'], time(), $list_start = new DateTime();
time() + 60 * 60 * 24 * 7, null, ['class' => 'PUBLIC'], $list_end = clone $list_start;
['CalendarEvent']); $list_end = $list_end->add(new DateInterval('P7D'));
$event_list = CalendarDateAssignment::getEvents($list_start, $list_end, $row['user_id'], ['PUBLIC']);
if (sizeof($event_list)) { if (sizeof($event_list)) {
echo "<tr><td width=\"100%\">\n"; echo "<tr><td width=\"100%\">\n";
echo "<table" . $module->config->getAttributes("TableParagraph", "table") . ">\n"; echo "<table" . $module->config->getAttributes("TableParagraph", "table") . ">\n";
...@@ -278,22 +279,26 @@ function termine (&$module, $row, $alias_content, $text_div, $text_div_end) ...@@ -278,22 +279,26 @@ function termine (&$module, $row, $alias_content, $text_div, $text_div_end)
echo "$alias_content</font></td></tr>\n"; echo "$alias_content</font></td></tr>\n";
foreach ($event_list as $event) { foreach ($event_list as $event) {
$event = $event->calendar_date;
if (!$event) {
continue;
}
echo "<tr" . $module->config->getAttributes("TableParagraphSubHeadline", "tr") . ">"; echo "<tr" . $module->config->getAttributes("TableParagraphSubHeadline", "tr") . ">";
echo "<td" . $module->config->getAttributes("TableParagraphSubHeadline", "td") . ">"; echo "<td" . $module->config->getAttributes("TableParagraphSubHeadline", "td") . ">";
echo $subheadline_div; echo $subheadline_div;
echo "<font" . $module->config->getAttributes("TableParagraphSubHeadline", "font") . ">"; echo "<font" . $module->config->getAttributes("TableParagraphSubHeadline", "font") . ">";
echo strftime($module->config->getValue("Main", "dateformat") . " %H:%M", $event->getStart()); echo strftime($module->config->getValue("Main", "dateformat") . " %H:%M", $event->begin);
if (date("dmY", $event->getStart()) == date("dmY", $event->getEnd())) if (date("dmY", $event->begin) == date("dmY", $event->end))
echo strftime(" - %H:%M", $event->getEnd()); echo strftime(" - %H:%M", $event->end);
else else
echo strftime(" - " . $module->config->getValue("Main", "dateformat") . " %H:%M", $event->getEnd()); echo strftime(" - " . $module->config->getValue("Main", "dateformat") . " %H:%M", $event->end);
echo " &nbsp;" . htmlReady($event->getTitle()); echo " &nbsp;" . htmlReady($event->title);
echo "</font>$subheadline_div_end</td></tr>\n"; echo "</font>$subheadline_div_end</td></tr>\n";
if ($event->getDescription()) { if ($event->description) {
echo "<tr" . $module->config->getAttributes("TableParagraphText", "tr") . ">"; echo "<tr" . $module->config->getAttributes("TableParagraphText", "tr") . ">";
echo "<td" . $module->config->getAttributes("TableParagraphText", "td") . ">"; echo "<td" . $module->config->getAttributes("TableParagraphText", "td") . ">";
echo "$text_div<font" . $module->config->getAttributes("TableParagraphText", "font") . ">"; 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"; echo "</font>$text_div_end</td></tr>\n";
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment