File modules/cms/action/pageelement/PageelementHistoryAction.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\pageelement; 3 use cms\action\Method; 4 use cms\action\PageelementAction; 5 use cms\model\Content; 6 use cms\model\Element; 7 use cms\model\PageContent; 8 use cms\model\Value; 9 10 class PageelementHistoryAction extends PageelementAction implements Method { 11 public function view() { 12 13 $this->page->load(); 14 $this->element->load(); 15 16 $languages = array(); 17 18 foreach ( $this->page->getProject()->getLanguages() as $languageId=>$languageName ) 19 { 20 $language = [ 21 'id' => $languageId, 22 'name' => $languageName, 23 'values' => [], 24 ]; 25 26 $pageContent = new PageContent(); 27 $pageContent->languageid = $languageId; 28 $pageContent->elementId = $this->element->elementid; 29 $pageContent->pageId = $this->page->pageid; 30 $pageContent->load(); 31 32 $content = new Content( $pageContent->contentId ); 33 34 foreach($content->getVersionList() as $valueId) { 35 36 $value = new Value(); 37 $value->loadWithId( $valueId ); 38 39 $language['values'][] = [ 40 'text' => $this->calculateValue($value, $this->element->typeid ), 41 'active' => $value->active, 42 'publish' => $value->publish, 43 'user' => $value->lastchangeUserName, 44 'date' => $value->lastchangeTimeStamp, 45 'id' => $value->getId(), 46 'usable' => ! $value->active, 47 'releasable' => $value->active && ! $value->publish, 48 'comparable' => in_array($this->element->typeid,[Element::ELEMENT_TYPE_LONGTEXT]), 49 ]; 50 } 51 52 $languages[$languageId] = $language; 53 } 54 55 $this->setTemplateVar('name' ,$this->element->label ); 56 $this->setTemplateVar('languages',$languages ); 57 } 58 59 60 public function post() { 61 } 62 }
Downloadmodules/cms/action/pageelement/PageelementHistoryAction.class.php
History Sat, 27 Nov 2021 00:11:56 +0100 Jan Dankert New: History for files and templates. Tue, 9 Nov 2021 00:35:42 +0100 Jan Dankert Fixes: Reading and writing template sources with the new content table. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.