Exemple #1
0
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $co_id = test_input($_POST['co_id']);
    $dateTime = test_input($_POST['dateTime']);
}
//check to see what checkout and if it needs to be deleted
if ($_SERVER["REQUEST_METHOD"] == "GET") {
    $co_id = test_input($_GET['co_id']);
    if (isset($_GET['delete']) && $_GET['delete'] == true) {
        Checkout::removeCheckout($co_id);
        $deleted = true;
        header("Location: checkouts.php?co_del=true");
    }
}
//pull checkout and gearlist
$checkout = new Checkout();
$checkout->retrieveCheckout($co_id);
if (isset($dateTime)) {
    $checkout->setReturned($dateTime);
    $checkout->finalizeCheckout();
}
$gearList = $checkout->getGearList();
//create array of gear types within this checkout
$gearTypes = array();
foreach ($gearList as $gear) {
    $gearObject = new Gear();
    $gearObject->fetch($gear[0]);
    $type = gearTypeWithID($gearObject->getType());
    //gearTypeWithID(getGearType($gear[0]));
    if (!in_array($type, $gearTypes)) {
        $gearTypes[] = $type;
    }
Exemple #2
0
 public static function getCheckoutsInRangeForPerson($person_id, $start, $end)
 {
     $database = new DB();
     $checkouts = array();
     $sql = "SELECT co_id, co_start FROM checkouts WHERE person_id='{$person_id}' ORDER BY co_start";
     $results = $database->select($sql);
     foreach ($results as $result) {
         if ($result['co_start'] > $start && $result['co_start'] < $end) {
             $newCO = new Checkout();
             $newCO->retrieveCheckout($result['co_id']);
             $checkouts[] = $newCO;
         }
     }
     //foreach
     return $checkouts;
 }