Esempio n. 1
0
 * @author Unit: School of Medicine
 * @author Developer: Matt Simpson <*****@*****.**>
 * @copyright Copyright 2010 Queen's University. All Rights Reserved.
 *
*/
if (!defined("PARENT_INCLUDED") || !defined("IN_PUBLIC_QUIZZES")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
}
if ($RECORD_ID) {
    if ($QUIZ_TYPE == "event") {
        $quiz = Models_Quiz_Attached_Event::fetchRowByID($RECORD_ID);
    } else {
        $quiz = Models_Quiz_Attached_CommunityPage::fetchRowByID($RECORD_ID);
    }
    $quiz_record = $quiz->toArray();
    if ($quiz_record) {
        if ($QUIZ_TYPE == "event") {
            $query = "\tSELECT e.*, c.`organisation_id`\n\t\t\t\t\t\tFROM `events` e\n\t\t\t\t\t\tJOIN `courses` c\n\t\t\t\t\t\tON e.`course_id` = c.`course_id`\n\t\t\t\t\t\tWHERE e.`event_id` = " . $db->qstr($quiz_record["content_id"]);
            $result = $db->GetRow($query);
            $BREADCRUMB[] = array("url" => ENTRADA_URL . "/events?id=" . $quiz_record["content_id"], "title" => limit_chars($quiz_record["content_title"], 32));
        } else {
            $BREADCRUMB[] = array("url" => ENTRADA_URL . "/community" . $quiz_record["community_url"] . ":" . $quiz_record["page_url"], "title" => limit_chars($quiz_record["content_title"], 32));
        }
        $BREADCRUMB[] = array("url" => ENTRADA_URL . "/" . $MODULE . "?section=attempt" . (isset($QUIZ_TYPE) && $QUIZ_TYPE == "community_page" ? "&community=true" : "") . "&id=" . $RECORD_ID, "title" => limit_chars($quiz_record["quiz_title"], 32));
        if ($result && $ENTRADA_ACL->amIAllowed(new EventResource($quiz_record["content_id"], $result['course_id'], $result['organisation_id']), 'read')) {
            /**
             * Providing there is no release date, or the release date is in the past
             * on both the quiz and the event, allow them to continue.