コード例 #1
0
 public static function getEvaluatorEvaluations($proxy_id, $organisation_id)
 {
     global $db;
     $evaluations = array();
     $cohort_ids = groups_get_enrolled_group_ids($proxy_id, false, $organisation_id, false);
     $cohort_ids_string = "";
     if (isset($cohort_ids) && is_array($cohort_ids)) {
         foreach ($cohort_ids as $cohort_id) {
             $cohort_ids_string .= ($cohort_ids_string ? ", " : "") . $db->qstr($cohort_id);
         }
     }
     $query = "SELECT a.`cgroup_id` FROM `course_group_audience` AS a\n\t\t\t\t\tJOIN `course_groups` AS b\n\t\t\t\t\tON a.`cgroup_id` = b.`cgroup_id`\n\t\t\t\t\tWHERE a.`proxy_id` = " . $db->qstr($proxy_id) . "\n\t\t\t\t\tAND a.`active` = 1\n\t\t\t\t\tAND b.`active` = 1";
     $course_groups = $db->GetAll($query);
     $cgroup_ids_string = "";
     if (isset($course_groups) && is_array($course_groups)) {
         foreach ($course_groups as $course_group) {
             if ($cgroup_ids_string) {
                 $cgroup_ids_string .= ", " . $db->qstr($course_group["cgroup_id"]);
             } else {
                 $cgroup_ids_string = $db->qstr($course_group["cgroup_id"]);
             }
         }
     }
     $query = "\tSELECT * FROM `evaluations` AS a\n\t\t\t\t\tJOIN `evaluation_evaluators` AS b\n\t\t\t\t\tON a.`evaluation_id` = b.`evaluation_id`\n\t\t\t\t\tJOIN `evaluation_forms` AS c\n\t\t\t\t\tON a.`eform_id` = c.`eform_id`\n\t\t\t\t\tJOIN `evaluations_lu_targets` AS d\n\t\t\t\t\tON c.`target_id` = d.`target_id`\n\t\t\t\t\tWHERE\n\t\t\t\t\t(\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tb.`evaluator_type` = 'proxy_id'\n\t\t\t\t\t\t\tAND b.`evaluator_value` = " . $db->qstr($proxy_id) . "\n\t\t\t\t\t\t)\n\t\t\t\t\t\tOR\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\tb.`evaluator_type` = 'organisation_id'\n\t\t\t\t\t\t\tAND b.`evaluator_value` = " . $db->qstr($organisation_id) . "\n\t\t\t\t\t\t)" . (isset($cohort_ids_string) && $cohort_ids_string ? " OR (\n\t\t\t\t\t\t\tb.`evaluator_type` = 'cohort'\n\t\t\t\t\t\t\tAND b.`evaluator_value` IN (" . $cohort_ids_string . ")\n\t\t\t\t\t\t)" : "") . ($cgroup_ids_string ? " OR (\n\t\t\t\t\t\t\tb.`evaluator_type` = 'cgroup_id'\n\t\t\t\t\t\t\tAND b.`evaluator_value` IN (" . $cgroup_ids_string . ")\n\t\t\t\t\t\t)" : "") . "\n\t\t\t\t\t)\n\t\t\t\t\tAND a.`evaluation_start` < " . $db->qstr(time()) . "\n\t\t\t\t\tAND a.`evaluation_active` = 1\n\t\t\t\t\tGROUP BY a.`evaluation_id`\n\t\t\t\t\tORDER BY a.`evaluation_finish` DESC";
     $temp_evaluations = $db->GetAll($query);
     if ($temp_evaluations) {
         foreach ($temp_evaluations as $evaluation) {
             $temp_evaluation = Models_Evaluation::getEvaluationDetails($evaluation, $proxy_id);
             if ($temp_evaluation) {
                 $evaluations[] = $temp_evaluation;
             }
         }
     }
     return $evaluations;
 }
コード例 #2
0
     }
 }
 $query = "\tSELECT a.*, c.`eprogress_id`, e.`target_title`, c.`etarget_id`, b.`eevaluator_id`, e.`target_shortname`\n\t\t\t\t\t\tFROM `evaluations` AS a\n\t\t\t\t\t\tLEFT JOIN `evaluation_evaluators` AS b\n\t\t\t\t\t\tON a.`evaluation_id` = b.`evaluation_id`\n\t\t\t\t\t\tLEFT JOIN `evaluation_progress` AS c\n\t\t\t\t\t\tON a.`evaluation_id` = c.`evaluation_id`\n\t\t\t\t\t\tAND c.`progress_value` = 'inprogress'\n\t\t\t\t\t\tAND c.`proxy_id` = " . $db->qstr($ENTRADA_USER->getID()) . "\n\t\t\t\t\t\tLEFT JOIN `evaluation_responses` AS cr\n\t\t\t\t\t\tON c.`eprogress_id` = cr.`eprogress_id`\n\t\t\t\t\t\tLEFT JOIN `evaluation_targets` AS d\n\t\t\t\t\t\tON a.`evaluation_id` = d.`evaluation_id`\n\t\t\t\t\t\tLEFT JOIN `evaluation_forms` AS ef\n\t\t\t\t\t\tON a.`eform_id` = ef.`eform_id`\n\t\t\t\t\t\tLEFT JOIN `evaluations_lu_targets` AS e\n\t\t\t\t\t\tON ef.`target_id` = e.`target_id`\n\t\t\t\t\t\tWHERE a.`evaluation_id` = " . $db->qstr($RECORD_ID) . "\n                        " . (defined("EVALUATION_LOCKOUT") && EVALUATION_LOCKOUT ? "AND a.`evaluation_finish` > " . $db->qstr(time() - EVALUATION_LOCKOUT) : "") . "\n\t\t\t\t\t\tAND \n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tb.`evaluator_type` = 'proxy_id'\n\t\t\t\t\t\t\t\tAND b.`evaluator_value` = " . $db->qstr($ENTRADA_USER->getID()) . "\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tb.`evaluator_type` = 'organisation_id'\n\t\t\t\t\t\t\t\tAND b.`evaluator_value` = " . $db->qstr($_SESSION["details"]["organisation_id"]) . "\n\t\t\t\t\t\t\t)" . (isset($cohort_ids_string) && $cohort_ids_string ? " OR (\n\t\t\t\t\t\t\t\tb.`evaluator_type` = 'cohort'\n\t\t\t\t\t\t\t\tAND b.`evaluator_value` IN (" . $cohort_ids_string . ")\n\t\t\t\t\t\t\t)" : "") . ($cgroup_ids_string ? " OR (\n\t\t\t\t\t\t\t\tb.`evaluator_type` = 'cgroup_id'\n\t\t\t\t\t\t\t\tAND b.`evaluator_value` IN (" . $cgroup_ids_string . ")\n\t\t\t\t\t\t\t)" : "") . "\n\t\t\t\t\t\t)\n\t\t\t\t\t\tAND a.`evaluation_active` = '1'\n\t\t\t\t\t\tGROUP BY cr.`eprogress_id`";
 $evaluation_record = $db->GetRow($query);
 if ($evaluation_record) {
     if ($evaluation_record["allow_target_request"] && !$evaluation_record["require_request_code"] && (!isset($evaluation_request) || !$evaluation_request)) {
         $evaluation_requests = Models_Evaluation::getEvaluationRequests($RECORD_ID, $ENTRADA_USER->getID());
         if ($evaluation_requests && count($evaluation_requests)) {
             $evaluation_request = $evaluation_requests[0];
         } elseif ($evaluation_record["require_requests"]) {
             $evaluation_record = NULL;
         }
     }
 }
 if ($evaluation_record) {
     $temp_evaluation_record = Models_Evaluation::getEvaluationDetails($evaluation_record, $ENTRADA_USER->getId());
     if ($temp_evaluation_record) {
         $evaluation_record = $temp_evaluation_record;
     }
     $PROCESSED = $evaluation_record;
     if (!isset($evaluation_record["completed_attempts"]) || !$evaluation_record["max_submittable"] || $evaluation_record["completed_attempts"] < $evaluation_record["max_submittable"]) {
         $BREADCRUMB[] = array("url" => ENTRADA_URL . "/" . $MODULE . "?section=attempt&id=" . $RECORD_ID, "title" => limit_chars($evaluation_record["evaluation_title"], 32));
         /**
          * Providing there is no release date, or the release date is in the past
          * on the evaluation, allow them to continue.
          */
         if ((int) $evaluation_record["release_date"] === 0 || $evaluation_record["release_date"] <= time()) {
             /**
              * Providing they can still still make attempts at this evaluation, allow them to continue.
              */
             if ((int) $evaluation_record["max_submittable"] === 0 || $evaluation_record["completed_attempts"] < $evaluation_record["max_submittable"]) {