File modules/cms/ui/action/tree/TreeBranchAction.class.php

Last commit: Wed Mar 9 13:28:52 2022 +0100	dankert	Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()'
1 <?php 2 namespace cms\ui\action\tree; 3 use cms\ui\action\TreeAction; 4 use cms\action\Method; 5 use util\Tree; 6 7 class TreeBranchAction extends TreeAction implements Method { 8 public function view() { 9 10 $type = $this->request->getAlphanum('type'); 11 12 $branch = $this->loadTreeBranch( $type ); 13 14 $this->setTemplateVar( 'branch',$branch ); 15 } 16 17 18 public function post() { 19 } 20 21 22 protected function loadTreeBranch($type ) 23 { 24 $tree = new Tree(); 25 26 try 27 { 28 $method = new \ReflectionMethod($tree,$type); 29 if ( $id = $this->request->getId() ) 30 $method->invoke($tree, $id ); 31 else 32 $method->invoke($tree); // <== Executing the Action 33 } 34 catch (\ReflectionException $re) 35 { 36 throw new \LogicException('Treemethod not found: '.$type); 37 } 38 39 40 $branch = array(); 41 foreach($tree->treeElements as $element ) 42 { 43 $branch[] = get_object_vars($element); 44 } 45 46 return $branch; 47 } 48 49 }
Download modules/cms/ui/action/tree/TreeBranchAction.class.php
History Wed, 9 Mar 2022 13:28:52 +0100 dankert Refactoring: Checkbox values are always sent to the server. In the actions we must test the value with 'isTrue()' Wed, 10 Mar 2021 23:51:22 +0100 Jan Dankert Refactoring: Cleaned the Request params. Fri, 26 Feb 2021 01:06:01 +0100 Jan Dankert Refactoring accessing the request parameter values. Wed, 18 Nov 2020 20:23:57 +0100 Jan Dankert Cleaning up the UI actions. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.