getId() public method

Obtain the resource's internal identifier.
public getId ( ) : string
return string The id.
コード例 #1
0
ファイル: Group.php プロジェクト: jubinpatel/horde
 /**
  * Obtain the resource's internal identifier, taking into account whether or
  * not we have validated/selected a resource for this group yet.
  *
  * @return string The id.
  */
 public function getId()
 {
     if (!empty($this->_selectedResource)) {
         return $this->_selectedResource->getId();
     } else {
         return parent::getId();
     }
 }
コード例 #2
0
ファイル: Resource.php プロジェクト: horde/horde
 /**
  * Removes a resource from storage, along with any events in the resource's
  * calendar.
  *
  * @param Kronolith_Resource_Base $resource  The kronolith resource to remove
  *
  * @throws Kronolith_Exception, Horde_Exception_PermissionDenied
  */
 public function delete($resource)
 {
     // @todo
     if (!$GLOBALS['registry']->isAdmin() && !$GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management')) {
         throw new Horde_Exception_PermissionDenied();
     }
     if (!$resource->getId()) {
         throw new Kronolith_Exception(_("Resource not valid."));
     }
     // Get group memberships and remove from group.
     $groups = $this->getGroupMemberships($resource->getId());
     foreach ($groups as $id) {
         $rg = $this->getResource($id);
         $members = $rg->get('members');
         unset($members[array_search($resource->getId(), $members)]);
         $rg->set('members', $members);
         $rg->save();
     }
     $this->_deleteResourceCalendar($resource->get('calendar'));
     try {
         $GLOBALS['injector']->getInstance('Kronolith_Shares')->removeShare($resource->share());
     } catch (Horde_Share_Exception $e) {
         throw new Kronolith_Exception($e);
     }
 }
コード例 #3
0
ファイル: Sql.php プロジェクト: DSNS-LAB/Dmail
 /**
  * Removes a resource from storage, along with any events in the resource's
  * calendar.
  *
  * @param Kronolith_Resource_Base $resource  The kronolith resource to remove
  *
  * @throws Kronolith_Exception, Horde_Exception_PermissionDenied
  */
 public function delete($resource)
 {
     if (!$GLOBALS['registry']->isAdmin() && !$GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management')) {
         throw new Horde_Exception_PermissionDenied();
     }
     if (!$resource->getId()) {
         throw new Kronolith_Exception(_("Resource not valid."));
     }
     // Get group memberships and remove from group.
     $groups = $this->getGroupMemberships($resource->getId());
     foreach ($groups as $id) {
         $rg = $this->getResource($id);
         $members = $rg->get('members');
         unset($members[array_search($resource->getId(), $members)]);
         $rg->set('members', $members);
         $rg->save();
     }
     $this->_deleteResourceCalendar($resource->get('calendar'));
     try {
         $query = 'DELETE FROM ' . $this->_params['table'] . ' WHERE resource_id = ?';
         $this->_db->delete($query, array($resource->getId()));
     } catch (Horde_Db_Exception $e) {
         throw new Kronolith_Exception($e);
     }
 }