moodle-mod_simplecertificate icon indicating copy to clipboard operation
moodle-mod_simplecertificate copied to clipboard

Improvement: A-Z Sorting of issued certificates

Open nikmav opened this issue 9 years ago • 5 comments

Hi, Not sure if there is a way to implement the A to Z sorting/filtering of issued certificates by first name/last name - a bit like moodle user accounts.

If there is a way I'd bee keen to know otherwise I think it would be useful as we have a number of our users who would have in excess of 500 students who find it very difficult in finding individual students in the list.

nikmav avatar Feb 08 '16 04:02 nikmav

I've achieved this by creating a report in the configurable report plugin. Hope this helps.

SELECT u.firstname AS firstname, u.lastname AS lastname,h.name AS cohort,c.fullname AS Course,

ce.name AS Certificate, DATE_FORMAT(FROM_UNIXTIME(ci.timecreated),'%d-%m-%y')AS Time

FROM prefix_user AS u

JOIN prefix_certificate_issues AS ci ON u.id = ci.userid

JOIN prefix_certificate AS cd ON ci.certificateid = ce.id

JOIN prefix_course AS c ON ce.course = c.id

JOIN prefix_cohort_members AS hm ON u.id = hm.userid

JOIN prefix_cohort AS h ON hm.cohortid = h.id

jimitodd avatar Feb 08 '16 20:02 jimitodd

humm i think you can put WHERE ci.timedelete IS NULL to list only valid certificates

bozoh avatar Feb 13 '16 05:02 bozoh

and i think a search form (by fullname) better ....

bozoh avatar Feb 13 '16 05:02 bozoh

This query/plugin didn't work for me for one and I think I perhaps I could have been clearer. What I was hoping to achieve is this kind of A-Z filtering at the top of the certificate list instead of/as well as the 1 2 3...n pagination:

image

or yes the inclusion of a search form like the user accounts would also be a useful feature

nikmav avatar Feb 13 '16 10:02 nikmav

In locallib.php line 2045 to orderby u.firstname, u.lastname

before: if (!$selectedusers) { $users = get_enrolled_users($course_context, '', $groupid); $usercount = count($users); $users = array_slice($users, $page_start, $perpage); } after: if (!$selectedusers) { $users = get_enrolled_users($course_context, '', $groupid, $userfields = 'u.*', $orderby = 'u.firstname, u.lastname'); $usercount = count($users); $users = array_slice($users, $page_start, $perpage); }

giselebrugger avatar May 13 '16 23:05 giselebrugger