public function manageAction($id = false) { $this->permission('manage'); $this->language->load("clinic_schedule_exceptions"); $model = new \modules\clinic\models\Clinic_schedule_exceptions(); $model->attributes = $this->Input->input['post']; $schedules = Form_helper::queryToDropdown('clinic_schedules', 'clinic_schedule_id', 'clinic_schedule_id'); if ($id) { $model->clinic_schedule_exception_id = $id; } $model->language_id = $this->language->getDefaultLanguage(); if ($model->save()) { Uri_helper::redirect("management/clinic_schedule_exceptions"); } return $this->render('clinic_schedule_exceptions/manage', ['item' => $id ? $model->get() : null, 'schedule' => $schedules]); }
public function exceptionsAction($id = false) { $this->language->load("clinic_doctors"); if ($_POST) { $date = $this->input->post('exc_date'); $from_time = $this->input->post('exc_from'); $to_time = $this->input->post('exc_to'); $clinic_schedule_exception_id = $this->input->post('clinic_schedule_exception_id'); foreach ($date as $key => $value) { $exceptions = new \modules\clinic\models\Clinic_schedule_exceptions(); $exceptions->clinic_doctor_id = $id; $exceptions->from_time = $from_time[$key]; $exceptions->to_time = $to_time[$key]; $exceptions->date = $value; if ($clinic_schedule_exception_id[$key]) { $exceptions->clinic_schedule_exception_id = $clinic_schedule_exception_id[$key]; } $exceptions->save(); } if ($exceptions->save()) { Uri_helper::redirect("management/clinic_doctors/doctor_schedule/" . $id); } } if (!$_POST) { $exception = new \modules\clinic\models\Clinic_schedule_exceptions(); $exception->select; $exception->clinic_doctor_id = $id; $result = $exception->get(); return $this->render('clinic_doctors/exceptions', ['items' => $result, 'doctor' => $id]); } }
public function schedule_exceptionsAction($id = false) { $this->layout = 'ajax'; $this->permission('schedule_exceptions'); $exceptions = new \modules\clinic\models\Clinic_schedule_exceptions(); $exceptions->clinic_doctor_id = $id; $exceptions->date = $this->input->post('exc_date'); $exceptions->from_time = $this->input->post('exc_from'); $exceptions->to_time = $this->input->post('exc_to'); $exp_schedule = []; foreach ($exceptions->get() as $item) { $exp_schedule[$item->clinic_doctor_id] = $item; } $exceptions->save(); return $this->render('clinic_doctors/exceptions', ['exp_schedule' => $exp_schedule, 'doctor' => $id]); }