public function executeAjax_show_records_indicators(sfWebRequest $request)
 {
     //recojo el id del indicador para este caso es ultimo de lo contrario arrojara un mensaje de error
     $id_indicators = $request->getParameter('id_indicators');
     //Se elimina todos los registros de las dos tablas temporales.
     TmpDataReportsPeer::doDeleteAll();
     TmpTreeScPeer::doDeleteAll();
     //verifico es ultimo nodo
     $criteria = new Criteria();
     $criteria->add(IndicatorsScPeer::ID, $id_indicators);
     $indicators = IndicatorsScPeer::doSelectOne($criteria);
     $criteria->clear();
     if (is_object($indicators)) {
         $this->indicator = $indicators;
         //obtengo los indicadores que son los ultimos nodos
         $criteria->add(IndicatorsScPeer::TREE_ID, $indicators->getTreeId());
         $criteria->add(IndicatorsScPeer::ULTIMO_NODO, '1', Criteria::LIKE);
         $list_last_indicators = IndicatorsScPeer::doSelect($criteria);
         $criteria->clear();
         $this->list_last_indicators = $list_last_indicators;
         //----------> lista de los indicadores que son ultimos nodos
         // obtengo la cantidad de registros que tiene en la tabla 'data_indicadores'
         //verifico si el indicador es  ultimo nodo
         foreach ($list_last_indicators as $obj_id_indicators) {
             if ($obj_id_indicators->getId() == $id_indicators) {
                 //si el id del indicador que estoy buscando es igual a uno de los ultimos nodos
                 $id = $obj_id_indicators->getId();
                 break;
             }
             $id = null;
         }
         if ($id != null) {
             // si es ultimo nodo
             //Verifico la cantidad de rows que tiene
             $criteria->add(DataIndicadoresPeer::INDICADOR_ID, $id);
             $rows_in_data_indicadores = DataIndicadoresPeer::doCount($criteria);
             if ($rows_in_data_indicadores > 0) {
                 $object_rows = DataIndicadoresPeer::doSelect($criteria);
                 $this->indicator = $indicators;
                 $this->object_rows = $object_rows;
                 $criteria->clear();
             }
         } else {
             // si el indicador no es ultimo nodo
             //obtengo el numero de registros que tiene la tabla 'data_indicadores'
             foreach ($list_last_indicators as $obj_last_indicators) {
                 $obj_evaluado = $obj_last_indicators;
                 //---> solo me hace falta obtener un indicador de esa lista para saber la cantidad de registros
                 break;
             }
             //verifico los registros ingresados por ese indicador
             $criteria->add(DataIndicadoresPeer::INDICADOR_ID, $obj_evaluado->getId());
             // $rows_in_data_indicadores = DataIndicadoresPeer::doCount($criteria);
             //1) saco la informacion de los registros
             //2) $obj_evaluado->getId() ----->este ID esta en muchos registros
             $rows_in_data_indicadores = DataIndicadoresPeer::doCount($criteria);
             //------>numero de registros
             $data_indicators = DataIndicadoresPeer::doSelect($criteria);
             //---> obtengo los registros por cada ID
             // efectuo el for para replicar el arbol y llenar los valores de cada indicador
             if ($rows_in_data_indicadores > 0) {
                 //realizo el for con el numero de registros
                 //    for($i=0; $i<$rows_in_data_indicadores ; $i++){
                 $data_list_grafico = null;
                 foreach ($data_indicators as $reg_indicators) {
                     $criteria->clear();
                     $criteria->add(DataIndicadoresPeer::GROUP_DATA, $reg_indicators->getGroupData());
                     //---> BUSCO EL PRIMER GRUPO DE DATOS
                     $data_util_graficos = DataIndicadoresPeer::doSelect($criteria);
                     $lista_relaciones = null;
                     //obtengo el id del arbol creado en temporal
                     $array_result = $this->executeEspejo_reportes($indicators->getTreeId(), $data_util_graficos, $reg_indicators->getUpdateAt());
                     $id_tmp_creado = $array_result['array'];
                     $lista_relaciones = $array_result['lista'];
                     //obtengo los ultmimos nodos pero de los indicadores que estan creados en la tabla temporal
                     $criteria->add(TmpDataReportsPeer::TREE_ID, $id_tmp_creado);
                     $criteria->add(TmpDataReportsPeer::ULTIMO_NODO, '1', Criteria::LIKE);
                     $list_tmp_last_indicators = TmpDataReportsPeer::doSelect($criteria);
                     //----> lista de los ultimos nodos de la tabla tmp
                     //$list_relation = null;
                     foreach ($list_tmp_last_indicators as $ob) {
                         $this->recalculate_tree($ob);
                     }
                     //obtengo el id del indicador relacionado
                     $id_relation = $this->return_relation_id($lista_relaciones, $indicators->getId());
                     //busco en la tabla temporal por el id
                     $data_list_grafico[] = $id_relation;
                 }
                 //envio datos para el grafico
                 $criteria->clear();
                 $criteria->add(TmpDataReportsPeer::INDICADOR_ID, $indicators->getId());
                 $list_indicators_reports = TmpDataReportsPeer::doSelect($criteria);
                 //  }
             }
             $this->indicator = $indicators;
             $this->object_rows = $list_indicators_reports;
         }
     } else {
         // $this->indicators = null;
         $this->list_last_indicators = null;
         $this->object_rows = null;
     }
 }
 /**
  * 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(TmpTreeScPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(TmpTreeScPeer::DATABASE_NAME);
         $criteria->add(TmpTreeScPeer::ID, $pks, Criteria::IN);
         $objs = TmpTreeScPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Get the associated TmpTreeSc object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     TmpTreeSc The associated TmpTreeSc object.
  * @throws     PropelException
  */
 public function getTmpTreeSc(PropelPDO $con = null)
 {
     if ($this->aTmpTreeSc === null && $this->tree_id !== null) {
         $this->aTmpTreeSc = TmpTreeScPeer::retrieveByPk($this->tree_id);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aTmpTreeSc->addTmpDataReportss($this);
         		 */
     }
     return $this->aTmpTreeSc;
 }
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = TmpTreeScPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setValorMinimo($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setValorDeseado($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setConfigureFlag($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setFlag($arr[$keys[4]]);
     }
 }
 /**
  * Selects a collection of TmpDataReports objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of TmpDataReports objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     TmpDataReportsPeer::addSelectColumns($criteria);
     $startcol2 = TmpDataReportsPeer::NUM_COLUMNS - TmpDataReportsPeer::NUM_LAZY_LOAD_COLUMNS;
     TmpTreeScPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (TmpTreeScPeer::NUM_COLUMNS - TmpTreeScPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(TmpDataReportsPeer::TREE_ID, TmpTreeScPeer::ID, $join_behavior);
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
         call_user_func($sf_hook, 'BaseTmpDataReportsPeer', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = TmpDataReportsPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = TmpDataReportsPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = TmpDataReportsPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             TmpDataReportsPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined TmpTreeSc rows
         $key2 = TmpTreeScPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = TmpTreeScPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = TmpTreeScPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 TmpTreeScPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (TmpDataReports) to the collection in $obj2 (TmpTreeSc)
             $obj2->addTmpDataReports($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }