load->model('Groups_model'); $this->load->model('Groups_permission_model'); if (!$this->ion_auth->in_group(array('admin'))) { redirect('home/permission'); } } public function index() { $this->load->view('home/dashboard'); // just the header file $this->load->view('groups'); $this->load->view('home/footer'); // just the header file } public function addNewView() { $this->load->view('home/dashboard'); // just the header file $this->load->view('add_new'); $this->load->view('home/footer'); // just the header file } public function addNew() { $id = $this->input->post('id'); $name = $this->input->post('name'); $description = $this->input->post('description'); $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('
', '
'); // Validating Name Field $this->form_validation->set_rules('name', 'Name', 'trim|required|min_length[1]|max_length[100]|xss_clean'); // Validating Email Field $this->form_validation->set_rules('description', 'Description', 'trim|required|min_length[1]|max_length[100]|xss_clean'); if ($this->form_validation->run() == FALSE) { if (!empty($id)) { $data = array(); $data['groups'] = $this->Groups_model->getGroupsById($id); $this->load->view('home/dashboard'); // just the header file $this->load->view('add_new', $data); $this->load->view('home/footer'); // just the footer file } else { $data = array(); $data['setval'] = 'setval'; $this->load->view('home/dashboard'); // just the header file $this->load->view('add_new', $data); $this->load->view('home/footer'); // just the header file } } else { $data = array(); $data = array( 'name' => $name, 'description' => $description, ); if (empty($id)) { // Adding New Group $this->Groups_model->insertGroup($data); $this->session->set_flashdata('feedback', 'Added'); } else { // Updating Group $this->Groups_model->updateGroup($id, $data); $this->session->set_flashdata('feedback', 'Updated'); } // Loading View redirect('groups'); } } function editGroup() { $data = array(); $id = $this->input->get('id'); $data['group'] = $this->Groups_model->getGroupById($id); $this->load->view('home/dashboard'); // just the header file $this->load->view('add_new', $data); $this->load->view('home/footer'); // just the footer file } function delete() { $data = array(); $id = $this->input->get('id'); $this->Groups_model->delete($id); $this->session->set_flashdata('feedback', 'Deleted'); redirect('groups'); } function getGroups() { $requestData = $_REQUEST; $start = $requestData['start']; $limit = $requestData['length']; $search = $this->input->post('search')['value']; // if ($limit == -1) { // if (!empty($search)) { // //$data['users'] = $this->Users_model->getDoctorBysearch($search); // } else { // $data['groups'] = $this->Groups_model->getGroups(); // } // } else { // if (!empty($search)) { // //$data['users'] = $this->Users_model->getDoctorByLimitBySearch($limit, $start, $search); // } else { // //$data['users'] = $this->Users_model->getDoctorByLimit($limit, $start); // } // } $data['groups'] = $this->Groups_model->getGroups(); //print_r($data);die; foreach ($data['groups'] as $group) { if ($this->ion_auth->in_group(array('admin'))) { //$options1 = ' ' . lang('edit') . ''; $options1 = ' ' . lang('edit') . ''; } // $options2 = ' ' . lang('appointments') . ''; if (($this->ion_auth->in_group(array('admin')))&&($group->id!=1)) { $options3 = ' Manage Permission'; // $options4 = ' ' . lang('delete') . ''; } $info[] = array( $group->id, $group->name, $group->description, $options1.' '.$options3.' '.$options4, ); } if (!empty($data['groups'])) { $output = array( "draw" => intval($requestData['draw']), "recordsTotal" => $this->db->get('groups')->num_rows(), "recordsFiltered" => $this->db->get('groups')->num_rows(), "data" => $info ); } else { $output = array( // "draw" => 1, "recordsTotal" => 0, "recordsFiltered" => 0, "data" => [] ); } echo json_encode($output); } //Group permission View function permission(){ $id = $this->input->get('id'); $data['group'] = $this->Groups_model->getGroupById($id); //$data['permission'] = $this->Groups_permission_model->getGroupPermission($id); $this->load->view('home/dashboard'); // just the header file $this->load->view('groups_permission',$data); $this->load->view('home/footer'); // just the footer file } public function addNewPermissionView() { $id = $this->input->get('id'); $data['group'] = $this->Groups_model->getGroupById($id); $data['group_permission']=$this->Groups_permission_model->getGroupPermissionById($id); // echo '
';
        //     print_r($data);
        //     echo '
'; // die; $this->load->view('home/dashboard'); // just the header file $this->load->view('add_new_permission',$data); $this->load->view('home/footer'); // just the header file } public function addNewPermission() { $permission=$this->input->post('name'); $group_id=$this->input->post('id'); $this->Groups_permission_model->delete($group_id); $data = array(); foreach ($permission as $p) { $data = array( 'group_id' => $group_id, 'permission_id' => $p, ); $this->Groups_permission_model->insertGroupPermission($data); } $this->session->set_flashdata('feedback', 'Added'); redirect('groups'); } // function details() { // $data = array(); // if ($this->ion_auth->in_group(array('Doctor'))) { // $doctor_ion_id = $this->ion_auth->get_user_id(); // $id = $this->doctor_model->getDoctorByIonUserId($doctor_ion_id)->id; // } else { // redirect('home'); // } // $data['doctor'] = $this->doctor_model->getDoctorById($id); // $data['todays_appointments'] = $this->appointment_model->getAppointmentByDoctorByToday($id); // $data['appointments'] = $this->appointment_model->getAppointmentByDoctor($id); // $data['patients'] = $this->patient_model->getPatient(); // $data['appointment_patients'] = $this->patient->getPatientByAppointmentByDctorId($id); // $data['doctors'] = $this->doctor_model->getDoctor(); // $data['prescriptions'] = $this->prescription_model->getPrescriptionByDoctorId($id); // $data['holidays'] = $this->schedule_model->getHolidaysByDoctor($id); // $data['schedules'] = $this->schedule_model->getScheduleByDoctor($id); // $this->load->view('home/dashboard'); // just the header file // $this->load->view('details', $data); // $this->load->view('home/footer'); // just the footer file // } // function editDoctorByJason() { // $id = $this->input->get('id'); // $data['doctor'] = $this->doctor_model->getDoctorById($id); // echo json_encode($data); // } // public function getDoctorInfo() { // // Search term // $searchTerm = $this->input->post('searchTerm'); // // Get users // $response = $this->doctor_model->getDoctorInfo($searchTerm); // echo json_encode($response); // } // public function getDoctorWithAddNewOption() { // // Search term // $searchTerm = $this->input->post('searchTerm'); // // Get users // $response = $this->doctor_model->getDoctorWithAddNewOption($searchTerm); // echo json_encode($response); // } // } } /* End of file doctor.php */ /* Location: ./application/modules/doctor/controllers/doctor.php */