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


PHP Kronolith::updateShare方法代码示例

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


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

示例1: updateCalendar

 /**
  * Update an internal calendar's information.
  *
  * @param string $id      The calendar id.
  * @param array $info     An array of calendar information.
  *                        @see self::addCalendar()
  * @since 4.2.0
  */
 public function updateCalendar($id, array $info)
 {
     $calendar = $this->getCalendar(null, $id);
     // Prevent wiping tags if they were not passed.
     if (!array_key_exists('tags', $info)) {
         $info['tags'] = Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR);
     }
     Kronolith::updateShare($calendar->share(), $info);
 }
开发者ID:horde,项目名称:horde,代码行数:17,代码来源:Api.php

示例2: saveCalendar

 /**
  * TODO
  */
 public function saveCalendar()
 {
     global $calendar_manager, $injector, $notification, $prefs, $registry, $session;
     $calendar_id = $this->vars->calendar;
     $result = new stdClass();
     switch ($this->vars->type) {
         case 'internal':
             $info = array();
             foreach (array('name', 'color', 'description', 'tags', 'system') as $key) {
                 $info[$key] = $this->vars->{$key};
             }
             // Create a calendar.
             if (!$calendar_id) {
                 if (!$registry->getAuth() || $prefs->isLocked('default_share')) {
                     return $result;
                 }
                 try {
                     $calendar = Kronolith::addShare($info);
                     Kronolith::readPermsForm($calendar);
                     if ($calendar->hasPermission($registry->getAuth(), Horde_Perms::SHOW)) {
                         $wrapper = new Kronolith_Calendar_Internal(array('share' => $calendar));
                         $result->saved = true;
                         $result->id = $calendar->getName();
                         $result->calendar = $wrapper->toHash();
                     }
                 } catch (Exception $e) {
                     $notification->push($e, 'horde.error');
                     return $result;
                 }
                 $notification->push(sprintf(_("The calendar \"%s\" has been created."), $info['name']), 'horde.success');
                 break;
             }
             // Update a calendar.
             try {
                 $calendar = $injector->getInstance('Kronolith_Shares')->getShare($calendar_id);
                 $original_name = $calendar->get('name');
                 $original_owner = $calendar->get('owner');
                 Kronolith::updateShare($calendar, $info);
                 Kronolith::readPermsForm($calendar);
                 if (!$info['system'] && $calendar->get('owner') != $original_owner || $info['system'] && !is_null($original_owner)) {
                     $result->deleted = true;
                 }
                 if ($calendar->hasPermission($registry->getAuth(), Horde_Perms::SHOW) || is_null($calendar->get('owner')) && $registry->isAdmin()) {
                     $wrapper = new Kronolith_Calendar_Internal(array('share' => $calendar));
                     $result->saved = true;
                     $result->id = $calendar->getName();
                     $result->calendar = $wrapper->toHash();
                 }
             } catch (Exception $e) {
                 $notification->push($e, 'horde.error');
                 return $result;
             }
             if ($calendar->get('name') != $original_name) {
                 $notification->push(sprintf(_("The calendar \"%s\" has been renamed to \"%s\"."), $original_name, $calendar->get('name')), 'horde.success');
             } else {
                 $notification->push(sprintf(_("The calendar \"%s\" has been saved."), $original_name), 'horde.success');
             }
             break;
         case 'tasklists':
             $calendar = array();
             foreach (array('name', 'color', 'description') as $key) {
                 $calendar[$key] = $this->vars->{$key};
             }
             // Create a task list.
             if (!$calendar_id) {
                 if (!$registry->getAuth() || $prefs->isLocked('default_share')) {
                     return $result;
                 }
                 try {
                     $tasklistId = $registry->tasks->addTasklist($calendar['name'], $calendar['description'], $calendar['color']);
                     $tasklists = $registry->tasks->listTasklists(true);
                     if (!isset($tasklists[$tasklistId])) {
                         $notification->push(_("Added task list not found."), 'horde.error');
                         return $result;
                     }
                     $tasklist = $tasklists[$tasklistId];
                     Kronolith::readPermsForm($tasklist);
                     if ($tasklist->hasPermission($registry->getAuth(), Horde_Perms::SHOW)) {
                         $wrapper = new Kronolith_Calendar_External_Tasks(array('api' => 'tasks', 'name' => $tasklistId, 'share' => $tasklist));
                         // Update external calendars caches.
                         $all_external = $session->get('kronolith', 'all_external_calendars');
                         $all_external[] = array('a' => 'tasks', 'n' => $tasklistId, 'd' => $tasklist->get('name'));
                         $session->set('kronolith', 'all_external_calendars', $all_external);
                         $display_external = $calendar_manager->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS);
                         $display_external[] = 'tasks/' . $tasklistId;
                         $calendar_manager->set(Kronolith::DISPLAY_EXTERNAL_CALENDARS, $display_external);
                         $prefs->setValue('display_external_cals', serialize($display_external));
                         $all_external = $calendar_manager->get(Kronolith::ALL_EXTERNAL_CALENDARS);
                         $all_external['tasks/' . $tasklistId] = $wrapper;
                         $calendar_manager->set(Kronolith::ALL_EXTERNAL_CALENDARS, $all_external);
                         $result->saved = true;
                         $result->id = 'tasks/' . $tasklistId;
                         $result->calendar = $wrapper->toHash();
                     }
                 } catch (Exception $e) {
                     $notification->push($e, 'horde.error');
                     return $result;
//.........这里部分代码省略.........
开发者ID:kossamums,项目名称:horde,代码行数:101,代码来源:Handler.php

示例3: execute

 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     switch ($this->_vars->submitbutton) {
         case _("Save"):
             $info = array();
             foreach (array('name', 'color', 'description', 'tags', 'system') as $key) {
                 $info[$key] = $this->_vars->get($key);
             }
             Kronolith::updateShare($this->_calendar, $info);
             break;
         case _("Delete"):
             Horde::url('calendars/delete.php')->add('c', $this->_vars->c)->redirect();
             break;
         case _("Cancel"):
             Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
             break;
     }
 }
开发者ID:horde,项目名称:horde,代码行数:21,代码来源:EditCalendar.php


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