$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]);
} 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
/** * Process any sorting or pagination requests. */ events_process_sorting(); /** * Process any filter requests. */ events_process_filters($ACTION, "admin"); /** * Check if preferences need to be updated. */ preferences_update($MODULE, $PREFERENCES); /** * Fetch all of the events that apply to the current filter set. */ $learning_events = events_fetch_filtered_events($ENTRADA_USER->getActiveId(), $ENTRADA_USER->getActiveGroup(), $ENTRADA_USER->getActiveRole(), $ENTRADA_USER->getActiveOrganisation(), $_SESSION[APPLICATION_IDENTIFIER]["events"]["sb"], $_SESSION[APPLICATION_IDENTIFIER]["events"]["so"], $_SESSION[APPLICATION_IDENTIFIER]["events"]["dtype"], $_SESSION[APPLICATION_IDENTIFIER]["tmp"]["dstamp"], 0, $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"], true, isset($_GET["pv"]) ? (int) trim($_GET["pv"]) : 1, $_SESSION[APPLICATION_IDENTIFIER]["events"]["pp"], false, false); echo "<h1>" . $MODULES[strtolower($MODULE)]["title"] . "</h1>"; if (isset($_SESSION["export_error"]) && $_SESSION["export_error"]) { add_error($_SESSION["export_error"]); echo display_error(); } /** * Output the filter HTML. */ events_output_filter_controls("admin"); if ($ENTRADA_ACL->amIAllowed("event", "create", false)) { ?> <div class="row-fluid"> <span class="pull-right"> <a class="btn space-right" href="<?php echo ENTRADA_RELATIVE;
$SORT_BY = "`events`.`event_phase` " . strtoupper($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["so"]) . ", `events`.`event_start` ASC"; break; case "date": default: $SORT_BY = "`events`.`event_start` " . strtoupper($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["so"]); break; } /** * Provides the first parameter of MySQLs LIMIT statement by calculating which row to start results from. */ $limit_parameter = (int) ($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"] * $PAGE_CURRENT - $_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"]); foreach ($course_ids as $course_id) { $filters["course"][] = (int) trim($course_id, '\''); } $_SESSION[APPLICATION_IDENTIFIER]["community_page"][$COMMUNITY_ID]["filters"] = $filters; $results = events_fetch_filtered_events($ENTRADA_USER->getActiveId(), $ENTRADA_USER->getActiveGroup(), $ENTRADA_USER->getActiveRole(), $ENTRADA_USER->getActiveOrganisation(), $_SESSION[APPLICATION_IDENTIFIER]["community_page"]["sb"], $_SESSION[APPLICATION_IDENTIFIER]["community_page"]["so"], $_SESSION[APPLICATION_IDENTIFIER]["community_page"]["dtype"], $_SESSION[APPLICATION_IDENTIFIER]["tmp"]["dstamp"], 0, $filters, true, isset($_GET["pv"]) ? (int) trim($_GET["pv"]) : 1, $_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"], $COMMUNITY_ID); if ($results["events"]) { ?> <div class="tableListTop"> <img src="<?php echo ENTRADA_URL; ?> /images/lecture-info.gif" width="15" height="15" alt="" title="" style="vertical-align: middle" /> <?php switch ($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["dtype"]) { case "day": echo "Found " . $TOTAL_ROWS . " event" . ($TOTAL_ROWS != 1 ? "s" : "") . " that take place on <strong>" . date("D, M jS, Y", $DISPLAY_DURATION["start"]) . "</strong>.\n"; break; case "month": echo "Found " . $TOTAL_ROWS . " event" . ($TOTAL_ROWS != 1 ? "s" : "") . " that take place during <strong>" . date("F", $DISPLAY_DURATION["start"]) . "</strong> of <strong>" . date("Y", $DISPLAY_DURATION["start"]) . "</strong>.\n"; break;
*/ preferences_update($MODULE, $PREFERENCES); if (!isset($_GET["my_export_options"]) || !($csv_headings = json_decode($_GET["my_export_options"], true)) || !is_array($csv_headings) || !(sizeof($csv_headings) > 0)) { $_SESSION["export_error"] = "No fields selected for export."; application_log("error", "No fields selected for Event Export."); header("Location: " . ENTRADA_URL . "/admin/events"); } else { $_SESSION["export_error"] = ""; $_SESSION["my_export_options"] = $csv_headings; } $csv_delimiter = ","; $csv_enclosure = '"'; /** * Fetch all of the events that apply to the current filter set. */ $learning_events = events_fetch_filtered_events($ENTRADA_USER->getActiveId(), $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"], $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"], $ENTRADA_USER->getActiveOrganisation(), $_SESSION[APPLICATION_IDENTIFIER]["events"]["sb"], $_SESSION[APPLICATION_IDENTIFIER]["events"]["so"], $_SESSION[APPLICATION_IDENTIFIER]["events"]["dtype"], $_SESSION[APPLICATION_IDENTIFIER]["tmp"]["dstamp"], 0, $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"], false); if (!empty($learning_events["events"])) { /** * Clears all open buffers so we can return a plain response for the Javascript. */ ob_clear_open_buffers(); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=\"schedule-export-" . date("Y-m-d") . ".csv\""); header("Content-Transfer-Encoding: binary"); $fp = fopen("php://output", "w"); // Output CSV headings
function events_fetch_transversal_ids($event_id, $community_id) { global $ENTRADA_CACHE, $ENTRADA_USER; $transversal_ids = array(); $result_ids_map = $ENTRADA_CACHE->load(($community_id ? "community_" . $community_id . "_" : "") . "events_map_" . AUTH_APP_ID . "_" . $ENTRADA_USER->getID()); if (!$result_ids_map || !count($result_ids_map)) { $learning_events = events_fetch_filtered_events($ENTRADA_USER->getActiveId(), $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"], $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"], $ENTRADA_USER->getActiveOrganisation(), $_SESSION[APPLICATION_IDENTIFIER][$community_id ? "community_page" : "events"]["sb"], $_SESSION[APPLICATION_IDENTIFIER][$community_id ? "community_page" : "events"]["so"], $_SESSION[APPLICATION_IDENTIFIER][$community_id ? "community_page" : "events"]["dtype"], $_SESSION[APPLICATION_IDENTIFIER]["tmp"]["dstamp"], 0, $community_id && isset($_SESSION[APPLICATION_IDENTIFIER]["community_page"][$COMMUNITY_ID]["filters"]) ? $_SESSION[APPLICATION_IDENTIFIER]["community_page"][$COMMUNITY_ID]["filters"] : $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"], true, 1, 15, $community_id ? $community_id : false); if (!($result_ids_map = $ENTRADA_CACHE->load(($community_id ? "community_" . $community_id . "_" : "") . "events_map_" . AUTH_APP_ID . "_" . $ENTRADA_USER->getID()))) { $result_ids_map = array(); foreach ($learning_events["events"] as $event) { $result_ids_map[] = $event["event_id"]; } } } if (($result_id = array_search($event_id, $result_ids_map)) !== false) { if ($result_id > 0) { $transversal_ids["prev"] = $result_ids_map[$result_id - 1]; } if ($result_id < count($result_ids_map) - 1) { $transversal_ids["next"] = $result_ids_map[$result_id + 1]; } } return $transversal_ids; }
$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>"); } }