Copyright 2010-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Автор: Jan Schneider (jan@horde.org)
Пример #1
0
 /**
  * Constructor.
  *
  * @param array $params  A hash with any parameters that this calendar
  *                       might need.
  *                       Required parameters:
  *                       - share: The share of this calendar.
  */
 public function __construct($params = array())
 {
     if (!isset($params['share'])) {
         throw new BadMethodCallException('share parameter is missing');
     }
     Kronolith_Calendar::__construct($params);
 }
Пример #2
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     $hash = parent::toHash();
     $hash['show'] = $this->display();
     return $hash;
 }
Пример #3
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     $owner = $GLOBALS['registry']->isAdmin() || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management');
     $hash = parent::toHash();
     $hash['id'] = $this->_resource->getId();
     $hash['name'] = $this->name();
     $hash['owner'] = $owner;
     $hash['show'] = $this->display();
     $hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
     $hash['sub'] = null;
     $hash['feed'] = null;
     $hash['embed'] = null;
     $hash['response_type'] = $this->_resource->get('response_type');
     if ($owner) {
         $hash['perms'] = Kronolith::permissionToJson($this->_resource->getPermission());
     }
     return $hash;
 }
Пример #4
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     $owner = $GLOBALS['registry']->isAdmin();
     $hash = parent::toHash();
     $hash['id'] = $this->_resource->getId();
     $hash['name'] = $this->name();
     $hash['owner'] = $owner;
     $hash['show'] = $this->display();
     $hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
     $hash['sub'] = null;
     $hash['feed'] = null;
     $hash['embed'] = null;
     $hash['members'] = $this->_resource->get('members');
     if ($owner) {
         $hash['perms'] = array('type' => 'matrix', 'default' => 0, 'guest' => 0, 'creator' => 0);
     }
     return $hash;
 }
Пример #5
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     return array_merge(parent::toHash(), array('show' => in_array($this->_url, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_REMOTE_CALENDARS)), 'edit' => $this->hasPermission(Horde_Perms::EDIT)), $this->credentials());
 }
Пример #6
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     $hash = parent::toHash();
     $hash['api'] = $GLOBALS['registry']->get('name', $GLOBALS['registry']->hasInterface($this->api()));
     $hash['show'] = in_array($this->_api . '/' . $this->_id, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_EXTERNAL_CALENDARS));
     return $hash;
 }
Пример #7
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     global $calendar_manager, $conf, $injector, $registry;
     $id = $this->_share->getName();
     $owner = $registry->getAuth() && $this->owner() == $registry->getAuth();
     $hash = parent::toHash();
     $hash['name'] = $this->name();
     $hash['owner'] = $owner;
     $hash['users'] = Kronolith::listShareUsers($this->_share);
     $hash['show'] = in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS));
     $hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
     try {
         $hash['caldav'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/calendars/' : '/rpc.php/calendars/'), true, -1) . $registry->getAuth() . '/' . $injector->getInstance('Horde_Dav_Storage')->getExternalCollectionId($id, 'calendar') . '/';
     } catch (Horde_Exception $e) {
     }
     $hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1) . ($this->owner() ? $this->owner() : '-system-') . '/' . $id . '.ics';
     $hash['feed'] = (string) Kronolith::feedUrl($id);
     $hash['embed'] = Kronolith::embedCode($id);
     $hash['tg'] = array_values(Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR));
     if ($owner) {
         $hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission());
     }
     return $hash;
 }
Пример #8
0
 /**
  * Returns a hash representing this calendar.
  *
  * @return array  A simple hash.
  */
 public function toHash()
 {
     global $calendar_manager, $conf, $injector, $registry;
     $id = $this->_share->getName();
     $owner = $registry->getAuth() && ($this->owner() == $registry->getAuth() || $this->isSystem() && $registry->isAdmin());
     $hash = parent::toHash();
     $hash['name'] = $this->name();
     $hash['owner'] = $owner;
     $hash['system'] = $this->isSystem();
     $hash['users'] = Kronolith::listShareUsers($this->_share);
     $hash['show'] = in_array($id, $calendar_manager->get(Kronolith::DISPLAY_CALENDARS));
     $hash['edit'] = $this->hasPermission(Horde_Perms::EDIT);
     $hash['delete'] = $this->hasPermission(Horde_Perms::DELETE);
     $hash['caldav'] = $this->caldavUrl();
     $hash['sub'] = Horde::url($registry->get('webroot', 'horde') . ($conf['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1) . ($this->owner() ? $registry->convertUsername($this->owner(), false) : '-system-') . '/' . $id . '.ics';
     $hash['feed'] = (string) Kronolith::feedUrl($id);
     $hash['embed'] = Kronolith::embedCode($id);
     $hash['tg'] = array_values(Kronolith::getTagger()->getTags($id, Kronolith_Tagger::TYPE_CALENDAR));
     if ($owner) {
         $hash['perms'] = Kronolith::permissionToJson($this->_share->getPermission(), is_null($this->_share->get('owner')));
     }
     return $hash;
 }