Skip to content

Commit

Permalink
Wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed May 10, 2017
1 parent 816f2ed commit 9f8bfab
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions kronolith/lib/Block/Prevmonthlist.php
Expand Up @@ -66,8 +66,16 @@ protected function _content()

$page_output->addScriptFile('tooltips.js', 'horde');

$startDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n') - $this->_params['months'], 'mday' => date('j')));
$endDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j') - 1));
$startDate = new Horde_Date(array(
'year' => date('Y'),
'month' => date('n') - $this->_params['months'],
'mday' => date('j')
));
$endDate = new Horde_Date(array(
'year' => date('Y'),
'month' => date('n'),
'mday' => date('j') - 1
));

$current_month = '';

Expand All @@ -86,7 +94,11 @@ protected function _content()
$all_events = $driver->listEvents(
$startDate, $endDate, array('show_recurrence' => true));
} else {
$all_events = Kronolith::listEvents($startDate, $endDate, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS));
$all_events = Kronolith::listEvents(
$startDate,
$endDate,
$GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS)
);
}
} catch (Exception $e) {
return '<em>' . $e->getMessage() . '</em>';
Expand All @@ -99,15 +111,18 @@ protected function _content()

/* Loop through the days. */
for ($i = 0; $i <= $days; ++$i) {
$day = new Kronolith_Day($startDate->month, $startDate->mday + $i, $startDate->year);
$day = new Kronolith_Day(
$startDate->month, $startDate->mday + $i, $startDate->year
);
if (empty($all_events[$day->dateString()])) {
continue;
}

/* Output month header. */
if ($current_month != $day->month) {
$current_month = $day->strftime('%m');
$html .= '<tr><td colspan="4" class="control"><strong>' . $day->strftime('%B') . '</strong></td></tr>';
$html .= '<tr><td colspan="4" class="control"><strong>'
. $day->strftime('%B') . '</strong></td></tr>';
}

$firstevent = true;
Expand Down Expand Up @@ -146,7 +161,8 @@ protected function _content()
$html .= '<td class="text" nowrap="nowrap" valign="top">';
if ($event->start->compareDate($startDate) < 0 &&
$event->end->compareDate($startDate) > 0) {
$html .= '<strong>' . htmlspecialchars($event->getLocation()) . '</strong>';
$html .= '<strong>'
. htmlspecialchars($event->getLocation()) . '</strong>';
} else {
$html .= htmlspecialchars($event->getLocation());
}
Expand All @@ -169,5 +185,4 @@ protected function _content()

return '<table cellspacing="0" width="100%">' . $html . '</table>';
}

}

0 comments on commit 9f8bfab

Please sign in to comment.