From 98092498383c673aa89343e28d030ea094f93851 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 17 Oct 2002 08:28:18 +0000 Subject: [PATCH] Better grade reports --- course/grades.php | 109 ----------------------------------------- lang/en/moodle.php | 2 + mod/assignment/lib.php | 11 ++--- mod/quiz/lib.php | 9 ++++ pix/i/grades.gif | Bin 88 -> 0 bytes 5 files changed, 14 insertions(+), 117 deletions(-) delete mode 100644 course/grades.php delete mode 100755 pix/i/grades.gif diff --git a/course/grades.php b/course/grades.php deleted file mode 100644 index 3242f9458e..0000000000 --- a/course/grades.php +++ /dev/null @@ -1,109 +0,0 @@ -id); - - if (!isteacher($course->id)) { - error("Only teachers can use this page!"); - } - - $strgrades = get_string("grades"); - $strgrade = get_string("grade"); - $strmax = get_string("maximumshort"); - - -/// Otherwise fill and print the form. - - print_header("$course->shortname: $strgrades", "$course->fullname", - "wwwroot/course/view.php?id=$course->id\">$course->shortname - -> $strgrades"); - - print_heading($strgrades); - - if (!$students = get_course_students($course->id)) { - print_heading(get_string("nostudentsyet")); - print_footer($course); - exit; - } - - foreach ($students as $student) { - $grades[$student->id] = array(); // Collect all grades in this array - } - $columns = array(); // Accumulate column names in this array. - - // Collect module data - get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts); - - $sections = get_all_sections($course->id); // Sort everything the same as the course - for ($i=0; $i<=$course->numsections; $i++) { - if (isset($sections[$i])) { // should always be true - $section = $sections[$i]; - if ($section->sequence) { - $sectionmods = explode(",", $section->sequence); - foreach ($sectionmods as $sectionmod) { - $mod = $mods[$sectionmod]; - $instance = get_record("$mod->modname", "id", "$mod->instance"); - $libfile = "$CFG->dirroot/mod/$mod->modname/lib.php"; - if (file_exists($libfile)) { - require_once($libfile); - $gradefunction = $mod->modname."_grades"; - if (function_exists($gradefunction)) { // Skip modules without grade function - $modgrades = $gradefunction($mod->instance); - - if ($modgrades->maxgrade) { - $maxgrade = "
$strmax: $modgrades->maxgrade"; - } else { - $maxgrade = ""; - } - - $image = "wwwroot/mod/$mod->modname/view.php?id=$mod->id\"". - " TITLE=\"$mod->modfullname\">". - "modname/icon.gif\" ". - "HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">"; - $columns[] = "$image ". - "wwwroot/mod/$mod->modname/view.php?id=$mod->id\">". - "$instance->name". - "$maxgrade"; - - foreach ($students as $student) { - $grades[$student->id][] = $modgrades->grades[$student->id]; // may be empty, that's ok - } - } - } - } - } - } - } // a new Moodle nesting record? ;-) - - $table->head = array ("", get_string("name")); - $table->head = array_merge($table->head, $columns); - $table->width = array(35, ""); - $table->align = array("LEFT", "LEFT"); - foreach ($columns as $column) { - $table->width[] = ""; - $table->align[] = "CENTER"; - } - - foreach ($grades as $studentid => $gradelist) { - $student = $students[$studentid]; - $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); - $name = array ("$picture", "$student->firstname $student->lastname"); - - - $table->data[] = array_merge($name, $gradelist); - } - - print_table($table); - - print_footer($course); - -?> diff --git a/lang/en/moodle.php b/lang/en/moodle.php index d15dd839ab..e5c29fce90 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -29,6 +29,7 @@ $string['allparticipants'] = "All participants"; $string['alphanumerical'] = "Can only contain alphabetical letters or numbers"; $string['alreadyconfirmed'] = "Registration has already been confirmed"; $string['answer'] = "Answer"; +$string['assessment'] = "Assessment"; $string['assignteachers'] = "Assign teachers"; $string['availablecourses'] = "Available Courses"; $string['cancel'] = "Cancel"; @@ -442,6 +443,7 @@ $string['topic'] = "Topic"; $string['topicoutline'] = "Topic outline"; $string['turneditingoff'] = "Turn editing off"; $string['turneditingon'] = "Turn editing on"; +$string['total'] = "Total"; $string['undecided'] = "Undecided"; $string['unenrol'] = "Unenrol"; $string['unenrolme'] = "Unenrol me from \$a"; diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 787142e998..14f798bfac 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -57,15 +57,10 @@ function assignment_delete_instance($id) { 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"; - } - } + + if ($submission->grade) { + $result->info = get_string("grade").": $submission->grade"; } - $result->info = $countfiles; $result->time = $submission->timemodified; return $result; } diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index f2fce6515c..a6e25e8cff 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -153,6 +153,15 @@ function quiz_user_outline($course, $user, $mod, $quiz) { /// Used for user activity reports. /// $return->time = the time they did it /// $return->info = a short text description + if ($grade = get_record_sql("SELECT * FROM quiz_grades WHERE user = '$user->id' AND quiz = '$quiz->id'")) { + + if ($grade->grade) { + $result->info = get_string("grade").": $grade->grade"; + } + $result->time = $grade->timemodified; + return $result; + } + return NULL; return $return; } diff --git a/pix/i/grades.gif b/pix/i/grades.gif deleted file mode 100755 index 355e73458612551323aa89595d6a61fcca2fb838..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 88 zcmZ?wbhEHb6krfwn8?5&{~ieC|NsBbz`&pb#6VF21_ma>DgBv;-`29tnB-^h=yv7Z pF4iRVg6J=uj2^T2vjVeTJH_?XM%`Vuc;ADs1v+k?Gc*|(tO4f2AMXGF -- 2.39.5