Print Experation Date on Certificate?

Print Experation Date on Certificate?

by Dustin Elliott -
Number of replies: 18

Does anyone have a way to print an experation date on the certificate which is calculated by adding a period of time to the certificate date?

Our certificates are valid for 2 years and I need to be able to print the experation date on the certificate which would be 2 years form the date the certificate was first issued.

Average of ratings: -
In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by E. L. Cooper -
I have used custom text field to say valid for 1 year from date of issue but I have never actually tried to do a calculation.
In reply to Dustin Elliott

Re: Print Expiration Date on Certificate?

by Dustin Elliott -
I was able to get an expiration data printed on the certificate by adding this line of code after the first section of "Date formatting code" in the certficate.php file.

This adds 2 years to the date the certificate was generated.

$expdate = str_replace(' 0', ' ', strftime('%B %d, %Y',(strtotime("+2 years", $certdate))));

Our certificates expire every two years but you can change the "+2 years" to whatever length of time you need.

To print the expiration date:

cert_printtext(285, 480, 'C', 'Arial', '', 16, utf8_decode("Expiration Date: ".$expdate));
In reply to Dustin Elliott

Re: Print Expiration Date on Certificate?

by cylinda dominguez -
I get December 31, 1971 as the date that prints out on the certificate?

Anyone have any idea why?
In reply to cylinda dominguez

Re: Print Expiration Date on Certificate?

by Matthew Brewer -

I'm having the same issue, but am not seeing a solution posted.  My certificates are posting December 31, 1972, in my case. 

Has there been a fix yet?  I'm hoping to get this resolved very soon. 

In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by Ruth Noordijk -
I have the same requirement for expiration of certificates and issue of new certificates for the same course after a period of time.

We have courses that must be done again by staff after a length of time. This length of time varies, but can be 1 year, 3 years, 5 years or indefinitely.

I would appreciate any feedback on how this is managed by other Moodlers.

In an ideal world it would:
  1. Show an expiry date on the certificate, which would be the date received + length of certification.
  2. Send an email to the student (and teacher) a period of time, eg 30 days before the certification will expire.
  3. Issue a new certificate when the course is redone and conditions are met.
  4. Keep a course history of the students certificates. Showing what date the certificate expired.
Thanks in advance for any assistance anyone can give me.
Rudi
In reply to Ruth Noordijk

Re: Print Experation Date on Certificate?

by Dustin Elliott -
Ruth,

You can get an expiration date to print on your certificates by adding a couple of lines of code the the certificate.php file you are using which is located in ...\mod\certificate\type\(choose the folder for your type of certificate).

The code I added is in bold it will print an expiration date that is 2 year from the certification date, you can change it to what ever length of time you need

Existing Code:
$certificatedate = str_replace(' 0', ' ', strftime('%B %d, %Y', $prereq_date));

New Code:
$expdate = str_replace(' 0', ' ', strftime('%B %d, %Y',(strtotime("+2 years", $prereq_date))));



This is the line of code to print the expiration date on the certificate, you will need to put this in the order you want it to show up on the certificate.

cert_printtext(285, 480, 'C', 'Arial', '', 16, utf8_decode("Expiration Date: ".$expdate));

Thanks,
Dustin
In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by Ruth Noordijk -
Hi Dustin,
Thanks for trying to help me with this. When I look at my certificate.php in mod\certificate\type, the code for date formatting looks like this.

// Date formatting
if($certificate->printdate > 0) {
$certificatedate = certificate_date_format('certdate', $certrecord);
} else {
$certificatedate = "";
}

and I don't see any code = your existing code? Why is mine different?
Rudi


In reply to Ruth Noordijk

Re: Print Experation Date on Certificate?

by Dustin Elliott -
Ruth,

Looks like you are using the 4.3 FAT certificate, I use the certificate module located here: Certificate Module

Also, after looking more closely at my code I realize I made more modifications to the certificate.php file that aren't related to adding the Expiration date and the location and code I originally said to add is incorrect.

here is the correct code and location to add it.

If you switch to the other Certificate Module add this line of code (in bold):

New Code
$expdate = str_replace(' 0', ' ', strftime('%B %d, %Y',(strtotime("+2 years", $certdate))));

BEFORE

Existing Code
//Grade formatting
$grade = '';


This is the line of code to print the expiration date on the certificate, you will need to put this in the order you want it to show up on the certificate.

cert_printtext(285, 480, 'C', 'Arial', '', 16, utf8_decode("Expiration Date: ".$expdate));

In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by Ruth Noordijk -
Hi Dustin,

Thanks for getting back to me so quickly!

I have messed about a bit with this in my code, my problem is that I don't have the $prereq_date that you refer to. I tried it with other variables but couldn't get it to work. I have no problem with adding extra fields to print on the certificate.

What are the differences between 4.3 FAT certificate, and Certificate Module? I have already made a lot of changes and would rather not have to re-do it.

Ruth

In reply to Ruth Noordijk

Re: Print Experation Date on Certificate?

by Dustin Elliott -
Ruth,

Please use the code from my last post on Wednesday, February 3, 2010, it doesn't include the $prereq_date, it says $certdate instead.

I accidentally posted the wrong code in the post that has the $prereq_date, I explained that in my last post, see red text.

I'm not really sure what all the differences between the 4.3 FAT and other certificate Module are but I believe there are other post that address that question.

Thanks,
Dustin
In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by shayan shahabi -
Dustin,


I was wondering if you or anyone else knows how to add the enrolled date on the certificate. or the first access date of the course on the certificate.


let me know

Thanks
Shayan
In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by shayan shahabi -
Dustin,


I was wondering if you or anyone else knows how to add the enrolled date on the certificate. or the first access date of the course on the certificate.


let me know

Thanks
Shayan
In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by shayan shahabi -
Dustin,


I was wondering if you or anyone else knows how to add the enrolled date on the certificate. or the first access date of the course on the certificate.


let me know

Thanks
Shayan
In reply to Dustin Elliott

Re: Print Experation Date on Certificate?

by Ruth Noordijk -
Hi Dustin,
I checked the forums and where the question of the differences between FAT 4.3 and Certificate module, has been asked a few times, no one could seem to answer. It looks to me like Fat is an offshute of the Certificate module, and one post said for most people the Certificate Module would be best, so I have bitten the bullet and uninstalled the Fat version and installed the Certificate module.

I have added the code in as you suggested and it works.

Thanks again, your help is very much appreciated!
Rudi
In reply to Ruth Noordijk

Re: Print Experation Date on Certificate?

by Tomas Östling -

Hi all

I have a demand similar to Ruths question from january 29th.

In an ideal world it would:

1. Show an expiry date on the certificate, which would be the date received + length of certification.Send an email to the student (and teacher) a period of time, eg 30 days before the certification will expire. [TÖ comment: ...and continue to send reminders until the student has enrolled to the course again and/or passed a test].

2. Issue a new certificate when the course is redone and conditions are met.
3. Keep a course history of the students certificates. Showing what date the certificate expired.

I have looked through the documentation on the site but found nothing. Anyone who can help?

In reply to Tomas Östling

Re: Print Experation Date on Certificate?

by Lester Cunningham -
Hi Tom,

First of all remember that Certificates are optional so not everone can be forced to collect theirs.

Secondly, if a student re-enrols onto a course for a re-take then they will find that their existing record of achievement will enable them to collect their certificate without retaking the assessment.

However, some time back we commissioned Chardelle to develop a certificate option for us which a) allows certificates to be re-issued and b) uses the latest pass date on the certificate itself. We have since granted permission for this to be included in Moodle version 2 development. Printing an expiry date should be possible by adding a calculation to the certificate.php itself, or simply adding custom text to say " This certiticate is valid for 12 months from the date shown".

I agree with you that a mechanism for alerting students to re-take an assessment is a nice idea but I suspect that this would involve a completely new module and to be honest, should be attached to an assessable activity such as a quiz rather than an optional certificate.

Hope this helps.

Lester
In reply to Tomas Östling

Re: Print Experation Date on Certificate?

by Ruth Noordijk -
Hi Tomas,

The only thing I have resolved is to have an expiration date print on the certificate.

My biggest problem has been with being able to re-issue certificates for courses that have to be redone on a reoccurring basis. This will be the same for many in the health and care industries. First aid (5 yearly) and CPR(1 yearly) are good examples. We are hoping Moodle 2.0 will be the answer to that one at least.

Cheers
Ruth