File modules/cms/action/page/PageChangetemplateAction.class.php
Last commit: Sat Mar 6 03:42:38 2021 +0100 Jan Dankert New: Better permission checks.
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 }
Downloadmodules/cms/action/page/PageChangetemplateAction.class.php
History Sat, 6 Mar 2021 03:42:38 +0100 Jan Dankert New: Better permission checks. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.