public function index()
 {
     $oBus = Business_App_Rol::listRol('', NULL, NULL);
     $eRols = $oBus->getInData('eRols');
     $combo_rol = Helper_Array::entitiesToIdText($eRols, 'id', 'name', 'value', 'text');
     Helper_App_View::layout('app/html/pages/security_profile/page', array('combo_rol' => $combo_rol));
 }
 public static function listByType($catalog_type_mix)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mCatalog Catalog_Model  */
     $mCatalog =& $MY->mCatalog;
     $data = array();
     try {
         if (is_array($catalog_type_mix)) {
             foreach ($catalog_type_mix as $idx => $value) {
                 $eCatalogos = $mCatalog->listByType($value);
                 $eCatalogos = Helper_Array::entitiesToIdText($eCatalogos, 'code', 'name', 'value', 'text');
                 $data[$value] = $eCatalogos;
             }
         } else {
             $eCatalogos = $mCatalog->listByType($catalog_type_mix);
             $eCatalogos = Helper_Array::entitiesToIdText($eCatalogos, 'code', 'name', 'value', 'text');
             $data[$catalog_type_mix] = $eCatalogos;
         }
         $oBus->isSuccess(TRUE);
     } catch (Exception $e) {
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     $oBus->data(array('eCatalogs' => $data));
     return $oBus;
 }
 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();
 }
 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();
 }
 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));
 }
 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();
 }