/** * Returns a node given its primary key or the node itself * * @param int/sfBreadNav $node Primary key/instance of required node * @param PropelPDO $con Connection to use. * @return object Propel object for model */ public static function getNode($node, PropelPDO $con = null) { if (is_object($node)) { return $node; } else { $object = sfBreadNavPeer::retrieveByPK($node, $con); $rtn = is_object($object) ? $object : false; return $rtn; } }
public static function editPage($values) { if (self::pageowner($values['id'])) { $parent = sfBreadNavPeer::retrieveByPK($values['parent']); $sibling = sfBreadNavPeer::retrieveByPK($values['order']); $beforeorafter = $values['order_option']; $newpage = sfBreadNavPeer::retrieveByPK($values['id']); $newpage->setPage($values['page']); $newpage->setModule($values['module']); $newpage->setAction($values['action']); $newpage->setCredential($values['credential']); if (!isset($values['catch_all'])) { $values['catch_all'] = null; } $newpage->setCatchall($values['catch_all']); if ($sibling) { if ($beforeorafter == 'above') { $newpage->moveToPrevSiblingOf($sibling); $newpage->save(); } if ($beforeorafter == 'below') { $newpage->moveToNextSiblingOf($sibling); $newpage->save(); } } elseif ($parent) { $newpage->moveToLastChildOf($parent); } $newpage->save(); return true; } else { return false; } }
protected function populateForm($pageid) { $page = sfBreadNavPeer::retrieveByPK($pageid); $formarray = $page->toForm(); $formarray['id'] = $pageid; $formarray['order_option'] = 'below'; $this->generateAddPageForm(); $this->form->setDefaults($formarray); }