openrat-cms

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

PageChangetemplateAction.class.php (1010B)


      1 <?php
      2 namespace cms\action\page;
      3 use cms\action\Method;
      4 use cms\action\PageAction;
      5 use cms\model\Permission;
      6 use cms\model\Project;
      7 use cms\model\Template;
      8 use util\Html;
      9 
     10 class PageChangetemplateAction extends PageAction implements Method {
     11 	public function getRequiredPermission() {
     12 		return Permission::ACL_PROP;
     13 	}
     14 
     15 	public function view() {
     16 		$this->page->load();
     17 
     18 
     19         $this->setTemplateVars( $this->page->getProperties() );
     20 
     21 		if   ( $this->userIsAdmin() )
     22 		{
     23 			$this->setTemplateVar('template_url',Html::url('template','show',$this->page->templateid));
     24 		}
     25 
     26 		$template = new Template( $this->page->templateid );
     27 		$template->load();
     28 		$this->setTemplateVar('template_name',$template->name);
     29 
     30 		$templates = Array();
     31         $project = new Project( $this->page->projectid );
     32 		foreach( $project->getTemplates() as $id=>$name )
     33 		{
     34 			if	( $id != $this->page->templateid )
     35 				$templates[$id]=$name;
     36 		}
     37 		$this->setTemplateVar('templates',$templates);
     38     }
     39 
     40     public function post() {
     41     }
     42 }