From 141530b9dd381df374c63cf5da2913ae311e7b5b Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 21 Sep 2017 17:50:28 +0800 Subject: [PATCH] MDL-60197 mod_data: not always necessary to show 'select all/none' link --- mod/data/export_form.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/data/export_form.php b/mod/data/export_form.php index 1377e6c73a6..fdee10f0a3e 100644 --- a/mod/data/export_form.php +++ b/mod/data/export_form.php @@ -58,8 +58,10 @@ class mod_data_export_form extends moodleform { $mform->setDefault('delimiter_name', 'comma'); } $mform->addElement('header', 'notice', get_string('chooseexportfields', 'data')); + $numfieldsthatcanbeselected = 0; foreach($this->_datafields as $field) { if($field->text_export_supported()) { + $numfieldsthatcanbeselected++; $html = '
' . $field->field->name . '
'; $name = ' (' . $field->name() . ')'; @@ -72,7 +74,9 @@ class mod_data_export_form extends moodleform { $mform->addElement('static', 'unsupported' . $field->field->id, $field->field->name, $str); } } - $this->add_checkbox_controller(1, null, null, 1); + if ($numfieldsthatcanbeselected > 1) { + $this->add_checkbox_controller(1, null, null, 1); + } $context = context_module::instance($this->_cm->id); if (has_capability('mod/data:exportuserinfo', $context)) { $mform->addElement('checkbox', 'exportuser', get_string('includeuserdetails', 'data'));