Skip to content
Browse files

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

…required
  • Loading branch information...
1 parent 57e034c commit 4754c0edd14f007c5bf498351f4fd0858d93b257 @srynot4sale srynot4sale committed Jun 10, 2011
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 4754c0e

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