Merge branch 'MDL-27757-20' of git://github.com/srynot4sale/moodle into MOODLE_20_STABLE

This commit is contained in:
Sam Hemelryk
2011-06-13 11:18:48 +08:00
+6 -1
View File
@@ -185,13 +185,18 @@ class completion_info {
* for a course-module.
*/
public function is_enabled($cm=null) {
global $CFG;
global $CFG, $DB;
// First check global completion
if (!isset($CFG->enablecompletion) || $CFG->enablecompletion == COMPLETION_DISABLED) {
return COMPLETION_DISABLED;
}
// Load data if we do not have enough
if (!isset($this->course->enablecompletion)) {
$this->course->enablecompletion = $DB->get_field('course', 'enablecompletion', array('id' => $this->course->id));
}
// Check course completion
if ($this->course->enablecompletion == COMPLETION_DISABLED) {
return COMPLETION_DISABLED;