File modules/cms/action/folder/FolderOrderAction.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\folder; 3 use cms\action\FolderAction; 4 use cms\action\Method; 5 use cms\model\Permission; 6 use cms\model\BaseObject; 7 use language\Messages; 8 9 10 class FolderOrderAction extends FolderAction implements Method { 11 12 public function getRequiredPermission() { 13 return Permission::ACL_WRITE; 14 } 15 16 public function view() { 17 $list = array(); 18 19 // Schleife ueber alle Objekte in diesem Ordner 20 foreach( $this->folder->getObjects() as $o ) 21 { 22 /* @var $o BaseObject */ 23 $id = $o->objectid; 24 $name = $o->getDefaultName(); 25 26 if ( $o->hasRight(Permission::ACL_READ) ) 27 { 28 $list[$id]['id' ] = $id; 29 $list[$id]['name'] = $name->name; 30 $list[$id]['filename'] = $o->filename; 31 $list[$id]['desc'] = 'ID '.$id.' - '.$name->description; 32 33 $list[$id]['type'] = $o->getType(); 34 $list[$id]['icon'] = $o->getType(); 35 36 $list[$id]['date'] = $o->lastchangeDate; 37 $list[$id]['user'] = $o->lastchangeUser; 38 39 $last_objectid = $id; 40 } 41 } 42 43 $this->setTemplateVar('object' ,$list ); 44 $this->setTemplateVar('act_objectid',$this->folder->objectid); 45 } 46 47 48 public function post() { 49 $ids = $this->folder->getObjectIds(); 50 $seq = 0; 51 52 $order = explode(',',$this->request->getText('order') ); 53 54 foreach( $order as $objectid ) 55 { 56 if ( ! is_numeric($objectid) || ! in_array($objectid,$ids) ) 57 { 58 throw new \LogicException('Object-Id '.$objectid.' is not in this folder any more'); 59 } 60 $seq++; // Sequenz um 1 erhoehen 61 62 $o = new BaseObject( $objectid ); 63 $o->setOrderId( $seq ); 64 65 unset( $o ); // Selfmade Garbage Collection :-) 66 } 67 68 $this->addNoticeFor($this->folder, Messages::SEQUENCE_CHANGED); 69 $this->folder->setTimestamp(); 70 } 71 }
Downloadmodules/cms/action/folder/FolderOrderAction.class.php
History Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Fri, 3 Dec 2021 23:27:44 +0100 dankert New: Only allowed methods are shown in the dropdown menu; Some security enhancements. Sat, 6 Mar 2021 03:42:38 +0100 Jan Dankert New: Better permission checks. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. 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.