Skip to content

Commit

Permalink
Reaaranged the functions into standard and other
Browse files Browse the repository at this point in the history
  • Loading branch information
martin committed Sep 22, 2002
1 parent 7bca795 commit 66ea15f
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions mod/survey/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"3" => "Actual and Preferred",
);

// FUNCTIONS ////////////////////////////////////////////////////////
// STANDARD FUNCTIONS ////////////////////////////////////////////////////////

function survey_add_instance($survey) {
// Given an object containing all the necessary data,
Expand Down Expand Up @@ -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 "<IMG SRC=\"$CFG->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;

Expand Down Expand Up @@ -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'");
}
Expand Down Expand Up @@ -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 "<IMG SRC=\"$CFG->wwwroot/mod/survey/graph.php?id=$mod->id&sid=$user->id&type=student.png\">";
} else {
print_string("notdone", "survey");
}
}


function survey_print_multi($question) {
Expand Down

0 comments on commit 66ea15f

Please sign in to comment.