Пример #1
0
 public static function getPreceptorSelect($evaluation_id, $event_id, $evaluator_proxy_id, $preceptor_proxy_id = 0)
 {
     global $db;
     $output = "";
     $preceptors = Models_Evaluation::getPreceptorArray($evaluation_id, $event_id, $evaluator_proxy_id);
     if ($preceptors) {
         $output = "<select id=\"preceptor_proxy_id\" name=\"preceptor_proxy_id\" onchange=\"fetchTargetDetails(this.value)\">\n";
         $output .= "<option value=\"0\">-- Select a preceptor --</option>\n";
         foreach ($preceptors as $preceptor) {
             if ($preceptor["proxy_id"]) {
                 $output .= "<option value=\"" . $preceptor["proxy_id"] . "\"" . ($preceptor_proxy_id && $preceptor_proxy_id == $preceptor["proxy_id"] ? " selected=\"selected\"" : "") . ">" . $preceptor["fullname"] . "</option>";
             }
         }
         $output .= "<option value=\"other\"" . (isset($preceptor_proxy_id) && $preceptor_proxy_id === "other" ? " selected=\"selected\"" : "") . ">Other Teacher</option>\n";
         $output .= "</select>\n";
     }
     return $output;
 }
     $preceptor_evaluation = false;
 }
 if ((isset($etarget_id) && $etarget_id || isset($proxy_id) && $proxy_id) && isset($eevaluator_id) && $eevaluator_id) {
     $evaluation_targets = Models_Evaluation::getTargetsArray($RECORD_ID, $eevaluator_id, $ENTRADA_USER->getID(), false, true, false, $erequest_id);
     foreach ($evaluation_targets as $evaluation_target) {
         if (!isset($preceptor_evaluation) || !$preceptor_evaluation) {
             if (isset($proxy_id) && $proxy_id && isset($evaluation_target["proxy_id"]) && $evaluation_target["proxy_id"] == $proxy_id) {
                 $found = true;
                 break;
             } elseif (isset($etarget_id) && $etarget_id && isset($evaluation_target["etarget_id"]) && $evaluation_target["etarget_id"] == $etarget_id) {
                 $proxy_id = $evaluation_target["proxy_id"];
                 $found = true;
                 break;
             }
         } elseif ($preceptor_evaluation == $evaluation_target["event_id"]) {
             $preceptors = Models_Evaluation::getPreceptorArray($RECORD_ID, $preceptor_evaluation, $ENTRADA_USER->getID());
             foreach ($preceptors as $preceptor) {
                 if ($preceptor["proxy_id"] == $proxy_id) {
                     $found = true;
                     break;
                 }
             }
             break;
         }
     }
     if (isset($found) && $found) {
         $query_profile = "\n\t\t\t\t\t\t\t\tSELECT a.*, b.`group`, b.`role`, b.`organisation_id`\n\t\t\t\t\t\t\t\tFROM `" . AUTH_DATABASE . "`.`user_data` AS a\n\t\t\t\t\t\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_access` AS b\n\t\t\t\t\t\t\t\tON b.`user_id` = a.`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 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 a.`id` = " . $db->qstr((int) $proxy_id) . "\n\t\t\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\t\t\t\tGROUP BY a.`id`";
         $user = $db->GetRow($query_profile);
         if ($user) {
             echo "<div id=\"result-" . $proxy_id . "\" class=\"media ps-media-padding\" style=\"overflow: visible;" . ($key % 2 == 1 ? " background-color: rgb(238, 238, 238);" : "") . "\">\n";
             $offical_file_active = false;