function test_select_dbDates()
{
    $newDate = new BSCAHdate("01-01-15", [], "notes", []);
    $nd = insert_dbDates($newDate);
    $id = "01-01-15";
    echo 'will test select_dbDates</br>';
    $result = select_dbDates($id);
    if ($result) {
        echo 'select_dbDates succeeded</br>';
    } else {
        echo 'select_dbDates failed</br>';
    }
    $res = delete_dbDates($newDate);
    if ($res == null) {
        echo 'Delete failed</br>';
    }
}
function update_dbDates_projects($date)
{
    $db_date = select_dbDates($date);
    if ($db_date != null) {
        insert_dbDates_project($db_date);
    } else {
        error_log("Date is currently not in DATE table");
    }
    return $db_date != null;
}
/**
 * retrieves a Week from the database
 *
 * @param $id = mm-dd-yy of the week to retrieve
 *
 * @return Week desired week, or null
 */
function get_dbWeeks($id)
{
    $result_row = select_dbWeeks($id);
    if ($result_row != null) {
        $dates = explode("*", $result_row['DATES']);
        $d = [];
        foreach ($dates as $date) {
            $temp = select_dbDates($date);
            $d[] = $temp;
        }
        $w = new Week($d, $result_row['STATUS']);
        return $w;
    } else {
        return null;
    }
}
示例#4
0
/**
 * replaces a date in the dbDates table by a new one (with a different shift);
 * makes no changes to the dbShifts table
 */
function replace_dbDates($old_s, $new_s)
{
    if (!$old_s instanceof Shift || !$new_s instanceof Shift) {
        die("Invalid argument for dbDates->replace_dbDates function call");
    }
    $d = select_dbDates($old_s->get_yy_mm_dd() . ":" . $old_s->get_venue());
    $d = $d->replace_shift($old_s, $new_s);
    update_dbDates($d);
    return true;
}
示例#5
0
/**
 * retrieves a Week from the database
 * @param $id = mm-dd-yy of the week to retrieve
 * @return the desired week, or null
 */
function get_dbWeeks($id)
{
    $result_row = select_dbWeeks($id);
    if ($result_row != null) {
        $dates = explode("*", $result_row['dates']);
        $d = array();
        foreach ($dates as $date) {
            $d[] = select_dbDates($date);
        }
        $w = new Week($d, $result_row['venue'], $result_row['status']);
        error_log("3");
        return $w;
    } else {
        return null;
    }
}