Index: lang/en_utf8/assignment.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/assignment.php,v
retrieving revision 1.30
diff -u -r1.30 assignment.php
--- lang/en_utf8/assignment.php 9 Sep 2008 21:06:19 -0000 1.30
+++ lang/en_utf8/assignment.php 11 Jan 2009 15:43:12 -0000
@@ -34,6 +34,7 @@
$string['configmaxbytes'] = 'Default maximum assignment size for all assignments on the site (subject to course limits and other local settings)';
$string['configshowrecentsubmissions'] = 'Everyone can see notifications of submissions in recent activity reports.';
$string['confirmdeletefile'] = 'Are you absolutely sure you want to delete this file?
$a';
+$string['countrealsubmissions'] = '$a->needgrade of $a->total submissions await grading';
$string['coursemisconf'] = 'Course is misconfigured';
$string['deleteallsubmissions'] = 'Delete all submissions';
$string['deletefilefailed'] = 'Deleting of file failed.';
Index: mod/assignment/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/assignment/lib.php,v
retrieving revision 1.373
diff -u -r1.373 lib.php
--- mod/assignment/lib.php 3 Jan 2009 13:16:59 -0000 1.373
+++ mod/assignment/lib.php 11 Jan 2009 16:33:18 -0000
@@ -304,9 +304,11 @@
} else {
$group = groups_get_activity_group($this->cm);
}
- if ($count = $this->count_real_submissions($group)) {
+ $count = new stdClass;
+ $count->needgrade = 0;
+ if ($count->total = $this->count_real_submissions($group,&$count->needgrade)) {
$submitted = ''.
- get_string('viewsubmissions', 'assignment', $count).'';
+ get_string('countrealsubmissions', 'assignment', $count).'';
} else {
$submitted = ''.
get_string('noattempts', 'assignment').'';
@@ -1542,10 +1544,11 @@
* Counts all real assignment submissions by ENROLLED students (not empty ones)
*
* @param $groupid int optional If nonzero then count is restricted to this group
+ * @param $countungraded int optional - reference to place count of ungraded assignments
* @return int The number of submissions
*/
- function count_real_submissions($groupid=0) {
- return assignment_count_real_submissions($this->cm, $groupid);
+ function count_real_submissions($groupid=0, &$countgraded=null) {
+ return assignment_count_real_submissions($this->cm, $groupid, &$countgraded);
}
/**
@@ -2767,9 +2770,10 @@
* There are also assignment type methods count_real_submissions() wich in the default
* implementation simply call this function.
* @param $groupid int optional If nonzero then count is restricted to this group
+ * @param $countungraded int optional - reference to place count of ungraded assignments
* @return int The number of submissions
*/
-function assignment_count_real_submissions($cm, $groupid=0) {
+function assignment_count_real_submissions($cm, $groupid=0, &$countungraded=null) {
global $CFG, $DB;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -2792,6 +2796,14 @@
$userlists = implode(',', $users);
+ if($countungraded!==null) {
+ $countungraded = $DB->count_records_sql("SELECT COUNT('x')
+ FROM assignment_submissions
+ WHERE assignment = ? AND
+ timemarked < timemodified AND
+ userid IN ($userlists)", array($cm->instance));
+ }
+
return $DB->count_records_sql("SELECT COUNT('x')
FROM {assignment_submissions}
WHERE assignment = ? AND