/**
  * Gets an array of sfBreadNav objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this sfBreadNavApplication has previously been saved, it will retrieve
  * related sfBreadNavs from storage. If this sfBreadNavApplication is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array sfBreadNav[]
  * @throws     PropelException
  */
 public function getsfBreadNavs($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(sfBreadNavApplicationPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collsfBreadNavs === null) {
         if ($this->isNew()) {
             $this->collsfBreadNavs = array();
         } else {
             $criteria->add(sfBreadNavPeer::SCOPE, $this->id);
             sfBreadNavPeer::addSelectColumns($criteria);
             $this->collsfBreadNavs = sfBreadNavPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(sfBreadNavPeer::SCOPE, $this->id);
             sfBreadNavPeer::addSelectColumns($criteria);
             if (!isset($this->lastsfBreadNavCriteria) || !$this->lastsfBreadNavCriteria->equals($criteria)) {
                 $this->collsfBreadNavs = sfBreadNavPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastsfBreadNavCriteria = $criteria;
     return $this->collsfBreadNavs;
 }
示例#2
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(sfBreadNavPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(sfBreadNavPeer::DATABASE_NAME);
         $criteria->add(sfBreadNavPeer::ID, $pks, Criteria::IN);
         $objs = sfBreadNavPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#3
0
<?php

$c = navbarfunctions::getCredentialCriteria($credArray, $credRoles);
$c->addAscendingOrderByColumn(sfBreadNavPeer::TREE_LEFT);
$c->add(sfBreadNavApplicationPeer::NAME, $menu);
$c->addJoin(sfBreadNavPeer::SCOPE, sfBreadNavApplicationPeer::ID);
$pages = sfBreadNavPeer::doSelect($c);
$pages = navbarfunctions::compressNavArray($pages);
$outputArray = array();
$root = sfBreadNavPeer::getMenuRoot($menu);
//return if no root
if (!$root) {
    return;
}
$newlevel = true;
echo '<ul id="navmenu">';
if (in_array($root->getCredential(), (array) $credArray)) {
    echo "<li>" . navbardisplayfunctions::link_to_valid($root->getPage(), $root->getModule(), $root->getAction(), array('class' => 'first top')) . "</li>\n";
}
$nexttop = 0;
for ($i = 0; $i < count($pages); $i++) {
    if ($i == $nexttop) {
        $havechildren = navbarfunctions::testforchildren($pages, $i);
        $nexttop = ($pages[$i]['tree_right'] + 1) / 2 - 1;
        if ($havechildren) {
            $open = '<li><a href="' . navbardisplayfunctions::url_for_valid(navbarfunctions::pageroute($pages[$i]['module'], $pages[$i]['action'])) . '">' . $pages[$i]['page'] . '</a><ul>';
            $close = '</ul></li>';
        } else {
            $open = '<li><a href="' . navbardisplayfunctions::url_for_valid(navbarfunctions::pageroute($pages[$i]['module'], $pages[$i]['action'])) . '">' . $pages[$i]['page'] . '</a>';
            $close = '</li>';
        }