} break; case 2: // This Term // This Term default: if (date("n", time()) <= 6) { $DISPLAY_DURATION["start"] = mktime(0, 0, 0, 1, 1, date("Y", time())); $DISPLAY_DURATION["end"] = mktime(0, 0, 0, 6, 30, date("Y", time())); } else { $DISPLAY_DURATION["start"] = mktime(0, 0, 0, 7, 1, date("Y", time())); $DISPLAY_DURATION["end"] = mktime(0, 0, 0, 12, 31, date("Y", time())); } break; } $results = events_fetch_filtered_events($ENTRADA_USER->getActiveId(), $ENTRADA_USER->getActiveGroup(), $ENTRADA_USER->getActiveRole(), $ENTRADA_USER->getActiveOrganisation(), "date", "asc", "custom", $DISPLAY_DURATION["start"], $DISPLAY_DURATION["end"], events_filters_defaults($ENTRADA_USER->getActiveId(), $ENTRADA_USER->getActiveGroup(), $ENTRADA_USER->getActiveRole(), $ENTRADA_USER->getActiveOrganisation()), false, 0, 0, 0, false); $TOTAL_ROWS = count($results["result_ids_map"]); ?> <table style="width: 100%" cellspacing="0" cellpadding="0" border="0" summary="Weekly Student Calendar"> <tr> <td style="padding-bottom: 3px; text-align: left; vertical-align: middle; white-space: nowrap"> <h1>My Teaching Events</h1> </td> <td style="padding-bottom: 3px; text-align: right; vertical-align: middle; white-space: nowrap"> <form id="dlength_form" action="<?php echo ENTRADA_RELATIVE; ?> " method="get"> <label for="dlength" class="content-small">Events taking place:</label> <select id="dlength" name="dlength" onchange="document.getElementById('dlength_form').submit()"> <option value="1"<?php
/** * Function used by public events and admin events index to process the provided filter settings. */ function events_process_filters($action = "", $module_type = "") { global $ENTRADA_USER; /** * Determine whether or not this is being called from the admin section. */ if ($module_type == "admin") { $module_type = "/admin"; } else { $module_type = ""; } /** * Handles any page actions for this module. */ switch ($action) { case "filter_add": if (isset($_GET["filter"])) { $pieces = explode("_", clean_input($_GET["filter"], array("nows", "lower", "notags"))); $filter_key = $pieces[0]; $filter_value = $pieces[1]; if ($filter_key && $filter_value) { $key = 0; if (!is_array($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key]) || !in_array($filter_value, $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key])) { /** * Check to see if this is a student attempting to view the calendar of another student. */ if ($filter_key != "student" || $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] != "student" || $filter_value == $ENTRADA_USER->getActiveId()) { $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key][] = $filter_value; ksort($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } } } } $_SERVER["QUERY_STRING"] = replace_query(array("action" => false, "filter" => false)); break; case "filter_edit": if (isset($_GET["filter"])) { $filters = explode(",", clean_input($_GET["filter"], array("nows", "lower", "notags"))); if (isset($filters[1])) { $pieces = explode("_", $filters[0]); $filter_key = $pieces[0]; unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key]); foreach ($filters as $filter) { $pieces = explode("_", $filter); $filter_value = $pieces[1]; if ($filter_key != "student" || $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] != "student" || $filter_value == $ENTRADA_USER->getActiveId()) { $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key][] = $filter_value; ksort($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } } } else { $pieces = explode("_", $filters[0]); $filter_key = $pieces[0]; $filter_value = $pieces[1]; if ($filter_value && $filter_key) { //This is an actual filter, cool dude. Erase everything else since we only got one and add this one if its not a student looking at another student if ($filter_key != "student" || $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] != "student" || $filter_value == $ENTRADA_USER->getActiveId()) { unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key]); $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_key][] = $filter_value; ksort($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } } else { // This is coming from the select box and nothing was selected, so erase. $filter_type = clean_input($_GET["filter_type"], array("nows", "lower", "notags")); if (is_array($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_type])) { unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_type]); } } } ksort($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } $_SERVER["QUERY_STRING"] = replace_query(array("action" => false, "filter" => false)); break; case "filter_remove": if (isset($_GET["filter"])) { $pieces = explode("_", clean_input($_GET["filter"], array("nows", "lower", "notags"))); $filter_type = $pieces[0]; $filter_key = $pieces[1]; if ($filter_type && $filter_key != "" && isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_type][$filter_key])) { unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_type][$filter_key]); if (!@count($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_type])) { unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"][$filter_type]); } ksort($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } } $_SERVER["QUERY_STRING"] = replace_query(array("action" => false, "filter" => false)); break; case "filter_removeall": if (isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"])) { unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } $_SERVER["QUERY_STRING"] = replace_query(array("action" => false, "filter" => false)); break; case "filter_defaults": /** * If this is the first time this page has been loaded, lets setup the default filters. */ if (!isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filter_defaults_set"])) { $_SESSION[APPLICATION_IDENTIFIER]["events"]["filter_defaults_set"] = true; } /** * First unset any previous filters if they exist. */ if (isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"])) { unset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]); } $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"] = events_filters_defaults($ENTRADA_USER->getActiveId(), $ENTRADA_USER->getActiveGroup(), $ENTRADA_USER->getActiveRole()); $_SERVER["QUERY_STRING"] = replace_query(array("action" => false, "filter" => false)); break; default: continue; break; } if (!isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filter_defaults_set"])) { header("Location: " . ENTRADA_URL . $module_type . "/events?action=filter_defaults"); exit; } }
$details["organisation_id"] = $user_organisation_id; $ENTRADA_ACL = new Entrada_Acl($details); } if ($user_proxy_id) { $event_start = strtotime("-12 months 00:00:00"); $event_finish = strtotime("+12 months 23:59:59"); if (isset($_GET["start"]) && ($tmp_input = clean_input($_GET["start"], array("trim", "int")))) { $event_start = $tmp_input; } if (isset($_GET["end"]) && ($tmp_input = clean_input($_GET["end"], array("trim", "int")))) { $event_finish = $tmp_input; } if ($user_group == "faculty" || $user_group == "staff" || $user_group == "medtech") { $learning_events = events_fetch_filtered_events($user_proxy_id, $user_group, $user_role, $user_organisation_id, "date", "asc", "custom", $event_start, $event_finish, events_filters_faculty($seleted_course, $user_group, $user_role), true, 1, 1750, 0, $user_group == "student" ? true : false); } else { $learning_events = events_fetch_filtered_events($user_proxy_id, $user_group, $user_role, $user_organisation_id, "date", "asc", "custom", $event_start, $event_finish, events_filters_defaults($user_proxy_id, $user_group, $user_role, 0, $seleted_course), true, 1, 1750, 0, $user_group == "student" ? true : false); } if ($ENTRADA_ACL->amIAllowed("clerkship", "read")) { $query = "\tSELECT c.*\n\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`events` AS a\n\t\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`event_contacts` AS b\n\t\t\t\t\tON b.`event_id` = a.`event_id`\n\t\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations` AS c\n\t\t\t\t\tON c.`rotation_id` = a.`rotation_id`\n\t\t\t\t\tWHERE a.`event_finish` >= " . $db->qstr(strtotime("00:00:00")) . "\n\t\t\t\t\tAND (a.`event_status` = 'published' OR a.`event_status` = 'approval')\n\t\t\t\t\tAND b.`econtact_type` = 'student'\n\t\t\t\t\tAND b.`etype_id` = " . $db->qstr($user_proxy_id) . "\n\t\t\t\t\tORDER BY a.`event_start` ASC"; $clerkship_schedule = $db->GetRow($query); if (isset($clerkship_schedule) && $clerkship_schedule && $clerkship_schedule["rotation_id"] != MAX_ROTATION) { $course_id = $clerkship_schedule["course_id"]; $course_ids = array(); $query = "SELECT `course_id` FROM `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations`\n\t\t\t\t\tWHERE `course_id` <> " . $db->qstr($course_id) . "\n\t\t\t\t\tAND `course_id` <> 0"; $course_ids_array = $db->GetAll($query); foreach ($course_ids_array as $id) { $course_ids[] = $id; } foreach ($learning_events["events"] as $key => $event) { if (array_search($event["course_id"], $course_ids) !== false) { unset($learning_events["events"][$key]);
$event_finish = strtotime("+12 months 23:59:59"); /*$learning_events = events_fetch_filtered_events( $user_proxy_id, $user_group, $user_role, $user_organisation_id, "date", "asc", "custom", $event_start, $event_finish, events_filters_defaults($user_proxy_id, $user_group, $user_role), true, 1, 1750);*/ $learning_events = events_fetch_filtered_events($ENTRADA_USER->getActiveId(), $user_group, $user_role, $ENTRADA_USER->getActiveOrganisation(), "date", "asc", "custom", $event_start, $event_finish, events_filters_defaults($ENTRADA_USER->getActiveId(), $user_group, $user_role, $ENTRADA_USER->getActiveOrganisation()), false, 0, 0, 0, false); $events = array(); if (!empty($learning_events["events"])) { foreach ($learning_events["events"] as $drid => $event) { $cal_type = 1; $cal_updated = ""; if ($event["audience_type"] == "proxy_id") { $cal_type = 3; } if ((int) $event["last_visited"] && (int) $event["last_visited"] < (int) $event["updated_date"]) { $cal_type = 2; $cal_updated = date(DEFAULT_DATE_FORMAT, $event["updated_date"]); } $events[] = array("id" => $event["event_id"], "start_date" => date("o-m-d G:i", $event["event_start"]), "end_date" => date("o-m-d G:i", $event["event_finish"]), "text" => strip_tags($event["event_title"]), "details" => $event["event_description"] . "<br /><b>Event Duration: </b>" . $event["event_duration"] . " minutes <br /><b>Location: </b>" . ($event["event_location"] == "" ? "To be announced" : $event["event_location"]) . "<br /><br /><a href='#' data-role='button' class='back' onclick='window.open(\"" . ENTRADA_URL . "/events?rid=" . $event['event_id'] . "\", \"_blank\", \"location=yes\");'>Review Learning Event</a><br><br><br>"); } }