From: martin Date: Sun, 22 Sep 2002 04:27:45 +0000 (+0000) Subject: Reaaranged the functions into standard and other X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=66ea15f3cc784c693a1cc145fa2a850071fead62;p=moodle.git Reaaranged the functions into standard and other --- diff --git a/mod/survey/lib.php b/mod/survey/lib.php index f1b981b7cb..b14c218c43 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -14,7 +14,7 @@ $SURVEY_QTYPE = array ( "3" => "Actual and Preferred", ); -// FUNCTIONS //////////////////////////////////////////////////////// +// STANDARD FUNCTIONS //////////////////////////////////////////////////////// function survey_add_instance($survey) { // Given an object containing all the necessary data, @@ -77,6 +77,29 @@ function survey_delete_instance($id) { return $result; } +function survey_user_outline($course, $user, $mod, $survey) { + if ($answers = get_records_sql("SELECT * FROM survey_answers WHERE survey='$survey->id' AND user='$user->id'")) { + + $lastanswer = array_pop($answers); + + $result->info = get_string("done", "survey"); + $result->time = $lastanswer->time; + return $result; + } + return NULL; +} + + +function survey_user_complete($course, $user, $mod, $survey) { + global $CFG; + + if (survey_already_done($survey->id, $user->id)) { + echo "wwwroot/mod/survey/graph.php?id=$mod->id&sid=$user->id&type=student.png\">"; + } else { + print_string("notdone", "survey"); + } +} + function survey_print_recent_activity(&$logs, $isteacher=false) { global $CFG, $COURSE_TEACHER_COLOR; @@ -108,6 +131,9 @@ function survey_print_recent_activity(&$logs, $isteacher=false) { return $content; } + +// MODULE FUNCTIONS //////////////////////////////////////////////////////// + function survey_already_done($survey, $user) { return record_exists_sql("SELECT * FROM survey_answers WHERE survey='$survey' AND user='$user'"); } @@ -189,33 +215,6 @@ function survey_shorten_name ($name, $numwords) { return $output; } -function survey_user_summary($course, $user, $mod, $survey) { - global $CFG; -} - - -function survey_user_outline($course, $user, $mod, $survey) { - if ($answers = get_records_sql("SELECT * FROM survey_answers WHERE survey='$survey->id' AND user='$user->id'")) { - - $lastanswer = array_pop($answers); - - $result->info = get_string("done", "survey"); - $result->time = $lastanswer->time; - return $result; - } - return NULL; -} - - -function survey_user_complete($course, $user, $mod, $survey) { - global $CFG; - - if (survey_already_done($survey->id, $user->id)) { - echo "wwwroot/mod/survey/graph.php?id=$mod->id&sid=$user->id&type=student.png\">"; - } else { - print_string("notdone", "survey"); - } -} function survey_print_multi($question) {