moveDown
Used to move a single node down the tree. You need to provide the ID of the element to be moved and a positive number of how many positions the node should be moved down. All child nodes for the specified node will also be moved.
Here is an example of a controller action (in a controller named Categories) that moves a specified node down the tree:
Простой текстfunction movedown($title = null, $delta = null) {$cat = $this->Category->findByTitle($title);if (empty($cat)) {$this->Session->setFlash('There is no category named ' . $title);$this->redirect(array('action' => 'index'), null, true);}$this->Category->id = $cat['Category']['id'];if ($delta > 0) {$this->Category->moveDown($this->Category->id, abs($delta));} else {$this->Session->setFlash('Please provide the number of positions the field should be moved down.');}$this->redirect(array('action' => 'show'), null, true);}
For example, if you'd like to move the "Cookies" category one step down, you would request: /categories/movedown/Cookies/1.


Коментарии:
Добавить коментарий