openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

PageelementReleaseAction.class.php (841B)


      1 <?php
      2 namespace cms\action\pageelement;
      3 use cms\action\Method;
      4 use cms\action\PageelementAction;
      5 use cms\model\Permission;
      6 use cms\model\Value;
      7 use language\Messages;
      8 use LogicException;
      9 use util\exception\SecurityException;
     10 
     11 class PageelementReleaseAction extends PageelementAction implements Method {
     12 
     13 
     14 	protected function getRequiredPagePermission()
     15 	{
     16 		return Permission::ACL_RELEASE;
     17 	}
     18 
     19     public function view() {
     20     }
     21     public function post() {
     22 
     23 		$valueId = $this->request->getRequiredNumber('valueid');
     24 
     25 		$this->ensureValueIdIsInAnyContent( $valueId );
     26 
     27 		$value = new Value();
     28 		$value->valueid = $valueId;
     29 		$value->loadWithId( $value->valueid );
     30 
     31 		// Restore value.
     32 		$value->valueid = null;
     33 		$value->publish = true;
     34 		$value->persist();
     35 
     36 		$this->addNoticeFor( $this->template,Messages::PAGEELEMENT_RELEASED );
     37     }
     38 }