From: nicolasconnault Date: Thu, 5 Apr 2007 07:58:15 +0000 (+0000) Subject: MDL-8537 Added $CFG as the object to check for enrol method when the course is being... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a937b164524d59643ab8079910589b75a024d9ca;p=moodle.git MDL-8537 Added $CFG as the object to check for enrol method when the course is being created. --- diff --git a/course/edit_form.php b/course/edit_form.php index 090c161143..ee4d3ab4e5 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -289,8 +289,13 @@ class course_edit_form extends moodleform { $mform->addElement('select', 'guest', get_string('opentoguests'), $choices); $mform->setHelpButton('guest', array('guestaccess', get_string('opentoguests')), true); $mform->setDefault('guest', 0); - - if (!empty($course) && method_exists(enrolment_factory::factory($course->enrol), 'print_entry') && $course->enrol != 'manual') { + + // If we are creating a course, its enrol method isn't yet chosen, BUT the site has a default enrol method which we can use here + $enrol_object = $CFG; + if (!empty($course)) { + $enrol_oject = $course; + } + if (method_exists(enrolment_factory::factory($enrol_object->enrol), 'print_entry') && $enrol_object->enrol != 'manual'){ $costgroup=array(); $currencies = get_list_of_currencies(); $costgroup[]= &MoodleQuickForm::createElement('text','cost', '', 'maxlength="6" size="6"'); @@ -400,4 +405,4 @@ class course_edit_form extends moodleform { } } } -?> \ No newline at end of file +?>