Skip to content

Commit

Permalink
Merge branch 'MDL-27757-HEAD' of git://github.com/srynot4sale/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Jun 13, 2011
2 parents 89b2cdb + 7075e37 commit 355871a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/completionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,18 @@ public static function is_enabled_for_site() {
* 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;
Expand Down

0 comments on commit 355871a

Please sign in to comment.