Exemplo n.º 1
0
 private function noaction($message)
 {
     $resAjax = new Response_Ajax();
     $resAjax->isSuccess(FALSE);
     $resAjax->message($message);
     echo $resAjax->toJsonEncode();
 }
 private function loadDay()
 {
     $resAjax = new Response_Ajax();
     //$MY =& MY_Controller::get_instance();
     $year = $this->input->post('year');
     $month = $this->input->post('month');
     $resAjax->data('day', Helper_Fecha::getArrayDay($year, $month));
     echo $resAjax->toJsonEncode();
 }
 public function backup()
 {
     $resAjax = new Response_Ajax();
     // ================================================
     Helper_Database::backup(Helper_Database::DB_DEFAULT);
     // ================================================
     $resAjax->isSuccess(TRUE);
     $resAjax->message('BackUP Generado Exitosamente');
     echo $resAjax->toJsonEncode();
 }
 private function loadGrupo()
 {
     $resAjax = new Response_Ajax();
     //$MY =& MY_Controller::get_instance();
     $id_rpte = $this->input->post('id_rpte');
     $dataRpteGrupo = array();
     if ($id_rpte == 'RPTE_GRUPOS_CAMARAS') {
         $dataRpteGrupo = array(array('code' => '1', 'name' => 'Accesos al Terminal'), array('code' => '2', 'name' => 'Baños'), array('code' => '3', 'name' => 'Patio de Comidas'), array('code' => '4', 'name' => 'Escaleras y Ascensores'), array('code' => '5', 'name' => 'Torniquetes'));
     } else {
         $dataRpteGrupo = array();
     }
     $resAjax->data('combo', $dataRpteGrupo);
     echo $resAjax->toJsonEncode();
 }
 private function loadGrupo()
 {
     $resAjax = new Response_Ajax();
     //$MY =& MY_Controller::get_instance();
     $id_rpte = $this->input->post('id_rpte');
     $dataRpteGrupo = array();
     if ($id_rpte == 'RPTE_RESUMEN_GRUPOS_CAMARAS') {
         $dataRpteGrupo = array(array('code' => '1', 'name' => 'Accesos generales'), array('code' => '2', 'name' => 'Viajeros arriban'), array('code' => '3', 'name' => 'Corredores'), array('code' => '4', 'name' => 'Escaleras Electricas'), array('code' => '5', 'name' => 'Ascensores'), array('code' => '6', 'name' => 'Patio de Comidas'), array('code' => '7', 'name' => 'Baños'), array('code' => '8', 'name' => 'Resumen de Torniquetes'), array('code' => '9', 'name' => 'Resumen General'));
     } else {
         $dataRpteGrupo = array();
     }
     $resAjax->data('combo', $dataRpteGrupo);
     echo $resAjax->toJsonEncode();
 }
 private function check()
 {
     $this->load->file('application/modules/app/login/login_data.php');
     $resAjax = new Response_Ajax();
     $dataLogin = new Data_App_Login(TRUE);
     $dataLoginError = NULL;
     //Helper_Log::write($_SESSION);
     try {
         $id_company = Helper_Config::getCompanyId();
         if (!$dataLogin->isValid($dataLoginError, FALSE)) {
             throw new Exception('Complete correctamente todos los campos 001');
         }
         $oBus = Business_App_User::login($dataLogin->username, $dataLogin->password);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $data = $oBus->data();
         /* @var $eUser eUser */
         $eUser = $data['eUser'];
         Helper_App_Session::init($id_company, $eUser->id);
         $resAjax->isSuccess(TRUE);
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->data('login_error', $dataLoginError->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
 private function saveParam()
 {
     $this->load->file('application/modules/app/system_setting_param/form/setting_param_form.php');
     $resAjax = new Response_Ajax();
     $frm_data = new Form_App_System_Setting_Param(TRUE);
     $logo = 'logo';
     $id_system = Helper_Config::getSystemId();
     try {
         if (!$this->permission->update) {
             throw new Exception('No tiene permisos para editar/actualizar');
         }
         if (!$frm_data->isValid()) {
             throw new Exception('Debe ingresar la información en todos los campos');
         }
         if (!isset($_FILES[$logo])) {
             $oBusUploadLogo = Business_App_Configuration_System::uploadLogo($id_system, $logo);
             if (!$oBusUploadLogo->isSuccess()) {
                 throw new Exception($oBusUploadLogo->message());
             }
         }
         $oBusLoadLogo = Business_App_Configuration_System::loadLogo($id_system);
         if (!$oBusLoadLogo->isSuccess()) {
             throw new Exception($oBusLoadLogo->message());
         }
         $dataLogo = $oBusLoadLogo->data();
         $eConfigurationSystem = $frm_data->getConfigurationSystemEntity();
         $eConfigurationSystem->id = $id_system;
         $eConfigurationSystem->logo = $dataLogo['uri'];
         $frm_data->logo = $eConfigurationSystem->logo;
         $oBus = Business_App_Configuration_System::saveConfigurationSystem($eConfigurationSystem);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $resAjax->isSuccess(TRUE);
         $resAjax->message($oBus->message());
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
     }
     $resAjax->form('setting', $frm_data->toArray());
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 8
0
 private function send()
 {
     $this->load->file('application/modules/site/index/form/email_form.php');
     $resAjax = new Response_Ajax();
     $frm_data = new Form_Site_Email(TRUE);
     try {
         if (!$frm_data->isValid()) {
             throw new Exception('Debe ingresar la información en todos los campos');
         }
         $Email = $frm_data->getEmail();
         $oBus = Helper_Site_Mail::sendEmail($Email);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $resAjax->isSuccess(TRUE);
         $resAjax->message($oBus->message());
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->form('email', $frm_data->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
 private function loadComponentsModalRol()
 {
     $resAjax = new Response_Ajax();
     $combo_rol = array(array('value' => 0, 'text' => '<< --ROLES-- >>'));
     try {
         $oBus = Business_App_Rol::listRol('', NULL, NULL);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $eRols = $oBus->getInData('eRols');
         $combo_rol2 = Helper_Array::entitiesToIdText($eRols, 'id', 'name', 'value', 'text');
         $combo_roles = array_merge($combo_rol, $combo_rol2);
         $resAjax->isSuccess(TRUE);
     } catch (Exception $e) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($e->getMessage());
     }
     $resAjax->data(array('combo-roles' => $combo_roles));
     echo $resAjax->toJsonEncode();
 }
 private function loadBinnacle()
 {
     $this->load->file('application/modules/app/security_binnacle/form/binnacle_form.php');
     $resAjax = new Response_Ajax();
     $id_binnacle = $this->input->post('id_binnacle');
     $oBus = Business_App_Binnacle::loadBinnacle($id_binnacle);
     $data = $oBus->data();
     /* @var $eUserLog eUserLog */
     $eUserLog = $data['eUserLog'];
     $eUser = $data['eUser'];
     $frm_data = new Form_App_Security_Binnacle();
     $frm_data->setBinnacleEntity($eUserLog);
     $frm_data->setUserEntity($eUser);
     $resAjax->isSuccess($oBus->isSuccess());
     $resAjax->message($oBus->message());
     $resAjax->form('binnacle', $frm_data->toArray());
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 11
0
 public function updateSedeSession()
 {
     $id_company_branch = $this->input->post('id_company_branch');
     Helper_App_Session::setCompanyBranchId($id_company_branch);
     Helper_App_Session::debugAll();
     $resAjax = new Response_Ajax();
     $resAjax->isSuccess(TRUE);
     $resAjax->message("Cambio Exitoso.<br/>Recargando...");
     echo $resAjax->toJsonEncode();
 }
 private function loadCiudad()
 {
     $resAjax = new Response_Ajax();
     $id_provincia = $this->input->post('id_provincia');
     try {
         $oBus = Business_App_Ciudad::listCiudad($id_provincia, $eCiudades);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $combo_ciudad = Helper_Array::entitiesToIdText($eCiudades, 'id', 'nombre', 'value', 'text');
         $resAjax->isSuccess(TRUE);
     } catch (Exception $e) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($e->getMessage());
     }
     $resAjax->data(array('cbo-ciudad' => $combo_ciudad));
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 13
0
 private function loadFile()
 {
     $texto = '';
     $dir = $this->input->post('path');
     $root = BASEPATH . "../application/logs" . (empty($dir) ? '/' : "/{$dir}");
     $path = $root;
     $resAjax = new Response_Ajax();
     if (file_exists($path) && $dir != '.' && $dir != '..' && !is_dir($path)) {
         $fp = fopen($path, 'r');
         //leemos el archivo
         $texto = fread($fp, filesize($path));
         $name = basename($path);
         $size = filesize($path);
         /*bytes*/
         $size_file = Helper_File::round_size($size, 2);
         //transformamos los saltos de linea en etiquetas <br>
         //$texto = nl2br($texto);
         /*$search  = array("\r\n", "\r", "\n", " ");
           $replace = array("<br/>", "<br/>", "<br/>", "&nbsp;");
           $texto = str_replace($search, $replace, $texto);*/
         $resAjax->isSuccess(TRUE);
         $resAjax->message('');
     } else {
         $resAjax->isSuccess(FALSE);
         $resAjax->message('Error de Archivo');
     }
     $resAjax->form('file', array('text' => print_r($texto, TRUE), 'name' => $name, 'path' => $dir, 'size' => $size_file));
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 14
0
 private function listModules()
 {
     $resAjax = new Response_Ajax();
     $txt_filter = $this->input->get('sSearch');
     $limit = $this->input->get('iDisplayLength');
     $offset = $this->input->get('iDisplayStart');
     $oBus = Business_App_Rol::listRol($txt_filter, $limit, $offset);
     $data = $oBus->data();
     $eRols = $data['eRols'];
     $count = $data['count'];
     $aaData = array();
     if (!empty($eRols)) {
         /* @var $eRol eRol */
         foreach ($eRols as $num => $eRol) {
             $aaData[] = array(trim($eRol->name), trim($eRol->name_key), trim($eRol->id));
         }
     }
     $resAjax->isSuccess($oBus->isSuccess());
     $resAjax->message($oBus->message());
     $resAjax->datatable($aaData, $count);
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 15
0
 private function changePassword()
 {
     $this->load->file('application/forms/app/login_change_password_form.php');
     $resAjax = new Response_Ajax();
     $oBus = new Response_Business();
     $frmChangePassword = new Form_App_Login_Change_Password(TRUE);
     try {
         if (!$frmChangePassword->isValid()) {
             throw new Exception('Complete Correctamente los campo');
         }
         $oBus = Business_App_Token::inactivarUserToken(Helper_Encrypt::decode($frmChangePassword->id_user), 'id_user');
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $oBus = Business_App_User::updatePassword(Helper_Encrypt::decode($frmChangePassword->id_user), $frmChangePassword->new_password);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $resAjax->isSuccess(TRUE);
         $resAjax->message($oBus->message());
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->form('changePassword', $frmChangePassword->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 16
0
 private function saveOrderModules()
 {
     $resAjax = new Response_Ajax();
     $data = $this->input->post('data');
     $eModules = array();
     foreach ($data as $dt) {
         $eModule = new eModule(FALSE);
         $eModule->id = $dt['id_module'];
         $eModule->num_order = $dt['order'];
         $eModules[] = $eModule;
     }
     $oBus = Business_App_Module::saveOrderModules($eModules);
     $resAjax->isSuccess($oBus->isSuccess());
     $resAjax->message($oBus->message());
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 17
0
 private function saveAcount()
 {
     $this->load->file('application/modules/app/user_settings/form/user_settings_form.php');
     $resAjax = new Response_Ajax();
     $frm_data = new Form_App_User_Settings(TRUE);
     try {
         if (!$this->permission->update) {
             throw new Exception('No tiene permisos para editar/actualizar');
         }
         if (!$frm_data->isValid()) {
             throw new Exception('Debe ingresar la información en todos los campos');
         }
         $ePerson = $frm_data->getPersonEntity();
         $eUser = $frm_data->getUserEntity();
         $eUserProfile = $frm_data->getUserProfileEntity();
         $eUserProfile_CompanyBranches = $frm_data->getUserProfile_CompanyBranchEntity();
         $oBus = Business_App_User_Settings::saveAcount($ePerson, $eUser, $eUserProfile, $eUserProfile_CompanyBranches);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $resAjax->isSuccess(TRUE);
         $resAjax->message($oBus->message());
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->form('acount', $frm_data->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
Exemplo n.º 18
0
 private function saveUser()
 {
     $this->load->file('application/modules/app/user_profile/form/user_form.php');
     $resAjax = new Response_Ajax();
     $frm_data = new Form_App_User(TRUE);
     try {
         if (!$this->permission->update) {
             throw new Exception('No tiene permisos para editar/actualizar');
         }
         if (!$frm_data->isValid()) {
             throw new Exception('Debe ingresar la información en todos los campos');
         }
         $oBus = Business_App_User::loadUser(Helper_App_Session::getUserId());
         $data = $oBus->data();
         $eUser = $data['eUser'];
         $oBus = Business_App_User::login($eUser->username, $frm_data->password_current);
         if (!$oBus->isSuccess()) {
             throw new Exception('Contraseña Incorrecta');
         }
         $oBus = Business_App_User::updatePassword($eUser->id, $frm_data->password_new_repeat);
         $resAjax->isSuccess(TRUE);
         $resAjax->message('Contraseña Actualizada');
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->form('user', $frm_data->toArray());
     }
     echo $resAjax->toJsonEncode();
 }