How can I change the UI of the Grade Export (specifically, the text format) so that either -
all assignments are not checked by default
or
the select all/none and submit button are at the top as well as at the bottom of the page
or both?
I'm comfortable editing the php if necessary, but I'm having a very hard time finding where to make the edits.
Any suggestions would be appreciated. Thanks.
Is there a different form in which I should post this question?
I have nothing to add other than I know I'd like the same information. Sorry.
Early on this Saturday morning, while waiting to see if my infant daughter would remain asleep after waking up much earlier than usual, I decided I'd use my time wisely and try to fix this little problem.
The file that needles to be modified is
moodle/grade/export/grade_export_form.php
Near the bottom of the form is this snippet of code:
$this->add_checkbox_controller(1, null, null, 1); // 1st argument is group name, 2nd is link text, 3rd is attributes and 4th is original value
I copied that line and pasted it near the top. I suggest looking for this section and pasting it immediately after:
if (!empty($features['includeseparator'])) {
$radio = array();
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
$mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
$mform->setDefault('separator', 'comma');
}
Now I have the select all/none link at the top and bottom of a very long list. This is useful since I generally only export one assignment at a time.
Hope this is of help to someone.
The file that needles to be modified is
moodle/grade/export/grade_export_form.php
Near the bottom of the form is this snippet of code:
$this->add_checkbox_controller(1, null, null, 1); // 1st argument is group name, 2nd is link text, 3rd is attributes and 4th is original value
I copied that line and pasted it near the top. I suggest looking for this section and pasting it immediately after:
if (!empty($features['includeseparator'])) {
$radio = array();
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
$radio[] = &MoodleQuickForm::createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
$mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
$mform->setDefault('separator', 'comma');
}
Now I have the select all/none link at the top and bottom of a very long list. This is useful since I generally only export one assignment at a time.
Hope this is of help to someone.
Hi Rory. Would you mind raising this issue in tracker? http://tracker.moodle.org
Attach a patch if possible (or just paste in your fix as its fairly straight forward).
Attach a patch if possible (or just paste in your fix as its fairly straight forward).
Wow, sorry I didn't see that way back in March. For some reason I unsubscribed to the topic after I posted. I searched for it today to find how I added that button since I lost it when I moved to a new server.
I'll go ahead and raise that on the tracker.
I also figured out how to change the default value to unchecked, if it is helpful to anyone.
Find this section of code in moodle/grade/export/grade_export_form.php
// Grab the grade_seq for this course
$gseq = new grade_seq($COURSE->id, $switch);
if ($grade_items = $gseq->items) {
$needs_multiselect = false;
foreach ($grade_items as $grade_item) {
if (!empty($features['idnumberrequired']) and empty($grade_item->idnumber)) {
$mform->addElement('advcheckbox', 'itemids['.$grade_item->id.']', $grade_item->get_name(), get_string('noidnumber', 'grades'));
$mform->hardFreeze('itemids['.$grade_item->id.']');
} else {
$mform->addElement('advcheckbox', 'itemids['.$grade_item->id.']', $grade_item->get_name(), null, array('group' => 1));
$mform->setDefault('itemids['.$grade_item->id.']', 2);
$needs_multiselect = true;
}
}
Within that section of code change this:
$mform->setDefault('itemids['.$grade_item->id.']', 1);
To this:
$mform->setDefault('itemids['.$grade_item->id.']', 2);
Now all boxes are unchecked by default.
I'll go ahead and raise that on the tracker.
I also figured out how to change the default value to unchecked, if it is helpful to anyone.
Find this section of code in moodle/grade/export/grade_export_form.php
// Grab the grade_seq for this course
$gseq = new grade_seq($COURSE->id, $switch);
if ($grade_items = $gseq->items) {
$needs_multiselect = false;
foreach ($grade_items as $grade_item) {
if (!empty($features['idnumberrequired']) and empty($grade_item->idnumber)) {
$mform->addElement('advcheckbox', 'itemids['.$grade_item->id.']', $grade_item->get_name(), get_string('noidnumber', 'grades'));
$mform->hardFreeze('itemids['.$grade_item->id.']');
} else {
$mform->addElement('advcheckbox', 'itemids['.$grade_item->id.']', $grade_item->get_name(), null, array('group' => 1));
$mform->setDefault('itemids['.$grade_item->id.']', 2);
$needs_multiselect = true;
}
}
Within that section of code change this:
$mform->setDefault('itemids['.$grade_item->id.']', 1);
To this:
$mform->setDefault('itemids['.$grade_item->id.']', 2);
Now all boxes are unchecked by default.
I can't get the boxes to be unchecked and the Select All/None link to be at the top anymore with this code in my new 2.9+ version. Any help?