<?php require 'ReadJson.php'; function printCourses($args) { $eb = new ReadJson(urlencode('https://www.eventbriteapi.com/v3/users/me/owned_events/?expand=category&status=live,started'), $args); if ($eb->getItems()) { echo $eb->pagination(); foreach ($eb->getItems() as $event) { echo "<div class=\"events\">"; echo "<h3>" . $event->name->html . "</h3>"; echo "<p>Places: " . $event->capacity . "</p>"; echo "<p>Date: " . date("l, j F, Y", strtotime($event->start->local)) . "</p>"; echo "<p>Starts: " . date("H:i", strtotime($event->start->local)) . "</p>"; echo "<p>Finishes: " . date("H:i", strtotime($event->end->local)) . "</p>"; echo "<p>Category: " . $event->category->name . "</p>"; echo "<a href=\"" . $event->url . "\">Book Now</a>"; echo "</div>"; } } else { echo "<div class=\"events\">"; echo "<h3>Please contact us for more information about the courses we have available</h3>"; echo "</div>"; } } $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1; $args = array('per_page' => 20, 'page' => $page); printCourses($args);
<meta charset="UTF-8"> <title>Nick Rose: Project (Web Programming)</title> <link rel="stylesheet" href="css/styles.css" type="text/css"> <link rel="shortcut icon" href="images/icon.ico" type="image/x-icon"> </head> <body> <div class="wrapper"> <br> <a href="logout.php"> <img class="signout" src="images/signout.png"> <p class="signoutText">Sign<br>out</p> </a> <h1>Congratulations, <span style="color: #F54F29;"><?php echo isset($_SESSION['firstName']) ? $_SESSION['firstName'] : $_COOKIE['firstName']; ?></span>!</h1> <h3 class="subtitle2">You have successfully enrolled <br>in the <span style="color: #F54F29;"><?php echo $_POST['programs']; ?></span> module</h3> <h3>Course(s) chosen:<br></h3> <h4><?php printCourses(); ?></h4> <a href="index.php"><img id="back" src="images/arrow.png"></a> <img id="sLogo" src="images/sheridan.png"> <p id="footnote">Nick Rose – Project: Web Programming – 4-16-2015</p> </div> <?php $_SESSION['programs'] = $_POST['programs']; $_SESSION['courses'] = implode(", ", $_POST['courses']); //grabs all student numbers from the database $sql = "SELECT studentnumber FROM `rosenich`.`students`"; $result = $conn->query($sql); $studentNumbersFromDB; //don't actually need to create the variable here, but I find it more readable this way if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) {
echo '<div id="rightcolumn">'; } } } for ($j = 0; $j < count($pagelayout[$i]); $j++) { switch ($pagelayout[$i][$j]) { case 0: if ($myrights > 10) { printCourses($page_teacherCourseData, _('Courses you\'re teaching'), 'teach'); } break; case 1: printCourses($page_tutorCourseData, _('Courses you\'re tutoring'), 'tutor'); break; case 2: printCourses($page_studentCourseData, _('Courses you\'re taking'), 'take'); break; case 10: printMessagesGadget(); break; case 11: printPostsGadget(); break; } } if ($i == 2 || $twocolumn) { echo '</div>'; } } require './footer.php'; function printCourses($data, $title, $type = null)