/** * Returns if the page allows a mode. Access rights and user state * are taken into consideration. * * @see $supportedModes * * @param integer $mode The mode to check for. * * @return boolean True if the mode is allowed. */ public function allows($mode) { if ($mode == Wicked::MODE_EDIT) { $page = Wicked_Page::getPage($this->referrer()); if ($page->isLocked(Wicked::lockUser())) { return false; } } return parent::allows($mode); }
/** * @throws Wicked_Exception */ public function lock() { if ($this->_locks) { $id = $this->_locks->setLock(Wicked::lockUser(), 'wicked', $this->pageName(), $GLOBALS['conf']['wicked']['lock']['time'] * 60, Horde_Lock::TYPE_EXCLUSIVE); if ($id) { $this->_lock = $this->_locks->getLockInfo($id); } else { throw new Wicked_Exception(_("The page is already locked.")); } } }