function add_mspr_admin_sidebar($year)
{
    $sidebar_html = "<ul class=\"menu\">";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/mspr?section=mspr-options&year=" . $year . "\">Class of " . $year . " MSPR Options</a></li>\n";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/mspr?mode=year&year=" . $year . "\">Manage Class of " . $year . " MSPRs</a></li>\n";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/mspr?mode=all\">Manage All MSPRs Requiring Attention</a></li>\n";
    $sidebar_html .= "</ul>";
    new_sidebar_item("MSPR Admin", $sidebar_html, "mspr-admin-nav", "open");
}
function add_manage_user_sidebar()
{
    global $ENTRADA_ACL, $PROXY_ID;
    $baseurl = ENTRADA_URL . "/admin/users";
    $sidebar_html = "<ul class=\"menu\">";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/users/metadata\">Manage User Meta Data</a></li>\n";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/mspr\">Manage MSPRs</a></li>\n";
    $sidebar_html .= "</ul>";
    new_sidebar_item("User Management", $sidebar_html, "user-management-nav", "open");
}
function add_mspr_management_sidebar()
{
    global $ENTRADA_ACL, $PROXY_ID;
    $user = User::get($PROXY_ID);
    $year = $user->getGradYear();
    $sidebar_html = "<ul class=\"menu\">";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/users/manage/students?section=mspr-options&id=" . $PROXY_ID . "\">MSPR Options</a></li>\n";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/users/manage/students?section=mspr-revisions&id=" . $PROXY_ID . "\">MSPR File Revisions</a></li>\n";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/mspr?mode=year&year=" . $year . "\">Manage Class of " . $year . " MSPRs</a></li>\n";
    $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/mspr?mode=all\">Manage All MSPRs Requiring Attention</a></li>\n";
    $sidebar_html .= "</ul>";
    new_sidebar_item("MSPR Management", $sidebar_html, "mspr-management-nav", "open");
}
                <script type="text/javascript">
                $$('select.ed_select_off').each(function(el) {
                    $(el).disabled = true;
                    $(el).fade({ duration: 0.3, to: 0.25 });
                });
                </script>
                <?php 
                /**
                 * Sidebar item that will provide the links to the different sections within this page.
                 */
                $sidebar_html = "<ul class=\"menu\">\n";
                $sidebar_html .= "\t<li class=\"link\"><a href=\"#event-details-section\" onclick=\"\$('event-details-section').scrollTo(); return false;\" title=\"Event Details\">Event Details</a></li>\n";
                $sidebar_html .= "\t<li class=\"link\"><a href=\"#event-objectives-section\" onclick=\"\$('event-objectives-section').scrollTo(); return false;\" title=\"Event Objectives\">Event Objectives</a></li>\n";
                $sidebar_html .= "\t<li class=\"link\"><a href=\"#event-resources-section\" onclick=\"\$('event-resources-section').scrollTo(); return false;\" title=\"Event Resources\">Event Resources</a></li>\n";
                $sidebar_html .= "</ul>\n";
                new_sidebar_item("Page Anchors", $sidebar_html, "page-anchors", "open", "1.9");
            }
        } else {
            $ERROR++;
            $ERRORSTR[] = "In order to edit a event you must provide a valid event identifier. The provided ID does not exist in this system.";
            echo display_error();
            application_log("notice", "Failed to provide a valid event identifer when attempting to edit a event.");
        }
    } else {
        $ERROR++;
        $ERRORSTR[] = "In order to edit a event you must provide the events identifier.";
        echo display_error();
        application_log("notice", "Failed to provide event identifer when attempting to edit a event.");
    }
}
						</div>
                        <?php 
                        if (isset($recurring_events) && $recurring_events) {
                            $sidebar_html = "<div class=\"content-small\">Please select which fields (if any) you would like to apply to related recurring events: </div>\n";
                            $sidebar_html .= "<div class=\"pad-left\">\n";
                            $sidebar_html .= "  <ul class=\"menu none\">\n";
                            $sidebar_html .= "      <li><input type=\"checkbox\" value=\"course\" id=\"cascade_course\" onclick=\"toggleRecurringEventField(this.checked, jQuery(this).val())\" class=\"update-recurring-checkbox\" name=\"update_recurring_fields[]\" /> <label for=\"cascade_course\">Course</label></li>\n";
                            $sidebar_html .= "      <li><input type=\"checkbox\" value=\"event_title\" id=\"cascade_event_title\" onclick=\"toggleRecurringEventField(this.checked, jQuery(this).val())\" class=\"update-recurring-checkbox\" name=\"update_recurring_fields[]\" /> <label for=\"cascade_event_title\">Event Title</label></li>\n";
                            $sidebar_html .= "      <li><input type=\"checkbox\" value=\"event_location\" id=\"cascade_event_location\" onclick=\"toggleRecurringEventField(this.checked, jQuery(this).val())\" class=\"update-recurring-checkbox\" name=\"update_recurring_fields[]\" /> <label for=\"cascade_event_location\">Event Location</label></li>\n";
                            $sidebar_html .= "      <li><input type=\"checkbox\" value=\"event_types\" id=\"cascade_event_types\" onclick=\"toggleRecurringEventField(this.checked, jQuery(this).val())\" class=\"update-recurring-checkbox\" name=\"update_recurring_fields[]\" /> <label for=\"cascade_event_types\">Event Types</label></li>\n";
                            $sidebar_html .= "      <li><input type=\"checkbox\" value=\"associated_faculty\" id=\"cascade_associated_faculty\" onclick=\"toggleRecurringEventField(this.checked, jQuery(this).val())\" class=\"update-recurring-checkbox\" name=\"update_recurring_fields[]\" /> <label for=\"cascade_associated_faculty\">Associated Faculty</label></li>\n";
                            $sidebar_html .= "      <li><input type=\"checkbox\" value=\"associated_learners\" id=\"cascade_associated_learners\" onclick=\"toggleRecurringEventField(this.checked, jQuery(this).val())\" class=\"update-recurring-checkbox\" name=\"update_recurring_fields[]\" /> <label for=\"cascade_associated_learners\">Associated Learners</label></li>\n";
                            $sidebar_html .= "  </ul>\n";
                            $sidebar_html .= "</div>\n";
                            $sidebar_html .= "<div><strong><a href=\"#recurringEvents\" data-toggle=\"modal\" data-target=\"#recurringEvents\"><i class=\"icon-edit\"></i> <span id=\"recurring_events_count\">" . (isset($_POST["recurring_event_ids"]) && @count($_POST["recurring_event_ids"]) ? @count($_POST["recurring_event_ids"]) : @count($recurring_events)) . "</span> Recurring Events Selected</a></strong></div>";
                            new_sidebar_item("Recurring Events", $sidebar_html, "recurring-events-sidebar");
                            ?>
                            <style type="text/css">
                                #recurring-events-sidebar.fixed {
                                    position: fixed;
                                    top: 20px;
                                    z-index: 1;
                                    width: 225px;
                                    border-bottom: 5px solid #ffffff;
                                }
                                #recurring-events-sidebar .panel-head {
                                    background: linear-gradient(to bottom, #8A0808 0%, #3B0B0B 100%);
                                }

                            </style>
                            <script type="text/javascript">
if ($target_evaluations) {
    foreach ($target_evaluations as $target_evaluation) {
        if (isset($target_evaluation["allow_target_request"]) && $target_evaluation["allow_target_request"]) {
            $request_evaluations[] = $target_evaluation;
        }
    }
}
$query = "SELECT * FROM `evaluation_requests` AS a\n            JOIN `evaluations` AS b\n            ON a.`evaluation_id` = b.`evaluation_id`\n            WHERE `target_proxy_id` = " . $db->qstr($ENTRADA_USER->getID()) . "\n            AND `request_code` IS NOT NULL\n            AND (\n                `request_expires` = 0\n                OR `request_expires` > " . $db->qstr(time()) . "\n            )";
$requested_evaluations = $db->GetAll($query);
if (isset($requested_evaluations) && count($requested_evaluations)) {
    $sidebar_html = "<form method=\"post\" action=\"" . ENTRADA_RELATIVE . "/evaluations?section=attempt\">\n";
    $sidebar_html .= "\t<label class=\"form-nrequired\" for=\"request_code\">Request Code: </label>";
    $sidebar_html .= "  <input type=\"text\" id=\"request_code\" name=\"request_code\">";
    $sidebar_html .= "\t<br /><br /><input type=\"submit\" class=\"btn btn-small btn-primary\" value=\"Submit\" />";
    $sidebar_html .= "</form>";
    new_sidebar_item("Fulfill an Evaluation Request", $sidebar_html, "evaluation-request-code", "open", "1.9");
}
if (isset($request_evaluations) && count($request_evaluations)) {
    $HEAD[] = "\n\t<script type=\"text/javascript\">\n\t\tfunction loadEvaluators(evaluation_id) {\n\t\t\tnew Ajax.Updater('request_evaluators', '" . ENTRADA_URL . "/api/evaluations-request-evaluators.api.php', {\n                parameters: {\n                    id: evaluation_id\n                }, \n                method: 'post'\n            });\n\t\t}\n\t</script>";
    $sidebar_html = "<form method=\"post\" action=\"" . ENTRADA_RELATIVE . "/evaluations?request=1\">\n";
    $sidebar_html .= "\t<label class=\"form-nrequired\" for=\"evaluation_request_id\">Evaluation/Assessment: </label>";
    $sidebar_html .= "\t<select style=\"width: 150px; overflow: none;\" name=\"id\" onchange=\"loadEvaluators(this.value)\">";
    $sidebar_html .= "\t\t<option value=\"0\">-- Select an Evaluation or Assessment --</option>";
    foreach ($request_evaluations as $request_evaluation) {
        $sidebar_html .= "\t\t<option value=\"" . $request_evaluation["evaluation_id"] . "\"" . (isset($RECORD_ID) && $RECORD_ID == $request_evaluation["evaluation_id"] ? " selecte=\"selected\"" : "") . ">" . $request_evaluation["evaluation_title"] . "</option>";
    }
    $sidebar_html .= "\t</select>";
    $sidebar_html .= "  <div id=\"request_evaluators\">&nbsp;</div>";
    $sidebar_html .= "</form>";
    new_sidebar_item("Request an Evaluation", $sidebar_html, "request-evaluation", "open", "1.9");
}
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] do not have access to this module [" . $MODULE . "]");
} else {
    define("IN_REGIONALED", true);
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/regionaled", "title" => "Regional Education");
    if ($router && $router->initRoute()) {
        $PREFERENCES = preferences_load($MODULE);
        /**
         * Add the Regional Education module secondary navigation.
         */
        $sidebar_html = "<ul class=\"menu\">";
        $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/regionaled\">Regional Education</a></li>\n";
        $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/regionaled/apartments\">Manage Apartments</a></li>\n";
        $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/regionaled/regions\">Manage Regions</a></li>\n";
        $sidebar_html .= "</ul>";
        new_sidebar_item("Regional Education", $sidebar_html, "regionaled-nav", "open");
        $module_file = $router->getRoute();
        if ($module_file) {
            require_once $module_file;
        }
        /**
         * Check if preferences need to be updated on the server at this point.
         */
        preferences_update($MODULE, $PREFERENCES);
    } else {
        $url = ENTRADA_URL . "/admin/" . $MODULE;
        application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "].");
        header("Location: " . $url);
        exit;
    }
}
    $PAGE_META["title"] = "Formal Remediations";
    $PAGE_META["description"] = "";
    $PAGE_META["keywords"] = "";
    $PROXY_ID = $user_record["id"];
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/users/manage/students?section=formalremediations&id=" . $PROXY_ID, "title" => "Formal Remediations");
    $HEAD[] = "<script language='javascript' src='" . ENTRADA_URL . "/javascript/PassiveDataEntryProcessor.js'></script>";
    if (is_array($_SESSION["permissions"]) && ($total_permissions = count($_SESSION["permissions"]) > 1)) {
        $sidebar_html = "The following individual" . ($total_permissions - 1 != 1 ? "s have" : " has") . " given you access to their " . APPLICATION_NAME . " permission levels:";
        $sidebar_html .= "<ul class=\"menu\">\n";
        foreach ($_SESSION["permissions"] as $access_id => $result) {
            if ($access_id != $ENTRADA_USER->getDefaultAccessId()) {
                $sidebar_html .= "<li class=\"checkmark\"><strong>" . html_encode($result["fullname"]) . "</strong><br /><span class=\"content-small\">Exp: " . ($result["expires"] ? date("D M d/y", $result["expires"]) : "Unknown") . "</span></li>\n";
            }
        }
        $sidebar_html .= "</ul>\n";
        new_sidebar_item("Delegated Permissions", $sidebar_html, "delegated-permissions", "open");
    }
    process_mspr_details($translate, "formal_remediation");
    display_status_messages();
    ?>
<h1>Formal Remediations: <?php 
    echo $user->getFullname();
    ?>
</h1>

<?php 
    $show_fr_form = $_GET['show'] == "fr_form";
    ?>
		
	
	<div id="add_formal_remediation_link" style="float: right;<?php 
        default:
            continue;
            break;
    }
    /**
     * Add the dashboard links to the Helpful Links sidebar item.
     */
    if (is_array($dashboard_links) && count($dashboard_links)) {
        $sidebar_html = "<ul class=\"menu\">";
        foreach ($dashboard_links as $link) {
            if (trim($link["title"]) && trim($link["url"])) {
                $sidebar_html .= "<li class=\"link\"><a href=\"" . html_encode($link["url"]) . "\" title=\"" . (isset($link["description"]) && $link["description"] ? html_encode($link["description"]) : html_encode($link["title"])) . "\"" . ($link["target"] ? " target=\"" . html_encode($link["target"]) . "\"" : "") . ">" . html_encode($link["title"]) . "</a></li>\n";
            }
        }
        $sidebar_html .= "</ul>";
        new_sidebar_item("Helpful Links", $sidebar_html, "helpful-links", "open");
    }
    /**
     * Check if preferences need to be updated on the server at this point.
     */
    preferences_update($MODULE, $PREFERENCES);
    ?>
	<div class="rss-add">
		<a id="add-rss-feeds-link" href="#edit-rss-feeds" class="feeds add-rss">Add RSS Feed</a>
		<a id="edit-rss-feeds-link" href="#edit-rss-feeds" class="feeds edit-rss">Modify RSS Feeds</a>

		<div id="rss-edit-details" class="display-generic" style="display: none;">
			While you are in <strong>edit mode</strong> you can rearrange the feeds below by dragging them to your preferred location. You can also <a href="#edit-rss-feeds" id="rss-feed-reset">reset this page to the default RSS feeds</a> if you would like. <span id="rss-save-results">&nbsp;</span>
		</div>
		<div id="rss-add-details">
			<form id="rss-add-form" class="form-horizontal">
Exemple #10
0
         $mail_list = $db->GetRow($query);
         if ($mail_list && $mail_list["list_type"] != "inactive") {
             $sidebar_html .= "<ul class=\"menu\" style=\"padding-left: 0px;\">\n";
             $sidebar_html .= "\t<li class=\"status-online\" style=\"font-weight: strong;\">Mailing List Active</li>\n";
             $sidebar_html .= "\t<li class=\"none\">" . ($mail_list["list_type"] == "announcements" ? "Announcement" : "Discussion") . " List</li>\n";
             if ($mail_list["list_type"] == "discussion" || $COMMUNITY_ADMIN) {
                 $sidebar_html .= "\t<li class=\"none\"><a href=\"mailto:" . $mail_list["list_name"] . "@" . $GOOGLE_APPS["domain"] . "\">Send Message</a></li>\n";
             }
             $sidebar_html .= "</ul>\n";
         } elseif ($COMMUNITY_ADMIN) {
             $sidebar_html .= "<ul class=\"menu\" style=\"padding-left: 0px;\">\n";
             $sidebar_html .= "\t<li class=\"status-offline\" style=\"font-weight: strong;\">Mailing List Not Active</li>\n";
             $sidebar_html .= "</ul>\n";
         }
     }
     new_sidebar_item("This Community", $sidebar_html, "community-my-membership", "open");
 }
 if ($PAGE_ACTIVE && (in_array($COMMUNITY_MODULE, array("default", "members", "pages", "course")) || array_key_exists($PAGE_URL, $COMMUNITY_PAGES["exists"]) && array_key_exists($COMMUNITY_MODULE, $COMMUNITY_MODULES["enabled"])) || $HOME_PAGE) {
     define("COMMUNITY_INCLUDED", true);
     if (array_key_exists($PAGE_URL, $COMMUNITY_PAGES["enabled"]) || $HOME_PAGE || $COMMUNITY_MODULE == "members" || $COMMUNITY_MODULE == "pages" && $USER_ACCESS == 3) {
         /**
          * ID of the record which can be set in the URL and used to edit or delete a page, etc.
          * Used within modules and actions.
          */
         if (isset($_GET["id"]) && (int) trim($_GET["id"]) && !(int) $RECORD_ID) {
             $RECORD_ID = (int) trim($_GET["id"]);
         }
         if (!in_array($COMMUNITY_MODULE, array("pages", "members", "default", "course"))) {
             $query = "SELECT `module_id` FROM `communities_modules` WHERE `module_shortname` = " . $db->qstr($COMMUNITY_MODULE);
             $result = $db->GetRow($query);
             if ($result) {
                    echo "</tr>\n";
                }
            } else {
                ?>
				<tr>
					<td colspan="3">
						<?php 
                echo display_notice(array("The top podcast download stats are not currently available. There are podcasts in the system; however, it doesn't appear anyone has downloaded them."));
                ?>
					</td>
				</tr>
				<?php 
            }
            ?>
		</tbody>
		</table>
		<?php 
            $sidebar_html = "<ul class=\"menu\">\n";
            $sidebar_html .= "\t<li class=\"link\"><a href=\"#general-stats\" title=\"General Podcast Statistics\">General Podcast Statistics</a></li>\n";
            $sidebar_html .= "\t<li class=\"link\"><a href=\"#detailed-stats\" title=\"Detailed Download Statistics\">Detailed Download Statistics</a></li>\n";
            $sidebar_html .= "\t<li class=\"link\"><a href=\"#top-podcasts\" title=\"Top Podcast Events\">Top Podcast Events</a></li>\n";
            $sidebar_html .= "\t<li class=\"link\"><a href=\"#top-downloaders\" title=\"Top Podcast Downloaders\">Top Podcast Downloaders</a></li>\n";
            $sidebar_html .= "</ul>";
            new_sidebar_item("Report Sections", $sidebar_html, "report-sections", "open");
        } else {
            $NOTICE++;
            $NOTICESTR[] = "There are no podcasts in the system during the selected duration or belonging to the selected organisation. Please choose a new date range and/or a different organisation and try again.";
            echo display_notice();
        }
    }
}
                    $temp_responses = array();
                    foreach ($available_targets[$selected_target_id]["questions"][$question["equestion_id"]]["comments"] as $comment) {
                        if ($comment["equestion_id"] == $question["equestion_id"]) {
                            echo "      <li>" . $comment["text"] . "</li>\n";
                        }
                    }
                    echo "\t</ul>\n";
                    echo "</div>\n";
                }
            }
            echo "</div>\n";
            if ($evaluation["show_comments"] || $permissions[0]["contact_type"] == "reviewer") {
                $HEAD[] = "\n\t\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\tfunction toggleComments () {\n\t\t\t\t\t\t\t\t\tif (\$('comments-display').hasClassName('on')) {\n\t\t\t\t\t\t\t\t\t\t\$('comments-display').removeClassName('on');\n\t\t\t\t\t\t\t\t\t\t\$('comments-display').addClassName('off');\n\t\t\t\t\t\t\t\t\t\tjQuery('#comments-display > a').text('Show Comments');\n\t\t\t\t\t\t\t\t\t\tjQuery('.comments-row').hide();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\$('comments-display').removeClassName('off');\n\t\t\t\t\t\t\t\t\t\t\$('comments-display').addClassName('on');\n\t\t\t\t\t\t\t\t\t\tjQuery('#comments-display > a').text('Hide Comments');\n\t\t\t\t\t\t\t\t\t\tjQuery('.comments-row').show();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</script>";
                $sidebar_html = "<ul class=\"menu\">\n";
                $sidebar_html .= "\t<li id=\"comments-display\" class=\"on\" style=\"cursor: pointer;\"><a onclick=\"toggleComments()\">Hide Comments</a></li>\n";
                $sidebar_html .= "</ul>\n";
                new_sidebar_item("Show/Hide Comments", $sidebar_html, "view-comments", "open", "1.9");
            }
        }
    } else {
        $ERROR++;
        $ERRORSTR[] = "In order to review an evaluation, you must provide a valid evaluation identifier.";
        echo display_error();
        application_log("error", "Failed to provide a valid evaluation_id identifer [" . $RECORD_ID . "] when attempting to review an evaluation.");
    }
} else {
    $ERROR++;
    $ERRORSTR[] = "In order to review an evaluation, you must provide a valid evaluation identifier.";
    echo display_error();
    application_log("error", "Failed to provide an evaluation_id identifier when attempting to review an evaluation.");
}
         $sidebar_html = "<center><a href=\"" . ENTRADA_URL . "/clerkship/logbook?section=select\"><strong>{$clinical_rotation['title']}</strong></a></center><br>";
         $sidebar_html .= "<ul class=\"menu\">\n";
         $sidebar_html .= "\t<li class=\"rejected\"><a href=\"" . ENTRADA_URL . "/clerkship/logbook?section=view&type=missing&core={$rotation}\"><strong>" . ($objectives_required - $objectives_recorded) . "</strong>  CPs Not Seen</a></li>\n";
         $sidebar_html .= "\t<li class=\"checkmark\"><a href=\"" . ENTRADA_URL . "/clerkship/logbook?section=view&type=mandatories&core={$rotation}\"><strong>" . $objectives_recorded . "</strong>  CPs Seen</a></li>\n";
         $sidebar_html .= "\t<li><a href=\"" . ENTRADA_URL . "/clerkship/logbook?section=view&type=procedures&core={$rotation}\"><strong>" . $clinical_encounters["procedures"] . "</strong> Procedures</a></li>\n";
         $sidebar_html .= "</ul>\n";
         $sidebar_html .= "\t<a href=\"" . ENTRADA_URL . "/clerkship/logbook?section=add&event=" . (isset($clerkship_schedule[0]) && $clerkship_schedule[0]["event_id"] ? $clerkship_schedule[0]["event_id"] : $clerkship_past_schedule[count($clerkship_past_schedule) - 1]["event_id"]) . "\">Log encounter</a>\n";
         if ((int) $clinical_encounters["entries"] > 0) {
             $sidebar_html .= "\t<br /><br /><a href=\"" . ENTRADA_URL . "/clerkship/logbook?sb=rotation&rotation=" . $rotation . "\">View " . ($clinical_encounters["entries"] == 1 ? "entry" : "entries - {$clinical_encounters['entries']}") . "</a>\n";
         }
         if ($rotation) {
             $sidebar_html .= "<div style=\"margin-top: 10px\">\n";
             $sidebar_html .= "\tYou have " . $remaining_weeks["yet"] . " weeks remaining in this " . $remaining_weeks["total"] . " week clerkship.<br /> To change rotations, <a href=\"" . ENTRADA_URL . "/clerkship/logbook?section=select\">click here</a>.";
             $sidebar_html .= "</div>\n";
             if ($SHOW_LOGBOOK) {
                 new_sidebar_item("Logbook Entries", $sidebar_html, "page-clerkship", "open");
             }
         }
     }
 }
 if ($router && $router->initRoute()) {
     $PREFERENCES = preferences_load($MODULE);
     if (isset($_GET["step"]) && (int) trim($_GET["step"])) {
         $STEP = (int) trim($_GET["step"]);
     } elseif (isset($_POST["step"]) && (int) trim($_POST["step"])) {
         $STEP = (int) trim($_POST["step"]);
     } else {
         $STEP = 1;
     }
     $module_file = $router->getRoute();
     if ($module_file) {
     $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["so"]) == "desc" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/community" . $COMMUNITY_URL . ":" . $PAGE_URL . "?" . replace_query(array("so" => "desc")) . "\" title=\"Descending Order\">in descending order</a></li>\n";
     $sidebar_html .= "</ul>\n";
     $sidebar_html .= "Rows per page:\n";
     $sidebar_html .= "<ul class=\"menu\">\n";
     $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"]) == "5" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/community" . $COMMUNITY_URL . ":" . $PAGE_URL . "?" . replace_query(array("pp" => "5")) . "\" title=\"Display 5 Rows Per Page\">5 rows per page</a></li>\n";
     $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"]) == "15" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/community" . $COMMUNITY_URL . ":" . $PAGE_URL . "?" . replace_query(array("pp" => "15")) . "\" title=\"Display 15 Rows Per Page\">15 rows per page</a></li>\n";
     $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"]) == "25" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/community" . $COMMUNITY_URL . ":" . $PAGE_URL . "?" . replace_query(array("pp" => "25")) . "\" title=\"Display 25 Rows Per Page\">25 rows per page</a></li>\n";
     $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER]["community_page"]["pp"]) == "50" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/community" . $COMMUNITY_URL . ":" . $PAGE_URL . "?" . replace_query(array("pp" => "50")) . "\" title=\"Display 50 Rows Per Page\">50 rows per page</a></li>\n";
     $sidebar_html .= "</ul>\n";
     $sidebar_html .= "&quot;Show Only&quot; settings:\n";
     new_sidebar_item("Sort Results", $sidebar_html, "sort-results", "open");
     $sidebar_html = "<div style=\"margin: 2px 0px 10px 3px; font-size: 10px\">\n";
     $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-updated.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> recently updated</div>\n";
     $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-individual.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> individual learning event</div>\n";
     $sidebar_html .= "</div>\n";
     new_sidebar_item("Learning Event Legend", $sidebar_html, "event-legend", "open");
     break;
 case preg_match("/objectives\$/", $PAGE_URL) != 0:
     $course_ids_str = "";
     $clean_ids_str = "";
     $course_ids = array();
     $query = "\tSELECT a.`course_id`\n                            FROM `community_courses` AS a\n                            JOIN `courses` AS b\n                            ON a.`course_id` = b.`course_id`\n                            WHERE b.`course_active` = '1'\n                            AND a.`community_id` = " . $db->qstr($COMMUNITY_ID);
     $results = $db->GetAll($query);
     if ($results) {
         foreach ($results as $course_id) {
             $course_ids[] = $course_id["course_id"];
             if ($course_ids_str) {
                 $course_ids_str .= ", " . $db->qstr($course_id["course_id"]);
                 $clean_ids_str .= "," . $course_id["course_id"];
             } else {
                 $course_ids_str = $db->qstr($course_id["course_id"]);
            }
            echo "<h1 style=\"page-break-before: avoid\">Department of " . $departmentOuput . " Rearch Grants</h1>";
            echo "<div class=\"content-small\" style=\"margin-bottom: 10px\">\n";
            echo "\t<strong>Date Range:</strong> " . $startYear . " <strong>to</strong> " . $endYear;
            echo "</div>";
            if (is_array($fundingStatus) && in_array("*", $fundingStatus)) {
                $fundingStatus = array("funded", "submitted", "unfunded");
            }
            foreach ($fundingStatus as $fundingStatusSpecific) {
                $query = "SELECT *\n\t\t\tFROM `ar_research` \n\t\t\tWHERE `proxy_id` IN(" . $listOfDepartmentMembers . ")\n\t\t\tAND `funding_status` = '{$fundingStatusSpecific}'" . $dateWhere;
                $currentStatus = ucfirst($fundingStatusSpecific);
                $researchSidebar[] = $currentStatus;
                echo "<a name=\"" . $currentStatus . "\"></a>";
                echo "<h2>" . $currentStatus . "</h2>\n";
                if ($results = $db->GetAll($query)) {
                    display($results, $db);
                } else {
                    echo "No Grants for the specified query.<br>";
                }
            }
            if (isset($researchSidebar)) {
                $sidebar_html = "<ul class=\"menu\">\n";
                foreach ($researchSidebar as $result) {
                    $sidebar_html .= "\t<li class=\"link\"><a href=\"#" . $result . "\" title=\"" . html_encode($result) . "\">" . html_encode($result) . "</a></li>\n";
                }
                $sidebar_html .= "</ul>";
                new_sidebar_item("Research List", $sidebar_html, "research-list", "open");
            }
        }
    }
}
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed("group", "update", false)) {
    $ERROR++;
    $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
    echo display_error();
    application_log("error", "Group [" . $GROUP . "] and role [" . $ROLE . "] does not have access to this module [" . $MODULE . "]");
} else {
    define("IN_GROUPS", true);
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/groups", "title" => "Manage Groups");
    if ($router && $router->initRoute()) {
        $PREFERENCES = preferences_load($MODULE);
        $module_file = $router->getRoute();
        if ($module_file) {
            require_once $module_file;
            $sidebar_html = "<div style=\"margin: 2px 0px 10px 3px; font-size: 10px\">\n";
            $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-not-accessible.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> Inactive</div>\n";
            $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-individual.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" />  Contains inactive members</div>\n";
            $sidebar_html .= "</div>\n";
            new_sidebar_item("Group Legend", $sidebar_html, "group-legend", "open");
        }
        /**
         * Check if preferences need to be updated on the server at this point.
         */
        preferences_update($MODULE, $PREFERENCES);
    } else {
        $url = ENTRADA_URL . "/admin/" . $MODULE;
        application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "].");
        header("Location: " . $url);
        exit;
    }
}
        if ($results) {
            $elective_weeks = clerkship_get_elective_weeks($PROXY_ID);
            $remaining_weeks = (int) $CLERKSHIP_REQUIRED_WEEKS - (int) $elective_weeks["approved"];
            $sidebar_html = "<ul class=\"menu\">\n";
            $sidebar_html .= "\t<li><strong>" . $elective_weeks["approval"] . "</strong> Pending Approval</li>\n";
            $sidebar_html .= "\t<li class=\"checkmark\"><strong>" . $elective_weeks["approved"] . "</strong> Weeks Approved</li>\n";
            $sidebar_html .= "\t<li class=\"incorrect\"><strong>" . $elective_weeks["trash"] . "</strong> Weeks Rejected</li>\n";
            $sidebar_html .= "\t<br />";
            if ((int) $elective_weeks["approval"] + (int) $elective_weeks["approved"] > 0) {
                $sidebar_html .= "\t<li><a target=\"blank\" href=\"" . ENTRADA_URL . "/admin/clerkship/electives?section=disciplines&id=" . $PROXY_ID . "\">Discipline Breakdown</a></li>\n";
            }
            $sidebar_html .= "</ul>\n";
            $sidebar_html .= "<div style=\"margin-top: 10px\">\n";
            $sidebar_html .= $student_name . " has " . $remaining_weeks . " required elective week" . ($remaining_weeks != 1 ? "s" : "") . " remaining.\n";
            $sidebar_html .= "</div>\n";
            new_sidebar_item("Elective Weeks", $sidebar_html, "page-clerkship", "open");
            ?>
			<div style="float: right; padding-top: 8px">
			    <div id="module-content">
			        <ul class="page-action">
			            <li>
			                <a href = "<?php 
            echo ENTRADA_URL . "/admin/clerkship/electives?section=add_elective&ids=" . $PROXY_ID;
            ?>
" class="strong-green">Add Elective</a>
			            </li>
			        </ul>
			    </div>
			</div>
			<div style="float: right; padding-top: 8px">
			    <div id="module-content">
														}
													}
												},
												onError: function() {
														$('question_' + qid).addClassName('notice');

														if ($('display-unsaved-warning').style.display == 'none') {
															$('display-unsaved-warning').appear({ duration: 0.5 });
														}
												}
											});
										}
										</script>
										<?php 
                                        $sidebar_html = quiz_generate_description($quiz_record["required"], $quiz_record["quiztype_code"], $quiz_record["quiz_timeout"], $total_questions, $quiz_record["quiz_attempts"], $quiz_record["timeframe"], $quiz_record["require_attendance"], isset($quiz_record["course_id"]) && $quiz_record["course_id"] ? $quiz_record["course_id"] : 0);
                                        new_sidebar_item("Quiz Statement", $sidebar_html, "page-anchors", "open", "1.9");
                                    } else {
                                        add_error("Unable to locate your progress information for this quiz at this time. The system administrator has been notified of this error; please try again later.");
                                        echo display_error();
                                        application_log("error", "Failed to locate a qprogress_id [" . $qprogress_id . "] (either existing or created) when attempting to complete aquiz_id [" . $RECORD_ID . "] (quiz_id [" . $quiz_record["quiz_id"] . "] / event_id [" . $quiz_record["content_id"] . "]).");
                                    }
                                    break;
                            }
                        } else {
                            add_error("You were only able to attempt this quiz a total of <strong>" . (int) $quiz_record["quiz_attempts"] . " time" . ($quiz_record["quiz_attempts"] != 1 ? "s" : "") . "</strong>, and time limit for your final attempt expired before completion.<br /><br />Please contact a teacher if you require further assistance.");
                            echo display_error();
                            application_log("notice", "Someone attempted to complete aquiz_id [" . $RECORD_ID . "] (quiz_id [" . $quiz_record["quiz_id"] . "] / event_id [" . $quiz_record["content_id"] . "]) more than the total number of possible attempts [" . $quiz_record["quiz_attempts"] . "] after their final attempt expired.");
                        }
                    } else {
                        add_notice("You were only able to attempt this quiz a total of <strong>" . (int) $quiz_record["quiz_attempts"] . " time" . ($quiz_record["quiz_attempts"] != 1 ? "s" : "") . "</strong>.<br /><br />Please contact a teacher if you require further assistance.");
                        echo display_notice();
				<?php 
                if ($SEARCH_CLASS) {
                    echo "<div style=\"border: 1px #CCCCCC solid; margin-bottom: 1px\">\n";
                    echo "\t<img src=\"" . ENTRADA_URL . "/images/dynamic/14/314/5/90/" . rawurlencode(groups_get_name($SEARCH_CLASS)) . "/jpg\" width=\"25\" height=\"325\" align=\"left\" alt=\"" . html_encode(groups_get_name($SEARCH_CLASS)) . "\" title=\"" . html_encode(groups_get_name($SEARCH_CLASS)) . "\" />\n";
                    echo "\t<div id=\"search-timeline-" . preg_replace("/[^0-9]/", "", groups_get_name($SEARCH_CLASS)) . "\" style=\"height: 325px\"></div>\n";
                    echo "</div>\n";
                } else {
                    $cohorts_list = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    foreach ($cohorts_list as $cohort) {
                        echo "<div style=\"border: 1px #CCCCCC solid; margin-bottom: 1px\">\n";
                        echo "\t<img src=\"" . ENTRADA_URL . "/images/dynamic/14/314/5/90/" . rawurlencode($cohort["group_name"]) . "/jpg\" width=\"25\" height=\"325\" align=\"left\" alt=\"" . html_encode($cohort["group_name"]) . "\" title=\"" . html_encode($cohort["group_name"]) . "\" />\n";
                        echo "\t<div id=\"search-timeline-" . preg_replace("/[^0-9]/", "", $cohort["group_name"]) . "\" style=\"height: 325px\"></div>\n";
                        echo "</div>\n";
                    }
                }
                new_sidebar_item("Class Result Totals", "<div id=\"class-result-totals\"></div>", "result-totals", "open");
                break;
            case "standard":
            default:
                if ($SEARCH_MODE != "timeline" && $TOTAL_PAGES > 1) {
                    echo "<form action=\"" . ENTRADA_RELATIVE . "/curriculum/searchbeta\" method=\"get\" id=\"pageSelector\">\n";
                    echo "<div style=\"margin-top: 10px; margin-bottom: 5px; text-align: right; white-space: nowrap\">\n";
                    echo "<span style=\"width: 20px; vertical-align: middle; margin-right: 3px; text-align: left\">\n";
                    if ($PAGE_PREVIOUS) {
                        echo "<a href=\"" . ENTRADA_RELATIVE . "/curriculum/searchbeta?" . replace_query(array("pv" => $PAGE_PREVIOUS)) . "\"><img src=\"" . ENTRADA_URL . "/images/record-previous-on.gif\" border=\"0\" width=\"11\" height=\"11\" alt=\"Back to page " . $PAGE_PREVIOUS . ".\" title=\"Back to page " . $PAGE_PREVIOUS . ".\" style=\"vertical-align: middle\" /></a>\n";
                    } else {
                        echo "<img src=\"" . ENTRADA_URL . "/images/record-previous-off.gif\" width=\"11\" height=\"11\" alt=\"\" title=\"\" style=\"vertical-align: middle\" />";
                    }
                    echo "</span>";
                    echo "<span style=\"vertical-align: middle\">\n";
                    echo "<select name=\"pv\" onchange=\"window.location = '" . ENTRADA_RELATIVE . "/curriculum/searchbeta?" . replace_query(array("pv" => false)) . "&amp;pv='+this.options[this.selectedIndex].value;\"" . ($TOTAL_PAGES <= 1 ? " disabled=\"disabled\"" : "") . ">\n";
                        foreach ($no_staff_number as $result) {
                            $i++;
                            $columns++;
                            echo "\t<td" . ($i == $total_no_staff_number && $columns < $max_columns ? " colspan=\"" . ($max_columns - $columns + 1) . "\"" : "") . ">" . html_encode($result["fullname"]) . "</td>\n";
                            if ($columns == $max_columns || $i == $total_no_staff_number) {
                                $columns = 0;
                                echo "</tr>\n";
                                if ($i < $total_no_staff_number) {
                                    echo "<tr>\n";
                                }
                            }
                        }
                        ?>
							</tbody>
						</table>
					</div>
					<?php 
                    }
                    $sidebar_html = "<ul class=\"menu\">\n";
                    foreach ($department_sidebar as $result) {
                        $sidebar_html .= "\t<li class=\"link\"><a href=\"" . $result["department_link"] . "\" title=\"" . html_encode($result["department_name"]) . "\">" . html_encode($result["department_name"]) . "</a></li>\n";
                    }
                    $sidebar_html .= "</ul>";
                    new_sidebar_item("Department List", $sidebar_html, "department-list", "open");
                } else {
                    echo '<div class="display-notice">There were no faculty found using the specified parameters. Try selecting a different organisation or date range.</div>';
                }
            }
        }
    }
}
            ?>
				<h3>You have not been selected to mark any assignments.</h3>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
    /**
     * Sidebar item that will provide another method for sorting, ordering, etc.
     */
    $sidebar_html = "Sort columns:\n";
    $sidebar_html .= "<ul class=\"menu\">\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["sb"]) == "type" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("sb" => "type")) . "\" title=\"Sort by Category\">by category</a></li>\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["sb"]) == "code" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("sb" => "code")) . "\" title=\"Sort by Code\">by code</a></li>\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["sb"]) == "name" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("sb" => "name")) . "\" title=\"Sort by Name\">by name</a></li>\n";
    $sidebar_html .= "</ul>\n";
    $sidebar_html .= "Order columns:\n";
    $sidebar_html .= "<ul class=\"menu\">\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["so"]) == "asc" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("so" => "asc")) . "\" title=\"Ascending Order\">in ascending order</a></li>\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["so"]) == "desc" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("so" => "desc")) . "\" title=\"Descending Order\">in descending order</a></li>\n";
    $sidebar_html .= "</ul>\n";
    $sidebar_html .= "Rows per page:\n";
    $sidebar_html .= "<ul class=\"menu\">\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["pp"]) == "5" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("pp" => "5")) . "\" title=\"Display 5 Rows Per Page\">5 rows per page</a></li>\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["pp"]) == "15" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("pp" => "15")) . "\" title=\"Display 15 Rows Per Page\">15 rows per page</a></li>\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["pp"]) == "25" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("pp" => "25")) . "\" title=\"Display 25 Rows Per Page\">25 rows per page</a></li>\n";
    $sidebar_html .= "\t<li class=\"" . (strtolower($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["pp"]) == "50" ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("pp" => "50")) . "\" title=\"Display 50 Rows Per Page\">50 rows per page</a></li>\n";
    $sidebar_html .= "</ul>\n";
    new_sidebar_item("Sort Results", $sidebar_html, "sort-results", "open");
}
     foreach ($available_targets as $target_id => $available_target) {
         if (!isset($selected_target) && (!isset($view_target) || !array_key_exists($view_target, $available_targets))) {
             $selected_target = $available_target;
             $selected_target_id = $target_id;
         } elseif (isset($view_target) && $view_target && $view_target == $target_id) {
             $selected_target = $available_target;
             $selected_target_id = $target_id;
         }
         $evaluation_ids_string = "";
         foreach ($PROCESSED["evaluation_ids"] as $evaluation_id) {
             $evaluation_ids_string .= ($evaluation_ids_string ? "," : "") . $evaluation_id;
         }
         $sidebar_html .= "\t<li class=\"" . (isset($selected_target_id) && $selected_target_id == $target_id ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/evaluations/reports?" . replace_query(array("view_target" => $target_id, "evaluation_ids[]" => NULL, "evaluation_ids_string" => $evaluation_ids_string)) . "\">" . $available_target . "</a></li>\n";
     }
     $sidebar_html .= "</ul>\n";
     new_sidebar_item("Targets to Review", $sidebar_html, "review-targets", "open", "1.9");
 } else {
     foreach ($available_targets as $target_id => $available_target) {
         $selected_target = $available_target;
         $selected_target_id = $target_id;
     }
 }
 if (isset($PROCESSED["parent_objective_ids"]) && @count($PROCESSED["parent_objective_ids"]) > 1) {
     $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/evaluations/reports?" . replace_query(array("step" => 3, "evaluation_ids[]" => NULL, "evaluation_ids_string" => $evaluation_ids_string, "objective_id" => NULL, "objective_parents" => NULL)), "title" => "Aggregate of Objectives");
     $parent_objectives_string = "";
     foreach ($PROCESSED["parent_objective_ids"] as $parent_objective_id) {
         $query = "SELECT `objective_name` FROM `global_lu_objectives` WHERE `objective_id` = " . $db->qstr($parent_objective_id);
         $objective_name = $db->getOne($query);
         if ($parent_objectives_string) {
             $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/evaluations/reports?" . replace_query(array("step" => 4, "evaluation_ids[]" => NULL, "evaluation_ids_string" => $evaluation_ids_string, "objective_id" => $parent_objective_id, "objective_parents" => $parent_objectives_string)), "title" => $objective_name);
         } else {
            if ($student) {
                ?>
				<input style="margin-left: 20px;" type="button" class="btn btn-primary" value="Edit Entry" onclick="if ($('current-entry').value != '0') {window.location = '<?php 
                echo ENTRADA_URL . "/clerkship/logbook?section=edit&id=";
                ?>
'+$('current-entry').value;} else {alert('You must select an active entry before selecting the Edit Entry button.');}" />
				<?php 
            }
            ?>
			</div>
			<?php 
            $sidebar_html = "<div style=\"margin: 2px 0px 10px 3px; font-size: 10px\">\n";
            $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-active-member.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> Active Entry</div>\n";
            $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-not-accessible.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> Deactivated Entry</div>\n";
            $sidebar_html .= "</div>\n";
            new_sidebar_item("Logbook Encounters", $sidebar_html, "objective-legend", "open");
        } else {
            $ERROR++;
            $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
            echo display_error();
        }
    } else {
        $ERROR++;
        if (array_key_exists($rotation_id, $rotation_names) && $rotation_names[$rotation_id]) {
            $ERRORSTR[] = "No clerkship logbook entries for this rotation [" . $rotation_names[$rotation_id] . "] have been found for this user in the system. You may view all entries for all rotations by clicking <a href=\"" . ENTRADA_URL . "/clerkship/logbook?" . replace_query(array("rotation" => false)) . "\" />here</a>.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
        } else {
            $ERRORSTR[] = "No clerkship logbook entries have been found for this user in the system.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
        }
        echo display_error();
    }
}
    $GROUP_TARGETS["resident"] = "Student Residents";
    $GROUP_TARGETS["staff"] = "Staff Members";
    asort($GROUP_TARGETS);
    $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/communities.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>\n";
    $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/tabpane/tabpane.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>\n";
    $HEAD[] = "<link href=\"" . ENTRADA_URL . "/css/tabpane.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n";
    $HEAD[] = "<link href=\"" . ENTRADA_URL . "/css/communities.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n";
    $query = "\tSELECT b.`community_id`, b.`community_url`, b.`community_title`\n\t\t\t\tFROM `community_members` AS a\n\t\t\t\tLEFT JOIN `communities` AS b\n\t\t\t\tON b.`community_id` = a.`community_id`\n\t\t\t\tWHERE a.`proxy_id` = " . $db->qstr($ENTRADA_USER->getActiveId()) . "\n\t\t\t\tAND a.`member_active` = '1'\n\t\t\t\tAND b.`community_active` = '1'\n\t\t\t\tAND b.`community_template` <> 'course'\n\t\t\t\tORDER BY b.`community_title` ASC";
    $results = $db->GetAll($query);
    if ($results) {
        $sidebar_html = "<ul class=\"menu\">\n";
        foreach ($results as $result) {
            $sidebar_html .= "<li class=\"community\"><a href=\"" . ENTRADA_URL . "/community" . $result["community_url"] . "\">" . html_encode($result["community_title"]) . "</a></li>\n";
        }
        $sidebar_html .= "</ul>\n";
        new_sidebar_item("My Communities", $sidebar_html, "my-communities", "open");
    }
    $module_file = $router->getRoute();
    if ($module_file) {
        require_once $module_file;
    }
    /**
     * Check if preferences need to be updated on the server at this point.
     */
    preferences_update($MODULE, $PREFERENCES);
} else {
    $url = ENTRADA_URL . "/" . $MODULE;
    application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "].");
    header("Location: " . $url);
    exit;
}
            } else {
                $ERROR++;
                $ERRORSTR[] = "You do not have the permissions required to view this course. If you believe that you have received this message in error, please contact a system administrator.";
                echo display_error();
            }
        }
    } else {
        $sidebar_html = "<div><form action=\"" . ENTRADA_RELATIVE . "/curriculum/search\" method=\"get\" style=\"margin:0\">\n";
        $sidebar_html .= "<label for=\"q\" class=\"form-nrequired\">Search the curriculum:</label><br />";
        $sidebar_html .= "<input type=\"text\" id=\"q\" name=\"q\" value=\"\" style=\"width: 95%\" /><br />\n";
        $sidebar_html .= "<span style=\"float: left; padding-top: 7px;\"><a href=\"" . ENTRADA_RELATIVE . "/curriculum/search\" style=\"font-size: 11px\">Advanced Search</a></span>\n";
        $sidebar_html .= "<span style=\"float: right; padding-top: 4px;\"><input type=\"submit\" class=\"btn btn-primary\" value=\"Search\" /></span>\n";
        $sidebar_html .= "</form></div>\n";
        $sidebar_html .= "<br /><br /><hr style=\"clear: both;\"/>\n";
        $sidebar_html .= "<a href=\"" . ENTRADA_RELATIVE . "/courses/objectives\">View <strong>Curriculum Map</strong></a>\n";
        new_sidebar_item("Our Curriculum", $sidebar_html, "curriculum-search-bar", "open");
        if ($COURSE_LIST) {
            ?>
		<div class="row-fluid">
			<div class="pull-left">
			<?php 
            $query = "SELECT * FROM `curriculum_lu_types` WHERE `curriculum_type_active` = '1' ORDER BY `curriculum_type_order` ASC";
            $terms = $db->GetAll($query);
            if ($terms) {
                echo "<h2>" . $module_singular_name . " Listing</h2>\n";
            }
            ?>
			</div>
			<form class="pull-right form-horizontal">
				<div class="control-group">
					<label for="course-quick-select" class="control-label content-small"><?php 
			<?php 
    if ($num_occupants) {
        echo "<ul class=\"menu\">\n";
        foreach ($apt_occupants as $result) {
            echo "<li class=\"" . ($result["group"] == "student" ? "undergrad" : "postgrad") . "\">\n";
            echo $result["fullname"] ? ($result["gender"] ? $result["gender"] == 1 ? "F: " : "M: " : "") . "<a href=\"" . ENTRADA_URL . "/people?profile=" . html_encode($result["username"]) . "\" target=\"_blank\">" . $result["fullname"] . "</a>" : $result["occupant_title"];
            echo "\t<div class=\"content-small\">" . date(DEFAULT_DATE_FORMAT, $result["inhabiting_start"]) . " until " . date(DEFAULT_DATE_FORMAT, $result["inhabiting_finish"]) . "</div>";
            echo "</li>";
        }
        echo "</ul>\n";
        $sidebar_html = "<ul class=\"menu\">\n";
        $sidebar_html .= "\t<li class=\"undergrad\">Undergraduate Learner</li>\n";
        $sidebar_html .= "\t<li class=\"postgrad\">Postgraduate Learner</li>\n";
        $sidebar_html .= "\t<li class=\"other\">Other Occupancy</li>\n";
        $sidebar_html .= "</ul>\n";
        new_sidebar_item("Occupant Type Legend", $sidebar_html, "occupant-type-legend", "open");
    } else {
        ?>
				<div class="display-generic">
					You are currently the only occupant in this apartment during this time period.
				</div>
				<?php 
    }
    ?>
			<div class="content-small" style="margin-top: 15px">
				The maximum possible simultaneous occupants is <strong><?php 
    echo $max_occupants;
    ?>
</strong> <?php 
    echo $max_occupants != 1 ? "people" : "person";
    ?>
	                </tfoot>
	                </table>
	                <?php 
            } else {
                echo display_notice(array("There are no evaluators who have not started this evaluation."));
            }
        }
        ?>
		</div>
		<br /><br />
		<?php 
        /**
         * Sidebar item that will provide a method for choosing which results to display.
         */
        $sidebar_html = "Display progress as a:\n";
        $sidebar_html .= "<ul class=\"menu\">\n";
        $sidebar_html .= "\t<li class=\"" . ($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["display"] == false ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("display" => "summary")) . "\" title=\"Summary\">summary</a></li>\n";
        $sidebar_html .= "\t<li class=\"" . ($_SESSION[APPLICATION_IDENTIFIER][$MODULE]["display"] == true ? "on" : "off") . "\"><a href=\"" . ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("display" => "complete_list")) . "\" title=\"Complete list\">complete list of attempts</a></li>\n";
        $sidebar_html .= "</ul>\n";
        new_sidebar_item("Progress Display", $sidebar_html, "sort-results", "open");
    } else {
        application_log("error", "User tried to manage progress of a evaluation id [" . $EVALUATION_ID . "] that does not exist or is not active in the system.");
        $ERROR++;
        $ERRORSTR[] = "The evaluation you are trying to manage either does not exist in the system or has been deactived by an administrator.<br /><br />If you feel you are receiving this message in error, please contact the MEdTech Unit (page feedback on left) and we will investigate. The MEdTech Unit has automatically been informed that this error has taken place.";
        echo display_error();
    }
} else {
    application_log("error", "User tried to manage members a evaluation without providing a evaluation_id.");
    header("Location: " . ENTRADA_URL . "/admin/evaluations");
    exit;
}
             } elseif ($_GET["search-type"] == "active") {
                 $query_counter = "\tSELECT count(*) as `total_rows` FROM (SELECT COUNT(a.`id`) AS `total_rows`\n\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\tAND b.`access_starts` < " . $db->qstr(time()) . "\n\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` > " . $db->qstr(time()) . " OR b.`access_expires` = 0) AND\n\t\t\t\t\t\t\t\t\t\t(a.`number` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`username` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`email` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`firstname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`lastname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . ")\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`id`) as t";
                 $query_search = "\tSELECT a.*, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`, b.`account_active`, b.`access_starts`, b.`access_expires`, b.`last_login`, b.`role`, b.`group`\n\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\tAND b.`access_starts` < " . $db->qstr(time()) . "\n\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` > " . $db->qstr(time()) . " OR b.`access_expires` = 0) AND\n\t\t\t\t\t\t\t\t\t\t(a.`number` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`username` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`email` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`firstname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`lastname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . ")\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\t\t{$order_by}\n\t\t\t\t\t\t\t\t\t\tLIMIT %d, %d";
             } elseif ($_GET["search-type"] == "inactive") {
                 $query_counter = "\tSELECT count(*) as `total_rows` FROM (SELECT COUNT(a.`id`) AS `total_rows`\n\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tAND (b.`account_active` = 'false'\n\t\t\t\t\t\t\t\t\t\tOR (b.`access_starts` > " . $db->qstr(time()) . "\n\t\t\t\t\t\t\t\t\t\tOR (b.`access_expires` < " . $db->qstr(time()) . " AND b.`access_expires` != 0))) AND\n\t\t\t\t\t\t\t\t\t\t(a.`number` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`username` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`email` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`firstname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`lastname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . ")\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`id`) as t";
                 $query_search = "\tSELECT a.*, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`, b.`account_active`, b.`access_starts`, b.`access_expires`, b.`last_login`, b.`role`, b.`group`\n\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tAND (b.`account_active` = 'false'\n\t\t\t\t\t\t\t\t\t\tOR (b.`access_starts` > " . $db->qstr(time()) . "\n\t\t\t\t\t\t\t\t\t\tOR (b.`access_expires` < " . $db->qstr(time()) . " AND b.`access_expires` != 0))) AND\n\t\t\t\t\t\t\t\t\t\t(a.`number` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`username` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`email` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`firstname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`lastname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . ")\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\t\t{$order_by}\n\t\t\t\t\t\t\t\t\t\tLIMIT %d, %d";
             } elseif ($_GET["search-type"] == "new") {
                 $query_counter = "\tSELECT count(*) as `total_rows` FROM (SELECT COUNT(a.`id`) AS `total_rows`\n\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` IS NULL AND\n\t\t\t\t\t\t\t\t\t\t(a.`number` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`username` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`email` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`firstname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`lastname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . ")\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`id`) as t";
                 $query_search = "\tSELECT a.*, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`, b.`account_active`, b.`access_starts`, b.`access_expires`, b.`last_login`, b.`role`, b.`group`\n\t\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\t\tAND b.`app_id` = " . $db->qstr(AUTH_APP_ID) . "\n\t\t\t\t\t\t\t\t\t\tWHERE b.`app_id` IS NULL AND\n\t\t\t\t\t\t\t\t\t\t(a.`number` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`username` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`email` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`firstname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . "\n\t\t\t\t\t\t\t\t\t\tOR a.`lastname` LIKE " . $db->qstr("%%" . str_replace("%", "", $search_query) . "%%") . ")\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\t\t{$order_by}\n\t\t\t\t\t\t\t\t\t\tLIMIT %d, %d";
             }
             $sidebar_html = "<div style=\"margin: 2px 0px 10px 3px; font-size: 10px\">\n";
             $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-active-member.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> Active Member</div>\n";
             $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-inactive-member.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> Inactive Member</div>\n";
             $sidebar_html .= "\t<div><img src=\"" . ENTRADA_URL . "/images/legend-non-member.gif\" width=\"14\" height=\"14\" alt=\"\" title=\"\" style=\"vertical-align: middle\" /> Non-Member</div>\n";
             $sidebar_html .= "</div>\n";
             new_sidebar_item("Members Legend", $sidebar_html, "member-legend", "open");
         }
         break;
 }
 /**
  * Get the total number of results using the generated queries above and calculate the total number
  * of pages that are available based on the results per page preferences.
  */
 $result = USE_CACHE ? $db->CacheGetRow(CACHE_TIMEOUT, $query_counter) : $db->GetRow($query_counter);
 if ($result) {
     $total_rows = $result["total_rows"];
     if ($total_rows <= $results_per_page) {
         $total_pages = 1;
     } elseif ($total_rows % $results_per_page == 0) {
         $total_pages = (int) ($total_rows / $results_per_page);
     } else {
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    if ($router && $router->initRoute()) {
        if (isset($_GET["id"]) && ($tmp_input = clean_input($_GET["id"], "int"))) {
            $REPORT_ID = $tmp_input;
        }
        if ($REPORT_ID) {
            $query = "SELECT * FROM `reports_aamc_ci` WHERE `raci_id` = " . $db->qstr($REPORT_ID) . " AND `organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation());
            $REPORT = $db->GetRow($query);
            if ($REPORT) {
                $SHORT_REPORT_TITLE = date("Y", $REPORT["report_start"]) . "-" . date("Y", $REPORT["report_finish"]) . " Curriculum";
                $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/reports/aamc/manage?id=" . $REPORT_ID, "title" => $SHORT_REPORT_TITLE);
                $sidebar_html = "<ul class=\"menu\">";
                $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/admin/reports/aamc/manage/edit?id=" . $REPORT_ID . "\">Edit Report</a></li>\n";
                $sidebar_html .= "</ul>";
                new_sidebar_item($SHORT_REPORT_TITLE, $sidebar_html, "aamc-report", "open");
                $module_file = $router->getRoute();
                if ($module_file) {
                    require_once $module_file;
                }
            } else {
                add_notice("You don't appear to have access to change this organisation. If you feel you are seeing this in error, please contact your system administrator.");
                echo display_notice();
            }
        }
    } else {
        $url = ENTRADA_URL . "/admin/" . $MODULE;
        application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "].");
        header("Location: " . $url);
        exit;
    }
            $NOTICE_ID = 0;
        }
        $module_file = $router->getRoute();
        if ($module_file) {
            require_once $module_file;
        }
        if (is_array($NOTICE_TARGETS) && count($NOTICE_TARGETS)) {
            $query = "\tSELECT a.* FROM `" . AUTH_DATABASE . "`.`organisations` AS a\n\t\t\t\t\t\tJOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\tON a.`organisation_id` = b.`organisation_id`\n\t\t\t\t\t\tWHERE b.`user_id` = " . $db->qstr($ENTRADA_USER->getID()) . "\n\t\t\t\t\t\tGROUP BY a.`organisation_id`\n\t\t\t\t\t\tORDER BY `organisation_title` ASC";
            $organisations = $db->GetAll($query);
            $sidebar_html = '';
            foreach ($organisations as $organisation) {
                if ($ENTRADA_ACL->amIAllowed(new NoticeResource($organisation["organisation_id"]), 'create')) {
                    $sidebar_html .= "<div onclick=\"rssOpen('" . $organisation["organisation_id"] . "_notice_list');\" class=\"rsslist" . ($organisation["organisation_id"] == $_SESSION["details"]["organisation_id"] ? " expanded\"" : "") . "\">" . html_encode($organisation["organisation_title"]) . "</div>";
                    $sidebar_html .= "<ul class=\"menu\" id=\"" . $organisation["organisation_id"] . "_notice_list');\"" . ($organisation["organisation_id"] == $_SESSION["details"]["organisation_id"] ? "" : " style=\"display: none\"") . ">";
                    foreach ($NOTICE_TARGETS as $key => $target_name) {
                        $sidebar_html .= "<li class=\"rss\"><a href=\"" . ENTRADA_URL . "/notices/" . $key . "/" . $organisation["organisation_id"] . "\">" . str_replace("&nbsp;", "", $target_name) . "</a></li>\n";
                    }
                    $sidebar_html .= "</ul>";
                }
            }
            if ($sidebar_html != "") {
                $sidebar_html .= "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\tfunction rssOpen(id) {\n\t\t\t\t\tid = \$(id);\n\n\t\t\t\t\tif (id.visible()) {\n\t\t\t\t\t\tnew Effect.BlindUp(id,{duration: 0.4});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew Effect.BlindDown(id,{duration: 0.4});\n\t\t\t\t\t}\n\n\t\t\t\t\tid.previousSibling.toggleClassName('expanded');\n\t\t\t\t}\n\t\t\t\t</script>";
                new_sidebar_item("RSS Notice Feeds", $sidebar_html, "rss-notice-feeds", "open");
            }
        }
        /**
         * Check if preferences need to be updated on the server at this point.
         */
        preferences_update($MODULE, $PREFERENCES);
    }
}