public function executeIndex(sfWebRequest $request) { //validacion de session $userBean = $this->getUser()->getAttribute(sfConfig::get('app_session_current_user'), null); if ($userBean != null) { /*se realizan consultas para manejar los botones de inicio*/ /*cantidad de Estrategias activas*/ $criteria = new Criteria(); $criteria->add(TreeScPeer::USER_ID, 1); $criteria->add(TreeScPeer::FLAG, 1); $count = TreeScPeer::doCount($criteria); /*cantidad de grupos activos*/ $criteria->clear(); $criteria->add(GrupoTrabajoScPeer::OWNER_ID, $userBean->getId()); $cantidadGrupos = GrupoTrabajoScPeer::doCount($criteria); $this->count = $count; $this->countGroup = $cantidadGrupos; return sfView::SUCCESS; } else { return sfView::ERROR; } }
/** * Returns the number of related TreeSc objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related TreeSc objects. * @throws PropelException */ public function countTreeScs(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PeriodoScPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collTreeScs === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(TreeScPeer::PERIODO_ID, $this->id); $count = TreeScPeer::doCount($criteria, false, $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 count of the collection. $criteria->add(TreeScPeer::PERIODO_ID, $this->id); if (!isset($this->lastTreeScCriteria) || !$this->lastTreeScCriteria->equals($criteria)) { $count = TreeScPeer::doCount($criteria, false, $con); } else { $count = count($this->collTreeScs); } } else { $count = count($this->collTreeScs); } } return $count; }