<?php

require_once dirname(__FILE__) . '/bagCheckIncludes.php';
session_start();
// Save the current state of the data.
persistCurrentBagCheckState();
$currentBlindIndex = $_GET['current_blind_index'];
$bagCheckInfo = getBagCheckInfo();
$newBlind = createCopyBagCheckBlind($bagCheckInfo, $currentBlindIndex + 1);
$bagCheckInfo->spliceInBlind($currentBlindIndex, $newBlind);
resetBlindFieldIds($bagCheckInfo);
//var_dump($bagCheckInfo);
//exit;
//bagCheckDump("After Add Blind", $bagCheckInfo, true);
setBagCheckInfoInSession($bagCheckInfo);
header("Location: ./bagCheck.php");
Example #2
0
function loadBagCheckDay($selectedDate)
{
    // Make connection to the database.
    $dbInfo = initialize_db_info();
    $dbLink = db_connect($dbInfo);
    db_select($dbLink, $dbInfo);
    $loadDaySql = generateLoadDaySql($selectedDate);
    $result = mysql_query($loadDaySql, $dbLink);
    if (!$result) {
        echo $loadDaySql;
        throw new Exception('Query Day Info Failed: ' . $loadDaySql);
    } else {
        $resultCount = mysql_num_rows($result);
        if ($resultCount == 1) {
            // We found an exact match
            $bagCheckInfo = new bagCheckInfo();
            $row = mysql_fetch_assoc($result);
            setDayInfoWithRow($bagCheckInfo, $row);
            loadNote($bagCheckInfo);
            // Load Each Blind
            loadBagCheckBlinds($bagCheckInfo);
            //exit;
            //bagCheckDump("After SET DAY", $bagCheckInfo, true);
        } else {
            if ($resultCount == 0) {
                // We found no matches
                $bagCheckInfo = createNewBagCheckInfo($selectedDate);
            } else {
                throw new Exception('More than one day found: ' . $resultCount);
            }
        }
        setBagCheckInfoInSession($bagCheckInfo);
    }
}