public function deleteAction() { $this->view->disable(); $this->response->setContentType('text/plain', 'UTF-8'); $Reservationid = $this->request->get('reservationid', 'string'); $reservation = Reservation::findFirst(array('coditions' => 'id=?1', 'bind' => array(1 => $reservationid))); if ($reservation != null) { $available = $reservation->Available; if ($available->date == date('Y-m-d', strtotime('now'))) { $this->response->setContent('对不起,该预约单已经超过可取消日期'); $this->response->send(); return; } else { if ($reservation->delete() == false) { $this->response->setContent('对不起,现在无法取消预约单'); $this->response->send(); return; } else { $this->response->setContent('预约单取消成功'); $this->response->send(); return; } } } }
public function doprintAction() { $rid = $this->request->get('reservationid', 'int'); $r = Reservation::findFirst(array('id=:rid:', 'bind' => array('rid' => $rid))); $user = $r->getUser(); $available = $r->getAvailable(); $doctor = $available->getDoctor(); $department = $doctor->getDepartment(); $hospital = $department->getHospital(); $this->view->setVars(array('user' => $user, 'available' => $available, 'doctor' => $doctor, 'department' => $department, 'hospital' => $hospital, 'reservation' => $r)); }
public function showsuccessAction() { $availableid = $this->request->get('availableid', 'int'); $this->tag->appendTitle('预约成功'); $available = Available::findFirst(array('id=:id:', 'bind' => array('id' => $availableid))); $doctor = $available->getDoctor(); $department = $doctor->getDepartment(); $hospital = $department->getHospital(); $user = User::findFirst(array('conditions' => 'id=?1', 'bind' => array(1 => $this->session->get('userid')))); $reservation = Reservation::findFirst(array('a_id=:a_id: AND u_id=:u_id:', 'bind' => array('a_id' => $available->id, 'u_id' => $user->id))); $this->view->setVars(array('doctor' => $doctor, 'hospital' => $hospital, 'department' => $department, 'reservationid' => $reservation->id, 'user' => $user, 'available' => $available)); }