本文整理汇总了PHP中Kronolith::displayedCalendars方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::displayedCalendars方法的具体用法?PHP Kronolith::displayedCalendars怎么用?PHP Kronolith::displayedCalendars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::displayedCalendars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sidebar
/**
* Adds additional items to the sidebar.
*
* This is for the traditional view. For the dynamic view, see
* Kronolith_View_Sidebar.
*
* @param Horde_View_Sidebar $sidebar The sidebar object.
*/
public function sidebar($sidebar)
{
global $calendar_manager, $conf, $injector, $prefs, $registry, $session;
$admin = $registry->isAdmin();
$perms = $injector->getInstance('Horde_Core_Perms');
if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) && ($perms->hasAppPermission('max_events') === true || $perms->hasAppPermission('max_events') > Kronolith::countEvents())) {
$sidebar->addNewButton(_("_New Event"), Horde::url('new.php')->add('url', Horde::selfUrl(true, false, true)));
}
if (strlen($session->get('kronolith', 'display_cal'))) {
$calendars = Kronolith::displayedCalendars();
$sidebar->containers['calendars'] = array('header' => array('id' => 'kronolith-toggle-calendars', 'label' => ngettext("Showing calendar:", "Showing calendars:", count($calendars)), 'collapsed' => false));
foreach ($calendars as $calendar) {
$row = array('label' => $calendar->name(), 'color' => $calendar->background(), 'type' => 'checkbox');
$sidebar->addRow($row, 'calendars');
}
return;
}
$user = $registry->getAuth();
$url = Horde::selfUrl();
$edit = Horde::url('calendars/edit.php');
$sidebar->containers['my'] = array('header' => array('id' => 'kronolith-toggle-my', 'label' => _("My Calendars"), 'collapsed' => false));
if (!$prefs->isLocked('default_share')) {
$sidebar->containers['my']['header']['add'] = array('url' => Horde::url('calendars/create.php'), 'label' => _("Create a new Local Calendar"));
}
if ($admin) {
$sidebar->containers['system'] = array('header' => array('id' => 'kronolith-toggle-system', 'label' => _("System Calendars"), 'collapsed' => true));
$sidebar->containers['system']['header']['add'] = array('url' => Horde::url('calendars/create.php')->add('system', 1), 'label' => _("Create a new System Calendar"));
}
$sidebar->containers['shared'] = array('header' => array('id' => 'kronolith-toggle-shared', 'label' => _("Shared Calendars"), 'collapsed' => true));
foreach (Kronolith::listInternalCalendars() as $id => $calendar) {
$owner = $calendar->get('owner');
if ($admin && empty($owner)) {
continue;
}
$row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', $id), 'label' => Kronolith::getLabel($calendar), 'color' => Kronolith::backgroundColor($calendar), 'edit' => $edit->add('c', $calendar->getName()), 'type' => 'checkbox');
if ($calendar->get('owner') && $calendar->get('owner') == $user) {
$sidebar->addRow($row, 'my');
} else {
$sidebar->addRow($row, 'shared');
}
}
if ($admin) {
foreach ($injector->getInstance('Kronolith_Shares')->listSystemShares() as $id => $calendar) {
$row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', $id), 'label' => $calendar->get('name'), 'color' => Kronolith::backgroundColor($calendar), 'edit' => $edit->add('c', $calendar->getName()), 'type' => 'checkbox');
$sidebar->addRow($row, 'system');
}
}
if (!empty($conf['resources']['enabled']) && ($admin || $perms->hasAppPermission('resource_management'))) {
$sidebar->containers['groups'] = array('header' => array('id' => 'kronolith-toggle-groups', 'label' => _("Resource Groups"), 'collapsed' => true, 'add' => array('url' => Horde::url('resources/groups/create.php'), 'label' => _("Create a new Resource Group"))));
$editGroups = Horde::url('resources/groups/edit.php');
$sidebar->containers['resources'] = array('header' => array('id' => 'kronolith-toggle-resources', 'label' => _("Resources"), 'collapsed' => true, 'add' => array('url' => Horde::url('resources/create.php'), 'label' => _("Create a new Resource"))));
$edit = Horde::url('resources/edit.php');
foreach (Kronolith::getDriver('Resource')->listResources() as $resource) {
if ($resource->get('isgroup')) {
$row = array('label' => $resource->get('name'), 'color' => '#dddddd', 'edit' => $editGroups->add('c', $resource->getId()), 'type' => 'radiobox');
$sidebar->addRow($row, 'groups');
} else {
$calendar = new Kronolith_Calendar_Resource(array('resource' => $resource));
$row = array('selected' => in_array($resource->get('calendar'), $calendar_manager->get(Kronolith::DISPLAY_RESOURCE_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', 'resource_' . $resource->get('calendar')), 'label' => $calendar->name(), 'color' => $calendar->background(), 'edit' => $edit->add('c', $resource->getId()), 'type' => 'checkbox');
$sidebar->addRow($row, 'resources');
}
}
}
foreach ($calendar_manager->get(Kronolith::ALL_EXTERNAL_CALENDARS) as $id => $calendar) {
if (!$calendar->display()) {
continue;
}
$app = $registry->get('name', $registry->hasInterface($calendar->api()));
if (!strlen($app)) {
$app = _("Other events");
}
$container = 'external_' . $app;
if (!isset($sidebar->containers[$container])) {
$sidebar->containers[$container] = array('header' => array('id' => 'kronolith-toggle-external-' . $calendar->api(), 'label' => $app, 'collapsed' => true));
}
$row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', 'external_' . $id), 'label' => $calendar->name(), 'color' => $calendar->background(), 'type' => 'checkbox');
$sidebar->addRow($row, $container);
}
$sidebar->containers['remote'] = array('header' => array('id' => 'kronolith-toggle-remote', 'label' => _("Remote Calendars"), 'collapsed' => true, 'add' => array('url' => Horde::url('calendars/remote_subscribe.php'), 'label' => _("Subscribe to a Remote Calendar"))));
$edit = Horde::url('calendars/remote_edit.php');
foreach ($calendar_manager->get(Kronolith::ALL_REMOTE_CALENDARS) as $calendar) {
$row = array('selected' => in_array($calendar->url(), $calendar_manager->get(Kronolith::DISPLAY_REMOTE_CALENDARS)), 'url' => $url->copy()->add('toggle_calendar', 'remote_' . $calendar->url()), 'label' => $calendar->name(), 'color' => $calendar->background(), 'edit' => $edit->add('url', $calendar->url()), 'type' => 'checkbox');
$sidebar->addRow($row, 'remote');
}
if (!empty($conf['holidays']['enable'])) {
$sidebar->containers['holidays'] = array('header' => array('id' => 'kronolith-toggle-holidays', 'label' => _("Holidays"), 'collapsed' => true));
foreach ($calendar_manager->get(Kronolith::ALL_HOLIDAYS) as $id => $calendar) {
$row = array('selected' => in_array($id, $calendar_manager->get(Kronolith::DISPLAY_HOLIDAYS)), 'url' => $url->copy()->add('toggle_calendar', 'holiday_' . $id), 'label' => $calendar->name(), 'color' => $calendar->background(), 'type' => 'checkbox');
$sidebar->addRow($row, 'holidays');
}
}
}