Ejemplo n.º 1
0
 public function _access_terminal()
 {
     $dateBegin = NULL;
     $dateEnd = date('Y-m-d') . ' 00:00:00';
     $arrDataProcess = array();
     /*
      * Inicio del proceso de Grupo de Camaras (ACCESO TERMINAL)
      */
     $DateTime_Begin = date('Y-m-d H:i:s');
     $cont_process = 0;
     while ($cont_process < 2) {
         $oRes = Business_Process_Generate::loadAccessTerminal($dateEnd, $dateBegin);
         if ($oRes->isSuccess()) {
             break;
         }
         $cont_process++;
     }
     if (!$oRes->isSuccess()) {
         Helper_Process_Log::write($oRes->message());
     }
     $arrDataProcess[Helper_Config::getFTTProcessAccessTerminal()] = array('isSuccess' => $oRes->isSuccess(), 'message' => $oRes->message(), 'timestamp' => Helper_Fecha::getDiff_DateTime($DateTime_Begin));
     /*-----------------------------------------------------------------*/
     Helper_Log::write($arrDataProcess);
     //print_r($arrDataProcess);
 }
 public static function loadAccessTerminal($dateEnd, $dateBegin)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mT_Analytics T_Analytics_Model  */
     $mT_Analytics = $MY->mT_Analytics;
     /* @var $mDateTime_Generate Datetime_Generate_Model */
     $mDateTime_Generate =& $MY->mDateTime_Generate;
     /* @var $mAccess_Terminal Access_Terminal_Model  */
     $mAccess_Terminal = $MY->mAccess_Terminal;
     $MY->db->trans_begin();
     try {
         $eDatetimeGenerate = $mDateTime_Generate->load(Helper_Config::getFTTProcessAccessTerminal(), 'process_name');
         if (!$eDatetimeGenerate->isEmpty()) {
             $dateBegin = $eDatetimeGenerate->update_datetime;
         }
         $eDatetimeGenerate->process_name = Helper_Config::getFTTProcessAccessTerminal();
         $eDatetimeGenerate->update_datetime = $dateEnd;
         $mDateTime_Generate->save($eDatetimeGenerate);
         $result = $mT_Analytics->loadAccessTerminal($dateEnd, $dateBegin);
         $eAccessTerminals = array();
         if (!empty($result)) {
             foreach ($result as $row) {
                 $eAccessTerminal = new eAccessTerminal(FALSE);
                 $eAccessTerminal->parseRow($row, '', true);
                 $eAccessTerminals[] = $eAccessTerminal;
             }
         }
         if (!empty($eAccessTerminals)) {
             foreach ($eAccessTerminals as $eAccessTerminal) {
                 $mAccess_Terminal->save($eAccessTerminal);
             }
         }
         $oBus->isSuccess(TRUE);
         $oBus->message('Guardado exitosamente: Acceso al Terminal');
         $MY->db->trans_commit();
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
         $MY->db->trans_rollback();
     }
     return $oBus;
 }