File modules/cms/action/pageelement/PageelementLinkAction.class.php
Last commit: Sun Dec 5 20:33:24 2021 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'.
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\Permission; 7 use cms\model\BaseObject; 8 use cms\model\Folder; 9 use cms\model\Page; 10 use cms\model\Project; 11 use cms\model\Template; 12 use cms\model\Value; 13 14 class PageelementLinkAction extends PageelementAction implements Method { 15 16 public function view() { 17 18 $pageContent = new PageContent(); 19 $pageContent->pageId = $this->page->pageid; 20 $pageContent->languageid = $this->page->getProject()->getDefaultLanguageId(); 21 $pageContent->elementId = $this->element->elementid; 22 $pageContent->load(); 23 24 $value = new Value(); 25 $value->contentid = $pageContent->contentId; 26 $value->load(); 27 28 $this->setTemplateVar('name' ,$this->element->name ); 29 $this->setTemplateVar('desc' ,$this->element->desc ); 30 31 $project = new Project($this->page->projectid); 32 $this->setTemplateVar('rootfolderid' ,$project->getRootObjectId() ); 33 34 // Ermitteln, welche Objekttypen verlinkt werden d�rfen. 35 if ( empty($this->element->subtype) ) 36 $types = array('page','file','link'); // Fallback: Alle erlauben :) 37 else 38 $types = explode(',',$this->element->subtype ); 39 40 $objects = array(); 41 42 $objects[ 0 ] = \cms\base\Language::lang('LIST_ENTRY_EMPTY'); // Wert "nicht ausgewählt" 43 44 45 $t = new Template( $this->page->templateid ); 46 47 foreach( $t->getDependentObjectIds() as $id ) 48 { 49 $o = new BaseObject( $id ); 50 $o->load(); 51 52 // if ( in_array( $o->getType(),$types )) 53 // { 54 $f = new Folder( $o->parentid ); 55 // $f->load(); 56 57 $objects[ $id ] = \cms\base\Language::lang( $o->getType() ).': '; 58 $objects[ $id ] .= implode( \util\Text::FILE_SEP,$f->parentObjectNames(false,true) ); 59 $objects[ $id ] .= \util\Text::FILE_SEP.$o->filename; 60 // } 61 } 62 63 asort( $objects ); // Sortieren 64 65 $this->setTemplateVar('objects' ,$objects); 66 $this->setTemplateVar('linkobjectid',$this->value->linkToObjectId); 67 68 $this->setTemplateVar( 'release',$this->page->hasRight(Permission::ACL_RELEASE) ); 69 $this->setTemplateVar( 'publish',$this->page->hasRight(Permission::ACL_PUBLISH) ); 70 71 $this->setTemplateVar( 'objectid',$this->page->objectid ); 72 } 73 74 75 public function post() { 76 } 77 }
Downloadmodules/cms/action/pageelement/PageelementLinkAction.class.php
History Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Sun, 5 Dec 2021 15:33:29 +0100 dankert Cleanup: Removed unusable properties from class 'Value'. Mon, 4 Jan 2021 19:03:18 +0100 Jan Dankert Refactoring: ACL class is renamed to Permission, because most RBAC/DMAC concepts are calling it a permission. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.