require_once '../config.php';
require_once './testReservationUtil.php';
require_once './resources/TestReservationInfo.php';
// require_login();
// Need group verification
$testReservationInfo = TestReservationInfo::Instance();
$identity = verifyODSIdentity($testReservationInfo);
$PAGE->set_context(get_system_context());
$PAGE->set_pagelayout('standard');
$PAGE->set_title("Test Reservation Table");
$PAGE->set_heading("Test Reservation Table");
$PAGE->set_url($CFG->wwwroot . '/testreservation/testReservationTable.php');
try {
    $transaction = $DB->start_delegated_transaction();
    verifyBasicDatabaseTableSetup();
    if (array_key_exists("submitType", $_POST)) {
        $submitType = $_POST['submitType'];
        switch ($submitType) {
            case "new":
                directSQLInsertRR($_POST);
                directSQLInsertRT($submitType, $_POST);
                // $record = createReservationRecordObj ( $_POST );
                // $lastinsertid = $DB->insert_record_raw ( $testReservationRecordTableName, $record, false );
                // $tansaction = createReservationTransactionObj ( $submitType, $_POST );
                // $lastinsertid = $DB->insert_record_raw ( $testReservationTransactionRecordTableName, $tansaction, false );
                break;
            case "update":
                $previousReservationId = $_POST['targetReservationId'];
                invalidateTargetReservation($previousReservationId);
                directSQLInsertRR($_POST);
 /**
  * Private ctor so nobody else can instance it
  */
 private function __construct()
 {
     verifyBasicDatabaseTableSetup();
 }