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


PHP Kronolith::initialize方法代码示例

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


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

示例1: listCalendars

 /**
  * Returns a list of all calendars.
  */
 public function listCalendars()
 {
     Kronolith::initialize();
     $all_external_calendars = $GLOBALS['calendar_manager']->get(Kronolith::ALL_EXTERNAL_CALENDARS);
     $result = new stdClass();
     $auth_name = $GLOBALS['registry']->getAuth();
     // Calendars. Do some twisting to sort own calendar before shared
     // calendars.
     foreach (array(true, false) as $my) {
         foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_CALENDARS) as $id => $calendar) {
             $owner = $auth_name && $calendar->owner() == $auth_name;
             if ($my && $owner || !$my && !$owner) {
                 $result->calendars['internal'][$id] = $calendar->toHash();
             }
         }
         // Tasklists
         if (Kronolith::hasApiPermission('tasks')) {
             foreach ($GLOBALS['registry']->tasks->listTasklists($my, Horde_Perms::SHOW, false) as $id => $tasklist) {
                 if (isset($all_external_calendars['tasks/' . $id])) {
                     $owner = $auth_name && $tasklist->get('owner') == $auth_name;
                     if ($my && $owner || !$my && !$owner) {
                         $result->calendars['tasklists']['tasks/' . $id] = $all_external_calendars['tasks/' . $id]->toHash();
                     }
                 }
             }
         }
     }
     // Resources
     if (!empty($GLOBALS['conf']['resources']['enabled'])) {
         foreach (Kronolith::getDriver('Resource')->listResources() as $resource) {
             if ($resource->get('isgroup')) {
                 $rcal = new Kronolith_Calendar_ResourceGroup(array('resource' => $resource));
                 $result->calendars['resourcegroup'][$resource->getId()] = $rcal->toHash();
             } else {
                 $rcal = new Kronolith_Calendar_Resource(array('resource' => $resource));
                 $result->calendars['resource'][$resource->get('calendar')] = $rcal->toHash();
             }
         }
     }
     // Timeobjects
     foreach ($all_external_calendars as $id => $calendar) {
         if ($calendar->api() != 'tasks' && $calendar->display()) {
             $result->calendars['external'][$id] = $calendar->toHash();
         }
     }
     // Remote calendars
     foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_REMOTE_CALENDARS) as $url => $calendar) {
         $result->calendars['remote'][$url] = $calendar->toHash();
     }
     // Holidays
     foreach ($GLOBALS['calendar_manager']->get(Kronolith::ALL_HOLIDAYS) as $id => $calendar) {
         $result->calendars['holiday'][$id] = $calendar->toHash();
     }
     return $result;
 }
开发者ID:kossamums,项目名称:horde,代码行数:58,代码来源:Handler.php

示例2: _init

 /**
  * Global variables defined:
  * - $kronolith_shares: TODO
  */
 protected function _init()
 {
     /* For now, autoloading the Content_* classes depend on there being a
      * registry entry for the 'content' application that contains at least
      * the fileroot entry. */
     $GLOBALS['injector']->getInstance('Horde_Autoloader')->addClassPathMapper(new Horde_Autoloader_ClassPathMapper_Prefix('/^Content_/', $GLOBALS['registry']->get('fileroot', 'content') . '/lib/'));
     if (!class_exists('Content_Tagger')) {
         throw new Horde_Exception(_("The Content_Tagger class could not be found. Make sure the Content application is installed."));
     }
     $GLOBALS['injector']->bindFactory('Kronolith_Geo', 'Kronolith_Factory_Geo', 'create');
     $GLOBALS['injector']->bindFactory('Kronolith_Shares', 'Kronolith_Factory_Shares', 'create');
     /* Set the timezone variable, if available. */
     $GLOBALS['registry']->setTimeZone();
     /* Store the request timestamp if it's not already present. */
     if (!isset($_SERVER['REQUEST_TIME'])) {
         $_SERVER['REQUEST_TIME'] = time();
     }
     if (!$GLOBALS['prefs']->getValue('dynamic_view')) {
         $this->features['dynamicView'] = false;
     }
     if ($GLOBALS['registry']->getView() != Horde_Registry::VIEW_DYNAMIC || !$GLOBALS['prefs']->getValue('dynamic_view') || empty($this->initParams['nodynamicinit'])) {
         Kronolith::initialize();
     }
 }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:Application.php

示例3: testDefaultShareDeletePermission

 public function testDefaultShareDeletePermission()
 {
     $GLOBALS['conf']['share']['auto_create'] = true;
     Kronolith::initialize();
     $shares = $GLOBALS['injector']->getInstance('Kronolith_Shares')->listShares('test@example.com');
     $default = array_pop($shares);
     $this->assertTrue($default->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:8,代码来源:Base.php


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