PageelementEditAction.class.php (1497B)
1 <?php 2 namespace cms\action\pageelement; 3 use cms\action\Method; 4 use cms\action\PageelementAction; 5 use cms\model\PageContent; 6 use cms\model\Value; 7 8 class PageelementEditAction extends PageelementAction implements Method { 9 public function view() { 10 11 $this->element->load(); 12 $this->setTemplateVar('name' ,$this->element->label ); 13 $this->setTemplateVar('description',$this->element->desc ); 14 $this->setTemplateVar('elementid' ,$this->element->elementid ); 15 $this->setTemplateVar('type' ,$this->element->getTypeName() ); 16 17 $languages = array(); 18 19 foreach ( $this->page->getProject()->getLanguages() as $languageId=>$languageName ) 20 { 21 $pageContent = new PageContent(); 22 $pageContent->pageId = $this->page->pageid; 23 $pageContent->languageid = $languageId; 24 $pageContent->elementId = $this->element->elementid; 25 $pageContent->load(); 26 27 $value = new Value(); 28 $value->contentid = $pageContent->contentId; 29 $value->load(); 30 31 $languages[$languageId] = array( 32 'languageid' => $languageId, 33 'languagename' => $languageName, 34 'text' => $this->calculateValue($value, $this->element->typeid), 35 'number' => $value->number, 36 'date' => $value->date, 37 'linkObjectId' => $value->linkToObjectId, 38 ); 39 } 40 41 $this->setTemplateVar('languages',$languages); 42 } 43 44 45 public function post() { 46 } 47 }