Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-27757 lib/completionlib.php: Load "enablecompletion" property if …

…required
  • Loading branch information...
commit 7075e37e0cd9590b3ef97f73b8e16c2e44794848 1 parent 6911fa1
@srynot4sale srynot4sale authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/completionlib.php
View
7 lib/completionlib.php
@@ -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;

0 comments on commit 7075e37

Please sign in to comment.
Something went wrong with that request. Please try again.