From d669c2075ab952fe5565b0e798264f4380620abd Mon Sep 17 00:00:00 2001 From: mkassaei Date: Tue, 28 Nov 2023 08:01:06 +0000 Subject: [PATCH] Matrix: column selection when they are legion #742237 --- edit_oumatrix_form.php | 13 +++++-------- styles.css | 12 +++--------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/edit_oumatrix_form.php b/edit_oumatrix_form.php index 9914d2c..1082ac7 100644 --- a/edit_oumatrix_form.php +++ b/edit_oumatrix_form.php @@ -172,15 +172,9 @@ protected function add_per_row_fields(MoodleQuickForm $mform, string $label) { protected function get_per_row_fields(MoodleQuickForm $mform, string $label, array &$repeatedoptions): array { $repeated = []; $rowoptions = []; - $rowoptions[] = $mform->createElement('text', 'rowname', '', ['size' => 40]); + $repeated[] = $mform->createElement('text', 'rowname', $label, ['size' => 40]); $mform->setType('rowname', PARAM_RAW); - $rowanswerlistlabel = ($this->inputtype === 'single') ? - get_string('correctanswer', 'qtype_oumatrix') : - get_string('correctanswers', 'qtype_oumatrix'); - $rowoptions[] = $mform->createElement('html', - html_writer::tag('span', $rowanswerlistlabel, ['class' => 'pl-3 pr-2'])); - // Get the list answer input type (radio buttons or checkboxes). for ($i = 0; $i < $this->numcolumns; $i++) { $anslabel = get_string('answerlabelshort', 'qtype_oumatrix', $i + 1); @@ -191,7 +185,10 @@ protected function get_per_row_fields(MoodleQuickForm $mform, string $label, arr $rowoptions[] = $mform->createElement('checkbox', "rowanswers$columnvalue", '', $anslabel); } } - $repeated[] = $mform->createElement('group', 'rowoptions', $label, $rowoptions, null, false); + $rowanswerlistlabel = ($this->inputtype === 'single') ? + get_string('correctanswer', 'qtype_oumatrix') : + get_string('correctanswers', 'qtype_oumatrix'); + $repeated[] = $mform->createElement('group', 'rowoptions', $rowanswerlistlabel, $rowoptions, null, false); $repeated[] = $mform->createElement('editor', 'feedback', get_string('feedback', 'question'), ['rows' => 2], $this->editoroptions); $repeatedoptions['rowname']['type'] = PARAM_RAW; diff --git a/styles.css b/styles.css index 6d8d8fa..affccd3 100644 --- a/styles.css +++ b/styles.css @@ -15,14 +15,14 @@ } /* Editing form. */ -body#page-question-type-oumatrix div[id^=fgroup_id_][id*=rowoptions_] { +body#page-question-type-oumatrix div[id^=fitem_id_][id*=rowname_], +body#page-question-type-oumatrix div[id^=fgroup_id_][id*=rowoptions_], +body#page-question-type-oumatrix div[id^=fitem_id_][id*=feedback_] { background: #eee; margin-top: 0; margin-bottom: 0; padding-bottom: 5px; padding-top: 5px; - border: 1px solid #bbb; - border-bottom: 0; } body#page-question-type-oumatrix label[data-fieldtype=checkbox] { margin-right: 0.75rem; @@ -32,11 +32,5 @@ body#page-question-type-oumatrix div[id^=fgroup_id_][id*=error_rowoptions_] { border: 0; } body#page-question-type-oumatrix div[id^=fitem_id_][id*=feedback_] { - background: #eee; margin-bottom: 2em; - margin-top: 0; - padding-bottom: 5px; - padding-top: 5px; - border: 1px solid #bbb; - border-top: 0; }