foreach ($prevResult as $prev) { //Find the application that corresponds to this course by the time_stamp $currentApp = find_app_by_time($appArray, $prev['time_stamp']); //Add the course to the application object $currentApp->add_prev_ta($prev['department'], $prev['number'], $prev['name'], $prev['ta_experience']); } /* Query for info for requested courses to TA and add it to the Application object as well */ $reqQuery = "SELECT Courses_Info.number, Courses_Info.name, Courses_Info.blurb,\n\tCourses_Info.department, Request_TA_Courses.ta_info, Request_TA_Courses.time_stamp\n\tFROM (Courses_Info JOIN Request_TA_Courses\n\tON Courses_Info.number = Request_TA_Courses.number)\n\tWHERE uID = :uid"; $reqStmt = $dbh->prepare($reqQuery); $reqStmt->bindParam(':uid', $_SESSION['uid'], PDO::PARAM_STR); $reqStmt->execute(); $reqResult = $reqStmt->fetchAll(PDO::FETCH_ASSOC); /* Add the Requested TA courses to the correct Application object */ foreach ($reqResult as $req) { //Find the application that corresponds to this course by the time_stamp $currentApp = find_app_by_time($appArray, $req['time_stamp']); //Add the course to the application object $currentApp->add_request_ta($req['number'], $req['name'], $req['ta_info']); } //Now that everything has been added to all the Application objects, put the array into a session variable $_SESSION['applications'] = $appArray; /* Pull the student's recommend level for existing TA applications */ $query = "SELECT class_request, recommend FROM TA_Applicants WHERE uID = :uid;"; $stmt = $dbh->prepare($query); $stmt->bindParam(':uid', $_SESSION['uid'], PDO::PARAM_STR); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); //Get the User object for this user from the session variable $user = $_SESSION['user']; //Clear out any existing status arrays for the user $user->clear_app_status_array();
--> <?php /*Require classes and start the session*/ require "classes/user.php"; require "classes/course.php"; require "classes/application.php"; session_start(); require_once "inc/helper/functions.php"; if (!verify_role('applicant')) { $_SESSION['requestedPage'] = 'Location: appForm.php'; $_SESSION['needsLoginApp'] = true; header('Location: login.php'); } /*Find the application selected by the user*/ $selectedApp = find_app_by_time($_SESSION['applications'], $_GET['time']); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Blake McGillis - Application Display</title> <meta name="author" content="Blake McGillis"> <meta name="date" content="March 21, 2015"> <meta name="phase" content="7"> <link rel="stylesheet" href="styles/styles.css"/> <link rel="stylesheet" href="styles/TAStyles.css"/> </head> <body> <!--Main content-->