Expiry date on a certificate. Please Help

Expiry date on a certificate. Please Help

de John Graham -
Número de respuestas: 2

Recently I have added the Certificate module to our Moodle Site 2.3.2+ (Build: 20120927). I have used tips from this forum to modify my certificate, text, design etc, and works great! Instead of having the date on the certificate I would like to have an expiry date.  So if the certificate was issued today the expiry date would be 04 October 2013.

Now when looking through this forum someone has posted this code, which I added to certificate/type/my certificate/certificate.php:


$expdate = str_replace(' 0', ' ', strftime('%B %d, %Y',(strtotime("+2 years", $certdate))));
cert_printtext(285, 480, 'C', 'Arial', '', 16, utf8_decode("Expiration Date: ".$expdate));

That did not work so I changed the code to this:

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

certificate_print_text($pdf, $x, $y, + 98, 'Helvetica', '', 16, utf8_decode("Expiration Date: ".$expdate));

The expiry date now shows on the certificate but as ‘Expiration Date: January 1, 1971’. I am not a programmer but I have experience with HTML/CSS.

Any ideas?

 

Thanks

John

Promedio de valoraciones:Useful (1)
En respuesta a John Graham

Re: Expiry date on a certificate. Please Help

de Mark Nelson -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers

Hi John,

I would actually do something like the following (I haven't test it).

$timetoadd = 365 * 24 * 60 * 60; // A year in seconds
$expdate = $certrecord->timecreated + $timetoadd;

certificate_print_text($pdf, $x, $y, + 98, 'Helvetica', '', 16, "Expiration Date: " . date("F d, Y", $expdate));

Regards,

Mark