public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     //PERSON
     $this->id_person = $MY->input->post('id_person');
     $this->name = $MY->input->post('name');
     $this->surname = $MY->input->post('surname');
     $this->tipo_documento = $MY->input->post('tipo_documento');
     $this->document = $MY->input->post('document');
     $this->birthday = $MY->input->post('birthday');
     $this->gender = $MY->input->post('gender');
     $this->address = $MY->input->post('address');
     $this->phone_cell = $MY->input->post('phone_cell');
     $this->email = $MY->input->post('email');
     $this->estado_civil = $MY->input->post('estado_civil');
     $this->tipo_sangre = $MY->input->post('tipo_sangre');
     $this->id_ciudad = $MY->input->post('id_ciudad');
     //USER
     $this->id_user = $MY->input->post('id_user');
     $this->username = $MY->input->post('username');
     $this->password_new = $MY->input->post('password_new');
     $this->password_new_repeat = $MY->input->post('password_new_repeat');
     //PROFILE
     $this->id_profile = $MY->input->post('id_profile');
     $this->isActive = $MY->input->post('isActive');
     //COMPANY_BRANCH
     $this->id_company_branchs = $MY->input->post('id_company_branchs');
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->password_current = $MY->input->post('password_current');
     $this->password_new = $MY->input->post('password_new');
     $this->password_new_repeat = $MY->input->post('password_new_repeat');
 }
 public static function set($eSessionActivity)
 {
     $MY =& MY_Controller::get_instance();
     /* @var $mSessionsActivity Session_Activity_Model */
     $mSessionsActivity =& $MY->mSessionsActivity;
     $mSessionsActivity->save($eSessionActivity);
 }
 static function remVar($name_key)
 {
     $MY =& MY_Controller::get_instance();
     $MY->load->library('libsession');
     $MY->libsession->setSessionGroup(self::$params_session['session_group']);
     $MY->libsession->rem($name_key);
 }
 public static function write($var, $LOG_TYPE = self::LOG_DEFAULT)
 {
     $MY =& MY_Controller::get_instance();
     $folder = '';
     if ($LOG_TYPE == self::LOG_DEFAULT) {
     }
     if ($LOG_TYPE == self::LOG_APP) {
         $folder = 'app';
     }
     if ($LOG_TYPE == self::LOG_DB) {
         $folder = 'db';
     }
     if ($LOG_TYPE == self::LOG_PROCESS) {
         $folder = 'process';
     }
     if ($LOG_TYPE == self::LOG_PUBLIC) {
         $folder = 'public';
     }
     $path = BASEPATH . "../application/logs" . (empty($folder) ? '' : "/{$folder}") . "/";
     if (!file_exists($path)) {
         mkdir($path, 0777);
     }
     if (is_array($var) || is_object($var)) {
         $var = print_r($var, TRUE);
     }
     $path .= date('Y') . '/' . date('m') . '/' . date('d');
     if (!file_exists($path)) {
         mkdir($path, 0777, TRUE);
     }
     $file = $path . "/" . date("H.i.s") . '.txt';
     $template = "========================" . date("Y-m-d H:i:s") . "========================\n\n" . $var . "\n\n" . "Desde la IP: " . $MY->input->ip_address() . "\n\n" . "=======================================================================\n\n";
     write_file($file, $template, FOPEN_READ_WRITE_CREATE);
     chmod($file, 0777);
 }
 public static function sendEmail($data)
 {
     $MY =& MY_Controller::get_instance();
     $config_email = Helper_Config::getEmail();
     $MY->load->library('email', $config_email);
     $oBus = new Response_Business();
     $smtp_user = $config_email['smtp_user'];
     $messege = "De: " . $data['name'] . " <br>";
     $messege .= "Email:" . $data['email'] . " <br>";
     $messege .= "Detalle:" . $data['message'] . " <br>";
     try {
         $MY->email->from($smtp_user, $data['name']);
         $MY->email->to('*****@*****.**');
         $MY->email->subject($data['subject']);
         $MY->email->message($messege);
         if (!$MY->email->send()) {
             throw new Exception($MY->email->print_debugger());
         }
         $oBus->isSuccess(TRUE);
         $oBus->message('Email enviado!');
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     return $oBus;
 }
 public static function post($name_or_prefix = NULL, $post_field_type = self::POST_FIELD_NAME)
 {
     $MY =& MY_Controller::get_instance();
     if (empty($name_or_prefix)) {
         $post = $MY->input->post();
         $arrData = array();
         if (!empty($post)) {
             foreach ($post as $field_name => $field_value) {
                 $arrData[$field_name] = is_array($field_value) ? $field_value : trim($field_value);
             }
         }
         return $arrData;
     }
     if ($post_field_type == self::POST_FIELD_NAME) {
         $res = $MY->input->post($name_or_prefix);
         return is_array($res) ? $res : trim($res);
     }
     $arrData = array();
     $post = $MY->input->post();
     if (!empty($post)) {
         foreach ($post as $field_name => $field_value) {
             $matches = NULL;
             if (preg_match("/^{$name_or_prefix}([^.]+\$)/i", $field_name, $matches)) {
                 $arrData[$matches[1]] = is_array($field_value) ? $field_value : trim($field_value);
             }
         }
     }
     return $arrData;
 }
 public static function transaccion($TRANSACCION_TYPE, $DB_TYPE = self::DB_DEFAULT)
 {
     $MY =& MY_Controller::get_instance();
     $db = NULL;
     switch ($DB_TYPE) {
         case self::DB_DEFAULT:
             $db =& $MY->db;
             break;
         case self::DB_DIGIFORT:
             $db =& $MY->dbd;
             break;
     }
     if (!empty($db)) {
         switch ($TRANSACCION_TYPE) {
             case self::TRANSACCION_BEGIN:
                 $db->trans_begin();
                 break;
             case self::TRANSACCION_COMMIT:
                 $db->trans_commit();
                 break;
             case self::TRANSACCION_ROLLBACK:
                 $db->trans_rollback();
                 break;
         }
     }
 }
 public static function uploadLogo($id_company, $field_name_post = 'logo')
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $upload CI_Upload */
     $upload =& $MY->upload;
     try {
         $path_company = BASEPATH . '../resources/uploads/company';
         $path = "{$path_company}/{$id_company}";
         if (!file_exists($path)) {
             if (!mkdir($path, 0777, TRUE)) {
                 throw new Exception("Error al subir el archivo");
             }
         }
         $upload->initialize(array('upload_path' => $path, 'allowed_types' => 'png', 'max_width' => '1080', 'max_height' => '1080', 'max_size' => '50000', 'overwrite' => TRUE, 'is_image' => TRUE, 'file_name' => 'logo', 'image_width' => '225', 'image_height' => '225', 'image_type' => 'png'));
         $wasUploaded = $upload->do_upload($field_name_post);
         if (!$wasUploaded) {
             throw new Exception(strip_tags($upload->display_errors()));
         }
         $oBus->isSuccess(TRUE);
         $data = $upload->data();
         $oBus->data(array('data' => $data));
     } catch (Exception $e) {
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }
 public static function saveProfilePermission($id_profile, $arr_eProfilePermissions)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mProfilePermission Profile_Permission_Model */
     $mProfilePermission =& $MY->mProfilePermission;
     $oTransaction = new MY_Business();
     $oTransaction->begin();
     try {
         $mProfilePermission->deleteByProfile($id_profile);
         /* @var $eProfilePermission eProfilePermission*/
         foreach ($arr_eProfilePermissions as $eProfilePermission) {
             if (!empty($eProfilePermission->id_permission)) {
                 $mProfilePermission->save($eProfilePermission);
             }
         }
         $oTransaction->commit();
         $oBus->isSuccess(TRUE);
         $oBus->message("Guardado exitosamente");
     } catch (Exception $e) {
         $oTransaction->rollback();
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }
 public static function listBinnacle($txt_filter, $limit, $offset, $arrTxtAction, $dateBegin, $dateEnd)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mUserLog User_Log_Model */
     $mUserLog =& $MY->mUserLog;
     $eUsers = array();
     $eUserLogs = array();
     $count = 0;
     try {
         $filter = new filterUserLog();
         $filter->limit = $limit;
         $filter->offset = $offset;
         $filter->text = $txt_filter;
         $filter->action = $arrTxtAction;
         $filter->date_begin = $dateBegin;
         $filter->date_end = $dateEnd;
         $mUserLog->filter($filter, $eUserLogs, $eUsers, $count);
         $oBus->isSuccess(TRUE);
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     $oBus->data(array('eUserLogs' => $eUserLogs, 'eUsers' => $eUsers, 'count' => $count));
     return $oBus;
 }
 public function listing($id_profile = 0)
 {
     $arrModules = array();
     $MY =& MY_Controller::get_instance();
     /* @var $mRolModule Rol_Module_Model */
     $mRolModule =& $MY->mRolModule;
     /* @var $mPermission Permission_Model */
     $mPermission =& $MY->mPermission;
     /* @var $mProfile Profile_Model */
     $mProfile =& $MY->mProfile;
     /* @var $mProfilePermission Profile_Permission_Model */
     $mProfilePermission =& $MY->mProfilePermission;
     /* @var $eProfile eProfile */
     $eProfile = $mProfile->load($id_profile);
     $arrModules = $mRolModule->listModulesByRol($eProfile->id_rol, NULL);
     /* @var $module eModule */
     foreach ($arrModules as $num => $module) {
         $arrModules[$num]->{'_permissions'} = $mPermission->listByModule($module->id);
         $arrModules[$num]->{'_submodules'} = $mRolModule->listModulesByRol($eProfile->id_rol, $module->id);
         if (isset($arrModules[$num]->{'_submodules'}) && !empty($arrModules[$num]->{'_submodules'})) {
             foreach ($arrModules[$num]->{'_submodules'} as $num2 => $submodule) {
                 $arrModules[$num]->{'_submodules'}[$num2]->{'_permissions'} = $mPermission->listByModule($submodule->id);
             }
         }
     }
     $arrProfilePermissionResult = array();
     $arrProfilePermission = $mProfilePermission->listByProfile($id_profile);
     if (!empty($arrProfilePermission)) {
         foreach ($arrProfilePermission as $profile_permission) {
             $arrProfilePermissionResult[] = $profile_permission["id_permission"];
         }
     }
     Helper_App_View::layout('app/html/pages/security_profile/listing', array('arrModuleResult' => $arrModules, 'eProfile' => $eProfile, 'arrProfilePermissionResult' => $arrProfilePermissionResult, 'save' => $this->permission->update_permission));
 }
 public function index()
 {
     $login_title = 'INGRESO AL SISTEMA';
     $MY =& MY_Controller::get_instance();
     /* @var $mCompany Company_Model */
     $mCompany =& $MY->mCompany;
     /* @var $mProfile Profile_Model */
     $mProfile =& $MY->mProfile;
     /* @var $mUser User_Model */
     $mUser =& $MY->mUser;
     /* @var $mPerson Person_Model */
     $mPerson =& $MY->mPerson;
     /* @var $mAppVersion App_Version_Model */
     $mAppVersion =& $MY->mAppVersion;
     $id_company = Helper_App_Session::getCompanyId();
     $id_profile = Helper_App_Session::getProfileId();
     $id_user = Helper_App_Session::getUserId();
     $id_person = Helper_App_Session::getPersonId();
     /* @var $eCompany eCompany */
     $eCompany = $mCompany->load($id_company);
     /* @var $eProfile eProfile */
     $eProfile = $mProfile->load($id_profile);
     /* @var $eUser eUser */
     $eUser = $mUser->load($id_user);
     /* @var $ePerson ePerson */
     $ePerson = $mPerson->load($id_person);
     /* @var $eAppVersion eAppVersion  */
     $eAppVersion = $mAppVersion->loadArray(array('isActive' => 1, 'isProject' => 1));
     $params_view = array('login_title' => $login_title, 'browser_message' => $this->browser['isSuccess'] ? $this->browser['message'] : '', 'ePerson' => $ePerson, 'eProfile' => $eProfile, 'eUser' => $eUser, 'eCompany' => $eCompany, 'eAppVersion' => $eAppVersion);
     Helper_App_View::view('app/html/pages/login/advanced', $params_view);
 }
 public static function decryptBlockCipher($value_encoded, $encryption_key = '')
 {
     $MY =& MY_Controller::get_instance();
     $MY->load->library('library_zend2');
     $cipher = \Zend\Crypt\BlockCipher::factory('mcrypt', array('algorithm' => 'aes'));
     $cipher->setKey(empty($encryption_key) ? self::$Encryption_Key : $encryption_key);
     return $cipher->decrypt($value_encoded);
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->name = $MY->input->post('name');
     $this->description = $MY->input->post('description');
     $this->name_key = $MY->input->post('name_key');
     $this->phone = $MY->input->post('phone');
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->id_rol = $MY->input->post('id_rol');
     $this->name = $MY->input->post('name');
     $this->name_key = $MY->input->post('name_key');
     $this->id_modules = $MY->input->post('id_modules');
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->name = $MY->input->post('name');
     $this->email = $MY->input->post('email');
     $this->subject = $MY->input->post('subject');
     $this->message = $MY->input->post('message');
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->id_profile = $MY->input->post('id_profile');
     $this->id_rol = $MY->input->post('id_rol');
     $this->name = $MY->input->post('name');
     $this->description = $MY->input->post('description');
     $this->isActive = $MY->input->post('isActive');
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->name_system = $MY->input->post('name_system');
     //        $this->logo                     = $MY->input->post('logo');
     $this->session_time_limit_min = $MY->input->post('session_time_limit_min');
     $this->session_time_limit_max = $MY->input->post('session_time_limit_max');
     $this->isSaveBinnacle = $MY->input->post('isSaveBinnacle');
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     /* @var $input CI_Input */
     $input =& $MY->input;
     $this->username = $input->post('username');
     $this->password = $input->post('password');
     $this->security = $input->post('security');
 }
 public function index()
 {
     $MY =& MY_Controller::get_instance();
     /* @var $mAppVersion App_Version_Model */
     $mAppVersion =& $MY->mAppVersion;
     /* @var $eAppVersion eAppVersion  */
     $eAppVersion = $mAppVersion->loadArray(array('isActive' => 1, 'isDataBase' => 1));
     $arr = array('eAppVersion' => $eAppVersion);
     Helper_App_View::layout("app/html/pages/system_db_backup/page", $arr);
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->id_company_branch = $MY->input->post('id_company_branch');
     $this->name = $MY->input->post('name');
     $this->address = $MY->input->post('address');
     $this->phone = $MY->input->post('phone');
     $this->isActive = $MY->input->post('isActive');
     $this->id_ciudad = $MY->input->post('id_ciudad');
 }
 public static function listPais(&$ePaises)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mPais Pais_Model  */
     $mPais = $MY->mPais;
     $ePaises = $mPais->listAll('', NULL, NULL);
     $oBus->isSuccess(TRUE);
     return $oBus;
 }
 public static function listAll(&$eT_ANALYTICS)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mP_TAnalytics T_Analytics_Model  */
     $mP_TAnalytics = $MY->mP_TAnalytics;
     $eT_ANALYTICS = $mP_TAnalytics->loadAll();
     $oBus->isSuccess(TRUE);
     return $oBus;
 }
 public static function loadCiudad($id_ciudad, &$eCiudad)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mCiudad Ciudad_Model  */
     $mCiudad = $MY->mCiudad;
     $eCiudad = $mCiudad->load($id_ciudad);
     $oBus->isSuccess(TRUE);
     return $oBus;
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->id_sede = $MY->input->post('id_sede');
     $this->nombre = $MY->input->post('nombre');
     $this->direccion = $MY->input->post('direccion');
     $this->telefono = $MY->input->post('telefono');
     $this->rector_nacional = $MY->input->post('rector_nacional');
     $this->secretaria = $MY->input->post('secretaria');
     $this->isActive = $MY->input->post('isActive');
 }
 public function index()
 {
     $MY =& MY_Controller::get_instance();
     $login_title = 'INGRESO AL SISTEMA';
     /* @var $mAppVersion App_Version_Model */
     $mAppVersion =& $MY->mAppVersion;
     /* @var $eAppVersion eAppVersion  */
     $eAppVersion = $mAppVersion->loadArray(array('isActive' => 1, 'isProject' => 1));
     $params_view = array('login_title' => $login_title, 'browser_message' => $this->browser['isSuccess'] ? $this->browser['message'] : '', 'eAppVersion' => $eAppVersion);
     Helper_App_View::view('app/html/pages/login/form', $params_view);
 }
 public static function backup($DB_TYPE, $readfile = false)
 {
     $MY =& MY_Controller::get_instance();
     $db = NULL;
     switch ($DB_TYPE) {
         case self::DB_DEFAULT:
             $db =& $MY->db;
             break;
     }
     $folder = BASEPATH . '..\\application\\logs\\db_backup\\' . date('Y') . '\\' . date('m') . '\\' . date('d');
     if (!file_exists($folder)) {
         mkdir($folder, 0777, TRUE);
     }
     if (empty($db)) {
         exit("DATABASE BACKUP: No hay seleccionado base de datos");
     }
     if ($db->dbdriver == 'postgre') {
         $db_host = preg_split('/:/', $db->hostname);
         $db_host = $db_host[0];
         //Helper_Log::write( $MY->db );
         //exit(0);
         putenv('PGHOST=' . $db_host);
         putenv('PGPORT=' . $db->port);
         putenv('PGDATABASE=' . $db->database);
         putenv('PGUSER='******'.sql')) {
                 $size = filesize("{$folder}\\" . $file_name_output . '.sql');
                 if (function_exists('mime_content_type')) {
                     $type = mime_content_type("{$folder}\\" . $file_name_output . '.sql');
                 } elseif (function_exists('finfo_file')) {
                     $info = finfo_open(FILEINFO_MIME);
                     $type = finfo_file($info, "{$folder}\\" . $file_name_output . '.sql');
                     finfo_close($info);
                 }
                 if ($type == '') {
                     $type = "application/force-download";
                 }
                 ob_clean();
                 header("Content-Type: {$type}");
                 header("Content-Disposition: attachment; filename={$file_name_output}.sql");
                 header("Content-Transfer-Encoding: binary");
                 header("Content-Length: " . $size);
                 readfile("{$folder}\\" . $file_name_output . '.sql');
             } else {
                 die("El archivo no existe.");
             }
         }
     }
 }
 public function readPost()
 {
     $MY =& MY_Controller::get_instance();
     $this->id_binnacle = $MY->input->post('id_binnacle');
     $this->username = $MY->input->post('username');
     $this->info = $MY->input->post('info');
     $this->date_time = $MY->input->post('date_time');
     $this->url = $MY->input->post('url');
     $this->ip = $MY->input->post('ip');
     $this->action = $MY->input->post('action');
     $this->browser = $MY->input->post('browser');
 }
 public static function readPostArray($dbtable, $field_name, $prefix = '')
 {
     $MY =& MY_Controller::get_instance();
     $arrData = array();
     $arrPost = $MY->input->post($field_name);
     if (!empty($arrPost)) {
         foreach ($arrPost as $post) {
             $arrData[] = self::readPostData($dbtable, $prefix, $post);
         }
     }
     return $arrData;
 }