From: moodler Date: Thu, 13 May 2004 08:57:39 +0000 (+0000) Subject: Fix for Bug 1383. Added support for the Critical Incident Survey type in the Complete... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b6b3deb48cc0eb3efd11d4cbb9154363b057173c;p=moodle.git Fix for Bug 1383. Added support for the Critical Incident Survey type in the Complete Activity Reports (Shane Elliott) --- diff --git a/mod/survey/lib.php b/mod/survey/lib.php index d5e641198f..ee96418a70 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -14,6 +14,14 @@ $SURVEY_QTYPE = array ( "3" => "Actual and Preferred", ); + +define("SURVEY_COLLES_ACTUAL", "1"); +define("SURVEY_COLLES_PREFERRED", "2"); +define("SURVEY_COLLES_PREFERRED_ACTUAL", "3"); +define("SURVEY_ATTLS", "4"); +define("SURVEY_CIQ", "5"); + + // STANDARD FUNCTIONS //////////////////////////////////////////////////////// function survey_add_instance($survey) { @@ -94,7 +102,31 @@ function survey_user_complete($course, $user, $mod, $survey) { global $CFG; if (survey_already_done($survey->id, $user->id)) { - survey_print_graph("id=$mod->id&sid=$user->id&type=student.png"); + if ($survey->template == SURVEY_CIQ) { // print out answers for critical incidents + $table = NULL; + $table->align = array("left", "left"); + + $questions = get_records_list("survey_questions", "id", $survey->questions); + $questionorder = explode(",", $survey->questions); + + foreach ($questionorder as $key=>$val) { + $question = $questions[$val]; + $questiontext = get_string($question->shorttext, "survey"); + + if ($answer = survey_get_user_answer($survey->id, $question->id, $user->id)) { + $answertext = "$answer->answer1"; + } else { + $answertext = "No answer"; + } + $table->data[] = array("$questiontext", $answertext); + } + print_table($table); + + } else { + + survey_print_graph("id=$mod->id&sid=$user->id&type=student.png"); + } + } else { print_string("notdone", "survey"); }