function edit_location() { $locations_model = new Locations_model(); $locations_service = new Locations_service(); $locations_model->set_id($this->input->post('loc_id', TRUE)); $locations_model->set_name($this->input->post('name', TRUE)); $locations_model->set_type($this->input->post('type', TRUE)); $locations_model->set_updated_date(date("Y-m-d H:i:s")); echo $locations_service->update_location($locations_model); }
public function index() { $questionnaire_service = new Questionnaire_service(); $settings_service = new Settings_service(); $locations_service = new Locations_service(); $setting = $settings_service->get_settings_by_slug('site_url'); $data['languages'] = $this->config->item('LANGUAGES'); $data['locations'] = $locations_service->get_locations(); $data['questionnaires'] = $questionnaire_service->get_questionnaires($this->session->userdata('USER_LOCATION')); $data['domain_url'] = $setting->value; $partials = array('content' => 'dashboard/dashboard_view'); //load the view $this->template->load('template/main_template', $partials, $data); //load teh template }
public function report_dashboard() { $locations_service = new Locations_service(); $location_id = $this->session->userdata('USER_LOCATION'); $location = $locations_service->get_location_by_id($location_id); $partials = array(); if (!empty($location)) { if ($location->type == 'hospital') { $partials = array('content' => 'reports/hospital_report_dashboard'); //load the view } else { $partials = array('content' => 'reports_other/report_dashboard'); //load the view } } $this->template->load('template/main_template', $partials); //load teh template }
function load_user() { $user_service = new User_service(); $user_model = new User_model(); $locations_service = new Locations_service(); $user_types = ""; if ($this->session->userdata('USER_TYPE') == '1') { $user_types = $this->config->item('USER_TYPES'); } else { if ($this->session->userdata('USER_TYPE') == '2') { //if admin users belongs to his location $user_types = $this->config->item('USER_TYPES'); unset($user_types[1]); } } $data['user_types'] = $user_types; $data['locations'] = $locations_service->get_locations(); $user_model->set_id(trim($this->input->post('user_id', TRUE))); $data['user'] = $user_service->get_user_by_id($user_model); echo $this->load->view('users/edit_user', $data); }