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 }
<div class="row"> <div class="col-sm-12"> <div> <header class="panel-heading"> <a class=" pull-right" href="<?php echo site_url(); ?> /settings"><i class="fa fa-cogs"></i>Settings</a> </header> <div class="panel-body"> <div class="row state-overview"> <?php $user_service = new User_service(); $questionnaire_service = new Questionnaire_service(); foreach ($locations as $location) { ?> <div id="first_btn" class="col-md-3 col-lg-2"> <div class="panel-base"> <div class="s-ad green"><?php echo $location->name . ' - (' . ucfirst($location->type) . ')'; ?> </div> <div class="s-top-ad green"> <span class="smilie fa dash-plus" style="font-size:4em;padding-top:20px;font-family: 'Open Sans';"> <?php echo count($user_service->get_users_for_location($location->id)); ?> </span> Users </div>
function upload_welcome_image($id) { $uploaddir = './uploads/'; $unique_tag = 'wl'; $filename = $unique_tag . time() . '-' . basename($_FILES['uploadfile']['name']); //this is the file name $file = $uploaddir . $filename; // this is the full path of the uploaded file if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { $questionnaire_service = new Questionnaire_service(); $data = array('welcome_image' => $filename); $questionnaire_service->update_questionnaire($data, $id); echo $filename; } else { echo "error"; } }
public function feedback_report() { $questionnaire_service = new Questionnaire_service(); $location_id = $this->session->userdata('USER_LOCATION'); $data['questionnaires'] = $questionnaire_service->get_questionnaires($location_id); $partials = array('content' => 'reports_other/feedback_monthly_report'); //load the view $this->template->load('template/main_template', $partials, $data); //load teh template }
public function save_feedback() { $patients_service = new Patients_service(); $patients_model = new Patients_model(); $patients_feeds_service = new Patients_feeds_service(); $questionnaire_service = new Questionnaire_service(); $questionnaire = $questionnaire_service->get_questionnaire_by_id($this->input->post('questionnaire_id', TRUE)); $data['questionnaire'] = $questionnaire; echo $this->load->view('content/thank_you', $data); //check is the user is exist or not /* $patient = $patients_service->get_patient_by_number($this->input->post('patient_number', TRUE)); $patient_id = ''; */ //if user exist update the details otherwise insert a new user /* if (!empty($patient)) { $patient_id = $patient->id; $patients_model->set_id($patient_id); $patients_model->set_patient_name($this->input->post('patient_name', TRUE)); $patients_model->set_patient_email($this->input->post('patient_email', TRUE)); $patients_model->set_patient_contact_no($this->input->post('patient_contact_no', TRUE)); $patients_model->set_patient_admission_date($this->input->post('patient_admission_date', TRUE)); $patients_model->set_patient_discharge_date($this->input->post('patient_discharge_date', TRUE)); $patients_model->set_updated_date(date("Y-m-d H:i:s")); $patients_service->update_patient_details($patients_model); } else { */ if ($questionnaire->active_user_detail == '0') { if ($questionnaire->loc_type == 'hospital') { $patients_model->set_patient_number($this->input->post('patient_number', TRUE)); } else { $patients_model->set_patient_name($this->input->post('patient_number', TRUE)); } } else { $patients_model->set_patient_name($this->input->post('patient_name', TRUE)); if ($questionnaire->loc_type == 'hospital') { $patients_model->set_patient_number($this->input->post('patient_number', TRUE)); } if ($questionnaire->email_field == '1') { $patients_model->set_patient_email($this->input->post('patient_email', TRUE)); } if ($questionnaire->contact_field == '1') { $patients_model->set_patient_contact_no($this->input->post('patient_contact_no', TRUE)); } if ($questionnaire->admission_date_field == '1') { $patients_model->set_patient_admission_date($this->input->post('patient_admission_date', TRUE)); } if ($questionnaire->discharge_date_field == '1') { $patients_model->set_patient_discharge_date($this->input->post('patient_discharge_date', TRUE)); } if ($questionnaire->ward_no_field == '1') { $patients_model->set_ward_no($this->input->post('ward_no', TRUE)); } } $patients_model->set_is_deleted('0'); $patients_model->set_added_date(date("Y-m-d H:i:s")); $patient_id = $patients_service->save_patient_details($patients_model); /* } */ $questions = $this->input->post('questions', TRUE); $answers = $this->input->post('answer', TRUE); if (!empty($questions)) { foreach ($questions as $question) { $patients_feeds_model = new Patients_feeds_model(); $patients_feeds_model->set_questionnaire_id($this->input->post('questionnaire_id', TRUE)); $patients_feeds_model->set_feed($answers[$question]); $patients_feeds_model->set_patient_id($patient_id); $patients_feeds_model->set_question_id($question); $patients_feeds_model->set_is_deleted('0'); $patients_feeds_model->set_added_date(date("Y-m-d")); $patients_feeds_service->save_patient_feed($patients_feeds_model); } } }