diff --git a/mod/choice/lib.php b/mod/choice/lib.php new file mode 100644 index 00000000000..a459beb6842 --- /dev/null +++ b/mod/choice/lib.php @@ -0,0 +1,39 @@ +id' AND user='$user->id'")) { + if ($current->answer == "1") { + $result->info = "'$choice->answer1'"; + } else if ($current->answer == "2") { + $result->info = "'$choice->answer2'"; + } + $result->time = $current->timemodified; + return $result; + } + return NULL; +} + + +function choice_user_complete($course, $user, $mod, $choice) { + if ($current = get_record_sql("SELECT * FROM choice_answers + WHERE choice='$choice->id' AND user='$user->id'")) { + if ($current->answer == "1") { + $result->info = "'$choice->answer1'"; + } else if ($current->answer == "2") { + $result->info = "'$choice->answer2'"; + } + $result->time = $current->timemodified; + echo "Answered: $result->info , last updated ".userdate($result->time); + } else { + echo "Not answered yet"; + } +} + +?> + diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 503b7db9022..e8ff32a7698 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1,7 +1,7 @@ dirroot/mod/discuss/lib.php"); +include_once("$CFG->dirroot/mod/discuss/lib.php"); // These are non-special forum types ie the ones that aren't automatically created $FORUM_TYPE = array ("general" => "General Forum", diff --git a/mod/journal/lib.php b/mod/journal/lib.php index 839c98d509e..09a7c087a36 100644 --- a/mod/journal/lib.php +++ b/mod/journal/lib.php @@ -4,4 +4,69 @@ $RATING = array ("3" => "Outstanding", "2" => "Satisfactory", "1" => "Not satisfactory"); + +function journal_user_summary($course, $user, $mod, $journal) { + global $CFG; +} + + +function journal_user_outline($course, $user, $mod, $journal) { + if ($entry = get_record_sql("SELECT * FROM journal_entries + WHERE user='$user->id' AND journal='$journal->id'")) { + + $numwords = count(preg_split("/\w\b/", $entry->text)) - 1; + + $result->info = "$numwords words"; + $result->time = $entry->modified; + return $result; + } + return NULL; +} + + +function journal_user_complete($course, $user, $mod, $journal) { + global $CFG, $THEME; + + if ($entry = get_record_sql("SELECT * FROM journal_entries + WHERE user='$user->id' AND journal='$journal->id'")) { + + print_simple_box_start(); + if ($entry->modified) { + echo "
Last edited: ".userdate($entry->modified)."
"; + } + if ($entry->text) { + echo text_to_html($entry->text); + } + if ($entry->teacher) { + $teacher = get_record("user", "id", $entry->teacher); + + echo "\n| "; + print_user_picture($entry->teacher, $course->id, $teacher->picture); + echo " | cellheading\">".$RATING[$entry->rating];
+ if ($entry->timemarked) {
+ echo " ".userdate($entry->timemarked)."";
+ }
+ echo " "; + if ($RATING[$entry->rating]) { + echo "Overall rating: "; + echo $RATING[$entry->rating]; + } else { + echo "No rating given"; + } + echo " "; + + echo ""; + echo text_to_html($entry->comment); + echo " "; + echo " |
Last edited: ".userdate($entry->modified)."
"; - } - if ($entry->text) { - echo text_to_html($entry->text); - } - if ($entry->teacher) { - $teacher = get_record("user", "id", $entry->teacher); - - echo "\n| "; - print_user_picture($entry->teacher, $course->id, $teacher->picture); - echo " | cellheading\">".$RATING[$entry->rating];
- if ($entry->timemarked) {
- echo " ".userdate($entry->timemarked)."";
- }
- echo " "; - if ($RATING[$entry->rating]) { - echo "Overall rating: "; - echo $RATING[$entry->rating]; - } else { - echo "No rating given"; - } - echo " "; - - echo ""; - echo text_to_html($entry->comment); - echo " "; - echo " |