Beispiel #1
0
/**
 * show_user($params) 
 *
 * Shows all the courses that belong to the currently logged in user.
 *
 * @param (Array) $params - The parameters submitted from POST
 * @return (array) 
 */
function my_courses($ObjectPDO)
{
    //The student ID will be received by the user session
    if (userSignedIn()) {
        $student_id = $_SESSION['id'];
    } else {
        die("You must be signed in to see this page");
    }
    $user = new User($ObjectPDO);
    $results = $user->get_user_classes($student_id);
    $course_detail = $result;
    return $results;
}
Beispiel #2
0
function my_courses($ObjectPDO)
{
    if (userSignedIn()) {
        $user_id = $_SESSION['id'];
        $course = new Course($ObjectPDO);
        $categories = $course->get_registered_courses($user_id);
        // $categories = scrub_array_output($categories); // Scrub Output
        scrub_array_output($categories);
        // Scrub Output with html entities
        return $categories;
    } else {
        header("Location:" . course_route("course_category"));
    }
}
Beispiel #3
0
		<?php 
}
?>


		<div class="main_nav--item__menu-button">
			<div class="main_nav--menu-button">
				<div class="menu-button--bar"> </div>
				<div class="menu-button--bar"> </div>
				<div class="menu-button--bar"> </div>
			</div>

			<nav class="main_subnav"> 

				<?php 
if (userSignedIn()) {
    ?>
					<a class="main_subnav--item" href="<?php 
    echo user_route('my-courses');
    ?>
"> My Courses </a>
					<a class="main_subnav--item" href="<?php 
    echo user_route('sign-out');
    ?>
"> Sign Out</a>
					<a class="main_subnav--item" href="http://www.calendarwiz.com/reo"> Calendar </a>
					<a class="main_subnav--item" href="<?php 
    echo user_route('edit');
    ?>
"> My Profile </a>
				<?php 
Beispiel #4
0
/**
 * display_alert()
 *
 * Shows message added to session's "flash_message" array
 *
 * DEPENDS ON IS SIGNED IN userSignedIn() function
 *
 * @param (String) set the message type as "Alert", "Notice", "Success", or "Error"
 * @param (boolean) whether or not to remove the session variable after showing the message
 * @return (boolean)
 *
 */
function display_alert($type, $clearMessage = true)
{
    if (isset($_SESSION['flash_message'][$type])) {
        foreach ($_SESSION['flash_message'][$type] as $message) {
            echo "<div class='alert'>";
            echo $message;
            echo "</div>";
        }
        // clear message from session
        if ($clearMessage) {
            // Clear the contents of the flash messages
            unset($_SESSION['flash_message']);
            //If ther user isn't signed in then close the session
            if (!userSignedIn()) {
                unset($_SESSION);
            }
        }
        return true;
    } else {
        return false;
    }
}