moveUp
Used to move a single node up 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 up. All child nodes will also be moved.
Here's an example of a controller action (in a controller named Categories) that moves a node up the tree:
Простой текстfunction moveup($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->moveup($this->Category->id, abs($delta));} else {$this->Session->setFlash('Please provide a number of positions the category should be moved up.');}$this->redirect(array('action' => 'index'), null, true);}
For example, if you would like to move the category "Desserts" up one level up you would request /categories/moveup/Desserts/1.


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