public static function listProfile($txt_filter, $limit, $offset)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mProfile Profile_Model */
     $mProfile =& $MY->mProfile;
     $eProfiles = array();
     $eRoles = array();
     $count = 0;
     try {
         $filter = new filterProfile();
         $filter->limit = $limit;
         $filter->offset = $offset;
         $filter->text = $txt_filter;
         $filter->isActive = NULL;
         $filter->withSuperAdmin = Helper_App_Session::isSuperAdminProfile();
         $filter->withAdmin = Helper_App_Session::isAdminProfile();
         $filter->isEditable = Helper_App_Session::isSuperAdminProfile() ? NULL : 1;
         $mProfile->filter($filter, $eProfiles, $eRoles, $count);
         $oBus->isSuccess(TRUE);
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     $oBus->data(array('eProfiles' => $eProfiles, 'eRoles' => $eRoles, 'count' => $count));
     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 static function listCompanyBranchsByUserProfile($id_user, $id_profile)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mUserProfileCompanyBranch User_Profile_Company_Branch_Model */
     $mUserProfileCompanyBranch =& $MY->mUserProfileCompanyBranch;
     $eCompanyBranchs = $mUserProfileCompanyBranch->listCompanyBranchsByUserProfile($id_user, $id_profile);
     $oBus->isSuccess(!empty($eCompanyBranchs));
     $oBus->message(empty($eCompanyBranchs) ? 'Usuario no tiene asociado ninguna Sede.' : '');
     $oBus->data(array('eCompanyBranchs' => $eCompanyBranchs));
     return $oBus;
 }
 public static function loadUser($id_user)
 {
     $MY =& MY_Controller::get_instance();
     $oBus = new Response_Business();
     /* @var $mUser User_Model */
     $mUser =& $MY->mUser;
     try {
         /* @var $eUser eUser  */
         $eUser = $mUser->load($id_user);
         $oBus->isSuccess(TRUE);
     } catch (Exception $e) {
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     $oBus->data(array('eUser' => $eUser));
     return $oBus;
 }
 public static function loadByPersonId($id_person)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mPerson Person_Model */
     $mPerson =& $MY->mPerson;
     $ePerson = new ePerson();
     try {
         /* @var $ePerson ePerson  */
         $ePerson = $mPerson->load($id_person);
         $oBus->isSuccess(TRUE);
     } catch (Exception $e) {
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     $oBus->data(array('ePerson' => $ePerson));
     return $oBus;
 }
 public static function listCatalog()
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mCatalog Catalog_Model  */
     $mCatalog = $MY->mCatalog;
     /* @var $mCatalogByType Catalog_Type_Model  */
     $mCatalogByType = $MY->mCatalogType;
     $data = array();
     $mCatalogByTypes = $mCatalogByType->listAll(NULL, NULL, NULL);
     if (!empty($mCatalogByTypes)) {
         foreach ($mCatalogByTypes as $eTypeByCatalog) {
             /* @var $eTypeByCatalog eCatalogType */
             $eCatalogos = $mCatalog->listAll($eTypeByCatalog->id, NULL, NULL);
             $data[] = array('eTypeByCatalog' => $eTypeByCatalog, 'eCatalog' => $eCatalogos);
         }
     }
     $oBus->isSuccess(TRUE);
     $oBus->data($data);
     return $oBus;
 }
 public static function listPermission($txt_filter, $limit, $offset)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mPermission Permission_Model */
     $mPermission =& $MY->mPermission;
     $ePermissions = array();
     $count = 0;
     try {
         $filter = new filterPermission();
         $filter->limit = $limit;
         $filter->offset = $offset;
         $filter->text = $txt_filter;
         $mPermission->filter($filter, $ePermissions, $count);
         $oBus->isSuccess(TRUE);
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     $oBus->data(array('ePermissions' => $ePermissions, 'count' => $count));
     return $oBus;
 }
 public static function loadModulePermissions($id_module)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mModule Module_Model */
     $mModule =& $MY->mModule;
     /* @var $mPermission Permission_Model */
     $mPermission =& $MY->mPermission;
     /* @var $mRol Rol_Model */
     $mRol =& $MY->mRol;
     $eModule = new eModule();
     $ePermissions = array();
     try {
         /* @var $eModule eModule  */
         $eModule = $mModule->load($id_module);
         $ePermissions = $mPermission->listByModule($eModule->id);
         $oBus->isSuccess(TRUE);
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     $oBus->data(array('eModule' => $eModule, 'ePermissions' => $ePermissions));
     return $oBus;
 }
 public static function loadLogo($id_company = NULL)
 {
     $oBus = new Response_Business();
     $uri = '';
     try {
         if (empty($id_company)) {
             throw new Exception('Logo por defecto');
         }
         $uri = "resources/uploads/company/{$id_company}/logo.png";
         if (!file_exists(BASEPATH . '../' . $uri)) {
             throw new Exception('Logo por defecto');
         }
         $oBus->isSuccess(TRUE);
     } catch (Exception $e) {
         $uri = "resources/img/nologo.png";
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     $oBus->data(array('uri' => $uri));
     return $oBus;
 }
 public static function loadUserProfile($id_user)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mUserProfile User_Profile_Model */
     $mUserProfile =& $MY->mUserProfile;
     $eUserProfile = new eUserProfile();
     try {
         $eUserProfile = $mUserProfile->load($id_user, 'id_user');
         $oBus->isSuccess(TRUE);
     } catch (Exception $e) {
         $oBus->isSuccess(FALSE);
         $oBus->message($e->getMessage());
     }
     $oBus->data(array('eUserProfile' => $eUserProfile));
     return $oBus;
 }
 public static function listRolesAndModulesAByRol($id_rol)
 {
     $oBus = new Response_Business();
     $MY =& MY_Controller::get_instance();
     /* @var $mRolModule Rol_Module_Model */
     $mRolModule =& $MY->mRolModule;
     $eRolesModules = array();
     try {
         $eRolesModules = $mRolModule->listRolesAndModulesByRol($id_rol);
         $oBus->isSuccess(TRUE);
     } catch (Exception $ex) {
         $oBus->isSuccess(FALSE);
         $oBus->message($ex->getMessage());
     }
     $oBus->data(array('eRolesModules' => $eRolesModules));
     return $oBus;
 }