public function indexAction($offset = 0) { $this->permission('index'); $this->language->load("clinic_doctors"); $model = new \modules\clinic\models\Clinic_doctors(); $model->_select = "clinic_doctor_id,(SELECT users.fullname FROM users WHERE users.user_id = clinic_doctors.user_id)\n AS doctor_name"; $users = ['' => 'select..']; foreach ($model->get() as $item) { $users[$item->clinic_doctor_id] = $item->doctor_name; } $model->_select = ' clinic_doctors.*,`clinic_specifications`.`specification`,`users`.`fullname`'; $model->_joins = ['clinic_specifications' => ['`clinic_specifications`.`clinic_specification_id`=`clinic_doctors`.`clinic_specification_id`', 'INNER'], 'users' => ['`users`.`user_id`=`clinic_doctors`.`user_id`', 'INNER']]; $specification = Form_helper::queryToDropdown('clinic_specifications', 'clinic_specification_id', 'specification'); if ($this->input->get('doctor_id')) { $model->where('clinic_doctors.clinic_doctor_id', $this->input->get('doctor_id')); } if ($this->input->get('specification_id')) { $model->where('clinic_doctors.clinic_specification_id', $this->input->get('specification_id')); } $this->load->library('pagination'); $model->_limit = $this->config->get('limit'); $model->_offset = $offset; $config = ['url' => Uri_helper::url('management/clinic_doctors/index'), 'total' => $model->get(true), 'limit' => $model->_limit, 'offset' => $model->_offset]; return $this->render('clinic_doctors/index', ['items' => $model->get(), 'users' => $users, 'specification' => $specification, 'pagination' => $this->Pagination->generate($config)]); }
public function indexAction($offset = 0) { $this->language->load("clinic_reservations"); $branches = Form_helper::queryToDropdown('clinic_branches', 'clinic_branch_id', 'clinic_branch'); $specification = Form_helper::queryToDropdown('clinic_specifications', 'clinic_specification_id', 'specification'); $doctors = new \modules\clinic\models\Clinic_doctors(); $doctors->_select = "clinic_doctor_id,(SELECT users.fullname FROM users WHERE users.user_id = clinic_doctors.user_id)\n AS doctor_name"; $users = ['' => 'select..']; foreach ($doctors->get() as $item) { $users[$item->clinic_doctor_id] = $item->doctor_name; } $doctors->_select = "users.fullname,users.image,specification,clinic_branch,clinic_doctor_id"; $doctors->_joins = ['users' => ['clinic_doctors.`user_id` = users.`user_id`'], 'clinic_specification_branches' => ['clinic_doctors.`clinic_specification_id` = clinic_specification_branches.`clinic_specification_id`'], 'clinic_specifications' => ['clinic_specifications.`clinic_specification_id` = clinic_doctors.`clinic_specification_id`'], 'clinic_branches' => ['clinic_branches.`clinic_branch_id` =`clinic_specification_branches`.`clinic_branch_id`']]; $doctors->_group_by = [['clinic_doctors.`clinic_doctor_id`']]; $doctors->_order_by = false; if ($this->input->get('clinic_branch_id')) { $doctors->where('clinic_branches.`clinic_branch_id` ', $this->input->get('clinic_branch_id')); } if ($this->input->get('specification_id')) { $doctors->where('clinic_specifications.`clinic_specification_id`', $this->input->get('specification_id')); } if ($this->input->get('clinic_doctor_id')) { $doctors->where('clinic_doctors.`clinic_doctor_id`', $this->input->get('clinic_doctor_id')); } $this->load->library('pagination'); $doctors->_limit = $this->config->get('limit'); $doctors->_offset = $offset; $config = ['url' => Uri_helper::url('clinic_reservation/index'), 'doctors' => $doctors->get(true), 'limit' => $doctors->_limit, 'offset' => $doctors->_offset]; return $this->render('clinic_reservations/clinic_reservations', ['branches' => $branches, 'specification' => $specification, 'doctors' => $doctors->get(), 'users' => $users, 'pagination' => $this->Pagination->generate($config)]); }