die; } require_once 'models/funcs.php'; require_once 'models/Gear.php'; require_once 'models/Package.php'; if ($_SERVER["REQUEST_METHOD"] == "GET") { $pkg_id = test_input($_GET['pkg_id']); $del = test_input($_GET['delete']); if ($del == true) { Package::removePackage($pkg_id); header("Location: packages.php"); } $pkg = new Package(); $pkg->retrievePackage($pkg_id); //pull pkg and gearlist $gearList = $pkg->getGearList(); //create array of gear types within this checkout $gearTypes = array(); foreach ($gearList as $gear) { $gearObject = new Gear(); $gearObject->fetch($gear); $type = gearTypeWithID($gearObject->getType()); if (!in_array($type, $gearTypes)) { $gearTypes[] = $type; } } //foreach } ?> <!DOCTYPE html>
"> </div> <div class="form-group"> <!-- DESC --> <label class="control-label" for="Description">Description:</label> <textarea class="form-control" name="description" rows="3"><?php echo $pkg->getDescription(); ?> </textarea> </div> <h2>Select Gear</h2> <p>Quantities are chosen at checkout based on what is available.</p> <hr /> <?php $currGearList = $pkg->getGearList(); $types = getGearTypes(); foreach ($types as $type) { $items = Gear::getGearListWithType($type['gear_type_id']); echo "<h4>" . $type['type'] . "</h4>"; foreach ($items as $item) { $gearObject = new Gear(); $gearObject->fetch($item['gear_id']); echo "<div class='checkbox'>"; if (in_array($gearObject->getID(), $currGearList)) { echo "<label><input type='checkbox' name='gear[]' value='" . $gearObject->getID() . "' checked> " . $gearObject->getName(); } else { echo "<label><input type='checkbox' name='gear[]' value='" . $gearObject->getID() . "'> " . $gearObject->getName(); } echo "</label></div>"; }
$title = test_input($_POST['title']); $description = test_input($_POST['description']); $co_start = test_input($_POST['co_start']); $co_end = test_input($_POST['co_end']); $location = test_input($_POST['location']); $dr_number = test_input($_POST['dr_number']); //look and see what pkgs are added already $preCheck = array(); //items to precheck if possible based on pkgs if (isset($_POST['addedPkgs'])) { $addedPkgs = array(); foreach ($_POST['addedPkgs'] as $pkg) { $addedPkgs[] = test_input($pkg); $newPkg = new Package(); $newPkg->retrievePackage($pkg); $preCheck = array_merge($preCheck, $newPkg->getGearList()); unset($newPkg); } if ($_POST['submit'] != "Next") { $step = 1; } //don't move onto step 3 yet. } //construct a clean gear list $gearList = array(); $gearToGetQtyFor = array(); if (isset($_POST['gear'])) { foreach ($_POST['gear'] as $gearItem) { $gearList[] = test_input($gearItem); //if the available qty is > 1, we need to find out //what qty the user wants to check out