Index: lang/en_utf8/assignment.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lang/en_utf8/assignment.php,v
retrieving revision 1.14.2.11
diff -u -r1.14.2.11 assignment.php
--- lang/en_utf8/assignment.php 27 Feb 2008 05:05:01 -0000 1.14.2.11
+++ lang/en_utf8/assignment.php 10 Jan 2009 21:45:44 -0000
@@ -30,6 +30,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['deleteallsubmissions'] = 'Delete all submissions';
$string['deletefilefailed'] = 'Deleting of file failed.';
$string['description'] = 'Description';
Index: mod/assignment/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/assignment/lib.php,v
retrieving revision 1.277.2.46
diff -u -r1.277.2.46 lib.php
--- mod/assignment/lib.php 23 Sep 2008 07:46:53 -0000 1.277.2.46
+++ mod/assignment/lib.php 11 Jan 2009 16:36:44 -0000
@@ -297,9 +297,11 @@
} else {
$group = groups_get_activity_group($this->cm);
}
- if ($count = $this->count_real_submissions($group)) {
+ $count = new stdClass;
+ $count->needgrade = $this->count_real_submissions($group,true);
+ if ($count->total = $this->count_real_submissions($group)) {
$submitted = ''.
- get_string('viewsubmissions', 'assignment', $count).'';
+ get_string('countrealsubmissions', 'assignment', $count).'';
} else {
$submitted = ''.
get_string('noattempts', 'assignment').'';
@@ -1539,10 +1541,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 bool optional - count all submissions or ungraded only
* @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=false) {
+ return assignment_count_real_submissions($this->cm, $groupid, $countgraded);
}
/**
@@ -2688,9 +2691,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 bool optional - count all submissions or ungraded only
* @return int The number of submissions
*/
-function assignment_count_real_submissions($cm, $groupid=0) {
+function assignment_count_real_submissions($cm, $groupid=0, $countungraded=false) {
global $CFG;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -2713,11 +2717,15 @@
$userlists = implode(',', $users);
+ $condition = 'timemodified > 0';
+ if($countungraded) {
+ $condition = 'timemarked < timemodified';
+ }
+
return count_records_sql("SELECT COUNT('x')
- FROM {$CFG->prefix}assignment_submissions
- WHERE assignment = $cm->instance AND
- timemodified > 0 AND
- userid IN ($userlists)");
+ FROM {$CFG->prefix}assignment_submissions
+ WHERE assignment = $cm->instance AND ". $condition .
+ " AND userid IN ($userlists)");
}