<?php
//2015-06-26 - nwmosses - added includes to display proper menu for logged in users
include_once("../php/common_functions.php"); //common functions in the course registartion system
include_once("../php/config.php"); //holds global config variables
$page_title = "Current Sessions";
include("../php/top.php"); //the HTML that outlines the top of the page
?>
<article class="ces-wide">
<div class="ces-header">
<?php include("../menu.php"); ?>
<h2><a href="//">CES Sessions</a><br>
<small class="ces-sub-heading grey">All sessions are offered at no cost.</small>
</h2>
</div>
<?php
//opens connection to database
$db = mysqli_connect($mysql_server, $user, $pass, $database);
$past = 0;
$session_past_or_future = " WHERE session.end_dt >= now()";
$order_by = " ORDER BY start_dt, course.course_name";
//show courses and related sessions
if(isset($_GET['p']) && $_GET['p'] == 'telehealth'){
$additional_session_criteria = " AND session.telehealth = 1";
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'non-telehealth' ){
$additional_session_criteria = " AND session.telehealth = 0";
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'in-person' ){
$additional_session_criteria = " AND session.online = 0 AND session.zoom = 0";
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'recorded' ){
$additional_session_criteria = " AND (session.online = 1 AND session.zoom = 0)";
$order_by = " ORDER BY session.end_dt, course.course_name";
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'zoom' ){
$additional_session_criteria = " AND (session.online = 0 AND session.zoom = 1)";
$order_by = " ORDER BY session.end_dt, course.course_name";
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'online' ){
$additional_session_criteria = " AND (session.online = 1 OR session.zoom = 1)";
$order_by = " ORDER BY session.end_dt, course.course_name";
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'past' ){
$session_past_or_future = " WHERE session.end_dt <= now()";
$additional_session_criteria = " AND DATE_ADD(session.end_dt, INTERVAL 3 MONTH) >= now() AND session.end_dt < now() ";
$order_by = " ORDER BY session.end_dt DESC, course.course_name";
$past = 1;
}//if
else{ //we are not filtering (show all)
$additional_session_criteria = "";
}//else
//2015-09-30 - nwmosses - updated to include session.open and session.display
$session_sql = mysqli_query($db, "SELECT course.course_id, course.course_name, course.course_description, session.session_id, session.telehealth, session.open, unix_timestamp(session.start_dt) as start_dt, unix_timestamp(session.end_dt) as end_dt, session.location_id, session.online
FROM ces_sessions session
LEFT OUTER JOIN ces_courses course ON course.course_id = session.course_id
LEFT OUTER JOIN ces_locations location ON location.location_id = session.location_id
$session_past_or_future
AND course.course_active = 1
-- AND location.location_name NOT LIKE '%online%'
-- AND session.online = 0
AND session.display = 1
$additional_session_criteria
$order_by");
echo "\n\t<div>";
?>
<div class="ces-filter-links">
<a href="/" title="CES Home"> <i class="fa fa-home" aria-hidden="true"></i> Home</a>
<a href="?p=all" class="first-filter <?php echo ((!isset($_GET['p']) || $_GET['p'] == 'all' || $_GET['p'] == '')? 'active-filter' : '');?>">
<i class="fa fa-calendar" aria-hidden="true"></i>
All Current Sessions
</a>
<a href="?p=recorded" <?php echo ((isset($_GET['p']) && $_GET['p'] == 'recorded')? 'class="active-filter"' : '');?>>
<i class="fa fa-desktop " aria-hidden="true"></i> Recorded
</a>
<a href="?p=webex" <?php echo ((isset($_GET['p']) && $_GET['p'] == 'webex')? 'class="active-filter"' : '');?>>
<i class="fa fa-tablet " aria-hidden="true"></i> ZOOM
</a>
<a href="?p=past" class="last-filter <?php echo ((isset($_GET['p']) && $_GET['p'] == 'past')? 'active-filter' : '');?>">
<i class="fa fa-clock-o" aria-hidden="true"></i>
Past Sessions
</a>
</div>
<?php
//display session instructions based on type
if(isset($_GET['p']) && $_GET['p'] == 'telehealth'){
echo '<div class="ces-session-instructions alert alert-info">
<a class="btn btn-block ces-blue-btn pull-right" href="instructions/telehealth.php"><i class="fa fa-info-circle " aria-hidden="true"></i> More Information</a>
<span><i class="fa fa-video-camera fa-fw fa-2x fa-pull-left orange" aria-hidden="true"></i> Telehealth/Video Conferencing is a way to access a session using specialized equipment. Telehealth/Video Conference sessions <strong>can not</strong> be viewed from a personal computer.</span>
</div>';
echo '<div class="ces-session-instructions alert alert-info">
<a class="btn btn-block ces-blue-btn pull-right" href="instructions/audioline.php"><i class="fa fa-info-circle " aria-hidden="true"></i> More Information</a>
<span><i class="fa fa-phone fa-2x fa-fw fa-pull-left green" aria-hidden="true"></i> Audioline is a way of accessing the session via your telephone. A session handout is typically provided which allows you to follow along.</span>
</div>';
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'non-telehealth' ){
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'in-person' ){
echo '<div class="ces-session-instructions alert alert-info">
<a class="btn btn-block ces-blue-btn pull-right" href="instructions/inperson.php"><i class="fa fa-info-circle " aria-hidden="true"></i> More Information</a>
<span><i class="fa fa-users fa-2x fa-fw fa-pull-left blue" aria-hidden="true"></i> In person sessions are held at a location within the Calgary area and your attendance is required.</span>
</div>';
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'recorded' ){
echo '<div class="ces-session-instructions alert alert-info">
<a class="btn btn-block ces-blue-btn pull-right" href="instructions/recorded.php"><i class="fa fa-info-circle " aria-hidden="true"></i> More Information</a>
<span><i class="fa fa-desktop fa-2x fa-fw fa-pull-left red" aria-hidden="true"></i> Recorded sessions are presented in the Windows Media Video (WMV) format. Internet Explorer and/or Windows Media Player is required to view these sessions.</span><br><br>
</div>
<br><br><font size="+2"><strong>Click <a href="https://youtube.com/playlist?list=PLi1tOF1I5ZoWtN4olLgPWHEoPP_7glMdP&si=8fqU-khFW7PD5Mes"> here </a>for past recorded presentations on the AHS YouTube channel</br></strong></font>';
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'webex' ){
echo '<div class="ces-session-instructions alert alert-info">
<span><i class="fa fa-tablet fa-2x fa-fw fa-pull-left green" aria-hidden="true"></i> Presentations are being broadcast using the ZOOM platform. Connect via your computer, smartphone, or tablet.</span>
</div>';
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'online' ){
echo '<div class="ces-session-instructions alert alert-info">
<a class="btn btn-block ces-blue-btn pull-right" href="instructions/recorded.php"><i class="fa fa-info-circle " aria-hidden="true"></i> More Information</a>
<span><i class="fa fa-desktop fa-2x fa-fw fa-pull-left red" aria-hidden="true"></i> Recorded sessions are presented in the Windows Media Video (WMV) format. Internet Explorer and/or Windows Media Player is required to view these sessions.</span>
</div>';
echo '<div class="ces-session-instructions alert alert-info">
<span><i class="fa fa-tablet fa-2x fa-fw fa-pull-left green" aria-hidden="true"></i> Presentations are being broadcast using the ZOOM platform. Connect via your computer, smartphone, or tablet.</span>
</div>';
}//if
elseif(isset($_GET['p']) && $_GET['p'] == 'past' ){
}//if
else{ //we are not filtering (show all)
}//else
//output the query results in html table format
if(mysqli_num_rows($session_sql) == 0){
echo "<div class='alert alert-success'>
<h3>No Sessions</h3>
<p>There are currently no sessions scheduled. Please <a href='https://ces.hmhc.ca/newsletter/'>register</a> to receive our newsletter and updates about future sessions.</p>
</div>\n";
}
else{
while ($session_query = mysqli_fetch_array($session_sql)) {
$session_full = is_session_full($session_query['session_id'], $session_query['location_id']);
$session_type = session_type($session_query['session_id']);
//replace 12:00 PM with Noon
$start_time = date('g:i A', $session_query["start_dt"]);
if ($start_time == "12:00 PM"){
$start_time = "Noon";
}
$end_time = date('g:i A', $session_query["end_dt"]);
if ($end_time == "12:00 PM"){
$end_time = "Noon";
}
$session_user_id = "&id=";
if (isset($_SESSION["userid"])){ $session_user_id = '&id='.$_SESSION["userid"];}
echo "<section class='presentation'>\n";
echo " <div class='ces-session-left'>\n";
echo " <div class='date'>\n";
if ($session_query['online'] && $past==1){
echo " <span class='day'>" . date('d', $session_query["end_dt"]) . "</span>\n";
echo " <span class='month'>" . date('M', $session_query["end_dt"]) . "</span>\n";
echo " <span class='year'>" . date('Y', $session_query["end_dt"]) . "</span>\n";
}
else{
echo " <span class='day'>" . date('d', $session_query["start_dt"]) . "</span>\n";
echo " <span class='month'>" . date('M', $session_query["start_dt"]) . "</span>\n";
echo " <span class='year'>" . date('Y', $session_query["start_dt"]) . "</span>\n";
}
echo " </div>\n";
echo " </div>\n";
echo " <div class='info ces-session-center' style='width:85%'>\n";
echo " <h3>". $session_query["course_name"] . "</h3>\n";
if ($session_query['online'] && $past==0 ){
echo " <p class='ces-course-time'>Available until: ". date('F j, Y', $session_query["end_dt"]) ." - ".$end_time. "</p>\n";
}
elseif ($session_query['online'] && $past==1){
echo " <p class='ces-course-time'>Online Course</p>\n";
}
else{
echo " <p class='ces-course-time'>". $start_time . " - ". $end_time . "</p>\n";
echo " <p class='ces-course-location'>";
output_map_link($session_query["location_id"]);
echo " </p>\n";
}
echo " <p class='ces-course-description'>". nl2br($session_query["course_description"]) ."</p>\n";
if(!$past){
session_icon($session_query["session_id"]);
}
echo " <p class='ces-session-files'>";
output_session_files($session_query['session_id'], "<br>");
echo "</p>\n";
//display Register, Registered, or Waiting List button
if($past == 0){
echo "<div style='padding-top:10px;'>";
if(is_user_logged_in()){
$registered_sql = mysqli_query($db, "SELECT session_id, id, on_waiting_list
FROM ces_course_registration
WHERE session_id = $session_query[session_id]
AND id = $_SESSION[userid]");
if(mysqli_num_rows($registered_sql) > 0){
$registered_query = mysqli_fetch_row($registered_sql);
if ($registered_query[2] == 0){
//registered, no waitlist
echo " <a class='btn btn-lg btn-primary btn-block ces-green-btn' href='../user/course-list/'><i class='fa fa-calendar-check-o fa-fw' aria-hidden='true'></i> Registered</a>\n";
}
elseif($registered_query[2] == 1){
//registed and on wait listed
echo " <a class='btn btn-lg btn-primary btn-block ces-green-btn' href='../user/course-list/'><i class='fa fa-clock-o fa-fw' aria-hidden='true'></i> On Waitlist</a>\n";
}
}
elseif(!is_session_open($session_query['session_id'])){
echo " <span class='btn ces-red-btn' title='Registration is currently closed for this session.' style='cursor:default;'><i class='fa fa-lock fa-fw' aria-hidden='true'></i> Registration Closed</span>\n";
}
elseif(is_session_cancelled($session_query['session_id'])){
echo " <span class='btn ces-red-btn' title='Registration is currently closed for this session.' style='cursor:default;'><i class='fa fa-exclamation-triangle fa-fw' aria-hidden='true'></i> Session Cancelled</span>\n";
}elseif($session_full && $session_type != 'recorded' && $session_type != 'webex'){
echo " <a class='btn ces-orange-btn' href='registration?session_id=" . $session_query["session_id"] . "&location_id=" . $session_query["location_id"] . $session_user_id . "&user_type=user'><i class='fa fa-calendar-plus-o fa-fw' aria-hidden='true'></i> Register on Waiting List</a>\n";
}
else{//display register buton
echo " <a class='btn ces-orange-btn' href='registration?session_id=" . $session_query["session_id"] . "&location_id=" . $session_query["location_id"] . $session_user_id . "&user_type=user'><i class='fa fa-calendar-plus-o fa-fw' aria-hidden='true'></i> Register</a>\n";
}
}
else{//no user logged in
echo " <a class='btn btn-lg ces-blue-btn' href='../login/'><i class='fa fa-sign-in fa-fw' aria-hidden='true'></i> Log in to Register</a>\n";
echo " <a class='btn btn-lg ces-green-btn' href='../registration/'><i class='fa fa-arrow-circle-right fa-fw' aria-hidden='true'></i> Create Account</a>\n";
}
echo " </div>\n";
}
echo " </div>\n";
echo "</section>\n\n";
} //while
}//else
?>
</article>
</section><!-- #middle-->
</div><!-- #wrapper -->
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>