/** * Override the get method to see if we have a selected resource. If so, * return the resource's property value, otherwise, return the group's * property value. * * @param string $property The property to get. * * @return mixed The requested property's value. */ public function get($property) { if (empty($this->_selectedResource)) { return parent::get($property); } else { return $this->_selectedResource->get($property); } }
/** * @throws Kronolith_Exception */ public function execute() { // If cancel was clicked, return false. if ($this->_vars->get('submitbutton') == _("Cancel")) { Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect(); } if (!$this->_resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) { throw new Kronolith_Exception(_("Permission denied")); } // Delete the resource. try { Kronolith::getDriver('Resource')->delete($this->_resource); } catch (Exception $e) { throw new Kronolith_Exception(sprintf(_("Unable to delete \"%s\": %s"), $this->_resource->get('name'), $e->getMessage())); } }
/** * 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; }
/** * 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['response_type'] = $this->_resource->get('response_type'); if ($owner) { $hash['perms'] = array('type' => 'matrix', 'default' => 0, 'guest' => 0, 'creator' => 0); } return $hash; }