Journals - Ability to Alphabetically Organize of Student Entries

Journals - Ability to Alphabetically Organize of Student Entries

per AL Rachels -
Nombre de respostes: 1
Imatge de Core developers Imatge de Particularly helpful Moodlers Imatge de Plugin developers Imatge de Testers

It has been over a year since a forum entry with the same subject was started, so it is locked and cannot be commented on. I somehow missed the original question posed by Robin Latham, but in a private message yesterday, I provided her a partial solution, and it was so simple, I am mentioning it here so that others can implement it, too.

She asked:  "Could we get a toggle to be able to organize the journal entries by student last name rather than as it is now by date of entry only?"

Not a toggle, but a change to alphabetical order...In the lib.php file, look for: function journal_get_users_done($journal, $currentgroup) { It should be around line 702, depending on your version of journal.

Just a few lines below that look for: $sql .= " WHERE j.journal=? ORDER BY j.modified DESC";

Change it to: $sql .= " WHERE j.journal=? ORDER BY u.lastname ASC, u.firstname ASC";

This will cause both the users that are done and the users who have no entry, to be listed alphabetically when a teacher goes to the page generated by report.php.

I have made a pull request to try and get this change into the Journal code at github.

Robin also asked: "Also, if we could be able to download the entries, that would be nice." I do have a solution for this, but it is nowhere nearly as simple, requiring the addition of about 100 lines of code lib.php and nearly that many in report.php. Time permitting, I will try to add it to my github version of Journal, and will post here when it is available.

Download entries is actually available in a new plugin I am developing, based on Journal, named, Diary. Over the years, I have seen numerous requests for a Diary plugin, and mine is similar (based off of) Journal with the added capability of giving the user a new blank entry, every time they go to edit on a new calendar day. Still have lots to do, but if anyone wants a look see, let me know via private message, and I will give access. Or you can git a, mostly current version, from the Diary master branch at my github account.

Mitjana de qualificacions:Useful (1)
En resposta a AL Rachels

Re: Journals - Ability to Alphabetically Organize of Student Entries

per AL Rachels -
Imatge de Core developers Imatge de Particularly helpful Moodlers Imatge de Plugin developers Imatge de Testers

Ooops! My wife was after me to go do something, and I forgot to include one other change that alphabetizes the users who have NOT made an entry.

Do the change listed above. Then, in the file report.php down around line 158, look for this line of code: $users = get_users_by_capability($context, 'mod/journal:addentries', '', '', '', '', $groups);

Change it to this: $users = get_users_by_capability($context, 'mod/journal:addentries', '', $sort='lastname ASC, firstname ASC', '', '', $groups);

Sorry for not catching the omission while making the first post.