private function listProfile() { $resAjax = new Response_Ajax(); $txt_filter = $this->input->get('sSearch'); $limit = $this->input->get('iDisplayLength'); $offset = $this->input->get('iDisplayStart'); $oBus = Business_App_Profile::listProfile($txt_filter, $limit, $offset); $data = $oBus->data(); $eProfiles = $data['eProfiles']; $eRoles = $data['eRoles']; $count = $data['count']; $aaData = array(); if (!empty($eProfiles)) { /* @var $eProfile eProfile */ foreach ($eProfiles as $num => $eProfile) { $aaData[] = array(trim($eProfile->name), trim($eRoles[$num]->name), trim($eProfile->isActive), trim($eProfile->id)); } } $resAjax->isSuccess($oBus->isSuccess()); $resAjax->message($oBus->message()); $resAjax->datatable($aaData, $count); echo $resAjax->toJsonEncode(); }
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(); }