public function saveAction()
 {
     $email = $this->input->post('email');
     $date = $this->input->post('date');
     $time = $this->input->post('time');
     $clinic_doctor_id = $this->input->post('clinic_doctor_id');
     $clinic_doctor_reservation_type_id = $this->input->post('clinic_doctor_reservation_type_id');
     $model = new \modules\users\models\Users();
     $model->_select = "user_id";
     $model->email = $email;
     if ($model->get()) {
         $user = $model->get();
         $user_id = $user[0]->user_id;
         $model_res = new \modules\clinic\models\Clinic_reservations(FALSE);
         $model_res->created = date("Y-m-d H:i:s");
         $model_res->time = $time;
         $model_res->date = $date;
         $model_res->user_id = $user_id;
         $model_res->clinic_doctor_id = $clinic_doctor_id;
         $model_res->clinic_doctor_reservation_type_id = $clinic_doctor_reservation_type_id;
         $model_res->clinic_reservation_status = 'pending';
         $model_res->status = '';
         if ($model_res->save()) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
 public function saveAction()
 {
     $clinic_doctor_id = $this->input->post('doctor_id');
     $user_id = $this->input->post('patient_id');
     $date = $this->input->post('date');
     $time = $this->input->post('time');
     $status = $this->input->post('status');
     //        $clinic_doctor_reservation_type_id = $this->input->post('clinic_doctor_reservation_type_id');
     $model_res = new \modules\clinic\models\Clinic_reservations(FALSE);
     $model_res->created = date("Y-m-d H:i:s");
     $model_res->time = $time;
     $model_res->date = $date;
     $model_res->user_id = $user_id;
     $model_res->clinic_doctor_id = $clinic_doctor_id;
     //        $model_res->clinic_doctor_reservation_type_id = $clinic_doctor_reservation_type_id;
     $model_res->clinic_reservation_status = $status;
     $model_res->status = '';
     if ($model_res->save()) {
         return true;
     } else {
         return false;
     }
 }
 public function attendAction()
 {
     $this->language->load("clinic_doctors");
     $user_id = $this->input->post('user_id');
     $date = $this->input->post('date');
     $time = $this->input->post('time');
     $model = new \modules\clinic\models\Clinic_reservations(FALSE);
     $model->_select = "clinic_reservation_id";
     $model->user_id = $user_id;
     $model->date = $date;
     $model->time = $time;
     $model->clinic_reservation_status = 'confirmed';
     $result = $model->get();
     if ($model->get()) {
         $clinic_reservation_id = $result[0]->clinic_reservation_id;
         $model->clinic_reservation_id = $clinic_reservation_id;
         $model->status = 'attend';
         if ($model->save(TRUE)) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }