Difference between revisions of "Certificate module"
Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: Certificate module.
(→General: 2 items)
(→Issue options: 4 options)
|Line 30:||Line 30:|
Revision as of 12:32, 18 October 2010
The Certificate module creates PDF certificates/diplomas for students of the course and is completely customizable. You can add borders, watermarks, seals and even show grade information. A contributed module, it was originally created by Hugo Salgado, July, 2004, updated by David T. Cannon, July, 2005 to use FPDF and include printing grades, updated and currently maintained by Chardelle Busch to include backup/restore, types, reporting, emailing, unicode support, etc.
There are different certificate modules for 1.6 and 1.7. They are not compatible. These instructions were written for 1.6. Chardelle Busch has made sure Certificate is updated for every version through 1.9. The 1.9 version has a few more printing features and has expanded the number of activities upon which the teacher can set conditions for issuing a certificate to a student.
- 1 Certificate companions
- 2 Installing
- 3 Settings
- 4 Tips & Tricks
- 5 Customizing
- 6 Tips and Tricks
- 7 See also
Certificate Site-wide Report
As of February 2008, there is a Certificate Site-wide Report which can be added in Moodle 1.9, as a supplement. This is an add-on to the certificate module--if installed, you will have an option when creating a certificate to send that certificate's info to the report. An optional block is included that provides a link to the report. Students will see a list of all received certificates. Administrators (or those who have the capability of viewing site reports) will see a link on the Certificate Report page to view/download a report of all students' received certificates. To install: Place the certificates folder in your root (main) moodle folder and upload to your server. Place the my_certificates block folder under your moodle/blocks folder, upload to your server and click on the Administration>>Notifications link to install.
Certificate Verification Block
A companion to the Certificate module for Moodle 1.9. This is a block with a form for entering a given certificate code for verification. The verification page shows the student name, course name, date received and grade (if a grade is printed on the certificate). The certificate code can be printed on a certificate.
This feature is useful when a Registrar, supervisor or administrator wishes to verify that the printed certificate is valid for that student. To install: Place the verify_certificate block folder under your moodle/blocks folder, upload to your server and click on the Administration>>Notifications link to install.
- Download and Unpack the Certificate zip file in a temporary area,
- Copy the "certificate" folder to your moodle mod folder located for example at yourhost\moodle\mod . This will include folders db, lang and all the subfolders located under pics.
- Note: It is not necessary to move the lang file into the Moodle lang folder, the certificate lang folder can stay in the mod/certificate folder.
- Go to your Moodle, and click on the Notifications link in the administation block. Moodle knows something has been added and it will proceed to install the certificate module.
See also: Installing_contributed_modules_or_plugins in MoodleDocs.
These instructions are for a certificate that works with Moodle 1.9.x . Earlier versions of Certificate will have similar instructions.
Put in your certificate name. This will appear on the certificate. Add an introduction for students which will appear above the "Get your certificate" button.
- Email Teachers - Yes or No.
- Email Others - add email addresses, separated by a comma.
- Delivery - should students open in a new window, force them to download, or be emailed certificate
- Save Certificates - No or Yes. If emailed you must save. Saving also allows reprinting of a certificate.
Common module settings
Tips & Tricks
Certificate icon location
If you are using your own theme you have to put the icon.gif inside a folder called certificate and put in your mod folder image. For example, if your theme uses custom icons, you must put a certificate folder with the certificate icon.gif in it under your theme/pix/mod folder.
Lesson dependency trick 1
The best trick to enable a conditional certificate is to upgrade to Moodle 1.9 and use the new Certificate version. The 1.9 Certificate allows the teacher to set a dependency on different activities.
Many Moodlers issue a certificate upon successful completion of a course. For those who use Questions in a Lesson to determine if a student can receive a certificate, here is one way to hide the certificate until the student passes. At the end of a lesson we will provide the student an option to select a link that will print a hidden certificate activity. The only non standard Moodle feature this uses is the Certificate module itself. Lesson dependency is available from 1.6 onward.
- Create a Certificate activity. Hide it.
- Create a lesson. We will call it "Certificate Qualification". This is the lesson that needs to be passed to get a certificate. We might add questions to this lesson as a means to automatically determine that student qualifies for a certificate.
- Create another lesson. We will call it "Certificate Gateway". In lesson settings make it dependent upon the "Certificate Qualification". For example we might say a student must answer 80% of the questions correctly. Still in lesson setting go to the link to activity setting and link it to Certificate.
Student view of the above example. The student will see a course with 2 lessons. If they try to enter the Certificate Gateway Lesson, first, they will be told that they must pass the Certificate Qualification Lesson with a score of 80% or higher. When the student takes the Certificate Qualification Lesson and only scores 70%, they will not be able to take the Certificate Gateway Lesson. The only way they can get to the certificate is to qualify to take the Certificate Gateway Lesson.
Important Note: For this trick to work you must have Show Grades set to Yes in the Course settings page or this trick won't work (and you'll get very frustrated wondering why :) )
The certificate code is located in the /mod/certificate folder. In 1.9 there are sub-folders for db, lang (holds language sub-folders), pix (holds sub-folders for boarders, seals, signatures and watermarks) and type (holds 6 standard certificate types, each in their own sub-folder).
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. Here is how:
1. Choose the certificate/type folder with the size/orientation you desire, copy and paste it in the certificate/type folder and give the copied folder a new name. For example copy the /type/letter_landscape folder and rename it 'mycertificate'.
2. Open the certificate/lang/en_utf8/certificate.php file and add the name of your new folder type. Following the above example, you would add:
- $string['typemycertificate'] = 'My New Certificate';
Now, when you add a certificate to a course, your new type should appear on the drop down list as "My New Certificate".
To add your own JPG or PNG image, place it in the appropriate mod/certificate/pix folder on your site. Your JPG or PNG image will now appear in the dropdown list by it's file name. This is an easy way to add your custom logo, signature or watermarks.
Make sure your new files are the same size as the standard images. For example, the standard signature file is 150x31 pixels. If the signature file is a different size, you may need to modify the code line. The same will be true for seals, borders and watermarks.
Modifing image position code example
Lets look at the signature code that is found in the letter_landscape type.
- print_signature($certificate->printsignature, $orientation, 110, 450, , );
Change it to:
- print_signature($certificate->printsignature, $orientation, 100, 435, 150, 75);
- We moved the image top left corner from the 110 margin position to the left and the 100 position.
- We raised the image from the 450 line on the page up to the 435 line.
- We set the width and height of the image to 150 by 75 pixels.
The default seal code for letter_landscape is below. We could alter it's position.
- print_seal($certificate->printseal, $orientation, 590, 425, , );
Changing Printed Text
There are different lang strings in the certificate/lang/en_utf8/certificate.php file for each certificate type, so be sure to change the correct one for the type you are using (or create your own custom type--see above). For example, if you want to customize the text for the landscape type, you can change these lines in the above mentioned lang file:
- $string['titlelandscape'] = 'CERTIFICATE OF ACHIEVEMENT';
- $string['introlandscape'] = 'This is to certify that';
- $string['statementlandscape'] = 'has successfully completed the course';
- $string['statementlandscape'] = 'has successfully passed the final exam';
Adding a New Line of Text
1. Open the certificate/lang/en_utf8/certificate.php file and add your new lang string giving it a unique name, e.g.:
- $string['mynewtext'] = 'This is what I want to print on the certificate';
2. Open the file for your certificate type, e.g. certificate/type/mycertificate/certificate.php. At the bottom of the page below '// Add Text' is the code that prints--you guessed it--text on the certificate. Find the current line below which you would like your new text to be printed. For example, if you want your text to print below the course name, find the line:
- cert_printtext(170, 330, 'C', 'Helvetica', '', 20, utf8_decode($classname));
3. Add a new line below that to print your new text using the name you gave your new lang string like this:
- cert_printtext(170, 350, 'C', 'Helvetica', '', 20, utf8_decode(get_string('mynewtext', 'certificate')));
- note: Make sure you a string to the language file called mynewtext. The above line of code gets that string.
4. You can adjust the placement over from the left by increasing or decreasing the '170' number. You can adjust the placement down on the page by increasing or decreasing the '350' number. Changing 'C' to 'L' or 'R' will print on the left or right side. For different fonts, see the moodle/lib/fpdf font folder for non-unicode types, and the moodle/lib/tcpdf/fonts folder for unicode types, for available fonts. (NOTE: for unicode certificates, using more than one font is NOT recommended since the entire font gets embedded in the certificate--increasing the certificate file size.) In the after the font name, you can add 'B' for bold, 'I' for italic, or 'U' for underline. Changing the '10' number will change the font size.
- cert_printtext(170, 350, 'C', 'Times', , 10, utf8_decode($USER->idnumber));
5. You can add a hard coded line of text. For example, a signature title block line:
- cert_printtext(150, 490, 'L', 'Times', , 10, utf8_decode('Martin Dougiamas, Lead Developer'));
Add your string to the pdf image
You can add your own custom string to the pdf print section. We wanted to add "These Continuing Credits are from Our University" below the title of the course. We used the landscape certificate type.
We added the string to the language file.
- $string(ceusfromus) = 'These Continuing Credits are from Our University';
In the type folder's certificate.php file, in the PDF area near the end of the file, we put the following line:
- cert_printtext(170, 380, 'C', 'Helvetica', '', 16, utf8_decode (get_string('ceusfromus', 'certificate')));
Tips and Tricks
- Start with one of the existing certificate types, copy it and modify it.
- Try your customized code on a non production site, such as a local host.
- In Administration>>Server set debugging to maximum (to show any coding error messages).
- While you can leave a php file open in edit mode, you must save the file before your changes become active.
- Make code changes one at a time, test and then backup after each successful change. For example,after adding a new string to the certificate lang file), go to your course page and click on a certificate to see if it appears on the list.
- If you broke the code you may get a blank screen for a certificate.
- So it might be a good idea to make a backup of each successful change before starting the next change. For example, after the 3rd code change, save certificate.php as certificate3.txt.
The links below will lead to the current download areas
- Moodle.org link Certificate at Modules and plugins
- Moodle.org link Certificate Sitewide Reports
- Moodle.org link Certificate Validation Block