Пример #1
0
 function Login($email, $password, $option = null)
 {
     $email = $email == "null" ? null : $email;
     $password = $password == "null" ? null : $password;
     $agentModel = new AgentModel();
     if ($agentModel->IsLogin($email, $password)) {
         $agent = new Agent();
         // The user has successfully login
         if ($agentModel->IsActive($email)) {
             if (!$agentModel->IsSuspended($email)) {
                 Session::set("db_username", "{$email}");
                 $agent->email = $email;
                 $agent->password = $email;
                 return $this->ReDirectTo("Account", "Index");
             } else {
                 Session::set("Warning", "This account as be fully suspected please contact administrator");
                 return $this->ReDirectTo("Agent", "LoginForm");
             }
         } else {
             Session::set("Warning", "Your email account [{$email}] is not yet verified.");
             return $this->ReDirectTo("Agent", "Confirmation");
         }
     } else {
         ContextManager::ValidationFor("warning", "Invalid username or password\n");
     }
     return $this->View(null, "Agent", "Login");
 }
Пример #2
0
 public function Create($planeId, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $noOfStops, $ticketPrice, $option = null)
 {
     $id = null;
     $this->filter($id, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $noOfStops, $ticketPrice, $option);
     $flight = new Flight();
     $flight->set($planeId, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $ticketPrice, $noOfStops);
     $flightModel = new FlightModel($flight, $this->db);
     $this->flightModelView->flight = $flight;
     Session::set("modifier_plane", $planeId);
     $this->ViewBag("Title", "New Flight");
     $this->ViewBag("Controller", "Flight");
     $this->ViewBag("Page", "Create");
     if (isset($option) && $option != 'null') {
         if ($flight->validate()) {
             $this->flightModelView->flightDbModel = $flightModel;
             if ($flightModel->isExists($from, $to, $boardingtime)) {
                 ContextManager::ValidationFor("warning", "There is already a flight leaving at the same time to the same destination");
             } else {
                 //else if did not exists
                 $referenceNumber = $flightModel->AddFlight();
                 if ($referenceNumber != null) {
                     $content = $flight->toString();
                     $path = ContextManager::CreateQRBarcode($content, $referenceNumber);
                 } else {
                     ContextManager::ValidationFor("warning", "Transaction fails : " . $flightModel->GetError());
                     $flightModel->Rollback($flight->Id);
                 }
             }
         } else {
             ContextManager::ValidationFor("warning", $flight->error);
         }
     }
     $listOfFlights = $flightModel->GetAllFlights();
     $this->flightModelView->flightList = $listOfFlights;
     return $this->View($this->flightModelView, "Account", "Index");
 }
Пример #3
0


<div id='dash-board-wrapper' class="row">



    <div class="col-lg-12">

        <div id='container'>

            <div class='title'>

                Flight List :
                <?php 
ContextManager::ValidationFor("warning-l");
?>
            </div>   


            <?php 
$attr = new ArrayIterator();
$attr->offsetSet("method", "post");
ContextManager::BeginForm("Flight", "Modify", $attr);
?>
            <table width="100%" class="table  table-heading borderless">
                <tr class ="">
                    <th>S/N</th>
                    <th>Flight Name</th>
                    <th>Source</th>
                    <th>Destination</th>
Пример #4
0
 public function AddPassenger($formno, $title, $firstname, $lastname, $btnpress = null)
 {
     $passenger = new Passenger();
     $passenger->formid = $formno;
     $passenger->title = $title;
     $passenger->firstname = $firstname;
     $passenger->lastname = $lastname;
     $passenger->analyser();
     $passenger_list = Session::get("Passengers");
     if ($passenger_list == NULL) {
         $passenger_list = [];
     }
     if ($passenger->validated()) {
     } else {
         Session::set("passage-form", $formno);
         ContextManager::ValidationFor("warning", $passenger->getError());
     }
     $passenger_list[$formno] = $passenger;
     Session::set("Passengers", $passenger_list);
     Session::set("Passager-Valid", $this->countValidPessenger());
     $this->ViewBag("Controller", "Booking");
     $this->ViewBag("Page", "PassenderForms");
     return $this->View($this->viewModel->flightDbModel, "Booking", "Index");
 }
Пример #5
0
 public function Update($seatId, $planeID, $seatNo, $rate, $type, $Desc, $press = null)
 {
     $seat = new Seat();
     $seat->set($seatNo, $planeID, $Desc, $type, $rate);
     $seat->id = $seatId;
     $seat->mode = "edit";
     $this->modelview->seat = $seat;
     Session::set("selected_plane_id", $planeID);
     Session::set("type_plane", $type);
     $model = new SeatModel($seat, $this->db);
     if (!$model->IsIdExists($seatId)) {
         ContextManager::ValidationFor("warning", "Oops! there is no flight seats selected to modify");
         return $this->View($this->modelview, "Seat", "Index");
     }
     $model->Update();
     $this->modelview->seatModel = $model;
     $this->ViewBag("Title", "Seats");
     $this->ViewBag("Controller", "Seat");
     $this->ViewBag("Page", "Index");
     return $this->View($this->modelview, "Account", "Index");
 }
Пример #6
0
 function SaveChanges($id, $name, $seats, $description, $buttonPress)
 {
     $id = $id == "null" ? null : $id;
     $name = $name == "null" ? null : $name;
     $seats = $seats == "null" ? null : $seats;
     $description = $description == "null" ? null : $description;
     $buttonPress = $buttonPress == "null" ? null : $buttonPress;
     $plane = new Plane();
     $plane->set($name, $seats, $description);
     $plane->Id = $id;
     $plane->mode = "edit";
     $this->modelView->plane = $plane;
     $this->modelView->planeModel = new PlaneModel($plane);
     if ($this->modelView->plane->validated()) {
         $this->modelView->planeModel->Update();
     } else {
         ContextManager::ValidationFor("warning", $this->modelView->plane->getError());
     }
     $this->ViewBag("Title", "Save Changes");
     $this->ViewBag("Controller", "Plane");
     $this->ViewBag("Page", "Index");
     return $this->View($this->modelView, "Account", "Index");
 }