File modules/cms/action/object/ObjectInfoAction.class.php
Last commit: Thu Feb 16 01:04:38 2023 +0100 Jan Dankert New: Tags for base objects.
1 <?php 2 namespace cms\action\object; 3 use cms\action\Method; 4 use cms\action\ObjectAction; 5 use cms\model\BaseObject; 6 use cms\model\Permission; 7 use util\ArrayUtils; 8 9 class ObjectInfoAction extends ObjectAction implements Method { 10 11 public function view() { 12 $this->setTemplateVars( $this->baseObject->getProperties() ); 13 14 $this->setTemplateVar( 'is_valid' ,$this->baseObject->isValid() ); 15 $this->setTemplateVar( 'full_filename',$this->baseObject->full_filename() ); 16 $this->setTemplateVar( 'extension' , '' ); 17 $this->setTemplateVar( 'mimetype' , '' ); 18 19 $this->setTemplateVar( 'name' , $this->baseObject->getDefaultName()->name ); 20 $this->setTemplateVar( 'description' , $this->baseObject->getDefaultName()->description ); 21 22 $this->setTemplateVar( 'description' , $this->baseObject->getDefaultName()->description ); 23 24 $this->setTemplateVar( 'tags' , $this->baseObject->getTags() ); 25 26 $languages = $this->baseObject->getProject()->getLanguages(); 27 $languagesVars = array(); 28 29 foreach( $languages as $languageId => $languageName ) 30 { 31 $name = $this->baseObject->getNameForLanguage( $languageId ); 32 33 34 $languagesVar = [ 35 'name' => $name->name, 36 'description' => $name->description, 37 'languagename' => $languageName, 38 'languageid' => $languageId, 39 ]; 40 41 $languagesVars[] = $languagesVar; 42 } 43 44 $this->setTemplateVar('languages',$languagesVars ); 45 46 // Read all objects linking to us. 47 $pages = $this->baseObject->getDependentObjectIds(); 48 49 $list = array(); 50 foreach( $pages as $languageid ) 51 { 52 $o = new BaseObject( $languageid ); 53 $o->load(); 54 $list[$languageid] = array(); 55 $list[$languageid]['id' ] = $o->objectid; 56 $list[$languageid]['name'] = $o->filename; 57 $list[$languageid]['type'] = $o->getType(); 58 } 59 60 asort( $list ); 61 62 $this->setTemplateVar('references',$list); 63 64 $this->setTemplateVar('size',number_format($this->baseObject->getSize()/1000,0,',','.').' kB' ); 65 66 $pad = str_repeat("\xC2\xA0",5); // Hard spaces 67 $totalSettings = $this->baseObject->getTotalSettings(); 68 $this->setTemplateVar('total_settings', $totalSettings,$pad ); 69 $this->setTemplateVar('settings', ArrayUtils::dryFlattenArray( $totalSettings,$pad ) ); 70 } 71 72 73 public function post() { 74 } 75 }
Downloadmodules/cms/action/object/ObjectInfoAction.class.php
History Thu, 16 Feb 2023 01:04:38 +0100 Jan Dankert New: Tags for base objects. Tue, 9 Mar 2021 09:17:27 +0100 Jan Dankert New: Show all links ('references') to the current object. Thu, 4 Mar 2021 03:39:25 +0100 Jan Dankert New: Separate edit action for images and texts. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.