File modules/cms/action/template/TemplateHistoryAction.class.php
Last commit: Sat Nov 27 00:11:56 2021 +0100 Jan Dankert New: History for files and templates.
1 <?php 2 namespace cms\action\template; 3 use cms\action\Method; 4 use cms\action\TemplateAction; 5 use cms\model\Content; 6 use cms\model\Element; 7 use cms\model\Page; 8 use cms\model\PageContent; 9 use cms\model\Project; 10 use cms\model\TemplateModel; 11 use cms\model\Value; 12 13 14 class TemplateHistoryAction extends TemplateAction implements Method { 15 16 public function view() { 17 18 $project = new Project( $this->template->projectid ); 19 $models = array(); 20 21 foreach( $project->getModels() as $modelId => $modelName ) 22 { 23 $templatemodel = new TemplateModel( $this->template->templateid, $modelId ); 24 $templatemodel->load(); 25 26 $model = [ 27 'id' => $modelId, 28 'name' => $modelName, 29 'values' => [], 30 ]; 31 32 /** @var Content */ 33 $content = new Content( $templatemodel->getContentid() ); 34 35 foreach($content->getVersionList() as $valueId) { 36 37 $value = new Value(); 38 $value->loadWithId( $valueId ); 39 40 $model['values'][] = [ 41 'text' => $value->text, 42 'active' => $value->active, 43 'publish' => $value->publish, 44 'user' => $value->lastchangeUserName, 45 'date' => $value->lastchangeTimeStamp, 46 'id' => $value->getId(), 47 'usable' => ! $value->active, 48 'releasable' => $value->active && ! $value->publish, 49 'comparable' => true, 50 ]; 51 } 52 53 $models[ $modelId ] = $model; 54 } 55 56 $this->setTemplateVar('models',$models ); 57 } 58 59 public function post() { 60 } 61 }
Downloadmodules/cms/action/template/TemplateHistoryAction.class.php
History Sat, 27 Nov 2021 00:11:56 +0100 Jan Dankert New: History for files and templates.