Custom Certificate - 1.9.5+ - Editing Text problem

Custom Certificate - 1.9.5+ - Editing Text problem

by Dawn Bleuel -
Number of replies: 14

My supervisor wants the certificates to print on custom paper which has our letterhead on it. No problems there. I've been able to add the image and set it up so I can select it when creating the Certificate Activity. However, try as I might, I can't seem to get the text to change from "CERTIFICATE of ACHIEVEMENT" to "Certificate of Completion". Nor, can I get it to move down on the page. I think if I could find where those adjustments are, that would allow me to modify the placement of the rest of the text on the page.

I have tried modifying the certificate.php in \Moodle\server\moodle\mod\certificate\type\letter_landscape and
\Moodle\server\moodle\mod\certificate\type\stfrancis and
\Moodle\server\moodle\mod\certificate\lang\en_utf8

I've come up empty. No matter what I have tried, the certificate does not change.

Average of ratings: -
In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Xiu Juan Xia -

I am using moodle 1.9. I am not sure what's your moodle version. But anyways here is my solution:

To get the text to change from "CERTIFICATE of ACHIEVEMENT" to "Certificate of Completion", you need modify $string['titlelandscape'] = 'CERTIFICATE of ACHIEVEMENT'; to $string['titlelandscape'] = 'Certificate of Completion';  for \Moodle\server\moodle\mod\certificate\lang\en_utf8\certificate.php

And if you want to get it to move down on the page, you need make changes of \Moodle\server\moodle\mod\certificate\type\stfrancis\certificate.php

You need change line of cert_printtext(170, 125, 'C', 'Helvetica', 'B', 30, utf8_decode(get_string('titlelandscape', 'certificate'))); you may increase the number of 125 to 135 to move down a little bit.

In reply to Xiu Juan Xia

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jean-Michel Védrine -

Oh yes you are right landscape letter certificate is not using title as I was beveiving it uses titlelandscape !! My fault blush i was confused by other certificate type using title

the 125 (or 135) is the distance from top in millimeters

all the cert_printtext instructions work the same the first number is the distance from the left and the second one the distance from top

In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jonathan Woodbury -

I'm using the 2.0 module, but it should be similar.

We had the same problem, and you have 2 options to fix it.  Either modify the database to change the certificate title OR remove the module all together and re-install it with the changes. (this might not be the case with 1.9.x but 2.0 currently it's now I had to change it)  See post above mine first.

Moving the text was not a problem though and you should refer to the documentation here: http://docs.moodle.org/20/en/Certificate_module#Customize_format

In reply to Jonathan Woodbury

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jean-Michel Védrine -

Hello Jonathan,

In Moodle 2.x all the lang strings are cached so if you change a lang string you don't see the result. But rather than uninstalling the module and reinstalling it wide eyes (and loose all your certificates instances) you need to go to Site Administration > Development > Purge all caches.

This is not necessary with Moodle 1.9

In reply to Jean-Michel Védrine

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jonathan Woodbury -

THANK YOU for this information.  I knew their had to be an easier way.

In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Kevin Putman -

The Certificate of Achievement language is in the lang/en_utf8/certificate.php file near the end of the file. I would change the language in each occurrence just to be sure. As for the positioning, that comes from type/[selected_type]/certificate.php. It is on line 103 after // Add text. It is the second line of code that begins cert_printtext(150, 180, ... You would need to increase the 180 value to move that line down. However, in doing so, you may need to adjusted the values of everything that prints below it as well.

In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jean-Michel Védrine -

When you want a customized certificate, choose the certificate type who suits your needs best but do not modify it. For instance if you want to start from the landscape type, make a copy of the subfolder mod/certificate/type/landscape and rename it.

This way in the future when you upgrade the certifictae module when a new version wil be released, your changes will not be overwritten

This is exactly what the docs says :

It is a good idea to create your own custom certificate type, that will appear on a list along with the standard certificates types. You will know which is your custom certificate type and it will survive when you upgrade.

For the title, if you want differents titles with differents certificates types it is possible to create several lang strings in mod/certificate/lang/en_utf8/certificate.php (or mod/certificate/lang/en/certificate.php if you are using Moodle 2)

$string['title'] = 'CERTIFICATE of ACHIEVEMENT';

$string['title2'] = 'Certificate of Completion';

and use one of them in a given certificate type replacing:

get_string('title', 'certificate')

with:

get_string('title2', 'certificate')

in the mod/certificate/type/your_type/certificate.php file

The only drawback of this method is again that at the next module upgrade the lang file change will be lost and you will have to re-do it.

 

In reply to Jean-Michel Védrine

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Dawn Bleuel -

Thanks Jean-Micheal ~

I had done what you / and the documentation suggested. I copied the Letter Landscape folder and renamed it stfrancis.

I am using Moodle version 1.9.5+

I have renamed every instance of "Achievement" to "Completion" and all my certificates still print Achievement. Attached please find a copy of my lang/en_utf8/ certificate file. Any other suggestions?

In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Xiu Juan Xia -

Are you able to select stfrancis while you are choosing certificate type?

In reply to Xiu Juan Xia

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Dawn Bleuel -

Sort of - it says typestfrancis

Also, I've done something so that my text is misaligned and goofy. I copied the certificate file from letterlandscape and overwrote the certificate.php document into the folder stfrancis and then made the modifications again with no joy.

Attachment 7-14-2011 1-10-29 PM.gif
In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jean-Michel Védrine -

Hello,

Can you post a short drawing of what you want to acheive and I will try to do a small tutorial maybe that would usefull for others certificate user too.

For each text, graphic, ... I need the place where you want it to be in millimeters from top and left.

In reply to Dawn Bleuel

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Xiu Juan Xia -

I know your problem.

Your new certificate type was not recognized by moodle yet. You need add this code to your mod\certificate\lang\en_utf8\certificate.php

$string['typestfrancis'] = 'stfrancis';

Then the new certificate type will be recognized by moodle. And your change of the type will be able to appear on your printed certificate.

Please try it and it should resolve your issue.

In reply to Xiu Juan Xia

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Jean-Michel Védrine -

Hello,

In fact it depends on what version of the certificate module that you are using.

With recent versions of the certificat module it will appear as typestfrancis between double brackets and it will work even if you don't add the string

In reply to Jean-Michel Védrine

Re: Custom Certificate - 1.9.5+ - Editing Text problem

by Dawn Bleuel -

Jean-Michel ~ I'm using Moodle 1.9.5
  Attached please find a scan of what I would like
  The logo, "Certificate of Completion" and border are all included in the custom image that I added to the border folder. As for the locations of the text... I am open to having it in the general vacinity on the page.

Xiu Juan ~ I do have $string['typestfrancis'] = 'St Francis'; in the en_utf8 certificate. I put it right below the $string['typeletter_landscape'] = 'Landscape (letter)';

Dawn