File modules/cms/action/page/PageInfoAction.class.php
Last commit: Thu Feb 16 23:18:09 2023 +0100 Jan Dankert Fix: Tags for pages.
1 <?php 2 namespace cms\action\page; 3 use cms\action\Method; 4 use cms\action\object\ObjectInfoAction; 5 use cms\action\PageAction; 6 use cms\generator\PageContext; 7 use cms\generator\PageGenerator; 8 use cms\generator\Producer; 9 use cms\generator\Publisher; 10 use cms\model\BaseObject; 11 use cms\model\File; 12 use cms\model\Permission; 13 use cms\model\Template; 14 use util\Html; 15 16 class PageInfoAction extends PageAction implements Method { 17 public function view() { 18 $this->setTemplateVar('id',$this->page->objectid); 19 20 $parentAction = new ObjectInfoAction(); 21 $parentAction->request = $this->request; 22 $parentAction->init(); 23 $parentAction->view(); 24 25 $this->page->load(); 26 27 $this->setTemplateVars( $this->page->getProperties() ); 28 29 $alias = $this->page->getAliasForLanguage(null); 30 $this->setTemplateVar( 'alias', $alias->full_filename() ); 31 32 $languages = $this->page->getProject()->getLanguages(); 33 $models = $this->page->getProject()->getModels(); 34 $languagesVars = array(); 35 36 foreach( $languages as $id => $name ) 37 { 38 $this->page->load(); 39 40 $languagesVar = $this->page->getProperties(); 41 $languagesVar['languagename'] = $name; 42 $languagesVar['languageid' ] = $id; 43 $alias = $this->page->getAliasForLanguage( $id ); 44 $languagesVar['alias' ] = $alias->full_filename(); 45 46 $languagesVars[] = $languagesVar; 47 } 48 49 $this->setTemplateVar('languages',$languagesVars ); 50 51 $filenames = []; 52 foreach( $languages as $languageid=>$language ) 53 foreach( $models as $modelid=>$model ) { 54 $pagecontext = new PageContext( $this->page->objectid,Producer::SCHEME_PUBLIC ); 55 $pagecontext->languageId = $languageid; 56 $pagecontext->modelId = $modelid; 57 58 $pageGenerator = new PageGenerator( $pagecontext ); 59 $filenames[] = [ 60 'filename' => $pageGenerator->getPublicFilename(), 61 'mimetype' => $pageGenerator->getMimeType(), 62 'modelid' => $modelid, 63 'modelname' => $model, 64 'languageid' => $languageid, 65 'languagename'=> $language, 66 ]; 67 } 68 69 $this->setTemplateVar('filenames',$filenames ); 70 $this->setTemplateVar('is_valid' ,$this->page->isValid() ); 71 72 73 if ( $this->userIsProjectAdmin() ) 74 { 75 $this->setTemplateVar('templateid',$this->page->templateid); 76 } 77 78 $template = new Template( $this->page->templateid ); 79 $template->load(); 80 $this->setTemplateVar('template_name',$template->name ); 81 82 $generator = new PageGenerator( $this->createPageContext( Producer::SCHEME_PUBLIC) ); 83 84 $this->setTemplateVar('tmp_filename' ,$generator->getPublicFilename() ); 85 86 $references = []; 87 88 // Schleife ueber alle Objekte in diesem Ordner 89 foreach( $this->page->getDependentObjectIds() as $id ) 90 { 91 /* @var BaseObject */ 92 $o = new BaseObject( $id ); 93 $o->load(); 94 95 if ( $o->hasRight(Permission::ACL_READ) ) 96 { 97 $references[$id]['name'] = $o->getDefaultName()->name; 98 $references[$id]['type'] = $o->getType(); 99 $references[$id]['id' ] = $id; 100 101 $references[$id]['date'] = $o->lastchangeDate; 102 $references[$id]['user'] = $o->lastchangeUser; 103 } 104 } 105 106 $this->setTemplateVar( 'references',$references ); 107 108 $this->setTemplateVar( 'tags' , $this->baseObject->getTags() ); 109 } 110 public function post() { 111 } 112 }
Downloadmodules/cms/action/page/PageInfoAction.class.php
History Thu, 16 Feb 2023 23:18:09 +0100 Jan Dankert Fix: Tags for pages. Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Tue, 9 Mar 2021 09:17:27 +0100 Jan Dankert New: Show all links ('references') to the current object. Thu, 4 Mar 2021 02:24:45 +0100 Jan Dankert New: The calculation of the mime types should be done in the generators. Thu, 4 Mar 2021 02:00:11 +0100 Jan Dankert New: Show all page filenames in info. Wed, 18 Nov 2020 01:46:36 +0100 Jan Dankert Refactoring of model classes: New method persist() and some other cleanups. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.