/**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeStrategy(sfWebRequest $request)
 {
     $user = $this->getUser()->getAttribute(sfConfig::get('app_session_current_user'), null);
     $id_tree = $request->getParameter('id_tree');
     $node_id = $request->getParameter('node_id');
     $response = $request->getParameter('response');
     $from = $request->getParameter('from');
     if ($user != null) {
         $criterio = new Criteria();
         $criterio->add(TreeScPeer::USER_ID, $user->getId());
         $criterio->add(TreeScPeer::ID, $id_tree);
         $criterio->add(TreeScPeer::FLAG, 1);
         $tree = TreeScPeer::doSelectOne($criterio);
         $criterio->clear();
         if (is_object($tree)) {
             $criterio->add(IndicatorsScPeer::TREE_ID, $tree->getId());
             $criterio->add(IndicatorsScPeer::FLAG, '%habilitado%', Criteria::LIKE);
             $criterio->addAscendingOrderByColumn(IndicatorsScPeer::PREVIOUS_ID);
             $list_indicadores = IndicatorsScPeer::doSelect($criterio);
             $criterio->clear();
             $criterio->add(GrupoTrabajoScPeer::OWNER_ID, $user->getId());
             $list_grupos = GrupoTrabajoScPeer::doSelect($criterio);
             $criterio->clear();
             $criterio->add(PeriodoScPeer::FLAG, '%activo%', Criteria::LIKE);
             $list_periodo = PeriodoScPeer::doSelect($criterio);
             $this->lista_indicadores = $list_indicadores;
             $this->lista_grupos = $list_grupos;
             $this->lista_periodos = $list_periodo;
             $this->tree = $tree;
             $this->network_attributes = DetNetworkAttributePeer::doSelect(new Criteria());
             $this->networks = NetworkPeer::doSelect(new Criteria());
             $this->response = $response;
             $this->from = $from;
             $this->node_id = $node_id;
         } else {
             return sfView::ERROR;
         }
         return sfView::SUCCESS;
     } else {
         return sfView::ERROR;
     }
 }
Ejemplo n.º 2
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(NetworkPeer::ID, $pks, Criteria::IN);
         $objs = NetworkPeer::doSelect($criteria, $con);
     }
     return $objs;
 }