From d030fa7b124583c32a44ecc022ea4e07110c91a4 Mon Sep 17 00:00:00 2001 From: sam_marshall Date: Thu, 2 Apr 2009 12:00:09 +0000 Subject: [PATCH] MDL-17810: Fix to stop you making activities depend on themselves --- course/moodleform_mod.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php index 74ece3fc97..3df6d54886 100644 --- a/course/moodleform_mod.php +++ b/course/moodleform_mod.php @@ -405,6 +405,12 @@ class moodleform_mod extends moodleform { $items=grade_item::fetch_all(array('courseid'=>$COURSE->id)); $items=$items ? $items : array(); foreach($items as $id=>$item) { + // Do not include grades for current item + if (!empty($this->_cm) && $this->_cm->instance == $item->iteminstance + && $this->_cm->modname == $item->itemmodule + && $item->itemtype == 'mod') { + continue; + } $gradeoptions[$id]=$item->get_name(); } asort($gradeoptions); @@ -442,7 +448,10 @@ class moodleform_mod extends moodleform { $completionoptions=array(); $modinfo=get_fast_modinfo($COURSE); foreach($modinfo->cms as $id=>$cm) { - if($cm->completion) { + // Add each course-module if it: + // (a) has completion turned on + // (b) is not the same as current course-module + if ($cm->completion && (empty($this->_cm) || $this->_cm->id != $id)) { $completionoptions[$id]=$cm->name; } } -- 2.39.5