Tweak to Grade Export UI

Tweak to Grade Export UI

by Rory McDaniel -
Number of replies: 6
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.
In reply to Rory McDaniel

Re: Tweak to Grade Export UI

by Rory McDaniel -
Is there a different form in which I should post this question?
In reply to Rory McDaniel

Re: Tweak to Grade Export UI

by Zachary Johnson -
I have nothing to add other than I know I'd like the same information. Sorry.
In reply to Zachary Johnson

Re: Tweak to Grade Export UI

by Rory McDaniel -
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.

In reply to Rory McDaniel

Re: Tweak to Grade Export UI

by Andrew Davis -
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).
In reply to Andrew Davis

Re: Tweak to Grade Export UI

by Rory McDaniel -
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.
In reply to Rory McDaniel

Re: Tweak to Grade Export UI

by Marc Hermon -

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?