From 821c604e826b30d6421622dfd55bc6bf33e97f8a Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 8 Oct 2008 13:40:26 +0000 Subject: [PATCH] MDL-15262 Instead of removing these form fields entirely, rendering them as static form elements --- course/edit_form.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/course/edit_form.php b/course/edit_form.php index 80375669aba..1626b652046 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -77,23 +77,31 @@ class course_edit_form extends moodleform { if (has_capability('moodle/course:changefullname', $coursecontext)) { $mform->addElement('text','fullname', get_string('fullname'),'maxlength="254" size="50"'); $mform->setHelpButton('fullname', array('coursefullname', get_string('fullname')), true); - $mform->setDefault('fullname', get_string('defaultcoursefullname')); $mform->addRule('fullname', get_string('missingfullname'), 'required', null, 'client'); $mform->setType('fullname', PARAM_MULTILANG); + } else { + $mform->addElement('static','fullname', get_string('fullname'), get_string('defaultcoursefullname')); } + $mform->setDefault('fullname', get_string('defaultcoursefullname')); + if (has_capability('moodle/course:changeshortname', $coursecontext)) { $mform->addElement('text','shortname', get_string('shortname'),'maxlength="100" size="20"'); $mform->setHelpButton('shortname', array('courseshortname', get_string('shortname')), true); - $mform->setDefault('shortname', get_string('defaultcourseshortname')); $mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client'); $mform->setType('shortname', PARAM_MULTILANG); + } else { + $mform->addElement('static','shortname', get_string('shortname'), get_string('defaultcourseshortname')); } + $mform->setDefault('shortname', get_string('defaultcourseshortname')); + if (has_capability('moodle/course:changeidnumber', $coursecontext)) { $mform->addElement('text','idnumber', get_string('idnumbercourse'),'maxlength="100" size="10"'); $mform->setHelpButton('idnumber', array('courseidnumber', get_string('idnumbercourse')), true); $mform->setType('idnumber', PARAM_RAW); + } else { + $mform->addElement('static','idnumber', get_string('idnumber')); } $mform->addElement('htmleditor','summary', get_string('summary'), array('rows'=> '10', 'cols'=>'65'));