* @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.
<?php } else { ?> <a href="<?php echo ENTRADA_URL; ?> /admin/<?php echo $MODULE; ?> ?section=attach&community=true&id=<?php echo $RECORD_ID; ?> " class="btn btn-success pull-right"><i class="icon-plus-sign icon-white"></i> Attach To Community Page</a> <div class="clear" style="margin-bottom: 15px"></div> <?php $community_page_attachments = Models_Quiz_Attached_CommunityPage::fetchAllByQuizID($RECORD_ID); if ($community_page_attachments) { ?> <table class="tableList" cellspacing="0" summary="List of Community Pages"> <colgroup> <col class="modified" /> <col class="title" /> <col class="title" /> <col class="completed" /> </colgroup> <thead> <tr> <td class="modified"> </td> <td class="title sortedASC">Community Page</td> <td class="title">Quiz Title</td> <td class="completed">Completed</td>
if ($result) { $PROCESSED["page_ids"][] = $tmp_input; } } } } } $quiz_types_record = array(); $quiz_types = Models_Quiz_QuizType::fetchAllRecords(); if ($quiz_types) { foreach ($quiz_types as $quiz_type) { $quiz_types_record[$quiz_type->getQuizTypeID()] = array("quiztype_title" => $quiz_type->getQuizTypeTitle(), "quiztype_description" => $quiz_type->getQuizTypeDescription(), "quiztype_order" => $quiz_type->getQuizTypeOrder()); } } $existing_page_relationship = array(); $attached_pages = Models_Quiz_Attached_CommunityPage::fetchAllByQuizID($RECORD_ID); if ($attached_events) { foreach ($attached_pages as $attached_page) { $existing_page_relationship[] = $attached_page->getCommunityID(); } } $default_event_start = 0; $default_event_finish = 0; $selected_community_pages = array(); if (count($PROCESSED["page_ids"]) > 0) { $query = "\tSELECT a.`cpage_id`, CONCAT('[', b.`community_title`, '] ', a.`page_title`) AS `page_title`\n\t\t\t\t\t\t\t\t\tFROM `community_pages` AS a\n\t\t\t\t\t\t\t\t\tJOIN `communities` AS b\n\t\t\t\t\t\t\t\t\tON a.`community_id` = b.`community_id`\n\t\t\t\t\t\t\t\t\tWHERE `cpage_id` IN (" . implode(", ", $PROCESSED["page_ids"]) . ")"; $results = $db->Execute($query); if ($results) { foreach ($results as $result) { $selected_community_pages[$result["cpage_id"]] = array("page_title" => $result["page_title"]); }