Example #1
0
     $output .= "    </select>\n";
     $output .= " </div>\n";
     return $output;
 }
 if ($PROXY_ID) {
     $query = "SELECT * FROM `" . AUTH_DATABASE . "`.`user_data` WHERE `id` = " . $db->qstr($PROXY_ID);
     $user_record = $db->GetRow($query);
     if ($user_record) {
         $BREADCRUMB[] = array("url" => "", "title" => "Edit Profile");
         $PROCESSED_ACCESS = array();
         $PROCESSED_DEPARTMENTS = array();
         $custom_fields = fetch_department_fields($PROXY_ID);
         /*
          * Get the user departments and the custom fields for the departments.
          */
         $user_departments = get_user_departments($PROXY_ID);
         foreach ($user_departments as $department) {
             $PROCESSED_DEPARTMENTS[$department["department_id"]] = $department["department_title"];
         }
         ksort($PROCESSED_DEPARTMENTS);
         // Error Checking
         switch ($STEP) {
             case 2:
                 if (isset($_POST["custom"]) && $_POST["custom"]) {
                     /*
                      * Fetch the custom fields
                      */
                     $query = "SELECT * FROM `profile_custom_fields` WHERE `organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . " AND `active` = '1' ORDER BY `organisation_id`, `department_id`, `id`";
                     $dep_fields = $db->GetAssoc($query);
                     if ($dep_fields) {
                         foreach ($dep_fields as $field_id => $field) {
    if (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
        header("Location: " . ENTRADA_URL . (isset($_SERVER["REQUEST_URI"]) ? "?url=" . rawurlencode(clean_input($_SERVER["REQUEST_URI"], array("nows", "url"))) : ""));
        exit;
    } elseif (!$ENTRADA_ACL->amIAllowed('mydepartment', 'read', 'DepartmentHead') && !$ENTRADA_ACL->amIAllowed('myowndepartment', 'read', 'DepartmentRep')) {
        $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/" . $MODULE . "\\'', 15000)";
        $ERROR++;
        $ERRORSTR[] = "You do not have the permissions required to use 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 [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] do not have access to this module [" . $MODULE . "]");
    } else {
        // Attempt to get the departmentID from the department heads table as most of the time this file will
        // be accessed by department heads, however, there are also department reps that may access this file
        // therefore a fall back needs to be added to grab their department.
        $departmentID = is_department_head($ENTRADA_USER->getActiveId());
        if (!$departmentID || $departmentID == 0) {
            $departmentID = get_user_departments($ENTRADA_USER->getActiveId());
            $departmentID = $departmentID[0]["department_id"];
        }
        $departmentOuput = fetch_department_title($departmentID);
        $BREADCRUMB[] = array("url" => "", "title" => "Undergraduate Medical Teaching for " . $departmentOuput);
        $years = getMinMaxARYears();
        if (isset($years["start_year"]) && $years["start_year"] != "") {
            $PROCESSED["year_reported"] = $_POST['year_reported'];
            ?>
		<style type="text/css">
		h1 {
			page-break-before:	always;
			border-bottom:		2px #CCCCCC solid;
			font-size:			24px;
		}
		
function fetch_department_fields($proxy_id = NULL)
{
    global $db, $ENTRADA_USER;
    if ($proxy_id == NULL) {
        $user = $ENTRADA_USER;
    } else {
        $user = User::get($proxy_id);
    }
    /*
     * Fetch the departments this use is a part of.
     */
    $departments = get_user_departments($user->getID());
    $custom_fields = array();
    if ($departments) {
        foreach ($departments as $department) {
            $department_list[] = (int) $department["department_id"];
        }
        /*
         * Fetch the custom fields and responses for the user.
         */
        $query = "\tSELECT a.*, b.`value`\n\t\t\t\t\tFROM `profile_custom_fields` AS a\n\t\t\t\t\tLEFT JOIN `profile_custom_responses` AS b\n\t\t\t\t\tON a.`id` = b.`field_id`\n\t\t\t\t\tAND (b.`proxy_id` = " . $db->qstr($user->getID()) . " OR b.`proxy_id` IS NULL)\n\t\t\t\t\tWHERE a.`department_id` IN ('" . implode("','", $department_list) . "')\n\t\t\t\t\tAND a.`organisation_id` = " . $db->qstr($user->getActiveOrganisation()) . "\n\t\t\t\t\tAND a.`active` = '1'\n\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\tORDER BY a.`organisation_id`, a.`department_id`, a.`order`";
        $dep_custom_fields = $db->GetAll($query);
        if ($dep_custom_fields) {
            foreach ($dep_custom_fields as $field) {
                $custom_fields[$field["department_id"]][$field["id"]] = $field;
            }
        }
    }
    return $custom_fields;
}
Example #4
0
 if ($offical_file_active || $uploaded_file_active) {
     echo "\t\t<a id=\"zoomin_photo_" . $result["id"] . "\" class=\"zoomin\" onclick=\"growPic(\$('official_photo_" . $result["id"] . "'), \$('uploaded_photo_" . $result["id"] . "'), \$('official_link_" . $result["id"] . "'), \$('uploaded_link_" . $result["id"] . "'), \$('zoomout_photo_" . $result["id"] . "'));\">+</a>";
     echo "\t\t<a id=\"zoomout_photo_" . $result["id"] . "\" class=\"zoomout\" onclick=\"shrinkPic(\$('official_photo_" . $result["id"] . "'), \$('uploaded_photo_" . $result["id"] . "'), \$('official_link_" . $result["id"] . "'), \$('uploaded_link_" . $result["id"] . "'), \$('zoomout_photo_" . $result["id"] . "'));\"></a>";
 } else {
     echo "\t\t<img class=\"media-object people-search-thumb\" src=\"" . ENTRADA_URL . "/images/headshot-male.gif\" width=\"72\" height=\"100\" alt=\"No Photo Available\" title=\"No Photo Available\" />\n";
 }
 if ($offical_file_active && $uploaded_file_active) {
     echo "\t\t<a id=\"official_link_" . $result["id"] . "\" class=\"img-selector one\" onclick=\"showOfficial(\$('official_photo_" . $result["id"] . "'), \$('official_link_" . $result["id"] . "'), \$('uploaded_link_" . $result["id"] . "'));\" href=\"javascript: void(0);\">1</a>";
     echo "\t\t<a id=\"uploaded_link_" . $result["id"] . "\" class=\"img-selector two\" onclick=\"hideOfficial(\$('official_photo_" . $result["id"] . "'), \$('official_link_" . $result["id"] . "'), \$('uploaded_link_" . $result["id"] . "'));\" href=\"javascript: void(0);\">2</a>";
 }
 echo "</div>";
 echo "<div class=\"media-body\">";
 echo "<div class=\"pull-left ps-media-body-margin\">";
 echo "<h5 class\"media-heading ps-media-heading\">" . html_encode(($result["prefix"] ? $result["prefix"] . " " : "") . $result["firstname"] . " " . $result["lastname"]) . "</h5>";
 echo "<span class=\"content-small\">";
 if ($departmentResults = get_user_departments($result["id"])) {
     $deptCtr = 0;
     foreach ($departmentResults as $key => $departmentValue) {
         if ($deptCtr == 0) {
             $deptCtr++;
             echo ucwords($departmentValue["department_title"]);
         } else {
             $deptCtr++;
             echo "<br />" . ucwords($departmentValue["department_title"]);
         }
     }
 } else {
     if ($result["group"] == "student") {
         $cohort = groups_get_cohort($result["id"]);
     }
     echo ucwords($result["group"]) . " > " . ($result["group"] == "student" && isset($cohort["group_name"]) ? $cohort["group_name"] : ucwords($result["role"]));
Example #5
0
    if ($SUCCESS) {
        fade_element("out", "display-success-box");
        echo display_success();
    }
    if ($NOTICE) {
        fade_element("out", "display-notice-box");
        echo display_notice();
    }
    $ONLOAD[] = "provStateFunction(\$F(\$('profile-update')['country_id']))";
    $query = "SELECT * FROM `" . AUTH_DATABASE . "`.`user_data` WHERE `" . AUTH_DATABASE . "`.`user_data`.`id`=" . $db->qstr($ENTRADA_USER->getID());
    $user_data = $db->GetRow($query);
    if ($user_data) {
        /*
         * Get the user departments and the custom fields for the departments.
         */
        $user_departments = get_user_departments($ENTRADA_USER->getID());
        foreach ($user_departments as $department) {
            $departments[$department["department_id"]] = $department["department_title"];
        }
        $custom_fields = fetch_department_fields();
        ?>
		<script type="text/javascript">
		function provStateFunction(country_id) {
			var url='<?php 
        echo webservice_url("province");
        ?>
';
			<?php 
        if ($PROCESSED["province"] || $PROCESSED["province_id"]) {
            $source_arr = $PROCESSED;
        } else {
 if ($offical_file_active || $uploaded_file_active) {
     echo "\t\t<a id=\"zoomin_photo_" . $proxy_id . "\" class=\"zoomin\" onclick=\"growPic(\$('official_photo_" . $proxy_id . "'), \$('uploaded_photo_" . $proxy_id . "'), \$('official_link_" . $proxy_id . "'), \$('uploaded_link_" . $proxy_id . "'), \$('zoomout_photo_" . $proxy_id . "'));\">+</a>";
     echo "\t\t<a id=\"zoomout_photo_" . $proxy_id . "\" class=\"zoomout\" onclick=\"shrinkPic(\$('official_photo_" . $proxy_id . "'), \$('uploaded_photo_" . $proxy_id . "'), \$('official_link_" . $proxy_id . "'), \$('uploaded_link_" . $proxy_id . "'), \$('zoomout_photo_" . $proxy_id . "'));\"></a>";
 } else {
     echo "\t\t<img class=\"media-object people-search-thumb\" src=\"" . ENTRADA_URL . "/images/headshot-male.gif\" width=\"72\" height=\"100\" alt=\"No Photo Available\" title=\"No Photo Available\" />\n";
 }
 if ($offical_file_active && $uploaded_file_active) {
     echo "\t\t<a id=\"official_link_" . $proxy_id . "\" class=\"img-selector one\" onclick=\"showOfficial(\$('official_photo_" . $proxy_id . "'), \$('official_link_" . $proxy_id . "'), \$('uploaded_link_" . $proxy_id . "'));\" href=\"javascript: void(0);\">1</a>";
     echo "\t\t<a id=\"uploaded_link_" . $proxy_id . "\" class=\"img-selector two\" onclick=\"hideOfficial(\$('official_photo_" . $proxy_id . "'), \$('official_link_" . $proxy_id . "'), \$('uploaded_link_" . $proxy_id . "'));\" href=\"javascript: void(0);\">2</a>";
 }
 echo "</div>";
 echo "<div class=\"media-body\">";
 echo "<div class=\"pull-left ps-media-body-margin\">";
 echo "<h5 class\"media-heading ps-media-heading\">" . html_encode(($user["prefix"] ? $user["prefix"] . " " : "") . $user["firstname"] . " " . $user["lastname"]) . "</h5>";
 echo "<span class=\"content-small\">";
 if ($departmentResults = get_user_departments($proxy_id)) {
     $deptCtr = 0;
     foreach ($departmentResults as $key => $departmentValue) {
         if ($deptCtr == 0) {
             $deptCtr++;
             echo ucwords($departmentValue["department_title"]);
         } else {
             $deptCtr++;
             echo "<br />" . ucwords($departmentValue["department_title"]);
         }
     }
 } else {
     if ($user["group"] == "student") {
         $cohort = groups_get_cohort($proxy_id);
     }
     echo ucwords($user["group"]) . " > " . ($user["group"] == "student" && isset($cohort["group_name"]) ? $cohort["group_name"] : ucwords($user["role"]));
        exit;
    } elseif (!$ENTRADA_ACL->amIAllowed('mydepartment', 'read', 'DepartmentHead') && !$ENTRADA_ACL->amIAllowed('myowndepartment', 'read', 'DepartmentRep')) {
        $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/" . $MODULE . "\\'', 15000)";
        $ERROR++;
        $ERRORSTR[] = "You do not have the permissions required to use 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 [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] do not have access to this module [" . $MODULE . "]");
    } else {
        $BREADCRUMB[] = array("url" => "", "title" => "Undergraduate Medical Teaching");
        $years = getMinMaxARYears();
        if (isset($years["start_year"]) && $years["start_year"] != "") {
            $PROCESSED["department_id"] = $_POST['department_id'];
            //$PROCESSED["department_id"]
            $PROCESSED["department_id"] = is_department_head($ENTRADA_USER->getActiveId());
            if (!$PROCESSED["department_id"] || $PROCESSED["department_id"] == 0) {
                $PROCESSED["department_id"] = get_user_departments($ENTRADA_USER->getActiveId());
                $PROCESSED["department_id"] = $PROCESSED["department_id"][0]["department_id"];
            }
            $departmentOutput = fetch_department_title($PROCESSED["department_id"]);
            if (isset($_POST["start_year"]) && $_POST["start_year"] != "") {
                $PROCESSED["start_year"] = (int) $_POST["start_year"];
                $startYear = $PROCESSED["start_year"];
            }
            if (isset($_POST["end_year"]) && $_POST["end_year"] != "") {
                $PROCESSED["end_year"] = (int) $_POST["end_year"];
                $endYear = $PROCESSED["end_year"];
            }
            ?>
		<style type="text/css">
		h1 {
			page-break-before:	always;