MDL-61444 question: freeze element for users without caps

This commit is contained in:
Simey Lameze 2018-02-22 09:44:15 +08:00
parent e2795e8632
commit 4509be2296

View File

@ -201,13 +201,16 @@ abstract class question_edit_form extends question_wizard_form {
// Any questiontype specific fields.
$this->definition_inner($mform);
if (core_tag_tag::is_enabled('core_question', 'question')
&& question_has_capability_on($this->question, 'tag')) {
if (core_tag_tag::is_enabled('core_question', 'question')) {
$mform->addElement('header', 'tagsheader', get_string('tags'));
}
$mform->addElement('tags', 'tags', get_string('tags'),
$mform->addElement('tags', 'tags', get_string('tags'),
array('itemtype' => 'question', 'component' => 'core_question'));
if (!question_has_capability_on($this->question, 'tag')) {
$mform->freeze('tags');
}
}
if (!empty($this->question->id)) {
$mform->addElement('header', 'createdmodifiedheader',
get_string('createdmodifiedheader', 'question'));