Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27960
Modified Files:
lib.php view.php
Log Message:
grade table is now groups aware
Index: lib.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** lib.php 2 Mar 2004 21:11:51 -0000 1.52
--- lib.php 6 Mar 2004 14:06:52 -0000 1.53
***************
*** 781,785 ****
}
! function math_assignment_get_grades($math_assignment, $sort="lastname", $sortdir="asc") {
// returns an array of grades indexed by userid for all students in the course
--- 781,785 ----
}
! function math_assignment_get_grades($math_assignment, $sort="lastname", $sortdir="asc", $groupmode=false, $currentgroup=0) {
// returns an array of grades indexed by userid for all students in the course
***************
*** 799,802 ****
--- 799,805 ----
if ($studentlist) {
foreach ($studentlist as $student) {
+ if ($groupmode and $currentgroup and !ismember($currentgroup, $student->userid)) {
+ continue;
+ }
if ($students[$student->userid] = get_record('user', 'id', $student->userid, 'deleted', 0)) {
$key = $student->userid;
Index: view.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** view.php 2 Mar 2004 21:11:51 -0000 1.30
--- view.php 6 Mar 2004 14:06:52 -0000 1.31
***************
*** 14,17 ****
--- 14,18 ----
optional_variable($sortdir, "asc"); // direction to sort
optional_variable($showgrades, NULL); // whether to show grades table
+ optional_variable($group, -1); // choose the current group
if (! $site = get_site()) {
***************
*** 66,69 ****
--- 67,82 ----
error("This assignment should not be visible");
}
+
+ // Check to see if groups are being used in this assignment
+ // and if so, set $currentgroup to reflect the current group
+ $changegroup = isset($_GET['group']) ? $_GET['group'] : -1; // Group change requested?
+ $groupmode = groupmode($course, $cm); // Groups are being used
+ $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
+
+ if ($groupmode and ($currentgroup === false) and !isteacheredit($course->id)) {
+ print_heading(get_string("notingroup", "math_assignment"));
+ print_footer($course);
+ exit;
+ }
$hasaim = ($math_assignment->aimgrade > 0);
***************
*** 106,110 ****
// Get a list of students for this course including grades
$students = array();
! $students = math_assignment_get_grades($math_assignment, $sort, $sortdir);
if (!$students) {
print_header("$course->shortname: $math_assignment->name", "$course->fullname",
--- 119,123 ----
// Get a list of students for this course including grades
$students = array();
! $students = math_assignment_get_grades($math_assignment, $sort, $sortdir, $groupmode, $currentgroup);
if (!$students) {
print_header("$course->shortname: $math_assignment->name", "$course->fullname",
***************
*** 366,369 ****
--- 379,390 ----
if ($isteacher and $showgrades) {
+
+ if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
+ if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
+ echo '<td>';
+ print_group_menu($groups, $groupmode, $currentgroup, "view.php?id=$cm->id&showgrades=true");
+ echo '</td>';
+ }
+ }
if ($hasboth) {
|