/** * Reorder method. * * Reorders the nodes (and child nodes) of the tree according to the field and direction specified in the parameters. * This method does not change the parent of any node. * * If the id parameter is not given the scope parameter is required to make this work on scoped trees. * * Requires a valid tree, by default it verifies the tree before beginning. * * Options: * * - 'id' id of record to use as top node for reordering * - 'field' Which field to use in reordeing defaults to displayField * - 'order' Direction to order either DESC or ASC (defaults to ASC) * - 'verify' Whether or not to verify the tree before reorder. defaults to true. * - 'scope' Manually set the scope to reorder the tree on. * * @param AppModel $Model Model instance * @param array $options array of options to use in reordering. * @return boolean true on success, false on failure * @link http://book.cakephp.org/view/1355/reorder * @link http://book.cakephp.org/view/1629/Reorder */ public function reorder($Model, $options = array()) { if ($this->scoped($Model)) { if (empty($options[$Model->primaryKey]) && empty($options['scope'])) { return false; } if (!empty($options[$Model->primaryKey])) { $scope = $this->__getScopeFromid($Model, $options[$Model->primaryKey]); } else { $scope = $options['scope']; } $this->__setScope($Model, $scope); } return parent::reorder($Model, $options); }