コード例 #1
0
ファイル: sfBreadNavPeer.php プロジェクト: anvaya/nckids
 public static function addPage($values, $scope)
 {
     if (self::scopeowner($scope)) {
         $parent = sfBreadNavPeer::retrieveByPK($values['parent']);
         $sibling = sfBreadNavPeer::retrieveByPK($values['order']);
         $beforeorafter = $values['order_option'];
         if (isset($values['catch_all'])) {
             $catchall = $values['catch_all'];
         } else {
             $catchall = null;
         }
         $newpage = new sfBreadNav();
         $newpage->setPage($values['page']);
         $newpage->setModule($values['module']);
         $newpage->setAction($values['action']);
         $newpage->setCredential($values['credential']);
         $newpage->setCatchall($catchall);
         $newpage->setScope($scope);
         if ($sibling) {
             if ($beforeorafter == 'above') {
                 $newpage->insertAsPrevSiblingOf($sibling);
                 $newpage->save();
             }
             if ($beforeorafter == 'below') {
                 $newpage->insertAsNextSiblingOf($sibling);
                 $newpage->save();
             }
         } else {
             //if parent not set  parent to root
             if (!$parent) {
                 $parent = self::getRoot($scope);
             }
             $newpage->insertAsLastChildOf($parent);
             $newpage->save();
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: BasesfBreadNavPeer.php プロジェクト: anvaya/nckids
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      sfBreadNav $value A sfBreadNav object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(sfBreadNav $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: anvaya/nckids
 protected function savepage($values)
 {
     //save page
     $page = new sfBreadNav();
     $page->setPage($values['page']);
     $page->setModule($values['module']);
     $page->setAction($values['action']);
     $page->setCredential($values['module']);
     $page->save();
 }