Certificate (plugin)

 
 
Picture of Kate Rhodes
"Customized" Certificate - dates not displaying properly - files included to whoever can help !
 

Hi there, I had a someone the certificate module for me so that we could set an expiry date on the certificates, and then display a list of the certificates with the expiry dates. The problem is the date isn't displaying properly - it always shows a year of 1969. I needed this done for a client who has annual refresher safety training.

I'm approaching the forum because the person who I paid to do the work, has since decided he doesn't do this type of work anymore and won't fix it for me.

I wasn't sure which files were needed to find the problem, so I've uploaded the whole modified certificate file for anyone who would be able to look at it. 

www.wizardsofvideo.ca/KateMoodleStuff

If someone could get it working properly, I don't mind others using it for their own sites. I just need to get it fixed up.

Thanks so much guys!

Kate

setwrongdate

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
Group DevelopersGroup Particularly helpful Moodlers

Hello Kate,

I had a look a he files you uploaded.

Unfortunately there are surely other files, because for instance I don't think that the code producing the display included in the screenshot you posted is in the zip.

When you display this report with the wrong dates what is the address in your browser ? This info would help me to tell you where are the missing files.

I am sorry to say the code quality for the expiry date is no very good, not plain wrong but not up to Moodle standards, so maybe the fact "he decided he doesn't do this type of work anymore" is a wise decision smile.

Last thing: what is your Moodle version so that I can adjust the code to it ?

 
Average of ratings: -
Picture of Kate Rhodes
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
 

Hi thank you so much for looking at this! I went through my moodle found the attached zipped folder. I think this is the missing piece.

I am using Moodle 2.3.2

Please let me know what else I can do to help with this.

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
Group DevelopersGroup Particularly helpful Moodlers

Hello Kate,

I am no convinced I solved your problem: I corrected a few evident bugs in the code and for me, on my test install, all is working as expected (new fields at certificate's creation, mails send when expiration date is approaching, and the display is OK in the block, I do see different dates for different certificates)

My problem is that I see no way the bugs I have corrected could produce all dates equal in the list display for different certificates sad

But I must admit I don't really understand how this expiration date feature is working. As it is done the date is set for each certificate (not certificate issue !)

So imagine I am an user and get certificate A to expire on date D. when I receive the mail telling me my certificate is about to expire. I return to the website, and .. what else ?

Certainly if I get the same certificate A it will also expire on date D because expiration dates are tied to certificates not to users or the time where they got it !

And if some administrator (or teacher) change the expiration date of certificate A it will change for all students already having this certificate without any need for them to get it again !!

I am puzzled wide eyes

My guess is that maybe the developer has no understood you client's needs and your client has changed the expiration date on a certificate not knowing it will change for all users already having this certificate.

Anyway if you want my corrected code, send me your mail because it is too big to attach it here.

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
Group DevelopersGroup Particularly helpful Moodlers

Looking at the screenshot you posted in your first mail seems to confirm my guess: there is only one certificate (Basic version - Certificate of completion) displayed on the page so it's quite normal that all dates are equal because this is how the code your developer has done works: expiration dates are a property of each certificate !!

Buy maybe this is not what you or your client expect.

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
Group DevelopersGroup Particularly helpful Moodlers

Here is how I think it should work (but this is not how it currently works !)

- When you create a new certificate instance in a course you enter an "Expiration date" and "Days to email before expiration" (no change here this is how it is working now). This data is related to a certificate so it would be saved in the mdl_certificate table. It can be changed by editing the certificate. The only modifications I would do would be to add settings (checkboxes) to activate or not the expiration date and sending of emails features.

- When a student get a new certificate, the expiration date would be copied from the mdl_certificate table to the mdl_certificate_issues table, so it would be related to just this user and just this certificate. A new column in that table would also indicate if this student has been mailed about the expiration of this certificate or not. This is brand new code that don't currently exist and would have to be written.

- The cron running periodically would search for certificates issues about to expire and send mails accordingly. This is just a modification of the existing code to look for the expiration date on a certificate issue basis (not certificate basis) and from the mdl_certificate_issues table (not mdl_certificate). I would also change some of the existing code (for instance it currently use the php mail function to send mails witch is very bad, it should use the Moodle way of sending mails).

- The certificate_expiry_users block would work the same as it does now, the only difference is that expiration date would be fetched on a certificate issue basis not certificate

How it would work  ?

student A follow the 2013 course and the course has a certificate set to expire on 2014 December 31th, and mails to be send 4 days before expiration.

when he get his certificate, this date is copied on the line for this issue and this student and 0 for mail send

on 2014 January 1st, the course is reset for a new year and expiration date is changed to 2015 December 31h. Student A is not affected at all by this change.

if another student B follow this course and get the certificate, the new date is copied for him.

on 2014 December 27th, when the cron is run, student A get a mail that his certificate is about to expire and mail send is set to 1 for this certificate issue. Student B don't get any mail.

If student A follow a new course he will get a new certificate issue with a new expiration date.

Do you follow my explanations and does it suit your client needs ?

I would also be interested to hear from other users of the certificate module and from Mark too.

 

 
Average of ratings: -
Mark
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
 

This feature would be appreciated by many I suspect, including us.

The ability to remind staff that they should re-complete courses such as Fire Safety is an ongoing issue. This would certainly assist.

Would we be able to select the "reminder" time or would that be set to 12 months as indicated/suggested?

Cheers

Mark

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
Group DevelopersGroup Particularly helpful Moodlers

Hello Mark,

Your question is very interesting.

As it is done now by the developer paid by Kate Rhodes, when you create (or edit) a certificate, you choose an expiration date (with a date selector) and a number of days to send an email to student before expiration date. for instance if in a certificate you enter 2013 November 1st and 3 days, students will receive a mail on 2013 October 29h.

I was asking myself if it would be better or not to let teachers enter a number of days rather than a date (for instance 365 if the certificate is to expire one year after student got it) so for instance if you enter 365 days and 3 days and a student get the certificate on 2013 September 1st he will receive a mail  on 2014 August 29th warning him that his certificate is about to expire in 3 days.

But I guess no solution will fit everybody needs.

 
Average of ratings:Useful (1)
Picture of Kate Rhodes
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
 

My apologies for the very late reply!

Yes! That's the way I would like it to happen. Each student needs to have their certificate renewed each year on the date they last took the the training. So if I took my training on May 1st, 2013 - my training would expire on May 1st, 2014. I would like to be able to have them notified of the expiry at least 30 days before to give them time to take the training again.  I think Mark is looking for the same thing as I am. 

I hope this is do-able!

Kate

 
Average of ratings: -
Picture of Kate Rhodes
Re: "Customized" Certificate - dates not displaying properly - files included to whoever can help !
 

Hi Jean-Michel!

Did you get anywhere with this? I'm really curious to see if you tried this to see if it would work.  I still haven't got anywhere with this problem either.

 

 

 
Average of ratings: -