From a0f2d25ccd33ebbbc8feb3213967e31490319a3c Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Thu, 30 Jul 2015 11:16:31 +0800 Subject: [PATCH 1/2] MDL-50391 format_singleactivity: fix activity_has_subtypes() --- course/format/singleactivity/lib.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/course/format/singleactivity/lib.php b/course/format/singleactivity/lib.php index 4c9289b1acf..65cd546dc8f 100644 --- a/course/format/singleactivity/lib.php +++ b/course/format/singleactivity/lib.php @@ -338,16 +338,10 @@ class format_singleactivity extends format_base { * @return bool|null (null if the check is not possible) */ public function activity_has_subtypes() { - global $CFG; if (!($modname = $this->get_activitytype())) { return null; } - $libfile = "$CFG->dirroot/mod/$modname/lib.php"; - if (!file_exists($libfile)) { - return null; - } - include_once($libfile); - return function_exists($modname. '_get_types'); + return component_callback('mod_' . $modname, 'get_types', array(), MOD_SUBTYPE_NO_CHILDREN) !== MOD_SUBTYPE_NO_CHILDREN; } /** From 7ae86a915c0e8a69d6d12d35eaf55d50de4ef835 Mon Sep 17 00:00:00 2001 From: Alistair Spark Date: Tue, 11 Aug 2015 10:13:48 +0100 Subject: [PATCH 2/2] MDL-50391 format_singleactivity: fix LTI Tool opens in existing window --- mod/lti/mod_form.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index 3652b475787..1df25e30fa4 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -75,10 +75,12 @@ class mod_lti_mod_form extends moodleform_mod { $mform->setAdvanced('introeditor'); // Display the label to the right of the checkbox so it looks better & matches rest of the form. - $coursedesc = $mform->getElement('showdescription'); - if (!empty($coursedesc)) { - $coursedesc->setText(' ' . $coursedesc->getLabel()); - $coursedesc->setLabel(' '); + if ($mform->elementExists('showdescription')) { + $coursedesc = $mform->getElement('showdescription'); + if (!empty($coursedesc)) { + $coursedesc->setText(' ' . $coursedesc->getLabel()); + $coursedesc->setLabel(' '); + } } $mform->setAdvanced('showdescription');