MDL-30724 mod_assignment: Minor fixes during integration

This commit is contained in:
Sam Hemelryk 2012-03-05 16:09:35 +13:00
parent 0c0ae1c696
commit ec5a34443c
3 changed files with 6 additions and 8 deletions

View file

@ -3490,18 +3490,18 @@ function assignment_count_real_submissions($cm, $groupid=0) {
global $CFG, $DB; global $CFG, $DB;
// Grab the assignment type for the given course module // Grab the assignment type for the given course module
$assignmenttype = $DB->get_field($cm->modname, 'assignmenttype', array('id' => $cm->instance)); $assignmenttype = $DB->get_field($cm->modname, 'assignmenttype', array('id' => $cm->instance), MUST_EXIST);
// Create the expected class file path and class name for the returned assignemnt type // Create the expected class file path and class name for the returned assignemnt type
$filename = "{$CFG->dirroot}/mod/assignment/type/{$assignmenttype}/assignment.class.php"; $filename = "{$CFG->dirroot}/mod/assignment/type/{$assignmenttype}/assignment.class.php";
$classname = "assignment_{$assignmenttype}"; $classname = "assignment_{$assignmenttype}";
// If the file exists and the class is not already loaded we require the class file // If the file exists and the class is not already loaded we require the class file
if (file_exists($file) && !class_exists($class)) { if (file_exists($filename) && !class_exists($classname)) {
require_once($file); require_once($filename);
} }
// If the required class is still not loaded then we revert to assignment base // If the required class is still not loaded then we revert to assignment base
if (!class_exists($class)) { if (!class_exists($classname)) {
$classname = 'assignment_base'; $classname = 'assignment_base';
} }
$instance = new $classname; $instance = new $classname;

View file

@ -405,7 +405,6 @@ class assignment_upload extends assignment_base {
* @return int The number of submissions * @return int The number of submissions
*/ */
function count_real_submissions($groupid=0) { function count_real_submissions($groupid=0) {
global $CFG;
global $DB; global $DB;
// Grab the context assocated with our course module // Grab the context assocated with our course module

View file

@ -111,7 +111,6 @@ class assignment_uploadsingle extends assignment_base {
* @return int The number of submissions * @return int The number of submissions
*/ */
function count_real_submissions($groupid=0) { function count_real_submissions($groupid=0) {
global $CFG;
global $DB; global $DB;
// Grab the context assocated with our course module // Grab the context assocated with our course module