Skip to content
Snippets Groups Projects
Commit 5c8e9567 authored by Isabel Uffinger's avatar Isabel Uffinger
Browse files

removed add remove answerfield button for students

parent 0f18e15e
No related branches found
No related tags found
No related merge requests found
...@@ -410,6 +410,8 @@ class qtype_moopt_renderer extends qtype_renderer { ...@@ -410,6 +410,8 @@ class qtype_moopt_renderer extends qtype_renderer {
$defaultproglang = $questionoptions->ftsstandardlang; $defaultproglang = $questionoptions->ftsstandardlang;
$fixedfilenames = false;
for ($i = 0; $i < (int)$questionoptions->ftsmaxnumfields; $i++) { for ($i = 0; $i < (int)$questionoptions->ftsmaxnumfields; $i++) {
$customoptions = $DB->get_record('qtype_moopt_freetexts', ['questionid' => $qa->get_question()->id, $customoptions = $DB->get_record('qtype_moopt_freetexts', ['questionid' => $qa->get_question()->id,
'inputindex' => $i]); 'inputindex' => $i]);
...@@ -451,6 +453,7 @@ class qtype_moopt_renderer extends qtype_renderer { ...@@ -451,6 +453,7 @@ class qtype_moopt_renderer extends qtype_renderer {
// readonly is used instead of disabled because the data in this field would not be submitted if it is disabled // readonly is used instead of disabled because the data in this field would not be submitted if it is disabled
$inputoptions['readonly'] = true; $inputoptions['readonly'] = true;
$inputoptions['style'] .= "color: grey;"; $inputoptions['style'] .= "color: grey;";
$fixedfilenames = true;
} }
// Adjust the height of the textarea based on the content of the textarea // Adjust the height of the textarea based on the content of the textarea
...@@ -476,12 +479,14 @@ class qtype_moopt_renderer extends qtype_renderer { ...@@ -476,12 +479,14 @@ class qtype_moopt_renderer extends qtype_renderer {
$PAGE->requires->js_call_amd('qtype_moopt/userinterfacewrapper', 'newUiWrapper', ['ace', $answertextid]); $PAGE->requires->js_call_amd('qtype_moopt/userinterfacewrapper', 'newUiWrapper', ['ace', $answertextid]);
} }
if(!($fixedfilenames && !has_capability('mod/quiz:grade', $PAGE->context))){
$renderedarea .= html_writer::start_div('', ['style' => 'display:flex;justify-content:flex-end;']); $renderedarea .= html_writer::start_div('', ['style' => 'display:flex;justify-content:flex-end;']);
$renderedarea .= html_writer::tag('button', get_string('addanswertext', 'qtype_moopt'), $renderedarea .= html_writer::tag('button', get_string('addanswertext', 'qtype_moopt'),
['id' => 'addAnswertextButton_' . $qa->get_question_id()]); ['id' => 'addAnswertextButton_' . $qa->get_question_id()]);
$renderedarea .= html_writer::tag('button', get_string('removelastanswertext', 'qtype_moopt'), $renderedarea .= html_writer::tag('button', get_string('removelastanswertext', 'qtype_moopt'),
['id' => 'removeLastAnswertextButton_' . $qa->get_question_id(), 'style' => 'margin-left: 10px']); ['id' => 'removeLastAnswertextButton_' . $qa->get_question_id(), 'style' => 'margin-left: 10px']);
$renderedarea .= html_writer::end_div(); $renderedarea .= html_writer::end_div();
}
$PAGE->requires->js_call_amd('qtype_moopt/manage_answer_texts', 'init', $PAGE->requires->js_call_amd('qtype_moopt/manage_answer_texts', 'init',
[(int)$questionoptions->ftsmaxnumfields, max($maxindexoffieldwithcontent, (int)$questionoptions->ftsnuminitialfields), $qa->get_question_id()]); [(int)$questionoptions->ftsmaxnumfields, max($maxindexoffieldwithcontent, (int)$questionoptions->ftsnuminitialfields), $qa->get_question_id()]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment