<?php
$page_title = "List Instructors | 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 heading common to all pages in the CES admin module
?>
<article class="ces-admin">
<h2>CES Admin - List Instructors </h2>
<?php
include_once($_SERVER['DOCUMENT_ROOT'] . "/admin/php/nav-admin.php");
//opens connection to database
$db = mysqli_connect($mysql_server, $user, $pass, $database);
$instructor_sql = mysqli_query($db, "SELECT instructor_id, first_name, last_name, CASE active WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' ELSE '' END AS active FROM ces_instructors ORDER BY first_name, last_name");
echo "\n<table id='ces-instructor-table' class='table table-striped' border='0'>"; //table for instructors
//output the session column headings
echo "\n\t<thead><tr>";
echo "\n\t<th>First Name</th>";
echo "\n\t<th>Last Name</th>";
echo "\n\t<th>Active</th>";
echo "\n\t<th style='text-align:center;'>Sessions</th>";
echo "\n\t<th>Edit</th>";
echo "\n\t</tr></thead>";
echo "\n\t<tbody>";
//output the query results in html table format
$row_count = 0;
while ($instructor_query = mysqli_fetch_array($instructor_sql)) {
//2011-05-23 - wsopko - modified so could do table striping
//echo "\n<tr>\n";
echo "\n\t<tr>";
//2011-05-23 - wsopko - added class to TD tags so consistent with rest of system
echo "\n\t<td>" . $instructor_query["first_name"] . "</td>";
echo "\n\t<td>" . $instructor_query["last_name"] . "</td>";
echo "\n\t<td>" . $instructor_query["active"] . "</td>";
echo "\n\t<td style='text-align:center;'>" . instructors_sessions($instructor_query["instructor_id"]) . "</td>";
echo "\n\t<td class='ces-list-icons'><a href=edit.php?instructor_id=" . $instructor_query["instructor_id"] . " class='orange-icon'><span title='Edit Instructor' class='fa fa-edit fa-lg'></span></a></td>";
echo "\n\t</tr>";
} //while
echo "\n</tbody>";
echo "\n</table>";
?>
</article>
</section><!-- #middle-->
</div><!-- #wrapper -->
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>
<script type="text/javascript">
$(document).ready(function(){
$('#ces-instructor-table').DataTable({
paging:false,
searching:false,
info:false
});
});
</script>