moodle-mod_simplecertificate
moodle-mod_simplecertificate copied to clipboard
Improvement: A-Z Sorting of issued certificates
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.
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
humm i think you can put WHERE ci.timedelete IS NULL to list only valid certificates
and i think a search form (by fullname) better ....
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:
or yes the inclusion of a search form like the user accounts would also be a useful feature
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); }