public function validated() { include_once "models/FlightModel.php"; $flightModel = new FlightModel(); $okay = true; if (!$flightModel->IsExistId($this->flight_id)) { $okay = false; $this->setError("Session expired contact admin or stage over again"); } else { if (intval($this->adult_no) == 0 || $this->adult_no == NULL) { $okay = false; $this->setError("Specify the number of adults please!"); } else { if ($this->ticket_cat == NULL || trim($this->ticket_cat) == "") { $okay = false; $this->setError("Select ticket category!"); } else { if ($this->ticket_type == NULL || trim($this->ticket_type) == "") { $okay = false; $this->setError("Select ticket ticket!"); } else { return $okay; } } } } }
function SaveChange($id, $planeId, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $noOfStops, $ticketPrice, $option = null) { $flight = new Flight(); $flight->set($planeId, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $ticketPrice, $noOfStops); $flight->Id = $id; $this->flightModelView->flight = $flight; $flight->mode = "edit"; $flightModel = new FlightModel(); if ($flightModel->IsExistId($id)) { $flightModel->Update($flight->Id, $flight); } $this->flightModelView->flightList = $flightModel->GetAllFlights(); return $this->View($this->flightModelView, "Flight", "Index"); }