public function process($action)
 {
     if (!Helper_App_Session::isLogin()) {
         $this->noaction('Fuera de sesión');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->noaction('Fuera de sesión por Inactividad');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->noaction('Fuera de session por Bloqueo');
         return;
     }
     if (!$this->permission->access) {
         $this->noaction('Acceso no permitido');
         return;
     }
     switch ($action) {
         case 'list-binnacle':
             $this->listBinnacle();
             break;
         case 'load-binnacle':
             $this->loadBinnacle();
             break;
         case 'save-rol':
             $this->saveRol();
             break;
         default:
             $this->noaction($action);
             break;
     }
 }
 public static function isLogin()
 {
     if (Helper_App_Session::isLogin()) {
         $dateBegin = self::getLastActivity();
         $date = DateTime::createFromFormat('Y-m-d H:i:s', self::getLastActivity());
         $dateEnd = strtotime('+1 hour', strtotime(date('Y-m-d H:i:s', $date->date)));
         $eSessionActivity = self::get();
         if (!$eSessionActivity->isEmpty()) {
             Helper_Log::write($eSessionActivity);
             Helper_Log::write($dateBegin);
             Helper_Log::write($date);
             Helper_Log::write($dateEnd);
             //Helper_Log::write(date('Y-m-d H:i:s', self::getLastActivity()));
             //Helper_Log::write(DateTime::createFromFormat('Y-m-d H:i:s', self::getLastActivity()));
             /*if((self::getSessionId()==Helper_App_Session::getSessionID()) && 
               (Helper_Fecha::isValidRangeDate($dateBegin, $dateEnd, date('Y-m-d H:i:s'))) )
               {
                   $eSessionActivity->last_activity = date('Y-m-d H:i:s');
                   self::set($eSessionActivity);
                   return TRUE;
               }
               else
               {
                   $eSessionActivity->inUse = 0;
                   self::set($eSessionActivity);
                   return FALSE;
               }*/
         }
     }
     return FALSE;
 }
 public function process($action)
 {
     if (!Helper_App_Session::isLogin()) {
         $this->noaction('Fuera de sesión');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->noaction('Fuera de sesión por Inactividad');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->noaction('Fuera de session por Bloqueo');
         return;
     }
     if (!$this->permission->access) {
         $this->noaction('Acceso no permitido');
         return;
     }
     switch ($action) {
         case 'backup':
             $this->backup();
             break;
         default:
             $this->noaction($action);
             break;
     }
 }
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     $this->load->file('application/modules/app/security_rol/permission.php');
     $this->permission = new Security_Rol_Permission($this->name_key);
     $this->permission->create = Helper_App_Session::isPermissionForModule($this->name_key, 'create');
     $this->permission->update = Helper_App_Session::isPermissionForModule($this->name_key, 'update');
     if (!Helper_App_Session::isLogin()) {
         $this->redirect('app/login');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (!$this->permission->access) {
         Helper_App_Log::write("Rol: intento de acceso");
         $this->redirect('app/dashboard');
         return;
     }
 }
Esempio n. 5
0
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     if (!Helper_App_Session::isLogin()) {
         return;
     }
 }
 public function load($module_name_key)
 {
     $arr = get_class_vars(get_class($this));
     foreach ($arr as $attr => $value) {
         $this->{$attr} = Helper_App_Session::isPermissionForModule($module_name_key, $attr);
     }
 }
 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();
 }
 public static function saveProfile(eProfile $eProfile)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mProfile Profile_Model */
     $mProfile =& $MY->mProfile;
     $oTransaction = new MY_Business();
     $oTransaction->begin();
     try {
         $isEditable = TRUE;
         if (!$eProfile->isEmpty()) {
             $eProfileT = $mProfile->load($eProfile->id);
             if (!Helper_App_Session::isSuperAdminProfile()) {
                 if ($eProfileT->isSuperAdmin == 1 || $eProfileT->isAdmin == 1) {
                     throw new Exception("Prohibido editar éste perfil");
                 }
                 $isEditable = $eProfileT->isEditable == 1;
             }
             $eProfile->isSuperAdmin = $eProfileT->isSuperAdmin;
             $eProfile->isAdmin = $eProfileT->isAdmin;
             $eProfile->isEditable = $eProfileT->isEditable;
         }
         if ($isEditable) {
             $mProfile->save($eProfile);
         }
         $oTransaction->commit();
         $oBus->isSuccess(TRUE);
         $oBus->message("Guardado exitosamente");
     } catch (Exception $e) {
         $oTransaction->rollback();
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }
Esempio n. 9
0
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     //Helper_App_Activity::logout();
     Helper_App_Session::logout();
     $this->redirect('app/login');
 }
 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);
 }
Esempio n. 11
0
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     if (Helper_App_Session::isLogin()) {
         $this->redirect('app/dashboard');
         return;
     }
     $this->browser = Helper_Browser::isIExplorer();
 }
Esempio n. 12
0
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     $this->browser_message = Helper_App_Browser::obtener_browser();
     if (!Helper_App_Session::isLogin()) {
         $this->redirect('app/dashboard');
         return;
     }
 }
 public static function saveAcount(ePerson $ePerson, eUser $eUser, eUserProfile $eUserProfile, $eUserProfile_CompanyBranches)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mPerson Person_Model */
     $mPerson =& $MY->mPerson;
     /* @var $mUser User_Model */
     $mUser =& $MY->mUser;
     /* @var $mUserProfile User_Profile_Model */
     $mUserProfile =& $MY->mUserProfile;
     /* @var $mUserProfileCompanyBranch User_Profile_Company_Branch_Model */
     $mUserProfileCompanyBranch =& $MY->mUserProfileCompanyBranch;
     $oTransaction = new MY_Business();
     $oTransaction->begin();
     try {
         if (!Helper_App_Session::isAdminProfile() || !Helper_App_Session::isSuperAdminProfile()) {
             if (Business_App_Person::isValidDocument($ePerson->document)) {
                 throw new Exception('Documento Invalido, No permitido');
             }
         }
         $ePersonT = $mPerson->loadByDocument($ePerson->document, $ePerson->id);
         if (!$ePersonT->isEmpty()) {
             throw new Exception('Persona Existente');
         }
         $eUserT = $mUser->load($eUser->username, 'username', $eUser->id);
         if (!$eUserT->isEmpty()) {
             throw new Exception('Usuario Existente');
         }
         $mPerson->save($ePerson);
         $mUser->save($eUser);
         $eUserProfileT = $mUserProfile->loadArray(array('id_user' => $eUser->id, 'id_profile' => $eUserProfile->id_profile));
         $eUserProfile->id_user = $eUser->id;
         $eUserProfile->id = $eUserProfileT->id;
         $mUserProfile->save($eUserProfile);
         $mUserProfileCompanyBranch->deleteByUserProfile($eUserProfile->id);
         if (!empty($eUserProfile_CompanyBranches)) {
             /* @var $eUserProfileCompanyBranch eUserProfileCompanyBranch */
             foreach ($eUserProfile_CompanyBranches as $eUserProfileCompanyBranch) {
                 $eUserProfileCompanyBranch->id_user_profile = $eUserProfile->id;
                 $mUserProfileCompanyBranch->save($eUserProfileCompanyBranch);
             }
         }
         $oTransaction->commit();
         $oBus->isSuccess(TRUE);
         $oBus->message("Guardado exitosamente");
     } catch (Exception $e) {
         $oTransaction->rollback();
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }
 public function mvcjs()
 {
     $this->load->file('application/modules/app/user_profile/form/profile_form.php');
     $this->load->file('application/modules/app/user_profile/form/user_form.php');
     $frmProfile = new Form_App_Profile();
     $frmUser = new Form_App_User();
     $oBus = Business_App_User::loadUser(Helper_App_Session::getUserId());
     $data = $oBus->data();
     $eUser = $data['eUser'];
     $frmUser->username = $eUser->username;
     $params = array('link' => $this->link, 'linkx' => $this->linkx, 'permissions' => $this->permission->toArray(), 'profile_form_default' => $frmProfile->toArray(), 'user_form_default' => $frmUser->toArray());
     Helper_App_JS::showMVC('user_profile', $params);
 }
Esempio n. 15
0
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     if (!Helper_App_Session::isLogin()) {
         $this->redirect('app/login');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->redirect('app/login_advanced');
         return;
     }
 }
 public static function listModules($id_parent = NULL)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mModule Module_Model */
     $mModule =& $MY->mModule;
     $eModules = array();
     try {
         $eModules = $mModule->listModules($id_parent, Module_Model::ORDER_BY_NAME, Helper_App_Session::isSuperAdminProfile());
         $oBus->isSuccess(TRUE);
     } catch (Exception $e) {
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     $oBus->data(array('eModules' => $eModules));
     return $oBus;
 }
Esempio n. 17
0
 public static function write($var, $isEncode = FALSE, $LOG_TYPE = self::LOG_DEFAULT)
 {
     $MY =& MY_Controller::get_instance();
     /* @var $mUserLog User_Log_Model */
     $mUserLog =& $MY->mUserLog;
     /* @var $mConfigurationSystem Configuration_System_Model */
     $mConfigurationSystem =& $MY->mConfigurationSystem;
     $id_system = Helper_App_Session::getConfigurationSystemId();
     // *******************
     // CONFIGURATION SYSTEM
     // *******************
     $eConfigurationSystem = $mConfigurationSystem->load($id_system);
     $id_user = Helper_App_Session::getUserId();
     $navegador = Helper_App_Session::getBrowser();
     $action = '';
     if ($LOG_TYPE == self::LOG_DEFAULT) {
         $action = 'ACTION_DEFAULT';
     }
     if ($LOG_TYPE == self::LOG_LOGIN) {
         $action = 'ACTION_LOGIN';
     }
     if ($LOG_TYPE == self::LOG_INSERT) {
         $action = 'ACTION_INSERT';
     }
     if ($LOG_TYPE == self::LOG_UPDATE) {
         $action = 'ACTION_UPDATE';
     }
     if ($LOG_TYPE == self::LOG_DELETE) {
         $action = 'ACTION_DELETE';
     }
     Helper_Log::write(print_r($var, true), Helper_Log::LOG_APP);
     if (!empty($eConfigurationSystem->isSaveBinnacle)) {
         if (!empty($id_user)) {
             $eUserLog = new eUserLog();
             $eUserLog->id_user = $id_user;
             $eUserLog->date_time = date('Y-m-d H:i:s');
             $eUserLog->info = $isEncode ? json_encode($var) : $var;
             $eUserLog->action = $action;
             $eUserLog->url = current_url();
             $eUserLog->browser = $navegador->browser . ' ' . $navegador->device_type . ' ' . $navegador->platform_maker . ' ' . $navegador->platform_description . ' de ' . $navegador->platform_bits;
             $eUserLog->ip = $MY->input->ip_address();
             $mUserLog->save($eUserLog);
         }
     }
 }
 public static function getMenu2()
 {
     $MY =& MY_Controller::get_instance();
     /* @var $mModule Module_Model */
     $mModule =& $MY->mModule;
     /* @var $mPermission Permission_Model */
     $mPermission =& $MY->mPermission;
     $arrModule = $mModule->listModules(NULL, Module_Model::ORDER_BY_ORDER, Helper_App_Session::isSuperAdminProfile(), 1);
     foreach ($arrModule as $num => $module) {
         $arrModule[$num]->{'_permissions'} = $mPermission->listByModule($module->id);
         $arrModule[$num]->{'_submodules'} = $mModule->listModules($module->id, Module_Model::ORDER_BY_ORDER, Helper_App_Session::isSuperAdminProfile(), 1);
         if (isset($arrModule[$num]->{'_submodules'}) && !empty($arrModule[$num]->{'_submodules'})) {
             foreach ($arrModule[$num]->{'_submodules'} as $num2 => $submodule) {
                 $arrModule[$num]->{'_submodules'}[$num2]->{'_permissions'} = $mPermission->listByModule($submodule->id);
             }
         }
     }
     return $arrModule;
 }
 public static function saveRolModule(eRol $eRol, $eRolesModules)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mRol Rol_Model */
     $mRol =& $MY->mRol;
     /* @var $mRolModule Rol_Module_Model */
     $mRolModule =& $MY->mRolModule;
     $oTransaction = new MY_Business();
     $oTransaction->begin();
     try {
         $isEditable = TRUE;
         if (!$eRol->isEmpty()) {
             $eRolT = $mRol->load($eRol->id);
             if (!Helper_App_Session::isSuperAdminProfile()) {
                 if ($eRolT->isEditable == 0) {
                     throw new Exception("Prohibido editar éste Rol");
                 }
             }
             $isEditable = $eRolT->isEditable == 0;
         }
         if ($isEditable) {
             $mRol->save($eRol);
         }
         $mRolModule->deleteByRol($eRol->id);
         if (!empty($eRolesModules)) {
             /* @var $eRolModule eRolModule */
             foreach ($eRolesModules as $eRolModule) {
                 $eRolModule->id_rol = $eRol->id;
                 $mRolModule->save($eRolModule);
             }
         }
         $oTransaction->commit();
         $oBus->isSuccess(TRUE);
         $oBus->message("Guardado exitosamente");
     } catch (Exception $e) {
         $oTransaction->rollback();
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }
Esempio n. 20
0
 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)) {
             throw new Exception('Complete correctamente todos los campos 001');
         }
         if (ENVIRONMENT != 'development') {
             if (!Helper_Captcha::isValid($this->name_key, $dataLogin->security)) {
                 throw new Exception('Código de seguridad inválido.');
                 //throw new Exception('Complete correctamente todos los campos 002');
             }
         }
         $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);
         //Helper_App_Session::buildData();
         /*$eSessionActivity = new eSessionActivity();
           $eSessionActivity->id_user = Helper_App_Session::getUserId();
           $eSessionActivity->inUse = 1;
           $eSessionActivity->last_activity = date('Y-m-d H:i:s');
           $eSessionActivity->session_id = Helper_App_Session::getSessionID();
           */
         //Helper_App_Activity::set($eSessionActivity);
         $resAjax->isSuccess(TRUE);
     } catch (Exception $ex) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($ex->getMessage());
         $resAjax->data('login_error', $dataLoginError->toArray());
     }
     echo $resAjax->toJsonEncode();
 }
Esempio n. 21
0
 public static function write($info)
 {
     $MY =& MY_Controller::get_instance();
     //$MY->load->model('user_log_model','mUserLog');
     $id_personal = Helper_App_Session::getUserId();
     Helper_Log::write($info, Helper_Log::LOG_PROCESS);
     /*if( empty($id_personal) )
       {
           
       }
       /*
       else
       {
           $MY->mUserLog->save(array(
               'id_user'   => $id_personal,
               'date_time' => date('Y-m-d H:i:s'),
               'info'      => $info
           ));
       }*/
 }
 public function process($action)
 {
     if (!Helper_App_Session::isLogin()) {
         $this->noaction('Fuera de sesión');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->noaction('Fuera de sesión por Inactividad');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->noaction('Fuera de session por Bloqueo');
         return;
     }
     if (!$this->permission->access) {
         $this->noaction('Acceso no permitido');
         return;
     }
     switch ($action) {
         case 'list-profile':
             $this->listProfile();
             break;
         case 'load-profile':
             $this->loadProfile();
             break;
         case 'save-profile':
             $this->saveProfile();
             break;
         case 'save-profile-permission':
             $this->saveProfilePermission();
             break;
         case 'load-components-modal-rol':
             $this->loadComponentsModalRol();
             break;
         default:
             $this->noaction($action);
             break;
     }
 }
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     $this->load->file('application/modules/app/system_module/permission.php');
     $this->permission = new System_Module_Permission($this->name_key);
     if (!Helper_App_Session::isLogin()) {
         $this->redirect('app/login');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (!$this->permission->access) {
         Helper_App_Log::write("Module: intento de acceso");
         $this->redirect('app/dashboard');
         return;
     }
 }
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     $this->load->file('application/modules/app/utility_company_and_company_branch/permission.php');
     $this->permission = new Utility_Company_And_Company_Branch_Permission($this->name_key);
     if (!Helper_App_Session::isLogin()) {
         $this->redirect('app/login');
         return;
     }
     if (!Helper_App_Session::inInactivity()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (Helper_App_Session::isBlock()) {
         $this->redirect('app/login_advanced');
         return;
     }
     if (!$this->permission->access) {
         Helper_App_Log::write("Mantenimiento de Empresa y Sucursales: intento de acceso");
         $this->redirect('app/dashboard');
         return;
     }
 }
 public static function savePerson(ePerson $ePerson)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mPerson Person_Model */
     $mPerson =& $MY->mPerson;
     $oTransaction = new MY_Business();
     $oTransaction->begin();
     try {
         $ePersonT = $mPerson->load($ePerson->id);
         if (!Helper_App_Session::isAdminProfile() || !Helper_App_Session::isSuperAdminProfile()) {
             if (self::isValidDocument($ePerson->document)) {
                 throw new Exception('Documento Invalido: ' + $ePerson->document);
             }
             if ($ePersonT->tipo_documento != $ePerson->tipo_documento) {
                 throw new Exception('No tiene permisos para editar el tipo de documento');
             }
             if ($ePersonT->document != $ePerson->document) {
                 throw new Exception('No tiene permisos para editar el documento');
             }
         }
         $ePersonDocument = $mPerson->loadByDocument($ePerson->document, $ePerson->id);
         if (!$ePersonDocument->isEmpty()) {
             throw new Exception('Documento Existente: ' + $ePerson->document);
         }
         $mPerson->save($ePerson);
         $oBus->isSuccess(TRUE);
         $oBus->message("Guardado exitosamente");
         $oTransaction->commit();
     } catch (Exception $e) {
         $oTransaction->rollback();
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     return $oBus;
 }
 private function loadComponents()
 {
     $resAjax = new Response_Ajax();
     $arrType = array('TIPO_IDENT', 'ESTADO_CIVIL', 'GENDER', 'TIPO_DE_SANGRE');
     try {
         $oBus = Business_App_Catalog::listByType($arrType);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $oBus1 = Business_App_Profile::listProfile('', NULL, NULL);
         $dataCatalogo = $oBus->data();
         $eCatalogs = $dataCatalogo['eCatalogs'];
         $dataProfile = $oBus1->data();
         $eProfiles = $dataProfile['eProfiles'];
         $eProfiles = Helper_Array::entitiesToIdText($eProfiles, 'id', 'name', 'value', 'text');
         $oBus2 = Business_App_Company_Branch::listByCompany(Helper_App_Session::getCompanyId(), 1);
         $dataCompanyBranch = $oBus2->data();
         $eCompanyBranches = $dataCompanyBranch['eCompanyBranchs'];
         $eCompanyBranches = Helper_Array::entitiesToIdText($eCompanyBranches, 'id', 'name', 'value', 'text');
         $resAjax->isSuccess(TRUE);
     } catch (Exception $e) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($e->getMessage());
     }
     $resAjax->data(array('eCatalogs' => $eCatalogs, 'eProfiles' => $eProfiles, 'eCompanyBranches' => $eCompanyBranches));
     echo $resAjax->toJsonEncode();
 }
 private function loadComponentsModalModule()
 {
     $resAjax = new Response_Ajax();
     $id_company = Helper_App_Session::getCompanyId();
     $combo_modules = array(array('id' => 0, 'name' => '<< --MÓDULO PADRE-- >>'));
     try {
         $oBus = Business_App_Module::listModules(NULL);
         if (!$oBus->isSuccess()) {
             throw new Exception($oBus->message());
         }
         $data = $oBus->data();
         $eModules = $data['eModules'];
         $combo_modules2 = Helper_Array::entitiesToIdText($eModules, 'id', 'name', 'id', 'name');
         $combo_modules = array_merge($combo_modules, $combo_modules2);
         $resAjax->isSuccess(TRUE);
     } catch (Exception $e) {
         $resAjax->isSuccess(FALSE);
         $resAjax->message($e->getMessage());
     }
     $resAjax->data(array('combo-modules' => $combo_modules));
     echo $resAjax->toJsonEncode();
 }
Esempio n. 28
0
 static function layout($view, $arrParams = array(), $arrParamsLayout = array(), $useIframe = FALSE)
 {
     $MY =& MY_Controller::get_instance();
     /* @var $mConfigurationSystem Configuration_System_Model */
     $mConfigurationSystem =& $MY->mConfigurationSystem;
     /* @var $mCompany Company_Model */
     $mCompany =& $MY->mCompany;
     /* @var $mCompanyBranch Company_Branch_Model */
     $mCompanyBranch =& $MY->mCompanyBranch;
     /* @var $mProfile profile_Model */
     $mProfile =& $MY->mProfile;
     /* @var $mUser User_Model */
     $mUser =& $MY->mUser;
     /* @var $mPerson Person_Model */
     $mPerson =& $MY->mPerson;
     /* @var $mUserProfile User_Profile_Model*/
     $mUserProfile =& $MY->mUserProfile;
     /* @var $mUserProfileCompanyBranch User_Profile_Company_Branch_Model */
     $mUserProfileCompanyBranch =& $MY->mUserProfileCompanyBranch;
     /* @var $mAppVersion App_Version_Model */
     $mAppVersion =& $MY->mAppVersion;
     $id_system = Helper_Config::getSystemId();
     $id_company = Helper_App_Session::getCompanyId();
     $id_company_branch = Helper_App_Session::getCompanyBranchId();
     $id_profile = Helper_App_Session::getProfileId();
     $id_user = Helper_App_Session::getUserId();
     /* @var $eConfigurationSystem eConfigurationSystem */
     $eConfigurationSystem = $mConfigurationSystem->load($id_system);
     /* @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($eUser->id_person);
     /* @var $eAppVersion eAppVersion  */
     $eAppVersion = $mAppVersion->loadArray(array('isActive' => 1, 'isProject' => 1));
     $resources_path = 'resources/assets/app';
     $arrMenu = Helper_App_Permission::getMenu();
     $controller_current = $MY->uri->rsegment(1);
     $function_current = $MY->uri->rsegment(2);
     // ================================================================
     // ================================================================
     $eProfiles = $mUserProfile->listProfilesByUser($id_user, 1);
     $show_combo_perfiles = TRUE;
     $combo_perfiles = Helper_Array::entitiesToIdText($eProfiles, 'id', 'name', 'value', 'text', $id_profile);
     // ================================================================
     // ================================================================
     if (empty($eProfiles)) {
         $flash = new Response_Flash();
         $flash->message('Ningun Perfil disponible!');
         $flash->flashType(Response_Flash::FLASH_ERROR);
         Helper_App_Flash::set($flash);
         $show_combo_perfiles = FALSE;
         $useIframe = TRUE;
         $view = 'app/html/error/403';
     }
     // ================================================================
     // ================================================================
     $eCompanyBranches = Helper_App_Session::isSuperAdminProfile() || Helper_App_Session::isAdminProfile() ? $mCompanyBranch->listByCompany($id_company) : $mUserProfileCompanyBranch->listCompanyBranchsByUserProfile($id_user, $id_profile);
     $show_combo_sedes = TRUE;
     $combo_sedes = Helper_Array::entitiesToIdText($eCompanyBranches, 'id', 'name', 'value', 'text', $id_company_branch);
     if (empty($eCompanyBranches)) {
         $flash = new Response_Flash();
         $flash->message('Ninguna Sucursal disponible!');
         $flash->flashType(Response_Flash::FLASH_ERROR);
         Helper_App_Flash::set($flash);
         $show_combo_sedes = FALSE;
         $useIframe = TRUE;
         $view = 'app/html/error/403';
     }
     $content = '';
     if (is_array($view)) {
         foreach ($view as $v) {
             $content .= $MY->load->view($v, $arrParams, true);
         }
     } else {
         $content = $MY->load->view($view, $arrParams, true);
     }
     $browser = Helper_App_Session::isIExplorer();
     $arrParamsLayoutDefault = array('useIframe' => $useIframe, 'resources_path' => $resources_path, 'content' => $content, 'arrMenu' => $arrMenu, 'controller_current' => $controller_current, 'function_current' => $function_current, 'navegador' => $browser, 'eConfigurationSystem' => $eConfigurationSystem, 'eCompany' => $eCompany, 'eProfile' => $eProfile, 'ePerson' => $ePerson, 'eUser' => $eUser, 'eAppVersion' => $eAppVersion, 'show_combo_perfiles' => $show_combo_perfiles, 'combo_perfiles' => $combo_perfiles, 'show_combo_sedes' => $show_combo_sedes, 'combo_sedes' => $combo_sedes);
     $MY->load->view('app/html/layout/layout', array_merge($arrParamsLayoutDefault, $arrParamsLayout));
 }
 public static function decryptIdValue(&$value_id)
 {
     if (ENVIRONMENT == 'development') {
         return;
     }
     if (empty($value_id)) {
         return;
     }
     $encryption_key = Helper_App_Session::getEncryptionKey();
     $value_id = Helper_Encrypt::decryptId($value_id, $encryption_key);
     if (!is_numeric($value_id)) {
         exit('Violacion de seguridad');
     }
 }
Esempio n. 30
0
 function __construct()
 {
     parent::__construct(MY_Controller::SYSTEM_APP);
     Helper_App_Session::setBlock(TRUE);
     $this->redirect('app/login_advanced');
 }