function view($data) { startOfPage(); echo "<div class='jumbotron'>" . PHP_EOL; startContent(); //$title = get_Title(); //siteTitle("$title"); admins_renderLoginForm(); echo "</div>" . PHP_EOL; echo '<hr>' . PHP_EOL; echo '<div class="container-narrow">' . PHP_EOL; //echo "<a href='index.php?option=store&view=admin'>If you are a professor, login here</a>".PHP_EOL; $courses = $data["Tbl_Courses"]; if (users_loggedIn()) { echo "<h2><a href='index.php?option=courses&view=edit'>Edit title and subtitle</a></h2>"; } // if (!empty($courses)) // { // foreach ($courses as $course) // { // courses_render($course); // } // } endContent(); endOfPage(); }
function subjects_render($subject) { h3($subject['Code'] . " -" . $subject['Name']); p("Building: " . $subject['Building'] . " " . $subject["Class"]); p("Imparted by: " . $subject['Professor']); p("Semester: " . $subject['Semester']); if (users_loggedIn()) { subjects_renderEnrollmentForm($subject); } }
function display_render($course) { h3("Number: " . $course['Course_number']); p("Name: " . $course['Name']); p("Description: " . $course['Description']); p("Hours: " . $course['Credit_hours']); if (users_loggedIn()) { disp_renderEnrollForm($course); disp_renderEnrollsForm($course); //echo '<a href="index.php?option=users&view=enrolls&user=$_SESSION">View enrollments</a>'.PHP_EOL; } }
function users_renderLoginForm() { if (!users_loggedIn()) { echo '<form action="index.php?option=home&view=login" method="post"> ' . PHP_EOL; echo ' <input type="text" placeholder="username" name="username"/>' . PHP_EOL; echo ' <input type="password" placeholder="password" name="password"/>' . PHP_EOL; echo ' <input type="submit" value="Login"/> ' . PHP_EOL; echo '</form> ' . PHP_EOL; } else { p("Welcome user!"); echo '<form action="index.php?option=home&view=logout" method="post"> ' . PHP_EOL; echo ' <input type="submit" value="Logout"/> ' . PHP_EOL; echo '</form> ' . PHP_EOL; } }
function admins_renderLoginForm() { if (!users_loggedIn()) { p("<h2>Welcome to IIT Web Site, please login as an admin</h2>"); echo '<form action="index.php?option=courses&view=loginAdm" method="post"> ' . PHP_EOL; echo ' <input type="text" placeholder="username" name="username"/><br>' . PHP_EOL; echo ' <input type="password" placeholder="password" name="password"/><br>' . PHP_EOL; echo ' <button type="submit" class="btn btn-success">Login</button> ' . PHP_EOL; echo '</form> ' . PHP_EOL; } else { p("<h2>Welcome professor!</h2>"); echo '<form action="index.php?option=courses&view=logout" method="post"> ' . PHP_EOL; echo ' <button type="submit" class="btn btn-danger">Logout</button> ' . PHP_EOL; echo '</form> ' . PHP_EOL; } }
function admins_renderLoginForm() { if (!users_loggedIn()) { p("Welcome to IIT Web Site, please login as an admin"); echo '<form action="index.php?option=store&view=loginAdm" method="post"> ' . PHP_EOL; echo ' <input type="text" placeholder="username" name="username"/>' . PHP_EOL; echo ' <input type="password" placeholder="password" name="password"/>' . PHP_EOL; echo ' <input type="submit" value="Login"/> ' . PHP_EOL; echo '</form> ' . PHP_EOL; } else { p("Welcome professor!"); echo '<form action="index.php?option=store&view=logout" method="post"> ' . PHP_EOL; echo ' <input type="submit" value="Logout"/> ' . PHP_EOL; echo '</form> ' . PHP_EOL; } }