当前位置: 首页>>代码示例>>PHP>>正文


PHP Kronolith::listInternalCalendars方法代码示例

本文整理汇总了PHP中Kronolith::listInternalCalendars方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::listInternalCalendars方法的具体用法?PHP Kronolith::listInternalCalendars怎么用?PHP Kronolith::listInternalCalendars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kronolith的用法示例。


在下文中一共展示了Kronolith::listInternalCalendars方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  *
  * @param Horde_Date $date  The day for this view
  * @param array $events     An array of Kronolith_Event objects
  *
  * @return Kronolith_View_Day
  */
 public function __construct(Horde_Date $date, array $events = null)
 {
     parent::__construct($date->month, $date->mday, $date->year);
     $this->sidebyside = $GLOBALS['prefs']->getValue('show_shared_side_by_side');
     if ($this->sidebyside) {
         $allCalendars = Kronolith::listInternalCalendars();
         foreach ($GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS) as $cid) {
             $this->_currentCalendars[$cid] = $allCalendars[$cid];
             $this->all_day_events[$cid] = array();
         }
     } else {
         $this->_currentCalendars = array(0);
     }
     if ($events === null) {
         try {
             $events = Kronolith::listEvents($this, new Horde_Date(array('year' => $this->year, 'month' => $this->month, 'mday' => $this->mday)));
             $this->events = array_shift($events);
         } catch (Exception $e) {
             $GLOBALS['notification']->push($e, 'horde.error');
             $this->events = array();
         }
     } else {
         $this->events = $events;
     }
     if (!is_array($this->events)) {
         $this->events = array();
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:35,代码来源:Day.php

示例2: __construct

 /**
  *
  * @global Horde_Prefs $prefs
  * @param Horde_Date $date
  *
  * @return Kronolith_View_Month
  */
 public function __construct(Horde_Date $date)
 {
     global $prefs;
     $this->month = $date->month;
     $this->year = $date->year;
     // Need to calculate the start and length of the view.
     $this->date = new Horde_Date($date);
     $this->date->mday = 1;
     $this->_startday = $this->date->dayOfWeek();
     $this->_daysInView = Date_Calc::weeksInMonth($this->month, $this->year) * 7;
     if (!$prefs->getValue('week_start_monday')) {
         $this->_startOfView = 1 - $this->_startday;
         // We may need to adjust the number of days in the view if
         // we're starting weeks on Sunday.
         if ($this->_startday == Horde_Date::DATE_SUNDAY) {
             $this->_daysInView -= 7;
         }
         $endday = new Horde_Date(array('mday' => Horde_Date_Utils::daysInMonth($this->month, $this->year), 'month' => $this->month, 'year' => $this->year));
         $endday = $endday->dayOfWeek();
         if ($endday == Horde_Date::DATE_SUNDAY) {
             $this->_daysInView += 7;
         }
     } else {
         if ($this->_startday == Horde_Date::DATE_SUNDAY) {
             $this->_startOfView = -5;
         } else {
             $this->_startOfView = 2 - $this->_startday;
         }
     }
     $startDate = new Horde_Date(array('year' => $this->year, 'month' => $this->month, 'mday' => $this->_startOfView));
     $endDate = new Horde_Date(array('year' => $this->year, 'month' => $this->month, 'mday' => $this->_startOfView + $this->_daysInView));
     if ($prefs->getValue('show_shared_side_by_side')) {
         $allCalendars = Kronolith::listInternalCalendars();
         $this->_currentCalendars = array();
         foreach ($GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS) as $id) {
             $this->_currentCalendars[$id] = $allCalendars[$id];
         }
     } else {
         $this->_currentCalendars = array('internal_0' => true);
     }
     try {
         $this->_events = Kronolith::listEvents($startDate, $endDate);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         $this->_events = array();
     }
     if (!is_array($this->_events)) {
         $this->_events = array();
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:57,代码来源:Month.php

示例3: execute

 /**
  * Purge old events.
  *
  * @throws Kronolith_Exception
  * @throws Horde_Exception_NotFound
  */
 public function execute()
 {
     /* Get the current time minus the number of days specified in
      * 'purge_events_keep'.  An event will be deleted if it has an end
      * time prior to this time. */
     $del_time = new Horde_Date($_SERVER['REQUEST_TIME']);
     $del_time->mday -= $GLOBALS['prefs']->getValue('purge_events_keep');
     /* Need to have Horde_Perms::DELETE on a calendar to delete events
      * from it */
     $calendars = Kronolith::listInternalCalendars(true, Horde_Perms::DELETE);
     /* Start building the search */
     $kronolith_driver = Kronolith::getDriver();
     $query = new StdClass();
     $query->start = null;
     $query->end = $del_time;
     $query->status = null;
     $query->calendars = array(Horde_String::ucfirst($GLOBALS['conf']['calendar']['driver']) => array_keys($calendars));
     $query->creator = $GLOBALS['registry']->getAuth();
     /* Perform the search */
     $days = Kronolith::search($query);
     $count = 0;
     foreach ($days as $events) {
         foreach ($events as $event) {
             /* Delete if no recurrence, or if we are past the last occurence */
             if (!$event->recurs() || $event->recurrence->nextRecurrence($del_time) == false) {
                 if ($event->calendar != $kronolith_driver->calendar) {
                     $kronolith_driver->open($event->calendar);
                 }
                 try {
                     $kronolith_driver->deleteEvent($event->id, true);
                     ++$count;
                 } catch (Exception $e) {
                     Horde::log($e, 'ERR');
                     throw $e;
                 }
             }
         }
     }
     $GLOBALS['notification']->push(sprintf(ngettext("Deleted %d event older than %d days.", "Deleted %d events older than %d days.", $count), $count, $GLOBALS['prefs']->getValue('purge_events_keep')));
 }
开发者ID:horde,项目名称:horde,代码行数:46,代码来源:PurgeEvents.php

示例4: __construct

 /**
  *
  * @global Horde_Prefs $prefs
  * @param Horde_Date $date
  *
  * @return Kronolith_View_Month
  */
 public function __construct(Horde_Date $date)
 {
     global $prefs;
     $this->month = $date->month;
     $this->year = $date->year;
     // Need to calculate the start and length of the view.
     $this->date = new Horde_Date($date);
     $this->date->mday = 1;
     $this->_startday = $this->date->dayOfWeek();
     if (!$prefs->getValue('week_start_monday')) {
         $this->_startOfView = 1 - $this->_startday;
     } else {
         if ($this->_startday == Horde_Date::DATE_SUNDAY) {
             $this->_startOfView = -5;
         } else {
             $this->_startOfView = 2 - $this->_startday;
         }
     }
     $startDate = new Horde_Date($this->year, $this->month, $this->_startOfView);
     $this->_endDate = new Horde_Date($this->year, $this->month, Horde_Date_Utils::daysInMonth($this->month, $this->year) + 1);
     $this->_endDate->mday += (7 - ($this->_endDate->format('w') - $prefs->getValue('week_start_monday'))) % 7;
     if ($prefs->getValue('show_shared_side_by_side')) {
         $allCalendars = Kronolith::listInternalCalendars();
         $this->_currentCalendars = array();
         foreach ($GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS) as $id) {
             $this->_currentCalendars[$id] = $allCalendars[$id];
         }
     } else {
         $this->_currentCalendars = array('internal_0' => true);
     }
     try {
         $this->_events = Kronolith::listEvents($startDate, $this->_endDate);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         $this->_events = array();
     }
     if (!is_array($this->_events)) {
         $this->_events = array();
     }
 }
开发者ID:horde,项目名称:horde,代码行数:47,代码来源:Month.php

示例5: _checkForOwnedCalendar

 /**
  * Check that the user owns a calendar and if not, creates one.
  */
 protected function _checkForOwnedCalendar()
 {
     global $prefs, $registry, $conf;
     if (!empty($conf['share']['auto_create']) && $registry->getAuth() && !count(Kronolith::listInternalCalendars(true))) {
         $calendars = $GLOBALS['injector']->getInstance('Kronolith_Factory_Calendars')->create();
         $share = $calendars->createDefaultShare();
         $this->_allCalendars[$share->getName()] = new Kronolith_Calendar_Internal(array('share' => $share));
         $this->_displayCalendars[] = $share->getName();
         $prefs->setValue('default_share', $share->getName());
         // Calendar auto-sharing with the user's groups
         if ($conf['autoshare']['shareperms'] != 'none') {
             $perm_value = 0;
             switch ($conf['autoshare']['shareperms']) {
                 case 'read':
                     $perm_value = Horde_Perms::READ | Horde_Perms::SHOW;
                     break;
                 case 'edit':
                     $perm_value = Horde_Perms::READ | Horde_Perms::SHOW | Horde_Perms::EDIT;
                     break;
                 case 'full':
                     $perm_value = Horde_Perms::READ | Horde_Perms::SHOW | Horde_Perms::EDIT | Horde_Perms::DELETE;
                     break;
             }
             try {
                 $group_list = $GLOBALS['injector']->getInstance('Horde_Group')->listGroups($registry->getAuth());
                 if (count($group_list)) {
                     $perm = $share->getPermission();
                     // Add the default perm, not added otherwise
                     foreach (array_keys($group_list) as $group_id) {
                         $perm->addGroupPermission($group_id, $perm_value, false);
                     }
                     $share->setPermission($perm);
                     $GLOBALS['notification']->push(sprintf(_("New calendar created and automatically shared with the following group(s): %s."), implode(', ', $group_list)), 'horde.success');
                 }
             } catch (Horde_Group_Exception $e) {
             }
         }
         $prefs->setValue('display_cals', serialize($this->_displayCalendars));
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:43,代码来源:CalendarsManager.php

示例6: serialize

            break;
        }
    }
    if (!$haveDefault) {
        $sync[] = $default;
        $GLOBALS['prefs']->setValue('sync_calendars', serialize($sync));
    }
});
// Calendars use for synchronization
$_prefs['sync_calendars'] = array('value' => 'a:0:{}', 'type' => 'multienum', 'enum' => array(), 'desc' => _("Select the calendars that, in addition to the default, should be used for synchronization with external devices:"), 'on_init' => function ($ui) {
    $enum = array();
    $sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
    if (empty($sync)) {
        $GLOBALS['prefs']->setValue('sync_calendars', serialize(array(Kronolith::getDefaultCalendar(Horde_Perms::EDIT))));
    }
    foreach (Kronolith::listInternalCalendars(false, Horde_Perms::DELETE) as $key => $cal) {
        if ($cal->getName() != Kronolith::getDefaultCalendar(Horde_Perms::DELETE)) {
            $enum[$key] = Kronolith::getLabel($cal);
        }
    }
    $ui->prefs['sync_calendars']['enum'] = $enum;
}, 'on_change' => function () {
    $sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
    $haveDefault = false;
    $default = Kronolith::getDefaultCalendar(Horde_Perms::DELETE);
    foreach ($sync as $cid) {
        if ($cid == $default) {
            $haveDefault = true;
            break;
        }
    }
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:prefs.php

示例7: updateAttendee

 /**
  * Updates an attendee's response status for a specified event.
  *
  * @param Horde_Icalendar_Vevent $response  A Horde_Icalendar_Vevent
  *                                          object, with a valid UID
  *                                          attribute that points to an
  *                                          existing event.  This is
  *                                          typically the vEvent portion
  *                                          of an iTip meeting-request
  *                                          response, with the attendee's
  *                                          response in an ATTENDEE
  *                                          parameter.
  * @param string $sender                    The email address of the
  *                                          person initiating the
  *                                          update. Attendees are only
  *                                          updated if this address
  *                                          matches.
  *
  * @throws Kronolith_Exception
  */
 public function updateAttendee($response, $sender = null)
 {
     try {
         $uid = $response->getAttribute('UID');
     } catch (Horde_Icalendar_Exception $e) {
         throw new Kronolith_Exception($e);
     }
     $events = Kronolith::getDriver()->getByUID($uid, null, true);
     /* First try the user's own calendars. */
     $ownerCalendars = Kronolith::listInternalCalendars(true, Horde_Perms::EDIT);
     $event = null;
     foreach ($events as $ev) {
         if (isset($ownerCalendars[$ev->calendar])) {
             $event = $ev;
             break;
         }
     }
     /* If not successful, try all calendars the user has access to. */
     if (empty($event)) {
         $editableCalendars = Kronolith::listInternalCalendars(false, Horde_Perms::EDIT);
         foreach ($events as $ev) {
             if (isset($editableCalendars[$ev->calendar])) {
                 $event = $ev;
                 break;
             }
         }
     }
     if (empty($event) || $event->private && $event->creator != $GLOBALS['registry']->getAuth()) {
         throw new Horde_Exception_PermissionDenied();
     }
     $atnames = $response->getAttribute('ATTENDEE');
     if (!is_array($atnames)) {
         $atnames = array($atnames);
     }
     $atparms = $response->getAttribute('ATTENDEE', true);
     $found = false;
     $error = _("No attendees have been updated because none of the provided email addresses have been found in the event's attendees list.");
     foreach ($atnames as $index => $attendee) {
         if ($response->getAttribute('VERSION') < 2) {
             $addr_ob = new Horde_Mail_Rfc822_Address($attendee);
             if (!$addr_ob->valid) {
                 continue;
             }
             $attendee = $addr_ob->bare_address;
             $name = $addr_ob->personal;
         } else {
             $attendee = str_ireplace('mailto:', '', $attendee);
             $name = isset($atparms[$index]['CN']) ? $atparms[$index]['CN'] : null;
         }
         if ($event->hasAttendee($attendee)) {
             if (is_null($sender) || $sender == $attendee) {
                 $event->addAttendee($attendee, Kronolith::PART_IGNORE, Kronolith::responseFromICal($atparms[$index]['PARTSTAT']), $name);
                 $found = true;
             } else {
                 $error = _("The attendee hasn't been updated because the update was not sent from the attendee.");
             }
         }
     }
     $event->save();
     if (!$found) {
         throw new Kronolith_Exception($error);
     }
 }
开发者ID:horde,项目名称:horde,代码行数:83,代码来源:Api.php

示例8: getByUID

 /**
  * Get an event or events with the given UID value.
  *
  * @param string $uid       The UID to match
  * @param array $calendars  A restricted array of calendar ids to search
  * @param boolean $getAll   Return all matching events?
  *
  * @return Kronolith_Event
  * @throws Kronolith_Exception
  * @throws Horde_Exception_NotFound
  */
 public function getByUID($uid, $calendars = null, $getAll = false)
 {
     $query = 'SELECT event_id, event_uid, calendar_id, event_description,' . ' event_location, event_private, event_status, event_attendees,' . ' event_title, event_recurcount, event_url, event_timezone,' . ' event_recurtype, event_recurenddate, event_recurinterval,' . ' event_recurdays, event_start, event_end, event_allday,' . ' event_alarm, event_alarm_methods, event_modified,' . ' event_exceptions, event_creator_id, event_resources, event_baseid,' . ' event_exceptionoriginaldate, event_organizer FROM kronolith_events' . ' WHERE event_uid = ?';
     $values = array((string) $uid);
     /* Optionally filter by calendar */
     if (!empty($calendars)) {
         if (!count($calendars)) {
             throw new Kronolith_Exception(_("No calendars to search"));
         }
         $query .= ' AND calendar_id IN (?' . str_repeat(', ?', count($calendars) - 1) . ')';
         $values = array_merge($values, $calendars);
     }
     try {
         $events = $this->_db->selectAll($query, $values);
     } catch (Horde_Db_Exception $e) {
         throw new Kronolith_Exception($e);
     }
     if (!count($events)) {
         throw new Horde_Exception_NotFound(sprintf(_("%s not found"), $uid));
     }
     $eventArray = array();
     foreach ($events as $event) {
         /* Convert TEXT/CLOB fields. */
         $event = $this->convertBlobs($event);
         $this->open($event['calendar_id']);
         $this->_cache[$this->calendar][$event['event_id']] = new $this->_eventClass($this, $event);
         $eventArray[] = $this->_cache[$this->calendar][$event['event_id']];
     }
     if ($getAll) {
         return $eventArray;
     }
     /* First try the user's own calendars. */
     $ownerCalendars = Kronolith::listInternalCalendars(true, Horde_Perms::READ);
     $event = null;
     foreach ($eventArray as $ev) {
         if (isset($ownerCalendars[$ev->calendar])) {
             $event = $ev;
             break;
         }
     }
     /* If not successful, try all calendars the user has access too. */
     if (empty($event)) {
         $readableCalendars = Kronolith::listInternalCalendars(false, Horde_Perms::READ);
         foreach ($eventArray as $ev) {
             if (isset($readableCalendars[$ev->calendar])) {
                 $event = $ev;
                 break;
             }
         }
     }
     if (empty($event)) {
         $event = $eventArray[0];
     }
     return $event;
 }
开发者ID:horde,项目名称:horde,代码行数:66,代码来源:Sql.php

示例9: getByUID

 /**
  * Get an event or events with the given UID value.
  *
  * @param string $uid The UID to match
  * @param array $calendars A restricted array of calendar ids to search
  * @param boolean $getAll Return all matching events? If this is false,
  * an error will be returned if more than one event is found.
  *
  * @return Kronolith_Event
  * @throws Kronolith_Exception
  * @throws Horde_Exception_NotFound
  */
 public function getByUID($uid, $calendars = null, $getAll = false)
 {
     if (!is_array($calendars)) {
         $calendars = array_keys(Kronolith::listInternalCalendars(false, Horde_Perms::READ));
     }
     $id = Horde_Url::uriB64Encode($uid);
     foreach ($calendars as $calendar) {
         $this->open($calendar);
         $this->synchronize();
         if (!isset($this->_events_cache[$id])) {
             continue;
         }
         // Ok, found event
         $event = $this->_events_cache[$id];
         if ($getAll) {
             return array($event);
         }
         return $event;
     }
     throw new Horde_Exception_NotFound(sprintf(_("Event not found: %s"), $uid));
 }
开发者ID:Gomez,项目名称:horde,代码行数:33,代码来源:Kolab.php

示例10: Horde_Date

 $event->end = new Horde_Date($event->start);
 $event->end->mday++;
 /* We need to set the event to initialized, otherwise we will end up with
  * a default end date. */
 $event->initialized = true;
 if (Horde_Util::getFormData('actionID') == 'search_calendar') {
     $event->readForm();
     if (Horde_Util::getFormData('status') == Kronolith::STATUS_NONE) {
         $event->status = null;
     }
     $events = Kronolith::search($event, $search_calendar[1] == '__any' ? null : $search_calendar[0] . '|' . $search_calendar[1]);
 }
 $optgroup = $GLOBALS['browser']->hasFeature('optgroup');
 $current_user = $GLOBALS['registry']->getAuth();
 $calendars = array();
 foreach (Kronolith::listInternalCalendars(false, Horde_Perms::READ) as $id => $cal) {
     if ($cal->get('owner') && $cal->get('owner') == $current_user) {
         $calendars[_("My Calendars:")]['|' . $id] = $cal->get('name');
     } else {
         $calendars[_("Shared Calendars:")]['|' . $id] = Kronolith::getLabel($cal);
     }
 }
 foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_EXTERNAL_CALENDARS) as $id => $cal) {
     $app = $GLOBALS['registry']->get('name', $GLOBALS['registry']->hasInterface($cal->api()));
     if (!$cal->display()) {
         continue;
     }
     $calendars[$app . ':']['Horde|external_' . $id] = $cal->name();
 }
 foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_REMOTE_CALENDARS) as $id => $cal) {
     $calendars[_("Remote Calendars:")]['Ical|' . $id] = $cal->name();
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:search.php

示例11: serialize

            break;
        }
    }
    if (!$haveDefault) {
        $sync[] = $default;
        $GLOBALS['prefs']->setValue('sync_calendars', serialize($sync));
    }
});
// Calendars use for synchronization
$_prefs['sync_calendars'] = array('value' => 'a:0:{}', 'type' => 'multienum', 'enum' => array(), 'desc' => _("Select the calendars that, in addition to the default, should be used for synchronization with external devices:"), 'on_init' => function ($ui) {
    $enum = array();
    $sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
    if (empty($sync)) {
        $GLOBALS['prefs']->setValue('sync_calendars', serialize(array(Kronolith::getDefaultCalendar())));
    }
    foreach (Kronolith::listInternalCalendars(!$GLOBALS['prefs']->getValue('activesync_no_multiplex'), Horde_Perms::EDIT) as $key => $cal) {
        if ($cal->getName() != Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
            $enum[$key] = Kronolith::getLabel($cal);
        }
    }
    $ui->prefs['sync_calendars']['enum'] = $enum;
}, 'on_change' => function () {
    $sync = @unserialize($GLOBALS['prefs']->getValue('sync_calendars'));
    $haveDefault = false;
    $default = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
    foreach ($sync as $cid) {
        if ($cid == $default) {
            $haveDefault = true;
            break;
        }
    }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:31,代码来源:prefs.php

示例12: 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');
         }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:100,代码来源:Application.php


注:本文中的Kronolith::listInternalCalendars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。