<?php
include_once("../../php/common_functions.php"); //common functions in the course registartion system
include_once("../../php/config.php"); //holds global config variables
$db = mysqli_connect($mysql_server, $user, $pass, $database);
$page_title = get_course_name($_GET['id']); //Leaving Blank will result in '<title>Community Education Service | The Family & Community Resource Centre</title>'
include("../../php/top.php"); //the HTML that outlines the top of the page
//include($_SERVER['DOCUMENT_ROOT'] . "/ces/ces_nav.php"); //get the HTML nav common to all CES public pages
?>
<article class="ces-wide">
<div class="ces-header">
<?php include("../../menu.php"); ?>
<h2>CES - Online Session<br>
<small class="ces-sub-heading grey">All sessions are offered at no cost.</small>
</h2>
<?php
if(!isset($_GET['id']) || !($_GET['id'] > '')){
//no session_id given
//display error
echo "\n<p class='alert alert-error'>No session information was given.</p>\n";
}
elseif(!is_user_logged_in()){
//user is not logged in
//show login in link
echo "\n<p class='alert alert-info'>This session is avalible only to registered users.<br>
<a href='../../login/'>Please log in</a>.</p>\n";
}
elseif(has_session_ended($_GET['id'])){
//session has ended
echo "\n<p class='alert alert-info'>This session has ended.<br>
Please view the <a href='../../sessions/?p=online'>current online sessions</a> being offered.</p>\n";
}
elseif(!is_user_registered($_SESSION['userid'], $_GET['id'])){
//user is not registered
//show link to course registration page (current and online) as well as 'your courses'
echo "\n<p class='alert alert-info'>You are not registered for this session.<br>
Please view <a href='../../user/course-list/'>Your Courses</a> for an updated list of your registered courses.</p>\n";
}elseif(!is_session_online($_GET['id'])){
//this is not an online session
//show link for 'your courses'
echo "\n<p class='alert alert-error'>This is not an online session.<br>
Please view <a href='../../user/course-list/'>Your Courses</a> for an updated list of your registered courses.</p>\n";
}else{
//display video
?>
<h3><?php echo get_course_name($_GET['id'])?></h3>
<OBJECT ID="MediaPlayer" WIDTH="640" HEIGHT="500" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="<?php echo get_session_link($_GET['id'])?>">
<PARAM name="autostart" VALUE="false">
<PARAM name="ShowControls" VALUE="true">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
</OBJECT>
<p class="alert alert-info"><strong>Download Video:</strong> <a href="<?php echo get_session_link($_GET['id'])?>"><?php echo get_course_name($_GET['id'])?></a></p>
<?php }//end display video ?>
</article>
</section><!-- #middle-->
</div><!-- #wrapper -->
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>