$evaluation_progress_array = array("updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()); if ($db->AutoExecute("evaluation_progress", $evaluation_progress_array, "UPDATE", "`eprogress_id` = " . $db->qstr($progress_record["eprogress_id"]))) { if (isset($_POST["qid"]) && ($tmp_input = clean_input($_POST["qid"], "int"))) { $qquestion_id = $tmp_input; if (isset($_POST["rid"]) && ($tmp_input = clean_input($_POST["rid"], "int"))) { $qqresponse_id = $tmp_input; } elseif (isset($_POST["comments"]) && clean_input($_POST["comments"], array("trim", "notags"))) { $qqresponse_id = 0; } if (isset($qqresponse_id)) { if (isset($_POST["comments"]) && clean_input($_POST["comments"], array("trim", "notags"))) { $comments = clean_input($_POST["comments"], array("trim", "notags")); } else { $comments = NULL; } if (evaluation_save_response($progress_record["eprogress_id"], $progress_record["eform_id"], $qquestion_id, $qqresponse_id, $comments)) { echo 200; exit; } else { /** * @exception 409: Unable to record a response to a question. */ echo 409; exit; } } else { application_log("error", "A rid variable was not provided when attempting to submit a response to a question with no comments attached."); /** * @exception 408: Quiz Question Response ID was not provided. */ echo 408;
} } if ($ERROR && empty($ERRORSTR)) { $ERRORSTR[] = "A problem was found storing a question response, please verify your responses and try again."; } } $query = "\tSELECT a.*, b.*\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM `evaluation_form_questions` AS a\n\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN `evaluations_lu_questions` AS b\n\t\t\t\t\t\t\t\t\t\t\t\t\tON a.`equestion_id` = b.`equestion_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE a.`eform_id` = " . $db->qstr($evaluation_record["eform_id"]) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND `questiontype_id` = (4)\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY a.`question_order` ASC"; $questions = $db->GetAll($query); if ($questions) { foreach ($questions as $question) { if (isset($_POST["comments"][$question["equestion_id"]]) && clean_input($_POST["comments"][$question["equestion_id"]], array("trim", "notags"))) { $comments = clean_input($_POST["comments"][$question["equestion_id"]], array("trim", "notags")); } else { $comments = NULL; } if (!evaluation_save_response($eprogress_id, $progress_record["eform_id"], $question["equestion_id"], 0, $comments)) { $ERROR++; $ERRORSTR[] = "A problem was found storing a question response, please verify your responses and try again."; $problem_questions[] = $question["equestion_id"]; } } } elseif (!$questions_found) { $ERROR++; $ERRORSTR[] = "An error occurred while attempting to save your evaluation responses. The system administrator has been notified of this error; please try again later."; application_log("error", "Unable to find any evaluation questions for evaluation_id [" . $progress_record["evaluation_id"] . "]. Database said: " . $db->ErrorMsg()); } /** * We can now safely say that all questions have valid responses * and that we have stored those responses evaluation_responses table. */ if (!$ERROR) {