コード例 #1
0
ファイル: SeatController.php プロジェクト: jimobama/app
 function Create($planeID, $seatNo, $rate, $type, $Desc, $buttonPressed = null)
 {
     $seat = new Seat();
     $seat->set($seatNo, $planeID, $Desc, $type, $rate);
     $this->modelview->seat = $seat;
     Session::set("selected_plane_id", $planeID);
     Session::set("type_plane", $type);
     $model = new SeatModel($seat, $this->db);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if ($seat->validated()) {
             if (!$model->IsExists()) {
                 $model->Add();
                 ContextManager::ValidationFor("warning", "Seat successfully created");
             } else {
                 ContextManager::ValidationFor("warning", "The current seat number for the given plane as already be created");
             }
         } else {
             ContextManager::ValidationFor("warning", $seat->getError());
         }
     }
     $this->ViewBag("Title", "Seats");
     $this->ViewBag("Controller", "Seat");
     $this->ViewBag("Page", "Index");
     return $this->View($this->modelview, "Account", "Index");
 }