Skip to content

Commit

Permalink
Fix calendar assignment to sections.
Browse files Browse the repository at this point in the history
Don't include system calendars in shared calendar section or resource calendars
in system calendar section.
  • Loading branch information
yunosh committed Apr 22, 2015
1 parent ea3e416 commit 51b739e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kronolith/lib/Application.php
Expand Up @@ -223,6 +223,10 @@ public function sidebar($sidebar)
),
);
foreach (Kronolith::listInternalCalendars() as $id => $calendar) {
if ($GLOBALS['registry']->isAdmin() &&
empty($calendar->get('owner'))) {
continue;
}
$row = array(
'selected' => in_array($id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS)),
'url' => $url->copy()->add('toggle_calendar', $id),
Expand All @@ -240,6 +244,9 @@ public function sidebar($sidebar)

if ($GLOBALS['registry']->isAdmin()) {
foreach ($GLOBALS['injector']->getInstance('Kronolith_Shares')->listSystemShares() as $id => $calendar) {
if ($calendar->get('type') != Kronolith::SHARE_TYPE_USER) {
continue;
}

This comment has been minimized.

Copy link
@mrubinsk

mrubinsk Apr 22, 2015

Member

This would probably be cleaner to do by implementing listSystemShares in Kronolith_Shares and filter out Kronolith::SHARE_TYPE_RESOURCE there similar to what is done in Kronolith_Shares::listShares.

$row = array(
'selected' => in_array($id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS)),
'url' => $url->copy()->add('toggle_calendar', $id),
Expand Down

0 comments on commit 51b739e

Please sign in to comment.