Ejemplo n.º 1
0
 public static function getAllPackages()
 {
     $database = new DB();
     $sql = "SELECT * FROM packages";
     $results = $database->select($sql);
     $packages = array();
     foreach ($results as $result) {
         $pkg = new Package();
         $pkg->retrievePackage($result['pkg_id']);
         $packages[] = $pkg;
     }
     return $packages;
 }
Ejemplo n.º 2
0
if (!securePage(htmlspecialchars($_SERVER['PHP_SELF']))) {
    die;
}
require_once 'models/Gear.php';
require_once 'models/funcs.php';
require_once 'models/Package.php';
if ($_SERVER["REQUEST_METHOD"] == "GET") {
    $pkg_id = test_input($_GET['pkg_id']);
    $pkg = new Package();
    $pkg->retrievePackage($pkg_id);
}
//form submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $pkg_id = test_input($_POST['pkg_id']);
    $pkg = new Package();
    $pkg->retrievePackage($pkg_id);
    //placeholder text in field
    if (empty($_POST['title'])) {
        //$errors[] = "No title provided";
    } else {
        $title = test_input($_POST['title']);
    }
    if (empty($_POST['description'])) {
        $errors[] = "No description provided";
    } else {
        $description = test_input($_POST['description']);
    }
    if (empty($_POST['gear'])) {
        $errors[] = "No gear in package";
    } else {
        $gearList = $_POST['gear'];
Ejemplo n.º 3
0
 //collect vars from step 1
 $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