openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

FolderEditAction.class.php (1651B)


      1 <?php
      2 namespace cms\action\folder;
      3 use cms\action\FolderAction;
      4 use cms\action\Method;
      5 use cms\model\Permission;
      6 use cms\model\BaseObject;
      7 use cms\model\File;
      8 use util\Html;
      9 
     10 
     11 class FolderEditAction extends FolderAction implements Method {
     12     public function view() {
     13 		if   ( ! $this->folder->isRoot() )
     14 			$this->setTemplateVar('parentid',$this->folder->parentid);
     15 
     16 		$list = array();
     17 
     18 		// Schleife ueber alle Objekte in diesem Ordner
     19 		foreach( $this->folder->getObjects() as $o )
     20 		{
     21             /* @var $o BaseObject */
     22 
     23             $id = $o->objectid;
     24 
     25 			if   ( $o->hasRight(Permission::ACL_READ) )
     26 			{
     27 				$list[$id]['name']     = $o->getDefaultName()->name;
     28 				$list[$id]['filename'] = $o->filename;
     29 				$list[$id]['desc']     = $o->getDefaultName()->description;
     30 				if	( $list[$id]['desc'] == '' )
     31 					$list[$id]['desc'] = \cms\base\Language::lang('NO_DESCRIPTION_AVAILABLE');
     32 				$list[$id]['desc'] = $list[$id]['desc'].' - '.\cms\base\Language::lang('IMAGE').' '.$id;
     33 
     34 				$list[$id]['type'] = $o->getType();
     35 				$list[$id]['id'  ] = $id;
     36 
     37 				$list[$id]['icon' ] = $o->getType();
     38 				$list[$id]['class'] = $o->getType();
     39 				$list[$id]['url' ] = Html::url($o->getType(),'',$id);
     40 
     41 				if	( $o->getType() == 'file' )
     42 				{
     43 					$file = new File( $id );
     44 					$file->load();
     45 					$list[$id]['desc'] .= ' - '.intval($file->size/1000).'kB';
     46 				}
     47 
     48 				$list[$id]['date'] = $o->lastchangeDate;
     49 				$list[$id]['user'] = $o->lastchangeUser->getProperties();
     50 			}
     51 		}
     52 
     53 		$this->setTemplateVar('object'      ,$list            );
     54 
     55 		$this->setTemplateVar('add',parent::hasPermissionToAddAnyObject() );
     56 	}
     57 
     58 
     59     public function post() {
     60     }
     61 }