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(); }
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 inInactivity() { $MY =& MY_Controller::get_instance(); /* @var $mConfigurationSystem Configuration_System_Model */ $mConfigurationSystem =& $MY->mConfigurationSystem; $id_system = Helper_Config::getSystemId(); /* @var $eConfigurationSystem eConfigurationSystem */ $eConfigurationSystem = $mConfigurationSystem->load($id_system); $lastTime = self::getLastTime(); $now = date("Y-m-d H:i:s"); $time = strtotime($now) - strtotime($lastTime); $limit_min = is_null($eConfigurationSystem->session_time_limit_min) ? 600 : $eConfigurationSystem->session_time_limit_min; $limit_max = is_null($eConfigurationSystem->session_time_limit_max) ? 1200 : $eConfigurationSystem->session_time_limit_max; if (ENVIRONMENT != 'development') { if ($time >= $limit_max) { self::logout(); return FALSE; } elseif ($time >= $limit_min) { self::setInactivity(FALSE); self::setBlock(TRUE); //return FALSE; } else { self::setLastTime($now); self::setInactivity(TRUE); self::setBlock(FALSE); //return TRUE; } } return self::getInactivity(); }