private function listUserAcounts() { $resAjax = new Response_Ajax(); $txt_filter = $this->input->get('sSearch'); $limit = $this->input->get('iDisplayLength'); $offset = $this->input->get('iDisplayStart'); $oBus = Business_App_User_Settings::listAcounts($txt_filter, $limit, $offset); $data = $oBus->data(); $eUsers = $data['eUsers']; $ePersons = $data['ePersons']; $count = $data['count']; $aaData = array(); if (!empty($eUsers)) { /* @var $eUser eUser */ foreach ($eUsers as $num => $eUser) { $aaData[] = array(trim($ePersons[$num]->document), trim($ePersons[$num]->surname) . ' ' . trim($ePersons[$num]->name), trim($eUser->username), trim($eUser->id)); } } $resAjax->isSuccess($oBus->isSuccess()); $resAjax->message($oBus->message()); $resAjax->datatable($aaData, $count); echo $resAjax->toJsonEncode(); }
private function listBinnacle() { $resAjax = new Response_Ajax(); $txt_filter = $this->input->get('sSearch'); $limit = $this->input->get('iDisplayLength'); $offset = $this->input->get('iDisplayStart'); $accion = $this->input->get('accion'); $dateB = $this->input->get('date_begin'); $dateE = $this->input->get('date_end'); $txtAccion = $accion == '' ? array() : explode(",", $accion); $arrTxtAction = array(); if (!empty($txtAccion)) { foreach ($txtAccion as $num => $action) { if ($action == Helper_App_Log::LOG_DEFAULT) { $arrTxtAction[$num] = 'ACTION_DEFAULT'; } if ($action == Helper_App_Log::LOG_LOGIN) { $arrTxtAction[$num] = 'ACTION_LOGIN'; } if ($action == Helper_App_Log::LOG_INSERT) { $arrTxtAction[$num] = 'ACTION_INSERT'; } if ($action == Helper_App_Log::LOG_UPDATE) { $arrTxtAction[$num] = 'ACTION_UPDATE'; } if ($action == Helper_App_Log::LOG_DELETE) { $arrTxtAction[$num] = 'ACTION_DELETE'; } } } $dateBegin = empty($dateB) ? null : $dateB; $dateEnd = empty($dateE) ? null : $dateE; $oBus = Business_App_Binnacle::listBinnacle($txt_filter, $limit, $offset, $arrTxtAction, $dateBegin, $dateEnd); $data = $oBus->data(); $eUserLogs = $data['eUserLogs']; $eUsers = $data['eUsers']; $count = $data['count']; $aaData = array(); if (!empty($eUserLogs)) { /* @var $eUserLog eUserLog */ foreach ($eUserLogs as $num => $eUserLog) { $action = null; if ($eUserLog->action == 'ACTION_DEFAULT') { $action = Helper_App_Log::LOG_DEFAULT; } if ($eUserLog->action == 'ACTION_LOGIN') { $action = Helper_App_Log::LOG_LOGIN; } if ($eUserLog->action == 'ACTION_INSERT') { $action = Helper_App_Log::LOG_INSERT; } if ($eUserLog->action == 'ACTION_UPDATE') { $action = Helper_App_Log::LOG_UPDATE; } if ($eUserLog->action == 'ACTION_DELETE') { $action = Helper_App_Log::LOG_DELETE; } $aaData[] = array(trim($action), trim($eUsers[$num]->username), trim($eUserLog->date_time), trim($eUserLog->ip), trim($eUserLog->id)); } } $resAjax->isSuccess($oBus->isSuccess()); $resAjax->message($oBus->message()); $resAjax->datatable($aaData, $count); echo $resAjax->toJsonEncode(); }
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 listCompanyBranch() { $resAjax = new Response_Ajax(); $aaData = array(); $count = 0; try { if (!$this->permission->access_branch) { throw new Exception('Acceso no permitido'); } $id_company = Helper_App_Session::getCompanyId(); $text = $this->input->get('sSearch'); $limit = $this->input->get('iDisplayLength'); $offset = $this->input->get('iDisplayStart'); $oBus = Business_App_Company_Branch::filterCompanyBranch($id_company, $text, $limit, $offset); $data = $oBus->data(); $eCompanyBranchs = $data['eCompanyBranches']; $count = $data['count']; $aaData = array(); if (!empty($eCompanyBranchs)) { /* @var $eCompanyBranch eCompanyBranch */ foreach ($eCompanyBranchs as $eCompanyBranch) { $aaData[] = array($eCompanyBranch->name, $eCompanyBranch->address, $eCompanyBranch->phone, $eCompanyBranch->isActive, $eCompanyBranch->id); } } $resAjax->isSuccess(TRUE); } catch (Exception $e) { $resAjax->isSuccess(FALSE); $resAjax->message($e->getMessage()); } $resAjax->datatable($aaData, $count); echo $resAjax->toJsonEncode(); }