Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: A-Z Sorting of issued certificates #140

Open
nikmav opened this issue Feb 8, 2016 · 5 comments
Open

Improvement: A-Z Sorting of issued certificates #140

nikmav opened this issue Feb 8, 2016 · 5 comments
Milestone

Comments

@nikmav
Copy link

nikmav commented Feb 8, 2016

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.

@jimitodd
Copy link

jimitodd commented Feb 8, 2016

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

@bozoh
Copy link
Owner

bozoh commented Feb 13, 2016

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

@bozoh bozoh added this to the 2.3.0 milestone Feb 13, 2016
@bozoh
Copy link
Owner

bozoh commented Feb 13, 2016

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

@nikmav
Copy link
Author

nikmav commented Feb 13, 2016

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

@giselebrugger
Copy link

giselebrugger commented May 13, 2016

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants