Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
 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();
 }