appendChild($root); $root->appendChild(generateHead($doc)); $body = $doc->createElement('body'); $root->appendChild($body); $body->appendChild(generateMastHead($doc, $baseDir)); $body->appendChild(generateSelectedMenuBar($doc)); if ($_SERVER['REQUEST_METHOD'] == 'POST') { /* * process class signup * * check if a seat is available * add a class_registrant record */ //print_r($_POST); if (isset($_POST['register'])) { if (isset($_POST['class_id']) && ($_POST['register'] === "Register")) { $classID = (int) cleanInput($_POST['class_id']); registerMemberForClass($classID, $_SESSION['MemberID']); $h3 = $doc->createElement('h3'); $h3->appendChild($doc->createTextNode("You have been registered for class " . $classID)); $body->appendChild($h3); $p = $doc->createElement('p'); $p->appendChild($doc->createTextNode($text7000)); $body->appendChild($p); } } else if (isset($_POST['withdraw'])) { if (isset($_POST['class_id'])) { $classID = (int) cleanInput($_POST['class_id']); } } } else if ($_SERVER['REQUEST_METHOD'] == 'GET') { try { if (isset($_GET['class_id'])) { /* * Get with class_id, show class details/signup */ $classID = (int) cleanInput($_GET['class_id']); $classDiv = $doc->createElement('div'); $classDiv->setAttribute('class', 'FloatLeft50Div'); $dbh = returnDatabaseHandel(); $sth = $dbh->prepare($statement249); if ($sth->execute(array($classID))) { $count = 0; while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $count++; $h3 = $doc->createElement('h3'); $h3->appendChild($doc->createTextNode("Class Number " . $row['id'])); $classDiv->appendChild($h3); //$classDiv->appendChild($doc->createElement('br')); $h3 = $doc->createElement('h3'); $h3->appendChild($doc->createTextNode($row['name'])); $classDiv->appendChild($h3); $h5 = $doc->createElement('h5'); $h5->appendChild($doc->createTextNode("Cost: " . money_format('%i', $row['cost']))); $classDiv->appendChild($h5); $h5 = $doc->createElement('h5'); $h5->appendChild($doc->createTextNode("Starting at: " . $row['start_datetime'])); $classDiv->appendChild($h5); $p = $doc->createElement('p'); $p->appendChild($doc->createTextNode($row['description'])); $classDiv->appendChild($p); /* * Register, deregister? */ $form = createForm($doc, "classes.php"); $input = createHiddenInput($doc, 'class_id', (string)$row['id']); /* $input = $doc->createElement('input'); $input->setAttribute('type', 'hidden'); $input->setAttribute('name', 'class_id'); $input->setAttribute('value', $row['id']); */ $form->appendChild($input); $status = returnMemberStatusForClass($classID, $_SESSION['MemberID']); if ($status === "Confirmed" || $status === "Registered") { $input = createSubmitInput($doc, 'withdraw', $text0020); /* $input = $doc->createElement('input'); $input->setAttribute('type', 'submit'); $input->setAttribute('name', 'withdraw'); $input->setAttribute('value', 'Withdraw');*/ $form->appendChild($input); } else { $input = createSubmitInput($doc, 'register', $text0021); /* $input = $doc->createElement('input'); $input->setAttribute('type', 'submit'); $input->setAttribute('name', 'register'); $input->setAttribute('value', 'Register'); */ $form->appendChild($input); } $classDiv->appendChild($form); } } if ($count == 1) $body->appendChild($classDiv); else $body->appendChild(generateTrainingTable($doc, 'classes.php')); } else if (isset($_GET['course_id'])) { /* * Get with no class_id, display table */ $courseID = (int) cleanInput($_GET['course_id']); $courseDiv = createDiv($doc, 'FloatLeft50Div'); $dbh = returnDatabaseHandel(); $sth = $dbh->prepare($statement289); if ($sth->execute(array($courseID))) { $count = 0; while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { $count++; //print ("bonk"); $h3 = $doc->createElement('h3'); $h3->appendChild($doc->createTextNode("Course ID: " . $row['id'])); $courseDiv->appendChild($h3); //$body->appendChild(generateTrainingTable($doc, 'classes.php')); $h3 = $doc->createElement('h3'); $h3->appendChild($doc->createTextNode("Course Title: " . $row['name'])); $courseDiv->appendChild($h3); $h3 = $doc->createElement('h3'); $h3->appendChild($doc->createTextNode("Course Description: " . $row['description'])); $courseDiv->appendChild($h3); } } $body->appendChild($courseDiv); } else { /* * Get with no class_id, display table */ $body->appendChild(generateTrainingTable($doc, 'classes.php')); } } catch (Exception $e) { $body->appendChild(generateTrainingTable($doc, 'classes.php')); } } $body->appendChild(generateFooter($doc)); if ($prettyPretty) $doc->formatOutput = true; echo $doc->saveXML(); } ?>