Ejemplo n.º 1
0
 public function index()
 {
     switch ($this->var['action']) {
         case 'add':
             loadCustomDropdowns();
             $this->setModel('userrole_model');
             $this->setMethod('getUserrole');
             $this->setIndex('userrole_list');
             $this->executeMethod(array('type' => 'get', 'active' => TRUE));
             if ($this->input->post('data')) {
                 $this->form_validation->set_rules('data[FirstName]', 'FirstName', 'trim|required');
                 $this->form_validation->set_rules('data[Username]', 'Username', 'trim|required|min_length[4]|xss_clean');
                 $this->form_validation->set_rules('data[UserRoleID]', 'User Role', 'trim|required');
                 $this->form_validation->set_rules('data[Password]', 'Password', 'trim|required|matches[ConfirmPassword]');
                 $this->form_validation->set_rules('ConfirmPassword', 'Password Confirmation', 'trim|required');
                 $this->form_validation->set_rules('data[UserEmail]', 'Email', 'trim|valid_email');
                 $input_data = $this->input->post('data');
                 $encryption = crypt($this->config->item('encryption_key'));
                 $input_data['EncryptionKey'] = $encryption;
                 $input_data['Salt'] = crypt($input_data['Password'], $encryption);
                 $input_data['Password'] = isset($input_data['Password']) ? md5($input_data['Password']) : NULL;
                 $this->setMethod('addUser');
                 $this->form_validation->run() == TRUE ? $this->var['data'] = json_encode($input_data) : NULL;
             }
             break;
         case 'edit':
             loadCustomDropdowns();
             $this->setModel('user_model');
             $this->setMethod('getUser');
             $this->setIndex('user_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             if ($this->input->post('data')) {
                 $this->form_validation->set_rules('data[PersonID]', 'Name', 'trim|required');
                 $this->form_validation->set_rules('data[Username]', 'Username', 'trim|required|min_length[4]|xss_clean');
                 $this->form_validation->set_rules('data[UserRoleID]', 'User Role', 'trim|required');
                 $this->form_validation->set_rules('data[Password]', 'Password', 'trim|matches[ConfirmPassword]');
                 $this->form_validation->set_rules('ConfirmPassword', 'Password Confirmation', 'trim|required');
                 $this->form_validation->set_rules('data[UserEmail]', 'Email', 'trim|valid_email');
                 $input_data = $this->input->post('data');
                 $input_data['Password'] = isset($input_data['Password']) ? md5($input_data['Password']) : NULL;
                 $this->setMethod('updateUser');
                 $this->form_validation->run() == TRUE ?: NULL;
             }
             break;
         default:
             loadAdvancedDataTables();
             $this->setModel('user_model');
             $this->setMethod('getUser');
             $this->setIndex('user_list');
             $this->executeMethod(array('type' => 'get'));
     }
     $this->viewPage();
 }
Ejemplo n.º 2
0
 public function index()
 {
     $this->setModel('usermenu_model');
     $input_data = $this->input->post('data') ? $this->input->post('data') : array();
     switch ($this->var['action']) {
         case 'add':
             /*Begin process when edit button is clicked */
             loadComponentsDropdowns();
             loadiCheck();
             $this->setMethod('getUsermenu');
             $this->setIndex('usermenu_list');
             $this->executeMethod(array('type' => 'get', 'active' => true));
             /*End process when edit button is clicked */
             /*Begin process when submit button is clicked */
             $this->setMethod('addUsermenu');
             $this->form_validation->set_rules('data[MenuName]', 'This', 'trim|required|is_unique[user_menu.MenuName]');
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
             /*End process when submit button is clicked */
             break;
         case 'edit':
             /*Begin process when edit button is clicked */
             loadComponentsDropdowns();
             loadiCheck();
             /*get specific user menu*/
             $this->setMethod('getUsermenuByID');
             $this->setIndex('menu_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*get all menus for parent menu dropdown selection*/
             $this->setMethod('getUsermenu');
             $this->setIndex('usermenu_list');
             $this->executeMethod(array('type' => 'get', 'active' => true));
             /*End process when edit button is clicked */
             /*Begin process when submit button is clicked*/
             $this->setMethod('updateUsermenu');
             $this->form_validation->set_rules('data[MenuName]', 'This', 'trim|required');
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data)) : NULL;
             /*End Process when submit button is clicked*/
             break;
         default:
             loadAdvancedDataTables();
             $this->setMethod('getUsermenu');
             $this->setIndex('usermenu_list');
             $this->executeMethod(array('type' => 'get'));
             break;
     }
     $this->viewPage();
 }
Ejemplo n.º 3
0
 public function index()
 {
     switch ($this->var['action']) {
         case 'add':
             /*Begin process when submit button is clicked*/
             $this->setMethod('addCitizenship');
             $this->form_validation->set_rules('data[CitizenshipName]', 'Ownership Type Name', 'trim|required|is_unique[citizenship.CitizenshipName]');
             $input_data = $this->input->post('data') ? $this->input->post('data') : array();
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
             /*End process when submit button is clicked*/
             break;
         case 'edit':
             /*Begin process when edit button is clicked*/
             /*get specific record by id*/
             $this->setMethod('getCitizenship');
             $this->setIndex('citizenship_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*End process when edit button is clicked*/
             /*Begin process when submit button is clicked*/
             $input_data = $this->input->post('data') ? $this->input->post('data') : array();
             $this->setMethod('updateCitizenship');
             $this->form_validation->set_rules('data[CitizenshipName]', 'Ownership Type Name', 'trim|required');
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data)) : NULL;
             /*End process when submit button is clicked*/
             break;
         default:
             /*Load Data Table*/
             loadAdvancedDataTables();
             /*get all records*/
             $this->setMethod('getCitizenship');
             $this->setIndex('citizenship_list');
             $this->executeMethod(array('type' => 'get'));
             break;
     }
     $this->viewPage();
 }
Ejemplo n.º 4
0
 public function index()
 {
     $this->setModel('userrole_model');
     $input_data = $this->input->post('data') ? $this->input->post('data') : array();
     switch ($this->var['action']) {
         case 'add':
             loadComponentsDropdowns();
             $input_data['Active'] = 1;
             $this->form_validation->set_rules('data[UserRoleName]', 'Name', 'trim|required|is_unique[user_role.UserRoleName]');
             if ($this->form_validation->run() == TRUE) {
                 /*set the method to add user role*/
                 $this->setMethod('addUserrole');
                 /*if adding user role is successfull*/
                 if ($this->executeMethod(array('type' => 'add', 'input' => $input_data))) {
                     /*set new container for user access input data*/
                     $data = array();
                     /*loop through each selected pages*/
                     foreach ($input_data['Page'] as $page) {
                         /*set the input data*/
                         $data[] = array('UserRoleID' => $this->{$model}->last_id, 'Page' => $page);
                     }
                     /*set the method to add user role access*/
                     $this->setMethod('addAccess');
                     /*execute the method to add user role access */
                     $this->executeMethod(array('type' => 'add', 'input' => $data));
                 }
             }
             break;
         case 'edit':
             loadComponentsDropdowns();
             /*get specific user role data*/
             $this->setMethod('getUserRole');
             $this->setIndex('userrole_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*get page access*/
             $this->setMethod('getPageAccess');
             $this->setIndex('pages');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             foreach ($this->var['pages'] as $row) {
                 $this->var['pageaccess_list'][] = $row['Page'];
             }
             $this->setMethod('updateUserrole');
             $this->form_validation->set_rules('data[UserRoleName]', 'Name', 'trim|required');
             if ($this->form_validation->run() == TRUE) {
                 //                    $this->var['data'] = $input_data;
                 /*set the method to add user role*/
                 $this->setMethod('updateUserrole');
                 if ($this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data))) {
                     /*remove the access*/
                     $this->setMethod('deleteAccess');
                     $this->executeMethod(array('type' => 'update'));
                     /*set new container for user access input data*/
                     $data = array();
                     /*loop through each selected pages*/
                     foreach ($input_data['Page'] as $page) {
                         /*set the input data*/
                         $data[] = array('UserRoleID' => $this->var['id'], 'Page' => $page);
                     }
                     /*set the method to add user role access*/
                     $this->setMethod('addAccess');
                     //                        $this->var['data'] = $this->$model->input_data;
                     /*execute the method to add user role access */
                     $this->executeMethod(array('type' => 'add', 'input' => $data));
                 }
             }
             break;
         default:
             loadAdvancedDataTables();
             $this->setMethod('getUserrole');
             $this->setIndex('userrole_list');
             $this->executeMethod(array('type' => 'get'));
     }
     $this->viewPage();
 }
Ejemplo n.º 5
0
 public function index()
 {
     switch ($this->var['action']) {
         case 'add':
             loadComponentsDropdowns();
             $this->setModel('requirement_model');
             $this->setMethod('getRequirement');
             $this->setIndex('requirement_list');
             $this->executeMethod(array('type' => 'get', 'active' => TRUE));
             /*Begin process when submit button is clicked*/
             $this->setModel('business_requirement_model');
             $this->setMethod('addBusinessRequirement');
             $this->form_validation->set_rules('data[TransactionType]', 'Transaction', 'trim|required');
             $this->form_validation->set_rules('data[RequirementID]', 'Requirement Name', 'trim|required');
             if ($this->input->post('data')) {
                 /*set input data*/
                 $data = $this->input->post('data');
                 foreach ($data['RequirementID'] as $requirement) {
                     $input_data[] = array('TransactionType' => $data['TransactionType'], 'RequirementID' => $requirement, 'Active' => 1);
                 }
                 $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
             }
             /*End process when submit button is clicked*/
             break;
         case 'edit':
             loadComponentsDropdowns();
             /*Begin process when edit button is clicked*/
             /*get specific record by id*/
             $this->setModel('business_requirement_model');
             $this->setMethod('getBusinessRequirement');
             $this->setIndex('business_requirement_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             $this->setModel('requirement_model');
             $this->setMethod('getRequirement');
             $this->setIndex('requirement_list');
             $this->executeMethod(array('type' => 'get', 'active' => TRUE));
             /*End process when edit button is clicked*/
             /*Begin process when submit button is clicked*/
             $this->form_validation->set_rules('data[TransactionType]', 'Transaction', 'trim|required');
             $this->form_validation->set_rules('data[RequirementID]', 'Requirement Name', 'trim|required');
             if ($this->input->post('data')) {
                 /*set input data*/
                 $data = $this->input->post('data');
                 foreach ($data['RequirementID'] as $requirement) {
                     $input_data[] = array('TransactionType' => $data['TransactionType'], 'RequirementID' => $requirement, 'Active' => isset($data['Active']) ? $data['Active'] : 0);
                 }
                 $this->setModel('business_requirement_model');
                 $this->setMethod('updateBusinessRequirement');
                 $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data)) : NULL;
             }
             /*End process when submit button is clicked*/
             break;
         default:
             /*Load Data Table*/
             loadAdvancedDataTables();
             /*get all records*/
             $this->setModel('business_requirement_model');
             $this->setMethod('getBusinessRequirement');
             $this->setIndex('business_requirement_list');
             $this->executeMethod(array('type' => 'get'));
             break;
     }
     $this->viewPage();
 }
Ejemplo n.º 6
0
 public function index()
 {
     switch ($this->var['action']) {
         case 'add':
             loadComponentPickers();
             /*Begin process when add button is clicked*/
             $this->setModel('location_model');
             $this->setMethod('getProvince');
             $this->setIndex('province_list');
             $this->executeMethod(array('type' => 'get', 'active' => TRUE));
             /*End process when add button is clicked*/
             /*Begin process when submit button is clicked*/
             $this->setModel('person_model');
             $model = $this->var['model'];
             $input_data = $this->input->post('data') ? $this->input->post('data') : array();
             $this->{$model}->input_data = $input_data;
             $this->setMethod('addPerson');
             $this->form_validation->set_rules('data[FirstName]', 'Firstname', 'trim|required');
             $this->form_validation->set_rules('data[LastName]', 'Lastname', 'trim|required');
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
             /*End process when submit button is clicked*/
             break;
         case 'edit':
             loadComponentPickers();
             /*Begin process when edit button is clicked*/
             /*get the specific person record*/
             $this->setModel('person_model');
             $this->setMethod('getPerson');
             $this->setIndex('person_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*get list of province*/
             $this->setModel('location_model');
             $this->setMethod('getProvince');
             $this->setIndex('province_list');
             $this->executeMethod(array('type' => 'get', 'active' => TRUE));
             /*get list of municipalities based on province id*/
             $province_id = $this->var['person_list'][0]['ProvinceID'];
             $this->setMethod('getCityMunicipality');
             $this->setIndex('citymunicipality_list');
             $this->executeMethod(array('type' => 'get', 'parent_id' => $province, 'active' => TRUE));
             /*get list of barangay based on citymunicipality id*/
             $citymunicipality_id = $this->var['person_list'][0]['CityMunicipalityID'];
             $this->setMethod('getBarangay');
             $this->setIndex('barangay_list');
             $this->executeMethod(array('type' => 'get', 'parent_id' => $citymunicipality_id, 'active' => TRUE));
             /*End process when edit button is clicked*/
             /*Begin process when update button is clicked*/
             $this->setModel('person_model');
             $input_data = $this->input->post('data') ? $this->input->post('data') : array();
             $this->setMethod('updatePerson');
             $this->form_validation->set_rules('data[FirstName]', 'Firstname', 'trim|required');
             $this->form_validation->set_rules('data[LastName]', 'Lastname', 'trim|required');
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data)) : NULL;
             /*End process when update button is clicked*/
             break;
         default:
             loadAdvancedDataTables();
             /*get person list*/
             $this->setModel('person_model');
             $model = $this->var['model'];
             $this->setMethod('getPerson');
             $this->setIndex('person_list');
             $this->executeMethod(array('type' => 'get'));
     }
     $this->viewPage();
 }
Ejemplo n.º 7
0
 public function barangay()
 {
     /*Begin getting data needed for input forms in add and edit*/
     /*Get the Province - this is needed for dropdown list*/
     $this->setMethod('getProvince');
     $this->setIndex('province_list');
     $this->executeMethod(array('type' => 'get', 'active' => TRUE));
     /*End getting data needed for input forms in add and edit*/
     /*Begin initial process when submit button is clicked on add and edit*/
     /*Set the input data */
     $input_data = $this->input->post('data') ? $this->input->post('data') : array();
     /*End inital process when submit button is clicked on add and edit */
     switch ($this->var['action']) {
         case 'add':
             loadComponentsDropdowns();
             /*Begin additional process when submit button is clicked*/
             $this->setMethod('addBarangay');
             $this->form_validation->set_rules('data[CityMunicipalityID]', 'City/Municipality', 'trim|required');
             $this->form_validation->set_rules('data[BarangayName]', 'Barangay', 'trim|required');
             $this->form_validation->run() ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
             /*End additional process when submit button is clicked*/
             break;
         case 'edit':
             loadComponentsDropdowns();
             /*Begin process when edit button is clicked*/
             /*get specific record by id*/
             $this->setMethod('getBarangay');
             $this->setIndex('barangay_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*get the municipality list based on province id - this is needed for dropdown list on edit*/
             $province_id = $this->var['barangay_list'][0]['ProvinceID'];
             $this->setMethod('getCityMunicipality');
             $this->setIndex('citymunicipality_list');
             $this->executeMethod(array('type' => 'get', 'parent_id' => $province_id, 'active' => 1));
             /*End process when edit button is clicked*/
             /*Begin additional process when submit button is clicked*/
             $this->setMethod('updateBarangay');
             $this->form_validation->set_rules('data[CityMunicipalityID]', 'City/Municipality', 'trim|required');
             $this->form_validation->set_rules('data[BarangayName]', 'Barangay', 'trim|required');
             $this->form_validation->run() ? $this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data)) : NULL;
             /*End additional process when submit button is clicked*/
             break;
         default:
             /*Load Data Table*/
             loadAdvancedDataTables();
             /*get all records*/
             $this->setMethod('getBarangay');
             $this->setIndex('barangay_list');
             $this->executeMethod(array('type' => 'get'));
             break;
     }
     $this->viewPage();
 }
Ejemplo n.º 8
0
 public function business_tfo_schedule()
 {
     /*GET TFO*/
     $this->setModel('tfo_model');
     $this->setMethod('getTFO');
     $this->setIndex('tfo_list');
     $this->executeMethod(array('type' => 'get', 'active' => TRUE));
     /*End process when add button is clicked*/
     /*Get Available Variables */
     $this->setModel($this->model);
     $this->setMethod('getVariables');
     $this->setIndex('tfo_variable_list');
     $this->executeMethod(array('type' => 'get'));
     /*End process when add button is clicked*/
     switch ($this->var['action']) {
         case 'add':
             /*Begin process when add button is clicked*/
             loadBusinessFunctions();
             /*Begin process when submit button is clicked*/
             $this->setModel($this->model);
             if ($this->input->post('data')) {
                 $this->form_validation->set_rules('data[TransactionType]', 'Transaction', 'trim|required');
                 $this->form_validation->set_rules('data[TFOID]', 'TFO', 'trim|required');
                 $this->form_validation->set_rules('data[Basis]', 'Basis', 'trim|required');
                 $this->form_validation->set_rules('data[ModeOfComputation]', 'Mode of Computation', 'trim|required');
                 $data = $this->input->post('data');
                 $input_data = array();
                 if (isset($data['Range'])) {
                     foreach ($data['Range'] as $range) {
                         $input_data[] = array('TFOScheduleID' => str_pad($this->var['id'], 5, '0', STR_PAD_LEFT) . '-' . str_pad($data['TFOID'], 5, '0', STR_PAD_LEFT) . '-' . $data['TransactionType'], 'TFOTemplateID' => $this->var['id'], 'TFOID' => $data['TFOID'], 'TransactionType' => $data['TransactionType'], 'Basis' => $data['Basis'], 'ModeOfComputation' => $data['ModeOfComputation'], 'MinimumAmount' => $data['MinimumAmount'], 'UnitOfMeasure' => isset($data['UnitOfMeasure']) ? $data['UnitOfMeasure'] : NULL, 'RangeNumber' => $range['RangeNumber'], 'LowerLimit' => $range['LowerLimit'], 'HigherLimit' => $range['HigherLimit'], 'Amount' => $range['Amount'], 'Formula' => $range['Formula'], 'Active' => 1);
                     }
                     $this->setMethod('addBatchTFOSchedule');
                     $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
                 } else {
                     $input_data = $data;
                     $input_data['TFOScheduleID'] = str_pad($this->var['id'], 5, '0', STR_PAD_LEFT) . '-' . str_pad($input_data['TFOID'], 5, '0', STR_PAD_LEFT) . '-' . $input_data['TransactionType'];
                     $input_data['TFOTemplateID'] = $this->var['id'];
                     $input_data['Active'] = 1;
                     $this->setMethod('addTFOSchedule');
                     $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
                 }
             }
             /*End process when submit button is clicked*/
             break;
         case 'edit':
             /*Begin process when edit button is clicked*/
             loadBusinessFunctions();
             /*GET TFO*/
             $this->setModel('tfo_model');
             $this->setMethod('getTFO');
             $this->setIndex('tfo_list');
             $this->executeMethod(array('type' => 'get', 'active' => TRUE));
             /*End process when add button is clicked*/
             /*get specific record by id*/
             $this->setModel($this->model);
             $this->setMethod('getTFOSchedule');
             $this->setIndex('business_tfo_schedule_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*End process when edit button is clicked*/
             /*Begin process when submit button is clicked*/
             $input_data = $this->input->post('data') ? $this->input->post('data') : array();
             $this->setMethod('updateTFOSchedule');
             $this->form_validation->set_rules('data[TFOScheduleName]', 'TFO Schedule Name', 'trim|required');
             $this->form_validation->set_rules('data[TFOScheduleDescription]', 'TFO Schedule Description', 'trim|required');
             $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'update', 'id' => $this->var['id'], 'input' => $input_data)) : NULL;
             /*End process when submit button is clicked*/
             break;
         default:
             /*Load Data Table*/
             loadAdvancedDataTables();
             /*get template detail */
             $this->setModel($this->model);
             $this->setMethod('getTFOTemplate');
             $this->setIndex('tfo_template_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             /*get tfo schedule */
             $this->setModel($this->model);
             $this->setMethod('getTFOSchedule');
             $this->setIndex('business_tfo_schedule_list');
             $this->executeMethod(array('type' => 'get', 'parent_id' => $this->var['id']));
             break;
     }
     $this->viewPage();
 }
Ejemplo n.º 9
0
 public function business_nature_template_schedule()
 {
     $this->setModel($this->model);
     /*get business nature detail*/
     $this->setMethod('getBusinessNature');
     $this->setIndex('business_nature_list');
     $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
     /*get available tfo template for dropdown list*/
     $this->setMethod('getAvailableTFOTemplate');
     $this->setIndex('tfo_template_list');
     $this->executeMethod(array('type' => 'get', 'parent_id' => $this->var['id']));
     switch ($this->var['action']) {
         case 'add':
             /*get available tfo template for dropdown list*/
             if ($this->input->post('data')) {
                 $this->form_validation->set_rules('data[TFOTemplateID]', 'trim');
                 $data = $this->input->post('data');
                 foreach ($data['TFOTemplateID'] as $template_id) {
                     $input_data[] = array('TFOTemplateID' => $template_id, 'BusinessNatureID' => $this->var['id'], 'Active' => 1);
                 }
                 $this->setMethod('addBusinessNatureTemplateSchedule');
                 $this->form_validation->run() == TRUE ? $this->executeMethod(array('type' => 'add', 'input' => $input_data)) : NULL;
             }
             break;
         case 'edit':
             $this->setMethod('getBusinessNatureTemplateSchedule');
             $this->setIndex('business_nature_template_schedule_list');
             $this->executeMethod(array('type' => 'get', 'id' => $this->var['id']));
             break;
         default:
             loadAdvancedDataTables();
             $this->setMethod('getBusinessNatureTemplateSchedule');
             $this->setIndex('business_nature_template_schedule_list');
             $this->executeMethod(array('type' => 'get', 'parent_id' => $this->var['id']));
     }
     $this->viewPage();
 }