From: martin Date: Sun, 4 Aug 2002 17:13:49 +0000 (+0000) Subject: Fixes in display of standard user_complete and user_outline functions X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=77db7e4c4929b497b31951222270abd7072a77db;p=moodle.git Fixes in display of standard user_complete and user_outline functions for journal, forum and assignments --- diff --git a/lang/en/assignment.php b/lang/en/assignment.php index bc2bfa9b9a..d553cb9628 100644 --- a/lang/en/assignment.php +++ b/lang/en/assignment.php @@ -9,13 +9,14 @@ $string[modulenameplural] = "Assignments"; $string[assignmentdetails] = "Assignment details"; $string[duedate] = "Assignment due"; $string[early] = "\$a early"; +$string[failedupdatefeedback] = "Failed to update submission feedback for user \$a"; +$string[feedbackupdated] = "Submissions feedback updated for \$a people"; $string[late] = "\$a late"; $string[notsubmittedyet] = "Not submitted yet"; $string[overwritewarning] = "Warning: uploading again will REPLACE your current submission"; $string[submissionfeedback] = "Submission feedback"; $string[submissions] = "Submissions"; -$string[failedupdatefeedback] = "Failed to update submission feedback for user \$a"; -$string[feedbackupdated] = "Submissions feedback updated for \$a people"; +$string[uploadedfiles] = "uploaded files"; $string[viewsubmissions] = "View \$a submitted assignments"; $string[yoursubmission] = "Your submission"; diff --git a/lang/en/journal.php b/lang/en/journal.php index dc0e7ca00c..f4a86af23f 100644 --- a/lang/en/journal.php +++ b/lang/en/journal.php @@ -5,4 +5,7 @@ $string[modulename] = "Journal"; $string[modulenameplural] = "Journals"; #------------------------------------------------------------ + +$string[noentry] = "No entry"; + ?> diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index e5e23c9f27..c76198b464 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -55,6 +55,55 @@ function assignment_delete_instance($id) { return $result; } +function assignment_user_outline($course, $user, $mod, $assignment) { + if ($submission = assignment_get_submission($assignment, $user)) { + if ($basedir = assignment_file_area($assignment, $user)) { + if ($files = get_directory_list($basedir)) { + $countfiles = count($files)." ".get_string("uploadedfiles", "assignment"); + foreach ($files as $file) { + $countfiles .= "; $file"; + } + } + } + $result->info = $countfiles; + $result->time = $submission->timemodified; + return $result; + } + return NULL; +} + +function assignment_user_complete($course, $user, $mod, $assignment) { + if ($submission = assignment_get_submission($assignment, $user)) { + if ($basedir = assignment_file_area($assignment, $user)) { + if ($files = get_directory_list($basedir)) { + $countfiles = count($files)." ".get_string("uploadedfiles", "assignment"); + foreach ($files as $file) { + $countfiles .= "; $file"; + } + } + } + + print_simple_box_start(); + echo "

"; + echo get_string("lastmodified").": "; + echo userdate($submission->timemodified); + echo assignment_print_difference($assignment->timedue - $submission->timemodified); + echo "

"; + + assignment_print_user_files($assignment, $user); + + echo "
"; + + assignment_print_feedback($course, $submission); + + print_simple_box_end(); + + } else { + print_string("notsubmittedyet", "assignment"); + } +} + + function assignment_cron () { // Function to be run periodically according to the moodle cron // Finds all assignment notifications that have yet to be mailed out, and mails them diff --git a/mod/forum/lib.php b/mod/forum/lib.php index f18c16d15a..2c873f4e11 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -494,7 +494,7 @@ function forum_user_complete($course, $user, $mod, $forum) { $footer = ""; } - print_post($post, $course->id, $ownpost=false, $reply=false, $link=false, $rate=false, $footer); + forum_print_post($post, $course->id, $ownpost=false, $reply=false, $link=false, $rate=false, $footer); } } else { diff --git a/mod/journal/lib.php b/mod/journal/lib.php index b866262904..13755b7b51 100644 --- a/mod/journal/lib.php +++ b/mod/journal/lib.php @@ -25,7 +25,6 @@ function journal_user_outline($course, $user, $mod, $journal) { 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'")) { @@ -38,34 +37,12 @@ function journal_user_complete($course, $user, $mod, $journal) { echo text_to_html($entry->text); } if ($entry->teacher) { - $teacher = get_record("user", "id", $entry->teacher); - - echo "\n
"; - echo ""; - echo "
"; - 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 "
"; + journal_print_feedback($course, $entry); } print_simple_box_end(); } else { - echo "No entry"; + print_string("noentry", "journal"); } }