<?php
$page_title = "User Course List | CES Admin";
include_once($_SERVER['DOCUMENT_ROOT'] . "/php/common_functions.php"); //common functions in the course registartion system
include_once($_SERVER['DOCUMENT_ROOT'] . "/php/config.php"); //holds global config variables
check_if_authenticated('admin');//check if user is logged in
include_once($_SERVER['DOCUMENT_ROOT'] . "/admin/php/top-admin.php"); //get the HTML nav common to all pages in the CES admin module
$db = mysqli_connect($mysql_server, $user, $pass, $database);
$sql = mysqli_query($db, "SELECT user.id, user.email, first_name.value as first_name, last_name.value as last_name
FROM phplist_user_user user
LEFT OUTER JOIN phplist_user_user_attribute first_name ON user.id = first_name.userid AND first_name.attributeid = '1'
LEFT OUTER JOIN phplist_user_user_attribute last_name ON user.id = last_name.userid AND last_name.attributeid = '2'
WHERE id = $_GET[id]");
//output the query results in html table format
$attendee_name = "User ".$_GET['id'];
while ($search_query = mysqli_fetch_array($sql)) {
$attendee_name = $search_query["first_name"] . " " . $search_query["last_name"];
}
?>
<article class="ces-admin">
<h2>CES Admin - User Course List</h2>
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/admin/php/nav-admin.php");
?>
<h3><?php echo $attendee_name; ?>'s Registered Sessions</h3>
<?php
//open connection to database
//output any sessions that user is registered in
output_registered_sessions($_GET['id']);
echo "<h3>".$attendee_name."'s Past Registered Sessions</h3>";
output_past_registered_sessions($_GET['id']);
?>
</article>
</section><!-- #middle-->
</div><!-- #wrapper -->
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>