示例#1
0
/**
 * @param $keytype e.g. 'blockchain', 'mtgox', 'notification', ...
 */
function can_user_add($user, $keytype, $amount = 1)
{
    $summary = user_limits_summary($user['id']);
    $data = get_account_data($keytype);
    $current_total = $summary['total_' . $data['group']];
    $limit = get_premium_value($user, $data['group']);
    return $current_total + $amount <= $limit;
    throw new Exception("Could not find user limit type '{$keytype}'");
}
示例#2
0
                            echo display_success();
                        }
                        break;
                    default:
                        ?>
					<div class="display-notice" style="vertical-align: middle; padding: 15px;">
						<strong>Confirmation:</strong> Are you sure you want to cancel this request? <input type="button" class="btn btn-danger" value="Confirm" style="margin-left: 15px" onclick="window.location='<?php 
                        echo ENTRADA_URL;
                        ?>
/clerkship/electives?section=delete&step=2&id=<?php 
                        echo $EVENT_ID;
                        ?>
'" />
					</div>
					<?php 
                        $student_name = get_account_data("firstlast", $event_info["etype_id"]);
                        echo $header_output;
                        ?>
					<table style="width: 100%" cellspacing="0" cellpadding="2" border="0" summary="Viewing Elective">
						<colgroup>
							<col style="width: 25%" />
							<col style="width: 75%" />
						</colgroup>
						<tfoot>
							<tr>
								<td style="width: 25%; text-align: left">
									<input type="button" class="btn" value="Back" onclick="window.location='<?php 
                        echo ENTRADA_URL;
                        ?>
/clerkship/electives?section=edit&id=<?php 
                        echo $EVENT_ID;
                            }
                        });
                    });
                </script>
                <h2>Select a Learner and a Time Period:</h2>
                <form action="<?php 
                echo html_encode(ENTRADA_URL);
                ?>
/admin/evaluations/reports?section=learner-evaluations&step=2" method="POST" id="evaluation-report-form">
                    <div class="control-group row-fluid">
                        <label for="course_id" class="form-required span3">Learner</label>
                        <span class="controls span8">
                            <?php 
                echo "<select data-placeholder=\"Choose a learner...\"  name=\"proxy_id\" id=\"proxy_id\" class=\"chosen-select\">";
                foreach ($students as $student) {
                    echo "<option value=\"" . (int) $student["proxy_id"] . "\"" . (isset($PROCESSED["proxy_id"]) && $student["proxy_id"] == $PROCESSED["proxy_id"] ? " selected=\"selected\"" : "") . ">" . html_encode(get_account_data("fullname", $student["proxy_id"])) . "</option>";
                }
                echo "</select>";
                ?>
                            </select>
                        </span>
                    </div>
                    <div class="control-group row-fluid">
                        <label for="course_id" class="form-required span3">Report Start: </label>
                        <span class="controls span8">
                            <div class="input-append">
                                <input type="text" class="input-small datepicker" value="<?php 
                echo isset($PROCESSED["report_start"]) && $PROCESSED["report_start"] ? date("Y-m-d", $PROCESSED["report_start"]) : "";
                ?>
" name="report_start" id="report_start" />
                                <span class="add-on pointer"><i class="icon-calendar"></i></span>
示例#4
0
                    ?>
</a>
							</div>
						</div>
					<?php 
                }
                if ((int) $course_details["studrep_id"]) {
                    ?>
						<div class="control-group">
							<label for="stud_rep" class="form-nrequired control-label"><strong>Student Rep</strong></label>
							<div class="controls">
								<a href="mailto:<?php 
                    echo get_account_data("email", $course_details["studrep_id"]);
                    ?>
"><?php 
                    echo get_account_data("fullname", $course_details["studrep_id"]);
                    ?>
</a>
							</div>
						</div>
					<?php 
                }
                if (clean_input($course_details["course_description"], array("notags", "nows")) != "") {
                    ?>
						<div class="control-group">
							<label for="course_description" class="form-nrequired control-label">&nbsp;</label>
							<div class="controls">
								<h3><?php 
                    echo $module_singular_name . " Description";
                    ?>
</h3>
示例#5
0
                 </td>
                 <td style="border-left: none;">
                     Tasks Progress
                 </td>
             </tr>
         </thead>
         <tbody>
             <?php 
 for ($i = ($page_current - 1) * $_SESSION[APPLICATION_IDENTIFIER]["clerkship"]["pp"]; $i < ($page_current * $_SESSION[APPLICATION_IDENTIFIER]["clerkship"]["pp"] < $clerk_count ? $page_current * $_SESSION[APPLICATION_IDENTIFIER]["clerkship"]["pp"] : $clerk_count); $i++) {
     $query = "SELECT COUNT(*) FROM `" . CLERKSHIP_DATABASE . "`.`logbook_entries` WHERE `proxy_id` = " . $db->qstr($clerks[$i]["id"]) . " AND `entry_active` = 1 AND\n                                                `rotation_id` IN (Select e.`event_id` FROM `" . CLERKSHIP_DATABASE . "`.`events` as e\n                                                WHERE e.`rotation_id` = " . $db->qstr($rotation["id"]) . ")";
     $entries = $db->CacheGetOne(LONG_CACHE_TIMEOUT, $query);
     $procedures_required = 0;
     $objectives_required = 0;
     $objectives_recorded = 0;
     $procedures_recorded = 0;
     $grad_year = get_account_data("grad_year", $clerks[$i]["id"]);
     $query = "SELECT `objective_id`, `lmobjective_id`, MAX(`number_required`) AS `required`\n                                                FROM `" . CLERKSHIP_DATABASE . "`.`logbook_mandatory_objectives`\n                                                WHERE `rotation_id` = " . $db->qstr($rotation["id"]) . "\n                                                AND `grad_year_min` <= " . $db->qstr($grad_year) . "\n                                                AND (`grad_year_max` = 0 OR `grad_year_max` >= " . $db->qstr($grad_year) . ")\n                                                GROUP BY `objective_id`";
     $required_objectives = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
     if ($required_objectives) {
         foreach ($required_objectives as $required_objective) {
             $objectives_required += $required_objective["required"];
             $llocation_ids_string = "";
             if (CLERKSHIP_SETTINGS_REQUIREMENTS) {
                 $query = "SELECT c.`llocation_id` FROM `" . CLERKSHIP_DATABASE . "`.`logbook_mandatory_objective_locations` AS a\n                                                            JOIN `logbook_location_types` AS b\n                                                            ON a.`lltype_id` = b.`lltype_id`\n                                                            JOIN `logbook_lu_locations` AS c\n                                                            ON b.`llocation_id` = c.`llocation_id\n                                                            WHERE a.`lmobjective_id` = " . $db->qstr($required_objective["lmobjective_id"]);
                 $valid_locations = $db->GetAll($query);
                 if ($valid_locations) {
                     foreach ($valid_locations as $location) {
                         if ($llocation_ids_string) {
                             $llocation_ids_string .= ", " . $db->qstr($location["llocation_id"]);
                         } else {
                             $llocation_ids_string = $db->qstr($location["llocation_id"]);
示例#6
0
     if ($evaluation_forms) {
         $authors_with_duplicates[] = $author;
     }
 }
 if (count($authors_with_duplicates) >= 1) {
     if (count($authors_with_duplicates) == 1) {
         if ($authors_with_duplicates[0] == $ENTRADA_USER->getActiveId()) {
             add_error("The <strong>Form Title</strong> must be unique for each author. Please ensure that you use a form name which you are not an author for already.<br /><br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.");
         } else {
             $author_name = get_account_data("wholename", $authors_with_duplicates[0]);
             add_error("The <strong>Form Title</strong> must be unique for each author. Please ensure that you use a form name which <strong>" . html_encode($author_name) . "</strong> is not an author for already.<br /><br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.");
         }
     } else {
         $error_string = "The <strong>Form Title</strong> must be unique for each author.<br /><br /> The following list of users are already an author on another form with the same name: <br />\n<ul class=\"menu\">\n";
         foreach ($authors_with_duplicates as $author) {
             $author_name = get_account_data("wholename", $author);
             $error_string .= "<li class=\"user\">" . html_encode($author_name) . "</li>";
         }
         $error_string .= "</ul>\n";
         $error_string .= "<br />Please consider adding a simple identifier to the end of the form name (such as \"" . date("M-Y") . "\") to identify this form compared to any other existing form with the same name.";
         add_error($error_string);
     }
 }
 if (!$ERROR) {
     $PROCESSED["form_parent"] = 0;
     $PROCESSED["form_active"] = 1;
     $PROCESSED["updated_date"] = time();
     $PROCESSED["organisation_id"] = $ENTRADA_USER->getActiveOrganisation();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     if ($db->AutoExecute("evaluation_forms", $PROCESSED, "INSERT") && ($eform_id = $db->Insert_Id())) {
         if (is_array($PROCESSED["associated_authors"]) && count($PROCESSED["associated_authors"])) {
                ?>
"><?php 
                echo $procedures_recorded;
                ?>
</a></td>
							<td class="date-smallest"><a href="<?php 
                echo $url;
                ?>
"><?php 
                echo $procedures_required;
                ?>
</a></td>
						</tr>
						<?php 
            }
        }
        ?>
		
				</tbody>
			</table>
		</form>
		<?php 
    }
    if (!$summary_shown) {
        $student_name = get_account_data("firstlast", $PROXY_ID);
        add_notice($student_name . " has not begun any core rotations in the system at this time.");
        echo "<div style=\"width: 100%; text-align: center; margin-top: 80px;\">\n";
        echo display_notice();
        echo "</div>\n";
    }
}
                echo display_success();
            }
            if ($NOTICE) {
                echo display_notice();
            }
            if ($ERROR) {
                echo display_error();
            }
            break;
        case 1:
        default:
            $ONLOAD[] = "initDynamicTable()";
            $ONLOAD[] = "updatePollTypeIcon('4')";
            $ONLOAD[] = "updateColorIcon('1')";
            $proxy_id = clean_input($_GET["id"], "int");
            $student_name = get_account_data("firstlast", $proxy_id);
            echo "<h1>Discipline Breakdown For " . $student_name . "</h1>\n";
            if ($ERROR) {
                echo display_error();
            }
            ?>
			<form name="viewDisciplines" action="<?php 
            echo ENTRADA_URL;
            ?>
/clerkship/electives" method="post">
			
			<div>
			 	<div style="float: left; vertical-align: middle;">
					<label for="PollingType" class="form-nrequired">Chart Style:</label> 
					
					<span id="polling-type-list">
$needToSend = false;
$output = array();
$query = "SELECT COUNT(`event_id`) AS `total` FROM `" . CLERKSHIP_DATABASE . "`.`events` WHERE `event_type` = 'elective' AND `event_status` = 'approval'";
$result = $db->GetRow($query);
if ($result["total"] > 9) {
    $needToSend = true;
} else {
    $twoWeeksAgo = strtotime("-2 weeks");
    $query = "SELECT * FROM `" . CLERKSHIP_DATABASE . "`.`events` WHERE `event_type` = 'elective' AND `event_status` = 'approval' AND `modified_last` < " . $db->qstr($twoWeeksAgo);
    if ($result = $db->GetRow($query)) {
        $needToSend = true;
    }
}
$search = array("%TO_NAME%", "%EVENT_LINK%");
$replace = array($AGENT_CONTACTS["agent-clerkship"]["name"], ENTRADA_URL . "/admin/clerkship/electives");
$mail->setFrom($AGENT_CONTACTS["administrator"]["email"], $AGENT_CONTACTS["administrator"]["name"]);
$mail->setSubject($NOTIFICATION_MESSAGE["subject"]);
$mail->setReplyTo($AGENT_CONTACTS["administrator"]["email"], $AGENT_CONTACTS["administrator"]["name"]);
$mail->setBodyText(str_replace($search, $replace, $NOTIFICATION_MESSAGE["textbody"]));
if ($needToSend) {
    $email_address = get_account_data("email", $AGENT_CONTACTS["agent-clerkship"]["director_ids"]["0"]);
    $name = get_account_data("firstlast", $AGENT_CONTACTS["agent-clerkship"]["director_ids"]["0"]);
    $mail->addTo($email_address, $name);
    try {
        $mail->send();
        application_log("notification", "SUCCESS: Sent electives approval reminder to undergrad.");
    } catch (Zend_Mail_Transport_Exception $e) {
        application_log("notification", "FAILURE: Unable to send electives approval reminder to undergrad.");
    }
}
$mail->clearRecipients();
示例#10
0
<?php

/**
 * Admin page for displaying the status of accounts in the system, allowing us to see
 * if particular classes of accounts are failing.
 */
require_admin();
require __DIR__ . "/../layout/templates.php";
require __DIR__ . "/../layout/graphs.php";
$messages = array();
$errors = array();
// enabling accounts?
if (require_post("enable", false)) {
    $exchange = require_post("enable");
    $account_data = get_account_data($exchange);
    // we re-enable ALL accounts, not just accounts belonging to active users, so that when a disabled user
    // logs back in, they automatically get their disabled accounts disabled as well
    $q = db()->prepare("SELECT t.*, users.email, user_properties.name AS users_name, user_properties.is_disabled AS user_is_disabled FROM " . $account_data['table'] . " t\n    JOIN users ON t.user_id=users.id\n    JOIN user_properties ON users.id=user_properties.id\n    WHERE t.is_disabled=1");
    $q->execute();
    $count = 0;
    $accounts = $q->fetchAll();
    foreach ($accounts as $account) {
        // re-enable it
        $q = db()->prepare("UPDATE " . $account_data['table'] . " SET is_disabled=0 WHERE id=? AND is_disabled_manually=0");
        $q->execute(array($account['id']));
        // email the user if their account is not disabled
        if (!$account['user_is_disabled']) {
            if ($account['email']) {
                $user_temp = array('email' => $account['email'], 'name' => $account['users_name']);
                send_user_email($user_temp, "reenable", array("name" => $account['users_name'] ? $account['users_name'] : $account['email'], "exchange" => get_exchange_name($exchange), "label" => $account_data['label'], "labels" => $account_data['labels'], "title" => isset($account['title']) && $account['title'] ? "\"" . $account['title'] . "\"" : "untitled", "url" => absolute_url(url_for("wizard_accounts"))));
                $messages[] = "Sent enabled message to " . htmlspecialchars($account['email']);
示例#11
0
 }
 $editable = false;
 $edit_ajax = array();
 if ($event_discussions) {
     $i = 0;
     foreach ($event_discussions as $result) {
         if ($result["proxy_id"] == $ENTRADA_USER->getID()) {
             $editable = true;
             $edit_ajax[] = $result["ediscussion_id"];
         } else {
             $editable = false;
         }
         $poster_name = get_account_data("firstlast", $result["proxy_id"]);
         echo "<div id=\"event_comment_" . $result["ediscussion_id"] . "\" class=\"discussion\"" . ($i % 2 ? " style=\"background-color: #F3F3F3\"" : "") . ">\n";
         echo "\t<span class=\"discussion-title\">" . html_encode($result["discussion_title"]) . "</span>" . ($editable ? " ( <span id=\"edit_mode_" . $result["ediscussion_id"] . "\" style=\"cursor: pointer\">edit</span> )" : "") . "<br />\n";
         echo "\t<div class=\"content-small\"><strong>" . get_account_data("firstlast", $result["proxy_id"]) . "</strong>, " . date(DEFAULT_DATE_FORMAT, $result["updated_date"]) . "</div>\n";
         echo "\t<div class=\"discussion-comment\" id=\"discussion_comment_" . $result["ediscussion_id"] . "\">" . nl2br(html_encode($result["discussion_comment"])) . "</div>\n";
         echo "</div>\n";
         $i++;
     }
     if (@is_array($edit_ajax) && @count($edit_ajax)) {
         echo "<script type=\"text/javascript\">\n";
         foreach ($edit_ajax as $discussion_id) {
             echo "var editor_" . $discussion_id . " = new Ajax.InPlaceEditor('discussion_comment_" . $discussion_id . "', '" . ENTRADA_RELATIVE . "/api/discussions.api.php', { rows: 7, cols: 75, okText: \"Save Changes\", cancelText: \"Cancel Changes\", externalControl: \"edit_mode_" . $discussion_id . "\", callback: function(form, value) { return 'action=edit&sid=" . session_id() . "&id=" . $discussion_id . "&discussion_comment='+escape(value) } });\n";
         }
         echo "</script>\n";
     }
 } else {
     echo "<div class=\"content-small\">There are no comments or discussions on this event. <strong>Start a conversation</strong>, leave your comment below.</div>\n";
 }
 echo "\t<br /><br />";
示例#12
0
/**
 * This function will notify the regional education office of updates / deletes to affected apartment events.
 *
 * @param string $action
 * @param int $event_id
 * @return bool $success
 */
function notify_regional_education($action, $event_id)
{
    global $db, $AGENT_CONTACTS, $event_info, $ENTRADA_USER;
    $query = "\tSELECT * FROM `" . CLERKSHIP_DATABASE . "`.`events` AS a\n\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`regions` AS b\n\t\t\t\tON a.`region_id` = b.`region_id`\n\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`event_contacts` AS c\n\t\t\t\tON a.`event_id` = c.`event_id`\n\t\t\t\tWHERE a.`event_id` = " . $db->qstr($event_id);
    $result = $db->GetRow($query);
    if ($result) {
        /**
         * Don't process this if the event has already ended as there's not need for notifications.
         */
        if ($result["event_finish"] > time()) {
            $whole_name = get_account_data("firstlast", $result["etype_id"]);
            $query = "\tSELECT a.`inhabiting_start`, a.`inhabiting_finish`, b.`apartment_title`\n\t\t\t\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`apartment_schedule` AS a\n\t\t\t\t\t\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`apartments` AS b\n\t\t\t\t\t\t\t\tON b.`apartment_id` = a.`apartment_id`\n\t\t\t\t\t\t\t\tWHERE a.`event_id` = " . $db->qstr($event_id);
            $apartments = $db->GetAll($query);
            if ($apartments) {
                switch ($action) {
                    case "deleted":
                        $message = "Attention " . $AGENT_CONTACTS["agent-regionaled"]["name"] . ",\n\n";
                        $message .= $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " has removed an event from " . $whole_name . "'s ";
                        $message .= "clerkship schedule, to which you had previously assigned housing. Due to the removal of this event from the system, ";
                        $message .= "the housing associated with it has also been removed.\n\n";
                        $message .= "Information For Reference:\n\n";
                        $message .= "Event Information:\n";
                        $message .= "Event Title:\t" . html_decode($result["event_title"]) . "\n";
                        $message .= "Region:\t\t" . $result["region_name"] . "\n";
                        $message .= "Start Date:\t" . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "\n";
                        $message .= "Finish Date:\t" . date(DEFAULT_DATE_FORMAT, $result["event_finish"]) . "\n\n";
                        if ($apartments && ($assigned_apartments = @count($apartments))) {
                            $message .= "Apartment" . ($assigned_apartments != 1 ? "s" : "") . " " . $whole_name . " was removed from:\n";
                            foreach ($apartments as $apartment) {
                                $message .= "Apartment Title:\t" . $apartment["apartment_title"] . "\n";
                                $message .= "Inhabiting Start:\t" . date(DEFAULT_DATE_FORMAT, $apartment["inhabiting_start"]) . "\n";
                                $message .= "Inhabiting Finish:\t" . date(DEFAULT_DATE_FORMAT, $apartment["inhabiting_finish"]) . "\n\n";
                            }
                        }
                        $message .= "=======================================================\n\n";
                        $message .= "Deletion Date:\t" . date("r", time()) . "\n";
                        $message .= "Deleted By:\t" . $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " (" . $ENTRADA_USER->getID() . ")\n";
                        break;
                    case "change-critical":
                        $message = "Attention " . $AGENT_CONTACTS["agent-regionaled"]["name"] . ",\n\n";
                        $message .= $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " has updated an event in " . $whole_name . "'s ";
                        $message .= "clerkship schedule, to which you had previously assigned housing. This update involves a change to the region or the ";
                        $message .= "dates that the event took place in. Due to this critical change taking place, the housing for this event for this ";
                        $message .= "student has been removed.\n\n";
                        if ($result["manage_apartments"]) {
                            $message .= "Please log into the clerkship system and re-assign housing to this student for this event.\n\n";
                        } else {
                            $message .= "Since this event no longer is taking place in a region which is managed by Regional Education, \n";
                            $message .= "no further action is required on your part in the system.\n\n";
                        }
                        $message .= "Information For Reference:\n\n";
                        $message .= "OLD Event Information:\n";
                        $message .= "Event Title:\t" . $event_info["event_title"] . "\n";
                        $message .= "Region:\t\t" . get_region_name($event_info["region_id"]) . "\n";
                        $message .= "Start Date:\t" . date(DEFAULT_DATE_FORMAT, $event_info["event_start"]) . "\n";
                        $message .= "Finish Date:\t" . date(DEFAULT_DATE_FORMAT, $event_info["event_finish"]) . "\n\n";
                        $message .= "NEW Event Information:\n";
                        $message .= "Event Title:\t" . html_decode($result["event_title"]) . "\n";
                        $message .= "Region:\t\t" . $result["region_name"] . "\n";
                        $message .= "Start Date:\t" . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "\n";
                        $message .= "Finish Date:\t" . date(DEFAULT_DATE_FORMAT, $result["event_finish"]) . "\n\n";
                        if ($apartments && ($assigned_apartments = @count($apartments))) {
                            $message .= "Apartment" . ($assigned_apartments != 1 ? "s" : "") . " " . $whole_name . " was removed from:\n";
                            foreach ($apartments as $apartment) {
                                $message .= "Apartment Title:\t" . $apartment["apartment_title"] . "\n";
                                $message .= "Inhabiting Start:\t" . date(DEFAULT_DATE_FORMAT, $apartment["inhabiting_start"]) . "\n";
                                $message .= "Inhabiting Finish:\t" . date(DEFAULT_DATE_FORMAT, $apartment["inhabiting_finish"]) . "\n\n";
                            }
                        }
                        $message .= "=======================================================\n\n";
                        $message .= "Deletion Date:\t" . date("r", time()) . "\n";
                        $message .= "Deleted By:\t" . $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " (" . $ENTRADA_USER->getID() . ")\n";
                        break;
                    case "change-non-critical":
                    case "updated":
                    default:
                        $message = "Attention " . $AGENT_CONTACTS["agent-regionaled"]["name"] . ",\n\n";
                        $message .= $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " has updated an event in " . $whole_name . "'s ";
                        $message .= "clerkship schedule, to which you had previously assigned housing.\n\n";
                        $message .= "Important:\n";
                        $message .= "This update does not affect the date or region of this event, as such this change is considered non-critical ";
                        $message .= "and no action is required on your part.\n\n";
                        $message .= "Information For Reference:\n\n";
                        $message .= "OLD Event Information:\n";
                        $message .= "Event Title:\t" . $event_info["event_title"] . "\n";
                        $message .= "Region:\t\t" . get_region_name($event_info["region_id"]) . "\n";
                        $message .= "Start Date:\t" . date(DEFAULT_DATE_FORMAT, $event_info["event_start"]) . "\n";
                        $message .= "Finish Date:\t" . date(DEFAULT_DATE_FORMAT, $event_info["event_finish"]) . "\n\n";
                        $message .= "NEW Event Information:\n";
                        $message .= "Event Title:\t" . html_decode($result["event_title"]) . "\n";
                        $message .= "Region:\t\t" . $result["region_name"] . "\n";
                        $message .= "Start Date:\t" . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "\n";
                        $message .= "Finish Date:\t" . date(DEFAULT_DATE_FORMAT, $result["event_finish"]) . "\n\n";
                        if ($apartments && ($assigned_apartments = @count($apartments))) {
                            $message .= "Apartment" . ($assigned_apartments != 1 ? "s" : "") . " " . $whole_name . " is assigned to:\n";
                            foreach ($apartments as $apartment) {
                                $message .= "Apartment Title:\t" . $apartment["apartment_title"] . "\n";
                                $message .= "Inhabiting Start:\t" . date(DEFAULT_DATE_FORMAT, $apartment["inhabiting_start"]) . "\n";
                                $message .= "Inhabiting Finish:\t" . date(DEFAULT_DATE_FORMAT, $apartment["inhabiting_finish"]) . "\n\n";
                            }
                        }
                        $message .= "=======================================================\n\n";
                        $message .= "Updated Date:\t" . date("r", time()) . "\n";
                        $message .= "Update By:\t" . $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " (" . $ENTRADA_USER->getID() . ")\n";
                        break;
                }
                $mail = new Zend_Mail();
                $mail->addHeader("X-Originating-IP", $_SERVER["REMOTE_ADDR"]);
                $mail->addHeader("X-Section", "Clerkship Notify System", true);
                $mail->clearFrom();
                $mail->clearSubject();
                $mail->setFrom($AGENT_CONTACTS["agent-notifications"]["email"], APPLICATION_NAME . ' Clerkship System');
                $mail->setSubject("MEdTech Clerkship System - " . ucwords($action) . " Event");
                $mail->setBodyText($message);
                $mail->clearRecipients();
                $mail->addTo($AGENT_CONTACTS["agent-regionaled"]["email"], $AGENT_CONTACTS["agent-regionaled"]["name"]);
                $sent = true;
                try {
                    $mail->send();
                    application_log("success", "An event change notification has been sent to regional education to notify them of the changes to the event [" . $event_info["event_id"] . "] which will affect the apartment schedule.");
                    return true;
                } catch (Exception $e) {
                    system_log_data("error", "Unable to send " . $action . " notification to regional education. Zend_mail said: " . $e->getMessage());
                    return false;
                }
            } else {
                return true;
            }
        } else {
            // No need to notify Regional Education because the event is already over, just return true.
            return true;
        }
    } else {
        system_log_data("error", "The notify_regional_education() function returned false with no results from the database query. Database said: " . $db->ErrorMsg());
        return false;
    }
}
                     break;
                 case $a['exchange'] . "_wallet":
                     $balances_wallet[$balance['currency']] = $balance['balance'];
                     break;
                 case $a['exchange'] . "_securities":
                     $balances_securities[$balance['currency']] = $balance['balance'];
                     break;
                 default:
                     throw new Exception("Unknown exchange '" . htmlspecialchars($balance['exchange']) . "' while retrieving account balances");
             }
             $last_updated = $balance['created_at'];
         }
     }
 }
 // get the account type data
 $account_type_data = get_account_data($a['exchange']);
 // was the last request successful?
 $q = db()->prepare("SELECT * FROM jobs\n      WHERE user_id=? AND arg_id=? AND job_type=? AND is_executed=1 AND is_recent=1\n      ORDER BY jobs.id DESC LIMIT 1");
 $q->execute(array(user_id(), $a['id'], $account_type_data['job_type']));
 $job = $q->fetch();
 if (!$last_updated && $job) {
     $last_updated = $job['executed_at'];
 }
 if ($job && $job['is_error']) {
     $q = db()->prepare("SELECT id,message FROM uncaught_exceptions WHERE job_id=? ORDER BY id DESC LIMIT 1");
     // select the most recent exception too
     $q->execute(array($job['id']));
     $ue = $q->fetch();
     if ($ue) {
         $job['message'] = $ue['message'];
     }
             } else {
                 $publicationCountArray[$departmentMember][4]["In Press"]["N/A"] = 0;
                 echo "<td class=\"general\" style=\"white-space: normal\">No Abstracts In Press</td>";
             }
             echo "</tr>";
             $lastMember = $departmentMember;
         }
     }
 }
 $fp = fopen($txtfname, 'w');
 $data = "Name|Articles Published|Articles In Press|Abstracts Published|Abstracts In Press\r\n";
 fwrite($fp, $data);
 $inPressData = "";
 $publishedData = "";
 foreach ($publicationCountArray as $key => $value) {
     $name = get_account_data("wholename", $key);
     $data = $name;
     foreach ($value as $newKey => $newValue) {
         foreach ($newValue as $newestKey => $newestValue) {
             if ($newestKey == "In Press") {
                 foreach ($newestValue as $newNewestKey => $newNewestValue) {
                     if ($inPressData == "") {
                         if ($newNewestKey != "N/A") {
                             $inPressData = $newNewestKey . "(" . $newNewestValue . ")";
                         } else {
                             $inPressData = "N/A";
                         }
                     } else {
                         if ($newNewestKey != "N/A") {
                             $inPressData .= ", " . $newNewestKey . "(" . $newNewestValue . ")";
                         } else {
 /**
  * Creates a new notification and returns its id.
  *
  * @param int $nuser_id
  * @param int $proxy_id
  * @param int $record_id
  * @return int $notification_id
  */
 public static function add($nuser_id, $proxy_id, $record_id, $subcontent_id = 0)
 {
     global $db, $ENTRADA_TEMPLATE;
     $notification_user = NotificationUser::getByID($nuser_id);
     if ($notification_user) {
         if ($notification_user->getDigestMode()) {
             $notification_body = $notification_user->getContentBody($record_id);
             $sent = false;
             $new_notification = array("nuser_id" => $nuser_id, "notification_body" => $notification_body, "proxy_id" => $proxy_id, "sent" => 0, "digest" => 1, "sent_date" => 0);
             $db->AutoExecute("notifications", $new_notification, "INSERT");
             if (!($notification_id = $db->Insert_Id())) {
                 application_log("error", "There was an issue attempting to add a notification record to the database. Database said: " . $db->ErrorMsg());
             } else {
                 $new_notification["notification_id"] = $notification_id;
                 $notification = self::fromArray($new_notification);
                 $notification_user->setNextNotificationDate();
                 return $notification;
             }
         } else {
             switch ($notification_user->getContentType()) {
                 case "logbook_rotation":
                     $search = array("%AUTHOR_FULLNAME%", "%OWNER_FULLNAME%", "%ROTATION_NAME%", "%CONTENT_BODY%", "%URL%", "%UNSUBSCRIBE_URL%", "%APPLICATION_NAME%", "%ENTRADA_URL%");
                     $replace = array(html_encode(get_account_data("wholename", $proxy_id)), html_encode(get_account_data("wholename", $notification_user->getRecordProxyID())), html_encode($notification_user->getContentTitle()), html_encode($notification_user->getContentBody($record_id)), html_encode($notification_user->getContentURL()), html_encode(ENTRADA_URL . "/profile?section=notifications&id=" . $nuser_id . "&action=unsubscribe"), html_encode(APPLICATION_NAME), html_encode(ENTRADA_URL));
                     $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-logbook-rotation-" . ($notification_user->getProxyID() == $notification_user->getRecordProxyID() ? "student" : "admin") . ".xml");
                     $notification_body = str_replace($search, $replace, $notification_body);
                     break;
                 case "evaluation":
                 case "evaluation_overdue":
                     $query = "SELECT * FROM `evaluations` AS a\n                                    JOIN `evaluation_forms` AS b\n                                    ON a.`eform_id` = b.`eform_id`\n                                    JOIN `evaluations_lu_targets` AS c\n                                    ON b.`target_id` = c.`target_id`\n                                    WHERE a.`evaluation_id` = " . $db->qstr($record_id);
                     $evaluation = $db->GetRow($query);
                     if ($evaluation) {
                         $search = array("%UC_CONTENT_TYPE_NAME%", "%CONTENT_TYPE_NAME%", "%CONTENT_TYPE_SHORTNAME%", "%UC_CONTENT_TYPE_SHORTNAME%", "%EVALUATOR_FULLNAME%", "%CONTENT_TITLE%", "%EVENT_TITLE%", "%CONTENT_BODY%", "%CONTENT_START%", "%CONTENT_FINISH%", "%CONTENT_LOCKOUT%", "%MANDATORY_STRING%", "%URL%", "%APPLICATION_NAME%", "%ENTRADA_URL%");
                         if (strpos($notification_user->getContentTypeName(), "assessment") !== false) {
                             $content_type_shortname = "assessment";
                         } else {
                             $content_type_shortname = "evaluation";
                         }
                         if (array_search($evaluation["target_shortname"], array("preceptor", "rotation_core", "rotation_elective")) !== false && $subcontent_id && defined("CLERKSHIP_EVALUATION_LOCKOUT") && CLERKSHIP_EVALUATION_LOCKOUT) {
                             $query = "SELECT * FROM `" . CLERKSHIP_DATABASE . "`.`events` WHERE `event_id` = " . $db->qstr($subcontent_id);
                             $clerkship_event = $db->GetRow($query);
                             if ($clerkship_event) {
                                 if ($evaluation["target_shortname"] != "rotation_elective") {
                                     $evaluation["evaluation_start"] = $clerkship_event["event_finish"] - 86400 * 5;
                                     $evaluation["evaluation_finish"] = $clerkship_event["event_finish"] + CLERKSHIP_EVALUATION_TIMEOUT;
                                 }
                                 $evaluation["evaluation_lockout"] = $clerkship_event["event_finish"] + CLERKSHIP_EVALUATION_LOCKOUT;
                                 $event_title = $clerkship_event["event_title"];
                             } else {
                                 $event_title = "";
                                 $evaluation["evaluation_lockout"] = $evaluation["evaluation_finish"];
                             }
                         } elseif (defined("EVALUATION_LOCKOUT") && EVALUATION_LOCKOUT) {
                             $event_title = "";
                             $evaluation["evaluation_lockout"] = $evaluation["evaluation_finish"] + (defined('EVALUATION_LOCKOUT') && EVALUATION_LOCKOUT ? EVALUATION_LOCKOUT : 0);
                         }
                         $mandatory = $evaluation["evaluation_mandatory"];
                         $evaluation_start = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_start"]);
                         $evaluation_finish = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_finish"]);
                         if (isset($evaluation["evaluation_lockout"])) {
                             $evaluation_lockout = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_lockout"]);
                         } else {
                             $evaluation_lockout = false;
                         }
                         $organisation_id = get_account_data("organisation_id", $proxy_id);
                         $content_url = $notification_user->getContentURL();
                         $replace = array(html_encode(ucwords($notification_user->getContentTypeName())), html_encode($notification_user->getContentTypeName()), html_encode($content_type_shortname), html_encode(ucfirst($content_type_shortname)), html_encode(get_account_data("wholename", $notification_user->getProxyID())), html_encode($notification_user->getContentTitle()), html_encode($event_title), html_encode($notification_user->getContentBody($record_id)), html_encode($evaluation_start), html_encode($evaluation_finish), html_encode($evaluation_lockout ? "\nAccess to this evaluation will be closed as of " . $evaluation_lockout . "." : ""), html_encode(isset($mandatory) && $mandatory ? "mandatory" : "non-mandatory"), html_encode($content_url), html_encode(APPLICATION_NAME), html_encode(ENTRADA_URL));
                         if ($evaluation["target_shortname"] == "rotation_core") {
                             $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-rotation-core-evaluation-" . ($evaluation["evaluation_finish"] >= time() || $evaluation["evaluation_start"] >= strtotime("-1 day") ? "release" : "overdue") . ".xml");
                         } elseif ($evaluation["target_shortname"] == "preceptor") {
                             $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-preceptor-evaluation-" . ($evaluation["evaluation_finish"] >= time() || $evaluation["evaluation_start"] >= strtotime("-1 day") ? "release" : "overdue") . ".xml");
                         } else {
                             $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-evaluation-" . ($evaluation["evaluation_finish"] >= time() || $evaluation["evaluation_start"] >= strtotime("-1 day") ? "release" : "overdue") . ".xml");
                         }
                         $notification_body = str_replace($search, $replace, $notification_body);
                     }
                     break;
                 case "evaluation_threshold":
                     $search = array("%UC_CONTENT_TYPE_NAME%", "%CONTENT_TYPE_NAME%", "%CONTENT_TYPE_SHORTNAME%", "%EVALUATOR_FULLNAME%", "%CONTENT_TITLE%", "%URL%", "%APPLICATION_NAME%", "%ENTRADA_URL%");
                     if (strpos($notification_user->getContentTypeName(), "assessment") !== false) {
                         $content_type_shortname = "assessment";
                     } else {
                         $content_type_shortname = "evaluation";
                     }
                     $evaluation = $db->GetRow("SELECT * FROM `evaluations` WHERE `evaluation_id` = " . $db->qstr($notification_user->getRecordID()));
                     $evaluation_start = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_start"]);
                     $evaluation_finish = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_finish"]);
                     $replace = array(html_encode(ucwords($notification_user->getContentTypeName())), html_encode($notification_user->getContentTypeName()), html_encode($content_type_shortname), html_encode(get_account_data("wholename", $proxy_id)), html_encode($notification_user->getContentTitle()), html_encode($notification_user->getContentURL() . "&pid=" . $record_id), html_encode(APPLICATION_NAME), html_encode(ENTRADA_URL));
                     $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-evaluation-threshold.xml");
                     $notification_body = str_replace($search, $replace, $notification_body);
                     break;
                 case "evaluation_request":
                     $search = array("%UC_CONTENT_TYPE_NAME%", "%CONTENT_TYPE_NAME%", "%CONTENT_TYPE_SHORTNAME%", "%TARGET_FULLNAME%", "%CONTENT_TITLE%", "%CONTENT_BODY%", "%URL%", "%APPLICATION_NAME%", "%ENTRADA_URL%");
                     if (strpos($notification_user->getContentTypeName(), "assessment") !== false) {
                         $content_type_shortname = "assessment";
                     } else {
                         $content_type_shortname = "evaluation";
                     }
                     $evaluation = $db->GetRow("SELECT * FROM `evaluations` WHERE `evaluation_id` = " . $db->qstr($notification_user->getRecordID()));
                     $evaluation_start = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_start"]);
                     $evaluation_finish = date(DEFAULT_DATE_FORMAT, $evaluation["evaluation_finish"]);
                     $replace = array(html_encode(ucwords($notification_user->getContentTypeName())), html_encode($notification_user->getContentTypeName()), html_encode($content_type_shortname), html_encode(get_account_data("wholename", $proxy_id)), html_encode($notification_user->getContentTitle()), html_encode($notification_user->getContentBody($record_id)), html_encode($notification_user->getContentURL() . "&proxy_id=" . $proxy_id), html_encode(APPLICATION_NAME), html_encode(ENTRADA_URL));
                     $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-evaluation-request.xml");
                     $notification_body = str_replace($search, $replace, $notification_body);
                     break;
                 default:
                     $search = array("%UC_CONTENT_TYPE_NAME%", "%CONTENT_TYPE_NAME%", "%AUTHOR_FULLNAME%", "%CONTENT_TITLE%", "%CONTENT_BODY%", "%URL%", "%UNSUBSCRIBE_URL%", "%DIGEST_URL%", "%APPLICATION_NAME%", "%ENTRADA_URL%");
                     $replace = array(html_encode(ucwords($notification_user->getContentTypeName())), html_encode($notification_user->getContentTypeName()), html_encode(get_account_data("wholename", $proxy_id)), html_encode($notification_user->getContentTitle()), html_encode($notification_user->getContentBody($record_id)), html_encode($notification_user->getContentURL()), html_encode(ENTRADA_URL . "/profile?section=notifications&id=" . $nuser_id . "&action=unsubscribe"), html_encode(ENTRADA_URL . "/profile?section=notifications&id=" . $nuser_id . "&action=digest-mode"), html_encode(APPLICATION_NAME), html_encode(ENTRADA_URL));
                     $notification_body = file_get_contents($ENTRADA_TEMPLATE->absolute() . "/email/notification-default.xml");
                     $notification_body = str_replace($search, $replace, $notification_body);
                     break;
             }
             $new_notification = array("nuser_id" => $nuser_id, "notification_body" => $notification_body, "proxy_id" => $proxy_id, "sent" => false, "digest" => 0, "sent_date" => 0);
             $db->AutoExecute("notifications", $new_notification, "INSERT");
             if (!($notification_id = $db->Insert_Id())) {
                 application_log("error", "There was an issue attempting to add a notification record to the database. Database said: " . $db->ErrorMsg());
             } else {
                 $new_notification["notification_id"] = $notification_id;
                 $notification = self::fromArray($new_notification);
                 $notification_user->setNextNotificationDate();
                 return $notification;
             }
         }
     }
     return false;
 }
示例#16
0
  * Get a list of all current quiz authors, and then check to see if
  * one quiz author is attempting to remove any other quiz authors. If
  * they are attempting to remove an existing quiz author, then we need
  * to check and see if that quiz author has already assigned this quiz
  * to any of their learning events. If they have, then they cannot be
  * removed because it will pose a data integrity problem.
  */
 $contacts = Models_Quiz_Contact::fetchAllRecords($RECORD_ID);
 if ($contacts) {
     foreach ($contacts as $contact) {
         $result = $contact->toArray();
         if (!in_array($result["proxy_id"], $PROCESSED["associated_proxy_ids"])) {
             $sresult = Models_Quiz_Attached::getCurrentContact($RECORD_ID, $result["proxy_id"]);
             if ($sresult) {
                 $PROCESSED["associated_proxy_ids"][] = $result["proxy_id"];
                 add_notice("Unable to remove <strong>" . html_encode(get_account_data("fullname", $result["proxy_id"])) . "</strong> from the <strong>Quiz Authors</strong> section because they have already attached this quiz to one or more events or communities.");
             }
         }
     }
 }
 if (!$ERROR) {
     $PROCESSED["updated_date"] = time();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     if ($quiz->fromArray($PROCESSED)->update()) {
         /**
          * Delete existing quiz contacts, so we can re-add them.
          */
         Models_Quiz_Contact::deleteContacts($RECORD_ID);
         /**
          * Add the updated quiz authors to the quiz_contacts table.
          */
示例#17
0
/**
 * This function handles granular permissions levels (where as communities_module_access handles higer level permissions)
 * for the actual gallery comments.
 *
 * @param int $cgallery_id
 * @param string $section
 * @return bool
 */
function galleries_comment_module_access($cgcomment_id = 0, $section = "")
{
    global $db, $COMMUNITY_ID, $LOGGED_IN, $COMMUNITY_MEMBER, $COMMUNITY_ADMIN, $NOTICE, $NOTICESTR, $ERROR, $ERRORSTR, $ENTRADA_USER;
    $allow_to_load = false;
    if ((bool) $LOGGED_IN && (bool) $COMMUNITY_MEMBER && (bool) $COMMUNITY_ADMIN) {
        $allow_to_load = true;
    } else {
        if ($cgcomment_id = (int) $cgcomment_id) {
            $query = "SELECT * FROM `community_gallery_comments` WHERE `cgcomment_id` = " . $db->qstr($cgcomment_id) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID);
            $result = $db->CacheGetRow(CACHE_TIMEOUT, $query);
            if ($result) {
                if ($allow_to_load = galleries_module_access($result["cgallery_id"], $section)) {
                    switch ($section) {
                        case "delete-comment":
                        case "edit-comment":
                            if ($ENTRADA_USER->getActiveId() != (int) $result["proxy_id"]) {
                                $allow_to_load = false;
                            }
                            break;
                        default:
                            continue;
                            break;
                    }
                }
            }
        }
        if ($allow_to_load) {
            if ((int) $result["comment_active"]) {
                /**
                 * You're good to go, no further checks at this time.
                 * If you need to add more checks, this is there they would go.
                 */
            } else {
                $NOTICE++;
                $NOTICESTR[] = "This comment was deactivated <strong>" . date(DEFAULT_DATE_FORMAT, $result["updated_date"]) . "</strong> by <strong>" . html_encode(get_account_data("firstlast", $result["updated_by"])) . "</strong>.<br /><br />If there has been a mistake or you have questions relating to this issue please contact the MEdTech Unit directly.";
                $allow_to_load = false;
            }
        } else {
            if (!$ERROR) {
                $ERROR++;
                $ERRORSTR[] = "You do not have access to this comment.<br /><br />If you believe there has been a mistake, please contact a community administrator for assistance.";
            }
        }
    }
    return $allow_to_load;
}
示例#18
0
<?php

/**
 * Process a single account for transactions.
 */
$q = db()->prepare("SELECT * FROM transaction_creators WHERE id=?");
$q->execute(array($job['arg_id']));
$creator = $q->fetch();
if (!$creator) {
    throw new JobException("Could not find any creator " . $job['arg_id'] . " for user " . $job['user_id']);
}
$account_data = get_account_data($creator['exchange']);
$q = db()->prepare("SELECT * FROM " . $account_data['table'] . " WHERE id=? AND user_id=?");
$q->execute(array($creator['account_id'], $job['user_id']));
$account = $q->fetch();
if (!$account) {
    throw new JobException("Could not find any " . $creator['exchange'] . " account ID " . $creator['account_id'] . " for user " . $job['user_id']);
}
crypto_log("Investigating account " . $account['id'] . " " . $creator['exchange']);
// for every currency this exchange should supports
$get_supported_wallets = get_supported_wallets();
// add all blockchain wallets
$account_data_grouped = account_data_grouped();
foreach ($account_data_grouped['Addresses'] as $exchange => $data) {
    $get_supported_wallets[$exchange] = array($data['currency'], '_is_currency_');
}
$cursor = false;
if (!isset($get_supported_wallets[$account_data['title_key']])) {
    crypto_log("No supported wallets for " . $account_data['title_key']);
} else {
    foreach ($get_supported_wallets[$account_data['title_key']] as $currency) {
示例#19
0
 $sidebar_html .= "</div>\n";
 new_sidebar_item("Elective Weeks", $sidebar_html, "page-clerkship", "open");
 /* Logbook Review setup */
 $query = "SELECT *\n                    FROM `" . CLERKSHIP_DATABASE . "`.`events` AS a\n                    LEFT JOIN `" . CLERKSHIP_DATABASE . "`.`event_contacts` AS b\n                    ON b.`event_id` = a.`event_id`\n                    LEFT JOIN `" . CLERKSHIP_DATABASE . "`.`regions` AS c\n                    ON c.`region_id` = a.`region_id`\n                    WHERE a.`event_finish` >= " . $db->qstr(strtotime("00:00:00", time())) . "\n                    AND (a.`event_status` = 'published' OR a.`event_status` = 'approval')\n                    AND b.`econtact_type` = 'student'\n                    AND b.`etype_id` = " . $db->qstr($ENTRADA_USER->getActiveId()) . "\n                    ORDER BY a.`event_start` ASC";
 $clerkship_schedule = $db->GetAll($query);
 $query = "SELECT *\n                    FROM `" . CLERKSHIP_DATABASE . "`.`events` AS a\n                    LEFT JOIN `" . CLERKSHIP_DATABASE . "`.`event_contacts` AS b\n                    ON b.`event_id` = a.`event_id`\n                    LEFT JOIN `" . CLERKSHIP_DATABASE . "`.`regions` AS c\n                    ON c.`region_id` = a.`region_id`\n                    WHERE a.`event_finish` <= " . $db->qstr(strtotime("00:00:00", time())) . "\n                    AND (a.`event_status` = 'published' OR a.`event_status` = 'approval')\n                    AND b.`econtact_type` = 'student'\n                    AND b.`etype_id` = " . $db->qstr($ENTRADA_USER->getActiveId()) . "\n                    ORDER BY a.`event_start` ASC";
 $clerkship_past_schedule = $db->GetAll($query);
 if (isset($clerkship_schedule[0]) && $clerkship_schedule[0]["event_start"] <= time() || isset($clerkship_past_schedule) && $clerkship_past_schedule) {
     $ROTATION_ID = isset($clerkship_schedule[0]) && $clerkship_schedule[0]["rotation_id"] ? $clerkship_schedule[0]["rotation_id"] : $clerkship_past_schedule[count($clerkship_past_schedule) - 1]["rotation_id"];
     $SHOW_LOGBOOK = (int) $_SESSION["details"]["role"] <= date("Y", strtotime("+1 year")) ? true : false;
     $clinical_rotation = clerkship_get_rotation($rotation ? $rotation : ($ROTATION_ID ? $ROTATION_ID : 0));
     $rotation = $clinical_rotation["id"];
     $clinical_encounters = clerkship_get_rotation_overview($rotation);
     $objectives_required = 0;
     $objectives_recorded = 0;
     $grad_year = get_account_data("grad_year", $ENTRADA_USER->getID());
     if ($rotation < 10) {
         $query = "\tSELECT `objective_id`, MAX(`number_required`) AS `required`\n\t\t\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`logbook_mandatory_objectives`\n\t\t\t\t\t\t\tWHERE `rotation_id` = " . $db->qstr($rotation ? $rotation : ($ROTATION_ID ? $ROTATION_ID : 0)) . "\n\t\t\t\t\t\t\tAND `grad_year_min` <= " . $db->qstr($grad_year) . "\n\t\t\t\t\t\t\tAND (`grad_year_max` = 0 OR `grad_year_max` >= " . $db->qstr($grad_year) . ")\n\t\t\t\t\t\t\tGROUP BY `objective_id`";
         $required_objectives = $db->GetAll($query);
         if ($required_objectives) {
             foreach ($required_objectives as $required_objective) {
                 $objectives_required += $required_objective["required"];
                 $number_required[$required_objective["objective_id"]] = $required_objective["required"];
                 $query = "SELECT COUNT(a.`objective_id`) AS `recorded`\n\t\t\t\t\t\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`logbook_entry_objectives` AS a\n\t\t\t\t\t\t\t\t\t\tJOIN `" . CLERKSHIP_DATABASE . "`.`logbook_entries` AS b\n\t\t\t\t\t\t\t\t\t\tON a.`lentry_id` = b.`lentry_id`\n\t\t\t\t\t\t\t\t\t\tAND b.`entry_active` = '1'\n\t\t\t\t\t\t\t\t\t\tAND b.`proxy_id` = " . $db->qstr($ENTRADA_USER->getID()) . "\n\t\t\t\t\t\t\t\t\t\tWHERE a.`objective_id` = " . $db->qstr($required_objective["objective_id"]) . "\n\t\t\t\t\t\t\t\t\t\tGROUP BY a.`objective_id`";
                 $recorded = $db->GetOne($query);
                 if ($recorded) {
                     if ($required_objective["required"] > $recorded) {
                         if ($objective_ids) {
                             $objective_ids .= "," . $db->qstr($required_objective["objective_id"]);
                         } else {
                             $objective_ids = $db->qstr($required_objective["objective_id"]);
/**
 * This function handles granular permissions levels (where as communities_module_access handles higer level permissions)
 * for the actual discussion forum topics.
 *
 * @param int $cdiscussion_id
 * @param string $section
 * @return bool
 */
function discussion_topic_module_access($cdtopic_id = 0, $section = "")
{
    global $db, $COMMUNITY_ID, $LOGGED_IN, $COMMUNITY_MEMBER, $COMMUNITY_ADMIN, $NOTICE, $NOTICESTR, $ERROR, $ERRORSTR, $ENTRADA_USER;
    $allow_to_load = false;
    if ((bool) $LOGGED_IN && (bool) $COMMUNITY_MEMBER && (bool) $COMMUNITY_ADMIN) {
        $allow_to_load = true;
    } else {
        if ($cdtopic_id = (int) $cdtopic_id) {
            $query = "SELECT * FROM `community_discussion_topics` WHERE `cdtopic_id` = " . $db->qstr($cdtopic_id) . " AND `community_id` = " . $db->qstr($COMMUNITY_ID);
            $result = $db->CacheGetRow(CACHE_TIMEOUT, $query);
            if ($result) {
                if ($allow_to_load = discussions_module_access($result["cdiscussion_id"], $section)) {
                    switch ($section) {
                        case "delete-post":
                        case "edit-post":
                            if ($ENTRADA_USER->getActiveId() != (int) $result["proxy_id"]) {
                                $allow_to_load = false;
                            }
                            break;
                        default:
                            continue;
                            break;
                    }
                }
            }
        }
        if ($allow_to_load) {
            if ((int) $result["topic_active"]) {
                /**
                 * Don't worry about checking the release dates if the person viewing
                 * the post is the post author.
                 */
                if (!$LOGGED_IN || $ENTRADA_USER->getActiveId() != (int) $result["proxy_id"]) {
                    if (!($release_date = (int) $result["release_date"]) || $release_date <= time()) {
                        if (!($release_until = (int) $result["release_until"]) || $release_until > time()) {
                            /**
                             * You're good to go, no further checks at this time.
                             * If you need to add more checks, this is there they would go.
                             */
                        } else {
                            $NOTICE++;
                            $NOTICESTR[] = "This discussion post was only accessible until <strong>" . date(DEFAULT_DATE_FORMAT, $release_until) . "</strong>.<br /><br />Please contact your community administrators for further assistance.";
                            $allow_to_load = false;
                        }
                    } else {
                        $NOTICE++;
                        $NOTICESTR[] = "This discussion post will not be accessible until <strong>" . date(DEFAULT_DATE_FORMAT, $release_date) . "</strong>.<br /><br />Please check back at this time, thank-you.";
                        $allow_to_load = false;
                    }
                }
            } else {
                $NOTICE++;
                $NOTICESTR[] = "This discussion post was deactivated <strong>" . date(DEFAULT_DATE_FORMAT, $result["updated_date"]) . "</strong> by <strong>" . html_encode(get_account_data("firstlast", $result["updated_by"])) . "</strong>.<br /><br />If there has been a mistake or you have questions relating to this issue please contact the MEdTech Unit directly.";
                $allow_to_load = false;
            }
        } else {
            if (!$ERROR) {
                $ERROR++;
                $ERRORSTR[] = "You do not have access to this discussion post.<br /><br />If you believe there has been a mistake, please contact a community administrator for assistance.";
            }
        }
    }
    return $allow_to_load;
}
示例#21
0
                        ?>
									</div>
								</td>
							</tr>
							<tr>
								<td colspan="2" class="content">
								<a name="comment-<?php 
                        echo (int) $result["cscomment_id"];
                        ?>
"></a>
								<?php 
                        echo trim($result["comment_title"]) ? "<div style=\"font-weight: bold\">" . html_encode(trim($result["comment_title"])) . "</div>" : "";
                        echo $result["comment_description"];
                        if ($result["release_date"] != $result["updated_date"]) {
                            echo "<div class=\"content-small\" style=\"margin-top: 15px\">\n";
                            echo "\t<strong>Last updated:</strong> " . date(DEFAULT_DATE_FORMAT, $result["updated_date"]) . " by " . ($result["proxy_id"] == $result["updated_by"] ? html_encode($result["commenter_fullname"]) : html_encode(get_account_data("firstlast", $result["updated_by"]))) . ".";
                            echo "</div>\n";
                        }
                        ?>
								</td>
							</tr>
							<?php 
                    }
                    ?>
						</tbody>
						</table>
						<?php 
                }
                if ($ADD_REVISION || $ADD_COMMENT || $MOVE_FILE) {
                    ?>
						<ul class="page-action">
                $url = ENTRADA_URL . "/profile/gradebook/assignments";
                $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
                $ERROR++;
                $ERRORSTR[] = "You are not authorized to add a comment to this file.<br /><br />You will now be redirected back to the assignment index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue";
                if ($ERROR) {
                    echo display_error();
                }
                if ($NOTICE) {
                    echo display_notice();
                }
            }
        } else {
            $url = ENTRADA_URL . "/profile/gradebook/assignments";
            $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
            $NOTICE++;
            $NOTICESTR[] = "The comment that you are trying to edit was deactivated <strong>" . date(DEFAULT_DATE_FORMAT, $comment_record["updated_date"]) . "</strong> by <strong>" . html_encode(get_account_data("firstlast", $comment_record["updated_by"])) . "</strong>.<br /><br />If there has been a mistake or you have questions relating to this issue please contact the MEdTech Unit directly.<br /><br />You will now be redirected back to the assignment index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue";
            echo display_notice();
            application_log("error", "The comment record id [" . $RECORD_ID . "] is deactivated; however, " . $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " [" . $ENTRADA_USER->getID() . "] has tried to edit it.");
        }
    } else {
        $url = ENTRADA_URL . "/profile/gradebook/assignments";
        $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
        $ERROR++;
        $ERRORSTR[] = "The comment id that you have provided does not exist in the system. Please provide a valid record id to proceed.<br /><br />You will now be redirected back to the assignment index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue";
        echo display_error();
        application_log("error", "The provided comment id was invalid [" . $RECORD_ID . "] (Edit Comment).");
    }
} else {
    $url = ENTRADA_URL . "/profile/gradebook/assignments";
    $ONLOAD[] = "setTimeout('window.location=\\'" . $url . "\\'', 5000)";
    $ERROR++;
         $question_progress_matrix[$evaluation_question["target_record_id"]] = array();
     }
     if (!array_key_exists($evaluation_question["efquestion_id"], $question_progress_matrix[$evaluation_question["target_record_id"]])) {
         $question_progress_matrix[$evaluation_question["target_record_id"]][$evaluation_question["efquestion_id"]] = $db->qstr($evaluation_question["eprogress_id"]);
     } else {
         $question_progress_matrix[$evaluation_question["target_record_id"]][$evaluation_question["efquestion_id"]] .= ", " . $db->qstr($evaluation_question["eprogress_id"]);
     }
 }
 foreach ($question_progress_matrix as $target_record_id => $question_progress) {
     foreach ($question_progress as $efquestion_id => $eprogress_ids_string) {
         $query = "SELECT `eqresponse_id`, COUNT(`eqresponse_id`) AS `responses` FROM `evaluation_responses`\n                                        WHERE `efquestion_id` = " . $db->qstr($efquestion_id) . "\n                                        AND `eprogress_id` IN (" . $eprogress_ids_string . ")\n                                        GROUP BY `eqresponse_id`";
         $evaluation_responses = $db->GetAll($query);
         if ($evaluation_responses) {
             foreach ($evaluation_responses as $evaluation_response) {
                 if (!array_key_exists($target_record_id, $available_targets)) {
                     $available_targets[$target_record_id] = get_account_data("wholename", $target_record_id);
                 }
                 if (!array_key_exists($target_record_id, $objectives[$objective_id]["temp_responses"])) {
                     $objectives[$objective_id]["temp_responses"][$target_record_id] = array();
                 }
                 if (!array_key_exists($evaluation_response["eqresponse_id"], $objectives[$objective_id]["temp_responses"][$target_record_id])) {
                     $objectives[$objective_id]["temp_responses"][$target_record_id][$evaluation_response["eqresponse_id"]] = (int) $evaluation_response["responses"];
                 } else {
                     $objectives[$objective_id]["temp_responses"][$target_record_id][$evaluation_response["eqresponse_id"]] += (int) $evaluation_response["responses"];
                 }
             }
         }
     }
 }
 $descriptors = array();
 $other_responses = array();
示例#24
0
    public static function getTargetControls($target_data, $options_for = "", $form_id = 0)
    {
        global $ENTRADA_USER, $ENTRADA_ACL, $db, $use_ajax;
        if ($form_id) {
            $query = "\tSELECT b.*\n\t\t\t\t\t\tFROM `evaluation_forms` AS a\n\t\t\t\t\t\tLEFT JOIN `evaluations_lu_targets` AS b\n\t\t\t\t\t\tON b.`target_id` = a.`target_id`\n\t\t\t\t\t\tWHERE a.`form_active` = '1'\n\t\t\t\t\t\tAND b.`target_active` = '1'\n\t\t\t\t\t\tAND a.`eform_id` = " . $db->qstr($form_id);
            $target_details = $db->GetRow($query);
            if ($target_details) {
                switch ($target_details["target_shortname"]) {
                    case "course":
                        $courses_list = array();
                        $query = "\tSELECT `course_id`, `organisation_id`, `course_code`, `course_name`\n\t\t\t\t\t\t\t\t\tFROM `courses`\n\t\t\t\t\t\t\t\t\tWHERE `organisation_id`=" . $ENTRADA_USER->getActiveOrganisation() . "\n\t\t\t\t\t\t\t\t\tAND `course_active` = '1'\n\t\t\t\t\t\t\t\t\tORDER BY `course_code` ASC, `course_name` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                if ($ENTRADA_ACL->amIAllowed(new CourseResource($result["course_id"], $result["organisation_id"]), "read")) {
                                    $courses_list[$result["course_id"]] = $result["course_code"] . " - " . $result["course_name"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td></td>
							<td style="vertical-align: top">
								<label for="PickList" class="form-required">Select Courses</label>
								<div class="content-small"><strong>Hint:</strong> Select the course or courses you would like to have evaluated.</div>
							</td>
							<td style="vertical-align: top">
								<select class="multi-picklist" id="PickList" name="course_ids[]" multiple="multiple" size="4" style="width: 100%; margin-bottom: 5px">
								<?php 
                        if (is_array($target_data["evaluation_targets"]) && !empty($target_data["evaluation_targets"])) {
                            foreach ($target_data["evaluation_targets"] as $target) {
                                echo "<option value=\"" . (int) $target["target_value"] . "\">" . html_encode($courses_list[$target["target_value"]]) . "</option>\n";
                            }
                        }
                        ?>
								</select>
								<div style="float: left; display: inline">
									<input type="button" id="courses_list_state_btn" class="btn" value="Show List" onclick="toggle_list('courses_list')" />
								</div>
								<div style="float: right; display: inline">
									<input type="button" id="courses_list_remove_btn" class="btn btn-danger" onclick="delIt()" value="Remove" />
									<input type="button" id="courses_list_add_btn" class="btn btn-success" onclick="addIt()" style="display: none" value="Add" />
								</div>
								<div id="courses_list" style="clear: both; padding-top: 3px; display: none">
									<h2>Course List</h2>
									<select class="multi-picklist" id="SelectList" name="other_courses_list" multiple="multiple" size="15" style="width: 100%">
									<?php 
                        foreach ($courses_list as $course_id => $course_name) {
                            if (!in_array($course_id, $target_data["evaluation_targets"])) {
                                echo "<option value=\"" . (int) $course_id . "\">" . html_encode($course_name) . "</option>\n";
                            }
                        }
                        ?>
									</select>
								</div>
							</td>
						</tr>
						<?php 
                        break;
                    case "teacher":
                        $teachers_list = array();
                        $query = "\tSELECT a.`id` AS `proxy_id`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\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\tON b.`user_id` = a.`id`\n\t\t\t\t\t\t\t\t\tLEFT JOIN `event_contacts` AS c\n\t\t\t\t\t\t\t\t\tON c.`proxy_id` = a.`id`\n\t\t\t\t\t\t\t\t\tLEFT JOIN `events` AS d\n\t\t\t\t\t\t\t\t\tON d.`event_id` = c.`event_id`\n\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\tAND (b.`group` = 'faculty' OR\n\t\t\t\t\t\t\t\t\t\t(b.`group` = 'resident' AND b.`role` = 'lecturer')\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tAND d.`event_finish` >= " . $db->qstr(strtotime("-12 months")) . "\n\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\tORDER BY a.`lastname` ASC, a.`firstname` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $teachers_list[$result["proxy_id"]] = $result["fullname"];
                            }
                        }
                        $target_ids = array();
                        foreach ($target_data["evaluation_targets"] as $temp_target) {
                            if ($temp_target["target_type"] == "proxy_id") {
                                $target_ids[] = $temp_target["target_value"];
                            }
                        }
                        ?>
						<tr>
							<td></td>
							<td style="vertical-align: top">
								<label for="PickList" class="form-required">Select Teachers</label>
								<div class="content-small"><strong>Hint:</strong> Select the teacher or teachers you would like to have evaluated.</div>
							</td>
							<td style="vertical-align: top">
								<select class="multi-picklist" id="PickList" name="teacher_ids[]" multiple="multiple" size="4" style="width: 100%; margin-bottom: 5px">
								<?php 
                        if (is_array($target_data["evaluation_targets"]) && !empty($target_data["evaluation_targets"])) {
                            foreach ($teachers_list as $proxy_id => $teacher_name) {
                                if (in_array($proxy_id, $target_ids)) {
                                    echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($teacher_name) . "</option>\n";
                                }
                            }
                        }
                        ?>
								</select>
								<div style="float: left; display: inline">
									<input type="button" id="teachers_list_state_btn" class="btn" value="Show List" onclick="toggle_list('teachers_list')" />
								</div>
								<div style="float: right; display: inline">
									<input type="button" id="teachers_list_remove_btn" class="btn btn-danger" onclick="delIt()" value="Remove" />
									<input type="button" id="teachers_list_add_btn" class="btn btn-success" onclick="addIt()" style="display: none" value="Add" />
								</div>
								<div id="teachers_list" style="clear: both; padding-top: 3px; display: none">
									<h2>Course List</h2>
									<select class="multi-picklist" id="SelectList" name="other_teachers_list" multiple="multiple" size="15" style="width: 100%">
									<?php 
                        foreach ($teachers_list as $proxy_id => $teacher_name) {
                            if (!isset($target_data["evaluation_targets"]) || !is_array($target_data["evaluation_targets"]) || !in_array($proxy_id, $target_data["evaluation_targets"])) {
                                echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($teacher_name) . "</option>\n";
                            }
                        }
                        ?>
									</select>
								</div>
							</td>
						</tr>
						<?php 
                        break;
                    case "resident":
                        $residents_list = array();
                        $query = "\tSELECT a.`id` AS `proxy_id`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\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\tON b.`user_id` = a.`id`\n\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\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\t\tORDER BY a.`lastname` ASC, a.`firstname` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $residents_list[$result["proxy_id"]] = $result["fullname"];
                            }
                        }
                        $target_ids = array();
                        if (isset($target_data["evaluation_targets"]) && @count($target_data["evaluation_targets"])) {
                            foreach ($target_data["evaluation_targets"] as $temp_target) {
                                if ($temp_target["target_type"] == "proxy_id") {
                                    $target_ids[] = $temp_target["target_value"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td></td>
							<td style="vertical-align: top">
								<label for="PickList" class="form-required">Select Learners</label>
								<div class="content-small"><strong>Hint:</strong> Select the learner(s) you would like to have evaluated.</div>
							</td>
							<td style="vertical-align: top">
								<select class="multi-picklist" id="PickList" name="resident_ids[]" multiple="multiple" size="4" style="width: 100%; margin-bottom: 5px">
								<?php 
                        if (is_array($target_data["evaluation_targets"]) && !empty($target_data["evaluation_targets"])) {
                            foreach ($residents_list as $proxy_id => $resident_name) {
                                if (in_array($proxy_id, $target_ids)) {
                                    echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($resident_name) . "</option>\n";
                                }
                            }
                        }
                        ?>
								</select>
								<div style="float: left; display: inline">
									<input type="button" id="residents_list_state_btn" class="btn" value="Show List" onclick="toggle_list('residents_list')" />
								</div>
								<div style="float: right; display: inline">
									<input type="button" id="residents_list_remove_btn" class="btn btn-danger" onclick="delIt()" value="Remove" />
									<input type="button" id="residents_list_add_btn" class="btn btn-success" onclick="addIt()" style="display: none" value="Add" />
								</div>
								<div id="residents_list" style="clear: both; padding-top: 3px; display: none">
									<h2>Learner List</h2>
									<select class="multi-picklist" id="SelectList" name="other_residents_list" multiple="multiple" size="15" style="width: 100%">
									<?php 
                        foreach ($residents_list as $proxy_id => $resident_name) {
                            if (!isset($target_data["evaluation_targets"]) || !is_array($target_data["evaluation_targets"]) || !in_array($proxy_id, $target_data["evaluation_targets"])) {
                                echo "<option value=\"" . (int) $proxy_id . "\">" . html_encode($resident_name) . "</option>\n";
                            }
                        }
                        ?>
									</select>
								</div>
							</td>
						</tr>
						<?php 
                        break;
                    case "student":
                    case "peer":
                        $query = "SELECT * FROM `course_groups` AS a\n\t\t\t\t\t\t\t\t\tJOIN `courses` AS b\n\t\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\t\tORDER BY b.`course_name`,\n\t\t\t\t\t\t\t\t\t\tLENGTH(a.`group_name`),\n\t\t\t\t\t\t\t\t\t\ta.`group_name` ASC";
                        $temp_course_groups = $db->GetAll($query);
                        $course_groups = array();
                        if ($temp_course_groups) {
                            foreach ($temp_course_groups as $temp_course_group) {
                                $course_groups[$temp_course_group["cgroup_id"]] = $temp_course_group;
                            }
                        }
                        if (!isset($target_data["associated_cgroup_ids"]) && !isset($target_data["associated_cohort_ids"]) && !isset($target_data["associated_proxy_ids"])) {
                            if (isset($target_data["evaluation_targets"]) && is_array($target_data["evaluation_targets"])) {
                                foreach ($target_data["evaluation_targets"] as $target) {
                                    if ($target["target_type"] == "cgroup_id") {
                                        $target_data["associated_cgroup_ids"][] = $target["target_value"];
                                    } elseif ($target["target_type"] == "cohort") {
                                        $target_data["associated_cohort_ids"][] = $target["target_value"];
                                    } elseif ($target["target_type"] == "proxy_id") {
                                        $target_data["associated_proxy_ids"][] = $target["target_value"];
                                    }
                                }
                            }
                        }
                        unset($temp_course_groups);
                        ?>
						<tr>
							<td>&nbsp;</td>
							<td style="vertical-align: top"><label for="faculty_name" class="form-nrequired">Evaluation Targets</label></td>
							<td>
								<table>
									<tbody>
										<tr>
											<td style="vertical-align: top"><input type="radio" name="target_type" id="target_type_custom" value="custom" onclick="selectEvaluationTargetOption('custom')" style="vertical-align: middle" checked="checked" /></td>
											<td colspan="2" style="padding-bottom: 15px">
												<label for="target_type_custom" class="radio-group-title">Custom Evaluation Targets</label>
												<div class="content-small">This evaluation is intended for a custom selection of evaluation targets.</div>

												<div id="evaluation_target_type_custom_options" style="position: relative; margin-top: 10px;">
													<select id="target_type" onchange="showMultiSelect();" style="width: 275px;">
														<option value="">-- Select an target type --</option>
														<option value="cohorts">Cohorts of learners</option>
															<?php 
                        if ($course_groups) {
                            ?>
															<option value="course_groups">Course specific small groups</option>
															<?php 
                        }
                        ?>
														<option value="students">Individual learners</option>
													</select>

													<span id="options_loading" style="display:none; vertical-align: middle"><img src="<?php 
                        echo ENTRADA_RELATIVE;
                        ?>
/images/indicator.gif" width="16" height="16" alt="Please Wait" title="" style="vertical-align: middle" /> Loading ... </span>
													<span id="options_container"></span>
													<?php 
                        /**
                         * Compiles the list of groups from groups table (known as Cohorts).
                         */
                        $COHORT_LIST = array();
                        $results = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                        if ($results) {
                            foreach ($results as $result) {
                                $COHORT_LIST[$result["group_id"]] = $result;
                            }
                        }
                        $GROUP_LIST = $course_groups;
                        /**
                         * Compiles the list of students.
                         */
                        $STUDENT_LIST = array();
                        $query = "\tSELECT a.`id` AS `proxy_id`, b.`role`, CONCAT_WS(' ', a.`firstname`, a.`lastname`) AS `fullname`, a.`organisation_id`\n\t\t\t\t\t\t\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\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\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\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND a.`grad_year` >= '" . (date("Y") - (date("m") < 7 ? 2 : 1)) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY a.`grad_year` ASC, a.`lastname` ASC, a.`firstname` ASC";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $STUDENT_LIST[$result["proxy_id"]] = array("proxy_id" => $result["proxy_id"], "fullname" => $result["fullname"], "organisation_id" => $result["organisation_id"]);
                            }
                        }
                        $target_data["form_id"] = $form_id;
                        if (!isset($target_data["associated_cohort_ids"]) && !isset($target_data["associated_cgroup_ids"]) && !isset($target_data["associated_proxy_ids"]) && isset($target_data["evaluation_id"])) {
                            $query = "SELECT * FROM `evaluation_targets` WHERE `evaluation_id` = " . $db->qstr($target_data["evaluation_id"]);
                            $results = $db->GetAll($query);
                            if ($results) {
                                $target_data["target_type"] = "custom";
                                foreach ($results as $result) {
                                    switch ($result["target_type"]) {
                                        case "cohort":
                                            $target_data["associated_cohort_ids"][] = (int) $result["target_value"];
                                            break;
                                        case "cgroup_id":
                                            $target_data["associated_cgroup_ids"][] = (int) $result["target_value"];
                                            break;
                                        case "proxy_id":
                                            $target_data["associated_proxy_ids"][] = (int) $result["target_value"];
                                            break;
                                    }
                                }
                            }
                        }
                        $cohort_ids_string = "";
                        $cgroup_ids_string = "";
                        $student_ids_string = "";
                        if (isset($target_data["associated_course_ids"]) && $target_data["associated_course_ids"]) {
                            $course_target_included = true;
                        } else {
                            $course_target_included = false;
                        }
                        if (isset($target_data["associated_cohort_ids"]) && is_array($target_data["associated_cohort_ids"])) {
                            foreach ($target_data["associated_cohort_ids"] as $group_id) {
                                if ($cohort_ids_string) {
                                    $cohort_ids_string .= ",group_" . $group_id;
                                } else {
                                    $cohort_ids_string = "group_" . $group_id;
                                }
                            }
                        }
                        if (isset($target_data["associated_cgroup_ids"]) && is_array($target_data["associated_cgroup_ids"])) {
                            foreach ($target_data["associated_cgroup_ids"] as $group_id) {
                                if ($cgroup_ids_string) {
                                    $cgroup_ids_string .= ",cgroup_" . $group_id;
                                } else {
                                    $cgroup_ids_string = "cgroup_" . $group_id;
                                }
                            }
                        }
                        if (isset($target_data["associated_proxy_ids"]) && is_array($target_data["associated_proxy_ids"])) {
                            foreach ($target_data["associated_proxy_ids"] as $proxy_id) {
                                if ($student_ids_string) {
                                    $student_ids_string .= ",student_" . $proxy_id;
                                } else {
                                    $student_ids_string = "student_" . $proxy_id;
                                }
                            }
                        }
                        ?>
													<input type="hidden" id="evaluation_target_cohorts" name="evaluation_target_cohorts" value="<?php 
                        echo $cohort_ids_string;
                        ?>
" />
													<input type="hidden" id="evaluation_target_course_groups" name="evaluation_target_course_groups" value="<?php 
                        echo $cgroup_ids_string;
                        ?>
" />
													<input type="hidden" id="evaluation_target_students" name="evaluation_target_students" value="<?php 
                        echo $student_ids_string;
                        ?>
" />
													<input type="hidden" id="evaluation_target_course" name="evaluation_target_course" value="<?php 
                        echo $course_target_included ? "1" : "0";
                        ?>
" />

													<ul class="menu multiselect" id="target_list" style="margin-top: 5px">
													<?php 
                        if (isset($target_data["associated_cohort_ids"]) && count($target_data["associated_cohort_ids"])) {
                            foreach ($target_data["associated_cohort_ids"] as $group) {
                                if (array_key_exists($group, $COHORT_LIST) && is_array($COHORT_LIST[$group])) {
                                    ?>
																<li class="group" id="target_group_<?php 
                                    echo $COHORT_LIST[$group]["group_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $COHORT_LIST[$group]["group_name"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('group_<?php 
                                    echo $COHORT_LIST[$group]["group_id"];
                                    ?>
', 'cohorts');" class="list-cancel-image" /></li>
																<?php 
                                }
                            }
                        }
                        if (isset($target_data["associated_cgroup_ids"]) && count($target_data["associated_cgroup_ids"])) {
                            foreach ($target_data["associated_cgroup_ids"] as $group) {
                                if (array_key_exists($group, $GROUP_LIST) && is_array($GROUP_LIST[$group])) {
                                    ?>
																<li class="group" id="target_cgroup_<?php 
                                    echo $GROUP_LIST[$group]["cgroup_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $GROUP_LIST[$group]["group_name"] . " - " . $GROUP_LIST[$group]["course_code"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('cgroup_<?php 
                                    echo $GROUP_LIST[$group]["cgroup_id"];
                                    ?>
', 'course_groups');" class="list-cancel-image" /></li>
																<?php 
                                }
                            }
                        }
                        if (isset($target_data["associated_proxy_ids"]) && count($target_data["associated_proxy_ids"])) {
                            foreach ($target_data["associated_proxy_ids"] as $student) {
                                if (array_key_exists($student, $STUDENT_LIST) && is_array($STUDENT_LIST[$student])) {
                                    ?>
																<li class="user" id="target_student_<?php 
                                    echo $STUDENT_LIST[$student]["proxy_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $STUDENT_LIST[$student]["fullname"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('student_<?php 
                                    echo $STUDENT_LIST[$student]["proxy_id"];
                                    ?>
', 'students');" class="list-cancel-image" /></li>
																<?php 
                                }
                            }
                        }
                        ?>
													</ul>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<?php 
                        if ($target_details["target_shortname"] == "peer") {
                            ?>
							<tr>
								<td colspan="2">&nbsp;</td>
								<td>
									<?php 
                            echo display_notice("When creating peer assessments, learners will be able to assess any others within the same cohort, course group, or custom list of students, depending on which evaluation targets you include. <br /><br />Additionally, they will not be able to view results of evaluations done on themselves until they have filled out all of the required evaluations available to them, or the evaluation period ends, whichever comes first.");
                            ?>
								</td>
							</tr>
							<?php 
                        }
                        break;
                    case "rotation_core":
                        $target_data["form_id"] = $form_id;
                        if (!isset($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["evaluation_targets"] as $target) {
                                if ($target["target_type"] == "rotation_id") {
                                    $target_data["associated_rotation_ids"][] = $target["target_value"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td>&nbsp;</td>
							<td style="vertical-align: top"><label for="faculty_name" class="form-nrequired">Evaluation Targets</label></td>
							<td>
								<table>
									<tbody>
										<tr>
											<td style="vertical-align: top"><input type="radio" name="target_type" id="target_type_rotations" value="rotations" onclick="selectEvaluationTargetOption('rotations')" style="vertical-align: middle"  checked="checked" /></td>
											<td colspan="2" style="padding-bottom: 15px">
												<label for="target_type_rotations" class="radio-group-title">Each Service in the selected Core Rotation</label>
												<div class="content-small">This evaluation is intended for all events associated with a custom selection of Core Rotations.</div>
												<?php 
                        $ROTATION_LIST = array();
                        $rotations[0] = array("text" => "All Core Rotations", "value" => "all", "category" => true);
                        $query = "SELECT * FROM `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `rotation_id` != " . $db->qstr(MAX_ROTATION);
                        $rotation_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                        if ($rotation_results) {
                            foreach ($rotation_results as $rotation) {
                                $ROTATION_LIST[$rotation["rotation_id"]] = $rotation;
                                if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"]) && in_array($rotation["rotation_id"], $target_data["associated_rotation_ids"])) {
                                    $checked = "checked=\"checked\"";
                                } else {
                                    $checked = "";
                                }
                                $rotations[0]["options"][] = array("text" => $rotation["rotation_title"], "class" => "cat_enabled", "value" => "rotation_" . $rotation["rotation_id"], "checked" => $checked);
                            }
                            echo lp_multiple_select_inline("rotations", $rotations, array("title" => "Select Core Rotations:", "hidden" => false, "class" => "select_multiple_area_container", "category_check_all" => true, "submit" => false));
                        } else {
                            echo display_notice("There are no core rotations available.");
                        }
                        if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation_id) {
                                if ($rotation_ids_string) {
                                    $rotation_ids_string .= ",rotation_" . $rotation_id;
                                } else {
                                    $rotation_ids_string = "rotation_" . $rotation_id;
                                }
                            }
                        }
                        ?>
												<input type="hidden" id="evaluation_target_rotations" name="evaluation_target_rotations" value="<?php 
                        echo $rotation_ids_string;
                        ?>
" />
												<ul class="menu multiselect" id="target_list" style="margin-top: 5px;">
													<?php 
                        if (is_array($target_data["associated_rotation_ids"]) && count($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation) {
                                if (array_key_exists($rotation, $ROTATION_LIST) && is_array($ROTATION_LIST[$rotation])) {
                                    ?>
																<li class="group" id="target_rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_title"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
', 'rotations');" class="list-cancel-image" style="position: relative; float: right;" /></li>
																<?php 
                                }
                            }
                        }
                        ?>
												</ul>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating core rotation evaluations, the list of <strong>Core Rotations</strong>, <strong>Evaluators</strong>, the <strong>Evaluation Start</strong>, and the <strong>Evaluation Finish</strong> determine which electives will be targeted for evaluation. <br /><br />Each of the services in one of selected <strong>Core Rotations</strong> which ends between the <strong>Evaluation Start</strong> and the <strong>Evaluation Finish</strong> for learners in the <strong>Evaluators</strong> list will require/allow an evaluation to be completed on it.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    case "rotation_elective":
                        ?>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating clerkship elective evaluations, the list of <strong>Evaluators</strong>, the <strong>Evaluation Start</strong>, and the <strong>Evaluation Finish</strong> determine which electives will be targeted for evaluation. <br /><br />Each elective which ends between the <strong>Evaluation Start</strong> and the <strong>Evaluation Finish</strong> for learners in the <strong>Evaluators</strong> list will require/allow an evaluation to be completed on it.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    case "preceptor":
                        $target_data["form_id"] = $form_id;
                        if (!isset($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["evaluation_targets"] as $target) {
                                if ($target["target_type"] == "rotation_id") {
                                    $target_data["associated_rotation_ids"][] = $target["target_value"];
                                }
                            }
                        }
                        ?>
						<tr>
							<td>&nbsp;</td>
							<td style="vertical-align: top"><label for="faculty_name" class="form-nrequired">Evaluation Targets</label></td>
							<td>
								<table>
									<tbody>
										<tr>
											<td style="vertical-align: top"><input type="hidden" name="target_subtype" value="preceptor" /><input type="radio" name="target_type" id="target_type_rotations" value="rotations" onclick="selectEvaluationTargetOption('rotations')" style="vertical-align: middle"  checked="checked" /></td>
											<td colspan="2" style="padding-bottom: 15px">
												<label for="target_type_rotations" class="radio-group-title">Each Service in the selected Clerkship Rotation</label>
												<div class="content-small">This evaluation is intended for all events associated with a custom selection of Clerkship Rotations.</div>
												<?php 
                        $ROTATION_LIST = array();
                        $rotations[0] = array("text" => "All Clerkship Rotations", "value" => "all", "category" => true);
                        $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`global_lu_rotations`";
                        $rotation_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                        if ($rotation_results) {
                            foreach ($rotation_results as $rotation) {
                                $ROTATION_LIST[$rotation["rotation_id"]] = $rotation;
                                if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"]) && in_array($rotation["rotation_id"], $target_data["associated_rotation_ids"])) {
                                    $checked = "checked=\"checked\"";
                                } else {
                                    $checked = "";
                                }
                                $rotations[0]["options"][] = array("text" => $rotation["rotation_title"], "value" => "rotation_" . $rotation["rotation_id"], "class" => "cat_enabled", "checked" => $checked);
                            }
                            echo lp_multiple_select_inline("rotations", $rotations, array("title" => "Select Clerkship Rotations:", "hidden" => false, "class" => "select_multiple_area_container", "category_check_all" => true, "submit" => false));
                        } else {
                            echo display_notice("There are no clerkship rotations available.");
                        }
                        if (isset($target_data["associated_rotation_ids"]) && is_array($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation_id) {
                                if ($rotation_ids_string) {
                                    $rotation_ids_string .= ",rotation_" . $rotation_id;
                                } else {
                                    $rotation_ids_string = "rotation_" . $rotation_id;
                                }
                            }
                        }
                        ?>
												<input type="hidden" id="evaluation_target_rotations" name="evaluation_target_rotations" value="<?php 
                        echo $rotation_ids_string;
                        ?>
" />
												<ul class="menu multiselect" id="target_list" style="margin-top: 5px;">
													<?php 
                        if (is_array($target_data["associated_rotation_ids"]) && count($target_data["associated_rotation_ids"])) {
                            foreach ($target_data["associated_rotation_ids"] as $rotation) {
                                if (array_key_exists($rotation, $ROTATION_LIST) && is_array($ROTATION_LIST[$rotation])) {
                                    ?>
																<li class="group" id="target_rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
" style="cursor: move;"><?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_title"];
                                    ?>
<img src="<?php 
                                    echo ENTRADA_URL;
                                    ?>
/images/action-delete.gif" onclick="removeTarget('rotation_<?php 
                                    echo $ROTATION_LIST[$rotation]["rotation_id"];
                                    ?>
', 'rotations');" class="list-cancel-image" style="position: relative; float: right;" /></li>
																<?php 
                                }
                            }
                        }
                        ?>
												</ul>
											</td>
										</tr>
									</tbody>
								</table>
							</td>
						</tr>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating clerkship preceptor evaluations, the list of <strong>Rotations</strong>, <strong>Evaluators</strong>, the <strong>Evaluation Start</strong>, and the <strong>Evaluation Finish</strong> determine which electives will be targeted for evaluation. <br /><br />Each preceptor for services in one of the selected <strong>Rotations</strong> which ends between the <strong>Evaluation Start</strong> and the <strong>Evaluation Finish</strong> for learners in the <strong>Evaluators</strong> list will require/allow an evaluation to be completed on it.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    case "self":
                        ?>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("When creating self evaluations, the list of evaluators also acts as the target, as learners can only evaluate themselves.");
                        ?>
							</td>
						</tr>
						<?php 
                        break;
                    default:
                        ?>
						<tr>
							<td colspan="2">&nbsp;</td>
							<td>
								<?php 
                        echo display_notice("The target that you have selected is not currently available.");
                        ?>
							</td>
						</tr>
						<?php 
                        application_log("error", "Unaccounted for target_shortname [" . $target_details["target_shortname"] . "] encountered. An update to api-targets.inc.php is required.");
                        break;
                }
                if ($target_details["target_shortname"] != "peer" && $target_details["target_shortname"] != "student" && $target_details["target_shortname"] != "resident") {
                    ?>
					<tr>
						<td colspan="3">&nbsp;</td>
					</tr>
					<tr>
						<td></td>
						<td style="vertical-align: top">
							<label for="PickList" class="form-required">Select Students</label>
							<div class="content-small"><strong>Hint:</strong> Select the student or students you would like to evaluate the teachers above.</div>
						</td>
						<td style="vertical-align: top">
							<table style="width: 100%" cellspacing="0" cellpadding="0">
								<colgroup>
									<col style="width: 4%" />
									<col style="width: 96%" />
								</colgroup>
								<tbody>
									<tr>
										<td style="vertical-align: top"><input<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) && $target_data["evaluation_evaluators"][0]["evaluator_type"] == "cohort" ? " checked=\"checked\"" : "";
                    ?>
 type="radio" name="target_group_type" id="target_group_type_cohort" value="cohort" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_cohort" class="radio-group-title">Entire class must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed by everyone in the selected class.</div>
										</td>
									</tr>
									<tr class="target_group cohort_target">
										<td></td>
										<td style="vertical-align: middle" class="content-small">
											<label for="cohort" class="form-required">All students in</label>
											<select id="cohort" name="cohort" style="width: 203px; vertical-align: middle">
												<?php 
                    $active_cohorts = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    if (isset($active_cohorts) && !empty($active_cohorts)) {
                        foreach ($active_cohorts as $cohort) {
                            echo "<option value=\"" . $cohort["group_id"] . "\"" . ($target_data["evaluation_evaluators"][0]["evaluator_type"] == "cohort" && $target_data["evaluation_evaluators"][0]["evaluator_value"] == $cohort["group_id"] ? " selected=\"selected\"" : "") . ">" . html_encode($cohort["group_name"]) . "</option>\n";
                        }
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2">&nbsp;</td>
									</tr>
									<tr>
										<td style="vertical-align: top"><input type="radio" name="target_group_type" id="target_group_type_percentage" value="percentage" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_percentage" class="radio-group-title">Percentage of class must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed by certain percentage of students in the selected class.</div>
										</td>
									</tr>
									<tr class="target_group percentage_target">
										<td>&nbsp;</td>
										<td style="vertical-align: middle" class="content-small">
											<input type="text" class="percentage" id="percentage_percent" name="percentage_percent" style="width: 30px; vertical-align: middle" maxlength="3" value="100" /> <label for="percentage_cohort" class="form-required">of the</label>
											<select id="percentage_cohort" name="percentage_cohort" style="width: 203px; vertical-align: middle">
											<?php 
                    $active_cohorts = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    if (isset($active_cohorts) && !empty($active_cohorts)) {
                        foreach ($active_cohorts as $cohort) {
                            echo "<option value=\"" . $cohort["group_id"] . "\">" . html_encode($cohort["group_name"]) . "</option>\n";
                        }
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2">&nbsp;</td>
									</tr>
									<tr>
										<td style="vertical-align: top"><input<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) && $target_data["evaluation_evaluators"][0]["evaluator_type"] == "cgroup_id" ? " checked=\"checked\"" : "";
                    ?>
 type="radio" name="target_group_type" id="target_group_type_cgroup_id" value="cgroup_id" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_cgroup_id" class="radio-group-title">Selected course groups must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed by everyone in the selected course groups.</div>
										</td>
									</tr>
									<tr class="target_group cgroup_id_target">
										<td></td>
										<td style="vertical-align: middle" class="content-small">
											<label for="cgroup_ids" class="form-required">All students in</label>
											<select multiple="multiple" id="cgroup_ids" name="cgroup_ids[]" style="width: 450px; height: 200px; vertical-align: top;"><?php 
                    $query = "SELECT * FROM `course_groups` AS a\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `courses` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE b.`course_active` = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND a.`active` = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND b.`organisation_id` = " . $ENTRADA_USER->getActiveOrganisation() . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY b.`course_name`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLENGTH(a.`group_name`),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ta.`group_name` ASC";
                    $temp_course_groups = $db->GetAll($query);
                    $course_groups = array();
                    if ($temp_course_groups) {
                        foreach ($temp_course_groups as $temp_course_group) {
                            $course_groups[$temp_course_group["cgroup_id"]] = $temp_course_group;
                        }
                    }
                    $evaluator_cgroup_ids = array();
                    foreach ($target_data["evaluation_evaluators"] as $evaluator) {
                        if ($evaluator["evaluator_type"] == "cgroup_id") {
                            $evaluator_cgroup_ids[] = $evaluator["evaluator_value"];
                        }
                    }
                    if (isset($course_groups) && !empty($course_groups)) {
                        $last_course_name = false;
                        foreach ($course_groups as $course_group) {
                            if ($course_group["course_name"] && $last_course_name != $course_group["course_name"]) {
                                if ($last_course_name) {
                                    echo "</optgroup>\n";
                                }
                                $last_course_name = $course_group["course_name"];
                                echo "<optgroup label=\"" . $course_group["course_name"] . ($course_group["course_code"] ? " - " . $course_group["course_code"] : "") . "\">\n";
                            }
                            echo "<option value=\"" . $course_group["cgroup_id"] . "\"" . (in_array($course_group["cgroup_id"], $evaluator_cgroup_ids) ? " selected=\"selected\"" : "") . ">" . html_encode($course_group["group_name"]) . "</option>\n";
                        }
                        if ($last_course_name) {
                            echo "</optgroup>\n";
                        }
                    }
                    ?>
											</select>
										</td>
									</tr>
									<tr>
										<td colspan="2">&nbsp;</td>
									</tr>
									<tr >
										<td style="vertical-align: top"><input<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) && $target_data["evaluation_evaluators"][0]["evaluator_type"] == "proxy_id" ? " checked=\"checked\"" : "";
                    ?>
 type="radio" name="target_group_type" id="target_group_type_proxy_id" value="proxy_id" onclick="selectTargetGroupOption(this.value)" style="vertical-align: middle" /></td>
										<td style="padding-bottom: 15px">
											<label for="target_group_type_proxy_id" class="radio-group-title">Selected students must complete this evaluation</label>
											<div class="content-small">This evaluation must be completed only by the selected individuals.</div>
										</td>
									</tr>
									<tr class="target_group proxy_id_target">
										<td>&nbsp;</td>
										<td style="vertical-align: middle" class="content-small">
											<label for="student_name" class="form-required">Student Name</label>

											<input type="text" id="student_name" name="fullname" size="30" autocomplete="off" style="width: 203px; vertical-align: middle" />
											<div class="autocomplete" id="student_name_auto_complete"></div>

											<input type="hidden" id="associated_student" name="associated_student" />
											<input type="button" class="btn btn-small" id="add_associated_student" value="Add" style="vertical-align: middle" />
											<span class="content-small" style="margin-left: 3px; padding-top: 5px"><strong>e.g.</strong> <?php 
                    echo html_encode($_SESSION["details"]["lastname"] . ", " . $_SESSION["details"]["firstname"]);
                    ?>
</span>
											<ul id="student_list" class="menu" style="margin-top: 15px">
												<?php 
                    if ($target_data["evaluation_evaluators"][0]["evaluator_type"] == "proxy_id" && is_array($target_data["evaluation_evaluators"]) && !empty($target_data["evaluation_evaluators"])) {
                        foreach ($target_data["evaluation_evaluators"] as $evaluator) {
                            $proxy_id = (int) $evaluator["evaluator_value"];
                            ?>
														<li class="community" id="student_<?php 
                            echo $proxy_id;
                            ?>
" style="cursor: move;"><?php 
                            echo get_account_data("fullname", $proxy_id);
                            ?>
<img src="<?php 
                            echo ENTRADA_URL;
                            ?>
/images/action-delete.gif" onclick="student_list.removeItem('<?php 
                            echo $proxy_id;
                            ?>
');" class="list-cancel-image" /></li>
														<?php 
                        }
                    }
                    ?>
											</ul>
											<input type="hidden" id="student_ref" name="student_ref" value="" />
											<input type="hidden" id="student_id" name="student_id" value="" />
										</td>
									</tr>
								</tbody>
							</table>
							<div id="scripts-on-open" style="display: none;">
								$('submittable_notice').update('&nbsp;');
								selectTargetGroupOption('<?php 
                    echo isset($target_data["evaluation_evaluators"][0]["evaluator_type"]) ? $target_data["evaluation_evaluators"][0]["evaluator_type"] : 'cohort';
                    ?>
');
								student_list = new AutoCompleteList({ type: 'student', url: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/api/personnel.api.php?type=student', remove_image: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/images/action-delete.gif' });
								<?php 
                    if (in_array($target_details["target_shortname"], array("course", "rotation_core", "preceptor"))) {
                        ?>
									$('directors_select').show();
									$('pcoordinators_select').show();
									$('tutors_select').hide();
									<?php 
                    } elseif ($target_details["target_shortname"] == "self") {
                        ?>
									$('tutors_select').show();
									$('directors_select').hide();
									$('pcoordinators_select').hide();
									<?php 
                    }
                    ?>
							</div>
						</td>
					</tr>
					<?php 
                } elseif ($target_details["target_shortname"] == "peer") {
                    ?>
					<tr>
						<td colspan="3">
							<div id="scripts-on-open" style="display: none;">
								$('tutors_select').show();
								$('submittable_notice').update('<div class="display-notice"><ul><li>If you set the Min or Max Submittable for a Peer Evaluation to 0, the value will default to the number of targets available to evaluate.</li></ul></div>');
							</div>
						</td>
					</tr
					<?php 
                } elseif ($target_details["target_shortname"] == "student" || $target_details["target_shortname"] == "resident") {
                    ?>
					<tr>
						<td colspan="3">&nbsp;</td>
					</tr
					<tr>
						<td></td>
						<td style="vertical-align: top"><label for="evalfaculty_name" class="form-required">Faculty Evaluators</label></td>
						<td>
							<input type="hidden" name="target_group_type" id="target_group_type_faculty" value="faculty" style="vertical-align: middle" />
							<div id="scripts-on-open" style="display: none;">
								faculty_list = new AutoCompleteList(
									{
										type: 'evalfaculty',
										url: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/api/personnel.api.php?type=evalfaculty',
										remove_image: '<?php 
                    echo ENTRADA_RELATIVE;
                    ?>
/images/action-delete.gif'
									});
								$('tutors_select').show();
								$('directors_select').hide();
								$('pcoordinators_select').hide();
								$('submittable_notice').update('&nbsp;');
							</div>
							<input type="text" id="evalfaculty_name" name="fullname" size="30" autocomplete="off" style="width: 203px; vertical-align: middle" />
							<div class="autocomplete" id="evalfaculty_name_auto_complete"></div>
							<input type="hidden" id="associated_evalfaculty" name="associated_evalfaculty" />
							<input type="button" class="btn btn-small" id="add_associated_evalfaculty" value="Add" style="vertical-align: middle" />
							<span class="content-small">(<strong>Example:</strong> <?php 
                    echo html_encode($_SESSION["details"]["lastname"] . ", " . $_SESSION["details"]["firstname"]);
                    ?>
)</span>
							<ul id="evalfaculty_list" class="menu" style="margin-top: 15px">
								<?php 
                    if ($target_data["evaluation_evaluators"][0]["evaluator_type"] == "proxy_id" && is_array($target_data["evaluation_evaluators"]) && !empty($target_data["evaluation_evaluators"])) {
                        foreach ($target_data["evaluation_evaluators"] as $evaluator) {
                            $proxy_id = (int) $evaluator["evaluator_value"];
                            ?>
										<li class="community" id="evalfaculty_<?php 
                            echo $proxy_id;
                            ?>
" style="cursor: move;"><?php 
                            echo get_account_data("fullname", $proxy_id);
                            ?>
<img src="<?php 
                            echo ENTRADA_URL;
                            ?>
/images/action-delete.gif" onclick="faculty_list.removeItem('<?php 
                            echo $proxy_id;
                            ?>
');" class="list-cancel-image" /></li>
										<?php 
                        }
                    }
                    ?>
							</ul>
							<input type="hidden" id="evalfaculty_ref" name="evalfaculty_ref" value="" />
							<input type="hidden" id="evalfaculty_id" name="evalfaculty_id" value="" />
						</td>
					</tr>
					<?php 
                }
            }
        } else {
            $organisation[$ENTRADA_USER->getActiveOrganisation()] = array("text" => fetch_organisation_title($ENTRADA_USER->getActiveOrganisation()), "value" => "organisation_" . $ENTRADA_USER->getActiveOrganisation(), "category" => true);
            switch ($options_for) {
                case "cohorts":
                    // Classes
                    /**
                     * Cohorts.
                     */
                    if (isset($target_data["evaluation_target_cohorts"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_cohorts"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "group") !== false) {
                                    if ($group_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT * FROM `groups`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `group_id` = " . $db->qstr($group_id) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND `group_active` = 1";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_cohort_ids"][] = $group_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $groups = $organisation;
                    $groups_results = groups_get_active_cohorts($ENTRADA_USER->getActiveOrganisation());
                    if ($groups_results) {
                        foreach ($groups_results as $group) {
                            if (isset($target_data["associated_cohort_ids"]) && is_array($target_data["associated_cohort_ids"]) && in_array($group["group_id"], $target_data["associated_cohort_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $groups[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $group["group_name"], "value" => "group_" . $group["group_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("cohorts", $groups, array("title" => "Select Cohorts of Learners:", "submit_text" => "Close", "submit" => true));
                    } else {
                        echo display_notice("There are no cohorts of learners available.");
                    }
                    break;
                case "course_groups":
                    /**
                     * Course Groups
                     */
                    if (isset($target_data["evaluation_target_course_groups"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_course_groups"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "cgroup") !== false) {
                                    if ($cgroup_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `course_groups`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `cgroup_id` = " . $db->qstr($cgroup_id) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (`active` = '1')";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_cgroup_ids"][] = $cgroup_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $groups = $organisation;
                    $query = "SELECT a.*, b.`course_name`, b.`course_code` FROM `course_groups` AS a\n\t\t\t\t\t\t\t\tJOIN `courses` AS b\n\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\tWHERE b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tORDER BY b.`course_name`,\n\t\t\t\t\t\t\t\t\tLENGTH(a.`group_name`),\n\t\t\t\t\t\t\t\t\ta.`group_name` ASC";
                    $groups_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                    if ($groups_results) {
                        $last_course_category = "";
                        foreach ($groups_results as $group) {
                            if ($last_course_category != $group["course_name"]) {
                                $last_course_category = $group["course_name"];
                                $groups[$group["course_id"]] = array("text" => $group["course_name"], "value" => "course_" . $group["course_id"], "category" => true);
                            }
                            if (isset($target_data["associated_cgroup_ids"]) && is_array($target_data["associated_cgroup_ids"]) && in_array($group["cgroup_id"], $target_data["associated_cgroup_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $groups[$group["course_id"]]["options"][] = array("text" => $group["group_name"] . ($group["course_code"] ? " - " . $group["course_code"] : ""), "value" => "cgroup_" . $group["cgroup_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("course_groups", $groups, array("title" => "Select Course Specific Small Groups:", "submit_text" => "Close", "submit" => true));
                    } else {
                        //echo display_notice("There are no small groups in the course you have selected.");
                    }
                    break;
                case "students":
                    // Students
                    /**
                     * Learners
                     */
                    if (isset($target_data["evaluation_target_students"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_students"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "student") !== false) {
                                    if ($proxy_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT a.*\n\t\t\t\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\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.`id` = " . $db->qstr($proxy_id) . "\n\t\t\t\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\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_proxy_ids"][] = $proxy_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $students = $organisation;
                    $query = "\tSELECT a.`id` AS `proxy_id`, a.`organisation_id`, b.`role`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\tJOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\tWHERE b.`app_id` IN (" . AUTH_APP_IDS_STRING . ")\n\t\t\t\t\t\t\t\tAND a.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\tAND a.`grad_year` >= " . $db->qstr(fetch_first_year() - 4) . ($ENTRADA_USER->getGroup() == "student" ? " AND a.`id` = " . $db->qstr($ENTRADA_USER->getID()) : "") . "\n\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\tORDER BY a.`grad_year` DESC, a.`lastname` ASC, a.`firstname` ASC";
                    $student_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                    if ($student_results) {
                        foreach ($student_results as $student) {
                            if (isset($target_data["associated_proxy_ids"]) && is_array($target_data["associated_proxy_ids"]) && in_array($student["proxy_id"], $target_data["associated_proxy_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $students[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $student["fullname"], "value" => "student_" . $student["proxy_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("students", $students, array("title" => "Select Individual Learners:", "submit_text" => "Close", "submit" => true));
                    } else {
                        echo display_notice("There are no students available.");
                    }
                    break;
                case "residents":
                    // Residents
                    if (isset($target_data["evaluation_target_residents"])) {
                        $associated_targets = explode(',', $target_data["evaluation_target_residents"]);
                        if (isset($associated_targets) && is_array($associated_targets) && count($associated_targets)) {
                            foreach ($associated_targets as $target_id) {
                                if (strpos($target_id, "resident") !== false) {
                                    if ($proxy_id = clean_input(preg_replace("/[a-z_]/", "", $target_id), array("trim", "int"))) {
                                        $query = "\tSELECT a.*\n\t\t\t\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\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.`id` = " . $db->qstr($proxy_id) . "\n\t\t\t\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\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")";
                                        $result = $db->GetRow($query);
                                        if ($result) {
                                            $target_data["associated_proxy_ids"][] = $proxy_id;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    $residents = $organisation;
                    $query = "\tSELECT a.`id` AS `proxy_id`, a.`organisation_id`, b.`role`, CONCAT_WS(', ', a.`lastname`, a.`firstname`) AS `fullname`\n\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\tJOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\tON a.`id` = b.`user_id`\n\t\t\t\t\t\t\t\tWHERE b.`app_id` IN (" . AUTH_APP_IDS_STRING . ")\n\t\t\t\t\t\t\t\tAND a.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tAND b.`account_active` = 'true'\n\t\t\t\t\t\t\t\tAND (b.`access_starts` = '0' OR b.`access_starts` <= " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND (b.`access_expires` = '0' OR b.`access_expires` > " . $db->qstr(time()) . ")\n\t\t\t\t\t\t\t\tAND b.`group` = 'student'\n\t\t\t\t\t\t\t\tGROUP BY a.`id`\n\t\t\t\t\t\t\t\tORDER BY a.`grad_year` DESC, a.`lastname` ASC, a.`firstname` ASC";
                    $resident_results = $db->CacheGetAll(LONG_CACHE_TIMEOUT, $query);
                    if ($resident_results) {
                        foreach ($resident_results as $resident) {
                            if (isset($target_data["associated_proxy_ids"]) && is_array($target_data["associated_proxy_ids"]) && in_array($resident["proxy_id"], $target_data["associated_proxy_ids"])) {
                                $checked = "checked=\"checked\"";
                            } else {
                                $checked = "";
                            }
                            $residents[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $resident["fullname"], "value" => "resident_" . $g["proxy_id"], "checked" => $checked);
                        }
                        echo lp_multiple_select_popup("residents", $residents, array("title" => "Select Individual Learners:", "submit_text" => "Close", "submit" => true));
                    } else {
                        echo display_notice("There are no residents available.");
                    }
                    break;
                default:
                    application_log("notice", "Unknown evaluation target filter type [" . $options_for . "] provided to evaluation targets API.");
                    break;
            }
        }
    }
示例#25
0
 $quiz_record = $db->GetRow($query);
 if ($quiz_record) {
     $is_administrator = false;
     if ($QUIZ_TYPE == "event") {
         if ($ENTRADA_ACL->amIAllowed(new EventContentResource($quiz_record["event_id"], $quiz_record["course_id"], $quiz_record["organisation_id"]), "update")) {
             $is_administrator = true;
         }
     } else {
         $query = "SELECT * FROM `community_members` WHERE `community_id` = " . $db->qstr($quiz_record["community_id"]) . " AND `proxy_id` = " . $db->qstr($ENTRADA_USER->getActiveId()) . " AND `member_active` = '1' AND `member_acl` = '1'";
         $result = $db->GetRow($query);
         if ($result) {
             $is_administrator = true;
         }
     }
     if ($is_administrator || $quiz_record["proxy_id"] == $ENTRADA_USER->getActiveId()) {
         $respondent_name = get_account_data("firstlast", $quiz_record["proxy_id"]);
         if ($QUIZ_TYPE == "event") {
             $BREADCRUMB[] = array("url" => ENTRADA_URL . "/events?id=" . $quiz_record["event_id"], "title" => limit_chars($quiz_record["content_title"], 32));
         } else {
             $BREADCRUMB[] = array("url" => ENTRADA_URL . "/community" . $quiz_record["community_url"] . ":" . $quiz_record["page_url"], "title" => limit_chars($quiz_record["content_title"], 32));
         }
         $BREADCRUMB[] = array("url" => ENTRADA_URL . "/" . $MODULE . "?section=results" . ($QUIZ_TYPE == "community_page" ? "&community=true" : "") . "&id=" . $RECORD_ID, "title" => limit_chars($quiz_record["quiz_title"], 32));
         if ($is_administrator) {
             $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/" . $MODULE . "?section=results" . ($QUIZ_TYPE == "community_page" ? "&community=true" : "") . "&id=" . $quiz_record["aquiz_id"], "title" => "Quiz Results");
             $BREADCRUMB[] = array("url" => "", "title" => $respondent_name);
         }
         /**
          * Providing there is no expiry date, or the expiry date is in the
          * future on both the quiz and the event, allow them to continue.
          */
         if ($is_administrator || $quiz_record["quiztype_code"] == "immediate" || $quiz_record["quiztype_code"] == "delayed" && ((int) $quiz_record["release_until"] === 0 || $quiz_record["release_until"] <= time())) {
示例#26
0
                        $cssclass = " class=\"in_draft\"";
                        break;
                    case "published":
                        $cssclass = " class=\"published\"";
                        break;
                    case "rejected":
                        $cssclass = " class=\"rejected\"";
                        break;
                    default:
                        $cssclass = "";
                }
            }
            $getStudentsQuery = "SELECT `etype_id`\n\t\t\t\tFROM " . CLERKSHIP_DATABASE . ".`event_contacts`\n\t\t\t\tWHERE `event_id` = " . $db->qstr($result["event_id"]);
            $getStudentsResults = $db->GetAll($getStudentsQuery);
            foreach ($getStudentsResults as $student) {
                $name = get_account_data("firstlast", $student["etype_id"]);
                echo "<tr" . ($is_here ? " class=\"current\"" : $cssclass) . ">\n";
                echo "\t<td class=\"modified\">&nbsp</td>\n";
                echo "\t<td class=\"date\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . $name . "</a></td>\n";
                echo "\t<td class=\"date\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . date(DEFAULT_DATE_FORMAT, $result["event_start"]) . "</a></td>\n";
                echo "\t<td class=\"region\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . ($result["city"] == "" ? html_encode(limit_chars($result["region_name"], 30)) : $result["city"]) . "</a></td>\n";
                echo "\t<td class=\"title\"><a href=\"" . $click_url . "\" style=\"font-size: 11px\">" . limit_chars(html_decode($result["event_title"]), 55, true, false) . "</a></td>\n";
                echo "</tr>\n";
            }
        }
        ?>
			</tbody>
			</table>
		<br /><br />
		<?php 
    }
							</div>
						</div>
						<?php 
                        break;
                }
            } else {
                if ($ERROR) {
                    echo display_error();
                }
                if ($NOTICE) {
                    echo display_notice();
                }
            }
        } else {
            $NOTICE++;
            $NOTICESTR[] = "The photo that you are trying to edit was deactivated <strong>" . date(DEFAULT_DATE_FORMAT, $photo_record["updated_date"]) . "</strong> by <strong>" . html_encode(get_account_data("firstlast", $photo_record["updated_by"])) . "</strong>.<br /><br />If there has been a mistake or you have questions relating to this issue please contact the MEdTech Unit directly.";
            echo display_notice();
            application_log("error", "The photo record id [" . $RECORD_ID . "] is deactivated; however, " . $_SESSION["details"]["firstname"] . " " . $_SESSION["details"]["lastname"] . " [" . $ENTRADA_USER->getID() . "] has tried to edit it.");
        }
    } else {
        $ERROR++;
        $ERRORSTR[] = "The photo id that you have provided does not exist in the system. Please provide a valid record id to proceed.";
        echo display_error();
        application_log("error", "The provided photo id was invalid [" . $RECORD_ID . "] (Edit Photo).");
    }
} else {
    $ERROR++;
    $ERRORSTR[] = "Please provide a valid photo id to proceed.";
    echo display_error();
    application_log("error", "No photo id was provided to edit. (Edit Photo)");
}
示例#28
0
         foreach ($locations as $location) {
             $location_string .= ($location_string ? "/" : "") . html_encode($location["location_type_short"]);
         }
         echo "<option id=\"rotation-proc-item-" . $result["lprocedure_id"] . "\" value=\"" . (int) $result["lprocedure_id"] . "\">" . html_encode($result["procedure"] . " (" . $location_string . ")") . "</option>\n";
     }
 }
 echo "</select>\n";
 echo "<select id=\"deficient_procedure_id\" name=\"deficient_procedure_id\" onchange=\"addProcedure(this.value, 0)\" style=\"width: 100%; display: none;\">\n";
 echo "<option value=\"0\"" . (!isset($PROCESSED["objective_id"]) ? " selected=\"selected\"" : "") . ">-- Select Clinical Tasks --</option>\n";
 if ($deficient_procedures) {
     foreach ($deficient_procedures as $result) {
         echo "<option id=\"deficient-proc-item-" . $result["lprocedure_id"] . "\" value=\"" . (int) $result["lprocedure_id"] . "\">" . html_encode($result["procedure"]) . "</option>\n";
     }
 }
 echo "</select>\n";
 $query = "SELECT a.* FROM `" . CLERKSHIP_DATABASE . "`.`logbook_lu_procedures` AS a\n                                            LEFT JOIN `" . CLERKSHIP_DATABASE . "`.`logbook_preferred_procedures` AS b\n                                            ON b.`lprocedure_id` = a.`lprocedure_id`\n                                            WHERE b.`grad_year_min` <= " . $db->qstr(get_account_data("grad_year", $ENTRADA_USER->getID())) . "\n                                            GROUP BY a.`lprocedure_id`\n                                            ORDER BY a.`procedure`";
 $results = $db->GetAll($query);
 echo "<select id=\"all_procedure_id\" style=\"width: 100%;" . (isset($preferred_procedures) && $preferred_procedures ? " display: none;" : "") . "\" name=\"all_procedure_id\" onchange=\"addProcedure(this.value, 0)\">\n";
 echo "<option value=\"0\"" . (!isset($PROCESSED["procedure_id"]) ? " selected=\"selected\"" : "") . ">-- Select Clinical Tasks --</option>\n";
 if ($results) {
     foreach ($results as $result) {
         echo "<option id=\"all-proc-item-" . $result["lprocedure_id"] . "\" value=\"" . (int) $result["lprocedure_id"] . "\">" . html_encode($result["procedure"]) . "</option>\n";
     }
 }
 echo "</select>\n";
 ?>
         </span>
     </div>
     <div class="control-group row-fluid" id="procedure-container"<?php 
 echo !(isset($PROCESSED_PROCEDURES) || !@count($PROCESSED_PROCEDURES) ? " style=\"display: none;\"" : "");
 ?>
示例#29
0
    } else {
        add_error("An evaluation must be selected from the drop-down list to request an evaluation be completed for you.");
    }
    if (has_error()) {
        echo display_error();
    }
    if (isset($notifications_sent) && $notifications_sent) {
        add_success("Successfully requested that " . ($notifications_sent > 1 ? $notifications_sent . " evaluators" : get_account_data("wholename", $associated_evaluator)) . " fill out this evaluation [" . $evaluation_title . "] for you.");
        echo display_success();
    }
}
$evaluation_requests = Models_Evaluation::getTargetRequests($ENTRADA_USER->GetID(), false, false, true);
if ($evaluation_requests) {
    $notice_msg = "The following Evaluation Request Codes are still active but unused: <br />";
    foreach ($evaluation_requests as $evaluation_request) {
        $requestee = get_account_data("wholename", $evaluation_request["target_proxy_id"]);
        $notice_msg .= "<br />" . $evaluation_request["evaluation_title"] . " [" . $requestee . "]: <strong>" . $evaluation_request["request_code"] . "</strong>";
    }
    add_notice($notice_msg);
    echo display_notice();
}
if ($evaluations && $view != "review") {
    ?>
	<h1>My Evaluations and Assessments</h1>
	<?php 
    if ($review_evaluations) {
        $sidebar_html = "<ul class=\"menu\">\n";
        $sidebar_html .= "\t<li class=\"link\"><a href=\"" . ENTRADA_URL . "/evaluations?view=review\">View Completed Evaluations Available for Review</a></li>\n";
        $sidebar_html .= "</ul>\n";
        new_sidebar_item("Evaluations Review", $sidebar_html, "view-review", "open", "1.9");
    }
示例#30
0
    echo t("Daily Rates");
    ?>
</th>
    <?php 
}
?>
    <th class="buttons"></th>
  </tr>
</thead>
<tbody>
<?php 
$totals = array();
$count = 0;
$last_date = 0;
foreach ($transactions as $transaction) {
    $account_data = get_account_data($transaction['exchange'], false);
    $account_full = false;
    if ($account_data) {
        $q = db()->prepare("SELECT * FROM " . $account_data['table'] . " WHERE id=? LIMIT 1");
        $q->execute(array($transaction['account_id']));
        $account_full = $q->fetch();
    }
    $transaction_date = date("Y-m-d", strtotime($transaction['transaction_date']));
    ?>
  <tr class="<?php 
    echo $count % 2 == 0 ? "odd" : "even";
    echo $transaction['id'] == require_get('highlight', 0) ? " selected" : "";
    ?>
">
    <td class="<?php 
    echo $last_date == $transaction_date ? "repeated_date" : "";