コード例 #1
0
ファイル: utils.php プロジェクト: beshad/FTTL-MVC
 /**
  * Get {@link FlightBooking} by the identifier 'id' found in the URL.
  * @return FlightBooking {@link FlightBooking} instance
  * @throws NotFoundException if the param or {@link FlightBooking} instance is not found
  */
 public static function getFlightBookingByGetId()
 {
     $id = null;
     try {
         $id = self::getUrlParam('id');
     } catch (Exception $ex) {
         throw new NotFoundException('No FlightBooking identifier provided.');
     }
     if (!is_numeric($id)) {
         throw new NotFoundException('Invalid FlightBooking identifier provided.');
     }
     $dao = new FlightBookingDao();
     $flightBooking = $dao->findById($id);
     if ($flightBooking === null) {
         throw new NotFoundException('Unknown FlightBooking identifier provided.');
     }
     return $flightBooking;
 }
コード例 #2
0
<?php

//status of list
$status = Utils::getUrlParam('status');
//command
$cmd = Utils::getUrlParam('cmd');
$flightBooking = Utils::getFlightBookingByGetId();
$flightBooking->setStatus($cmd);
$dao = new FlightBookingDao();
$dao->save($flightBooking);
$msg = '';
if ($cmd === FlightBooking::VOIDED) {
    $smg = 'Flight booking deleted successfully.';
} else {
    $smg = 'Flight boooking changed successfully.';
}
Flash::addFlash($smg);
Utils::redirect('list', array('status' => $status));
コード例 #3
0
ファイル: list-script.php プロジェクト: richjava/fttl-mvc
<?php

$status = Utils::getUrlParam('status');
//TodoValidator::validateStatus($status);
//
$dao = new FlightBookingDao();
// data for template
$title = ucfirst($status) . ' bookings';
$flightBookings = $dao->find($status);