コード例 #1
0
 /**
  * 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;
     }
 }
コード例 #2
0
ファイル: sfBreadNavPeer.php プロジェクト: anvaya/nckids
 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;
     }
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: anvaya/nckids
 protected function populateForm($pageid)
 {
     $page = sfBreadNavPeer::retrieveByPK($pageid);
     $formarray = $page->toForm();
     $formarray['id'] = $pageid;
     $formarray['order_option'] = 'below';
     $this->generateAddPageForm();
     $this->form->setDefaults($formarray);
 }