From 55f736e5a11e1b08aa741c97ed302db65fdf7139 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 10 Mar 2019 18:51:52 -0600 Subject: [PATCH] Pull in changes --- classes.php | 186 ++++++++++++++++++++++++++++------------------- courseEditor.php | 19 +++-- members.css | 6 +- text.php | 4 +- training.php | 6 +- userCourses.php | 3 +- 6 files changed, 134 insertions(+), 90 deletions(-) diff --git a/classes.php b/classes.php index 9d67272..413504a 100644 --- a/classes.php +++ b/classes.php @@ -98,95 +98,135 @@ else } } else - { - try + if ($_SERVER['REQUEST_METHOD'] == 'GET') { - if (isset($_GET['class_id'])) + try { - /* - * 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))) + if (isset($_GET['class_id'])) { - $count = 0; - while ($row = $sth->fetch(PDO::FETCH_ASSOC)) + /* + * 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'])) { - $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? + * Get with no class_id, display table */ - $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']); + $courseID = (int) cleanInput($_GET['course_id']); + $courseDiv = createDiv($doc, 'FloatLeft50Div'); - 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 + $dbh = returnDatabaseHandel(); + $sth = $dbh->prepare($statement289); + if ($sth->execute(array($courseID))) { - $input = createSubmitInput($doc, 'register', $text0021); -/* $input = $doc->createElement('input'); - $input->setAttribute('type', 'submit'); - $input->setAttribute('name', 'register'); - $input->setAttribute('value', 'Register'); */ - $form->appendChild($input); + $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); + + + } } - $classDiv->appendChild($form); + $body->appendChild($courseDiv); } - } - if ($count == 1) - $body->appendChild($classDiv); - else - $body->appendChild(generateTrainingTable($doc, 'classes.php')); + else + { + /* + * Get with no class_id, display table + */ + $body->appendChild(generateTrainingTable($doc, 'classes.php')); + } + } - else + catch (Exception $e) { - /* - * 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) diff --git a/courseEditor.php b/courseEditor.php index 67d0485..1153172 100644 --- a/courseEditor.php +++ b/courseEditor.php @@ -330,13 +330,8 @@ else $editorDiv->setAttribute('class', 'sticky'); $form = $doc->createElement('form'); $form->setAttribute('action', 'courseEditor.php'); - $form->setAttribute('method', 'post'); - $input = $doc->createElement('input'); - $input->setAttribute('type', 'hidden'); - $input->setAttribute('value', 'Add'); - $input->setAttribute('name', 'action'); - $input->setAttribute('readonly', 'readonly'); - $form->appendChild($input); + $form->setAttribute('method', 'POST'); + $form->setAttribute('enctype', 'multipart/form-data'); $label = $doc->createElement('H3'); $label->appendChild($doc->createTextNode("Add New Course")); $form->appendChild($label); @@ -347,7 +342,7 @@ else $fieldSet->appendChild($fieldSetDiv); $label = $doc->createElement('label', 'Course ID:'); - $label->setAttribute('for', 'id$'); + $label->setAttribute('for', 'id'); $label->setAttribute('class', 'CourseEditorInputLabel'); $fieldSetDiv->appendChild($label); $input = $doc->createElement('input'); @@ -369,6 +364,7 @@ else $input->setAttribute('name', 'name'); $input->setAttribute('autocomplete', 'off'); $input->setAttribute('required', 'required'); + $fieldSetDiv->appendChild($input); $label = $doc->createElement('br'); $fieldSetDiv->appendChild($label); @@ -413,6 +409,13 @@ else $input = $doc->createElement('input'); $input->setAttribute('type', 'submit'); $form->appendChild($input); + $input = $doc->createElement('input'); + $input->setAttribute('type', 'hidden'); + $input->setAttribute('value', 'Add'); + $input->setAttribute('name', 'action'); + $input->setAttribute('readonly', 'readonly'); + $form->appendChild($input); + $editorDiv->appendChild($form); //$bodyDiv->appendChild($editorDiv); $body->appendChild($editorDiv); // Needs to be in the body for sticky diff --git a/members.css b/members.css index 29f2fb6..db82e07 100644 --- a/members.css +++ b/members.css @@ -266,7 +266,7 @@ td.padLeftAndRight { top: 5; width: 45%; /* float: right; */ - background-color: cyan; + /* background-color: ; */ border: 2px solid blue; } @@ -391,9 +391,9 @@ td.padLeftAndRight { //left: 5; width: 45%; //float: right; - background-color: green; + //background-color: green; border: 2px solid blue; - z-index: -5; + //z-index: -5; } diff --git a/text.php b/text.php index ccd5a09..234ae17 100644 --- a/text.php +++ b/text.php @@ -103,8 +103,8 @@ the class. EOD; $text7100 = 'This page was generated on '; $text7101 = ' by software '; -$text7102 = 'licened'; -$text7103 = ' by The Deerfoot Irregualrs and is CopyRight of '; +$text7102 = 'licenced'; +$text7103 = ' by The Deerfoot Irregualrs and is Copyright of '; $text7104 = '.'; diff --git a/training.php b/training.php index 747c252..6669262 100644 --- a/training.php +++ b/training.php @@ -146,11 +146,10 @@ else $body->appendChild(generateSelectedMenuBar($doc, 0)); $myClassesDiv = createDiv($doc, NULL, 'ClassTableDiv'); - $tableTitle = $doc->createElement('H3'); $tableTitle->appendChild($doc->createTextNode("Classes I'm Teaching")); $myClassesDiv->appendChild($tableTitle); - $myClassesDiv->appendChild(generateTrainingTable($doc, NULL, $sort_order, $sort_field, '', NULL, $_SESSION['MemberID'])); + $myClassesDiv->appendChild(generateTrainingTable($doc, 'classes.php', $sort_order, $sort_field, '', NULL, $_SESSION['MemberID'])); $newClassDiv = createDiv($doc, 'NewClassDiv'); $form = createForm($doc, 'training.php'); @@ -184,7 +183,8 @@ else $fieldSet->appendChild(createSubmitInput($doc, 'addClass', 'Add A Class')); $form->appendChild($fieldSet); $newClassDiv->appendChild($form); - $myClassesDiv->appendChild($newClassDiv); + //$myClassesDiv->appendChild($newClassDiv); + $body->appendChild($newClassDiv); $body->appendChild($myClassesDiv); diff --git a/userCourses.php b/userCourses.php index defbaad..86b31a9 100644 --- a/userCourses.php +++ b/userCourses.php @@ -94,7 +94,8 @@ else $tableTitle->appendChild($doc->createTextNode("Current Course Schedule")); $myClassesDiv->appendChild($tableTitle); - $myClassesDiv->appendChild(generateTrainingTable($doc, 'userCourses.php')); + //$myClassesDiv->appendChild(generateTrainingTable($doc, 'userCourses.php')); + $myClassesDiv->appendChild(generateTrainingTable($doc, 'classes.php')); $body->appendChild($myClassesDiv);