General plugins

Checklist plugin updated

Checklist plugin updated

There's a new version of my checklist plugin available at https://github.com/davosmith/moodle-checklist (on the master branch)

This has had quite a bit of testing already, but due to it having quite a bit internal tidy-up I'd really appreciate it if one or two people were willing to give it a bit more of a test, before I make it generally available.

Aside from the tidy up (and removal of a lot of pre-Moodle 2.7 support code), there are a few new features in this version:

• Items can be linked to arbitrary URLs
• Items can be linked to courses - with automatic check-off when the associated course is complete (assuming the course has completion turned on)
• Items can be linked to groupings, so different items are displayed to different groupings of users (this is already supported for items linked to course activities, but now supported for any items)
• When the checklist is set to 'teacher only', automatic updates will update the 'teacher' mark, not the (hidden) student mark - for 'student only' or 'student and teacher' checklists, it is still the student mark that is updated

I'm hoping to update the version in the Moodle plugins database very soon - so thanks, in advance, for anyone willing to try this out.

Average of ratings: Useful (1)
Re: Checklist plugin updated

Hello Davo Smith, awesome checklist - great work.  is there a way to have the arbitrary URLs open in a new window or Tab so students don't get lost.

Thanks, Ron

Average of ratings: -
Re: Checklist plugin updated

Without changing the code, the only way is for students to right-click and select 'open in new tab/window' (or ctrl+click, or middle-mouse click).

Normally I'd prefer opening new tabs to be under the control of the end user, rather than something the website owner is deciding on.

If you really want to change it, then in your theme, you could override the mod_checklist_renderer class, then override the checklist_item_link() function. If you copy the original, then add an extra param to 'html_writer::link()' with ['target' => '_blank'], then links will all open in a new tab, i.e. change the line to:

$out .= html_writer::link($url, $icon, ['target' => '_blank']); Average of ratings: Useful (2) Re: Checklist plugin updated Thank you Davo! Do I make these code changes to a particular php file under the theme or the Checklist? I'm a novice when it come to changing code but most of the time I can figure it out. Thanks! Average of ratings: - Re: Checklist plugin updated Try reading through: https://docs.moodle.org/dev/Overriding_a_renderer And get back to me if you're still not sure. Average of ratings: - Re: Checklist plugin updated Thanks Davo, I read through the documentation but I still can't figure out how to force a new window to open a URL Also, I keep getting this error message while trying to test the email function after the Checklist is completed. Been trying for a couple of days but no emails have been sent - Any idea of what's going on? Thanks for your time on this! Average of ratings: - Re: Checklist plugin updated As I said above, you need to change the line that outputs the link to add the ['target' => '_blank'] param to the end of it - the best way to do that is in a theme renderer override, but if you want to you could just put it in the original plugin code itself. As for the warning message - I'm not sure, off the top of my head, how the email function would get called by my plugin without there being a valid$id field set. From the looks of the latest version of the code it should all work.

Average of ratings: -
Re: Checklist plugin updated

Davo,

﻿I just now updated our Checklist module - from 2016052000 to 2017060500. Moodle 3.1.5+ (Build: 20170407)

• With debugging on
• The first visit to the new checklist - by me or a student account - gives the following:
Warning: mysqli::real_escape_string() expects parameter 1 to be string, array given in /usr/share/moodle/lib/dml/mysqli_native_moodle_database.php on line 1042

After reloading the page or leaving and returning, the warning is gone. Everything seems to be working correctly otherwise. I'm asking our server admin to role the site back to the snapshot taken just before the update.

I don't know that this warning is connected to the Checklist update or not. Any advice is appreciated.

Thanks for a great and well-used plugin!

David

Average of ratings: -
Re: Checklist plugin updated

Just an update - After the server was rolled back to the snapshot taken just before updating Checklist, the warning still appears in the same circumstance. So, this could have become and issue after one of the May updates and I just hadn't noticed. It seems to be the same warning referenced in this tracker item - https://tracker.moodle.org/browse/CONTRIB-3904, except that in that situation, the warning occurred when resetting a course. I do not get the warning when resetting a course with a Checklist.

Average of ratings: -
Re: Checklist plugin updated

Hi David,

Sorry for the slow reply (I've had a non-stop weekend running a local music festival and just catching up with myself now).

I've had a quick go at reproducing the problem you described, created a checklist, left everything at default (apart from entering a name), saved and returned to the course, reopened the checklist and no error appeared.

The error message you have reported unfortunately doesn't give much to go on - it is a line deep inside the Moodle database code which could have been called from almost anywhere. What would be more helpful is if you could tell me the full list of lines that are called before that (with Debugging set to developer, you should get a long list of filenames, functions and line numbers, finishing with the line you reported).

Aside from that, maybe you could tell me exactly what settings you have for the checklist (and possibly the global checklist settings) and I can try again to reproduce the problem.

Average of ratings: Useful (1)
Re: Checklist plugin updated

Davo,

Thanks for the reply and guidance. And very timely - no worries, please.

But it looks like I need to apologize - I cannot recreate the warning. At the time I wrote, I had re-created it at least a half-dozen times. It was very consistent. Other than the name, the only setting I changed was setting "Show course modules in checklist" to "Current section". The warning was the same each time, and would clear upon refreshing or revisiting the page. And the warning displayed to whomever "got there first" - if a student (test account logged in on another browser) clicked the link to the new checklist before I did, the warning was not present when I visited it.

And that was the complete message, with debugging set to developer. There wasn't a stack trace or debug info section - just the warning.

The global Checklist settings - are those the settings at mysite/admin/settings.php?section=modsettingchecklist? The first three options - "Show ___ on 'My Moodle' page" - are all checked. The last one - "Allow linking items to courses" - is not checked.

I guess this was a false alarm. I purged all caches several times during this event - any chance that helped? Or maybe something got cleaned up during a subsequent cron run? (I'm obviously not a programmer/developer).

I do appreciate your willingness to help - and this great plugin!

David

Average of ratings: -
Re: Checklist plugin updated

If you've not been able to reproduce again, then I'll put this to one side and see if it comes up later. Odd that there isn't a full stack trace - have you tried with debugging set to 'developer'? If you find the problem again, that might help to shed some light ...

Average of ratings: -