示例#1
0
 $evaluation_progress_array = array("progress_value" => "complete", "evaluation_id" => $evaluation_record["evaluation_id"], "etarget_id" => $PROCESSED["etarget_id"], "target_record_id" => isset($PROCESSED["target_record_id"]) && $PROCESSED["target_record_id"] ? $PROCESSED["target_record_id"] : 0, "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID());
 if ($db->AutoExecute("evaluation_progress", $evaluation_progress_array, "UPDATE", "eprogress_id = " . $db->qstr($eprogress_id))) {
     $query = "UPDATE `evaluations` SET `evaluation_completions` = (`evaluation_completions` + 1) WHERE `evaluation_id` = " . $db->qstr($evaluation_record["evaluation_id"]);
     if (!$db->Execute($query)) {
         application_log("error", "Unable to increment evaluation [" . $progress_record["evaluation_id"] . "] completions by one upon a completed attempt being submitted by a user [" . $ENTRADA_USER->getID() . "]. Database said: " . $db->ErrorMsg());
     }
     if (isset($evaluation_request) && $evaluation_request && !$db->AutoExecute("evaluation_requests", array("request_fulfilled" => 1), "UPDATE", "`erequest_id` = " . $db->qstr($evaluation_request["erequest_id"]))) {
         application_log("error", "Unable to mark evaluation request as completed [" . $progress_record["evaluation_id"] . "]. Database said: " . $db->ErrorMsg());
     }
     if ($evaluation_record["threshold_notifications_type"] != "disabled") {
         $is_below_threshold = Models_Evaluation::responsesBelowThreshold($evaluation_record["evaluation_id"], $eprogress_id);
         if ($is_below_threshold) {
             if (defined("NOTIFICATIONS_ACTIVE") && NOTIFICATIONS_ACTIVE) {
                 require_once "Models/notifications/NotificationUser.class.php";
                 require_once "Models/notifications/Notification.class.php";
                 $threshold_notification_recipients = Models_Evaluation::getThresholdNotificationRecipients($evaluation_record["evaluation_id"], $eprogress_id, $PROCESSED["eevaluator_id"]);
                 if (isset($threshold_notification_recipients) && $threshold_notification_recipients) {
                     foreach ($threshold_notification_recipients as $threshold_notification_recipient) {
                         $notification_user = NotificationUser::get($threshold_notification_recipient["proxy_id"], "evaluation_threshold", $evaluation_record["evaluation_id"], $ENTRADA_USER->getID());
                         if (!$notification_user) {
                             $notification_user = NotificationUser::add($threshold_notification_recipient["proxy_id"], "evaluation_threshold", $evaluation_record["evaluation_id"], $ENTRADA_USER->getID());
                         }
                         Notification::add($notification_user->getID(), $ENTRADA_USER->getID(), $eprogress_id);
                     }
                 }
             }
         }
     }
     if (array_search($PROCESSED["target_shortname"], array("preceptor", "rotation_core", "rotation_elective")) !== false) {
         if (!$db->AutoExecute("evaluation_progress_clerkship_events", $PROCESSED_CLERKSHIP_EVENT, "INSERT")) {
             $db->Execute("UPDATE `evaluation_progress` SET `progress_value` = 'inprogress' WHERE `eprogress_id` = " . $db->qstr($PROCESSED["eprogress_id"]));