I would like to share the solution I used to meet the following requirement. I need three different certificates for a course, based on a combination of completion factors and examination scores.
The first part requires creating three different certificates for the course. I set up different restrict access rules for each certificate such that:
- no certificate is accessible if the course is not completed, and
- only one certificate is accessible if the course is completed, based on different exam results.
I did not want to display any scores on the certificate, as they would be meaningless to anyone viewing it. Basically, I wanted to distinguish among those who simply attended the course, those who succeeded in the course, and those who succeeded with distinction. So, I used a different string in the custom text field for each case:
- "has completed the course"
- "has completed with success the course"
- "has completed with distinction the course"
But, you will say, this duplicates what is already in the certificate, corresponding to the "statement" field in certificate.php. This is true. So, I changed certificate.php (for the certificate type I am using) as follows:
1) I commented out the line
// certificate_print_text($pdf, $x, $y + 55, 'C', $fontsans, '', 20, get_string('statement', 'certificate'));
2) I added immediately thereafter the line
certificate_print_text($pdf, $x, $y + 55, 'C', $fontsans, '', 20, $certificate->customtext);
3) I commented out the line
// certificate_print_text($pdf, $custx, $custy, 'L', null, null, null, $certificate->customtext);
which is farther down in the file.
I had to go to this trouble for these reasons:
1) the value of the variable 'statement' is set in only one place, in the language folder language. It is used for all certificate types and all certificates. I think this is an error of analysis, but that is another question.
2) I want to be able to adjust the texts in the certificates without having to go back and edit the php code each time.
Perhaps someone has a more elegant way of achieving this result, but in the meantime I hope it is of use to those with a similar need whose technical skills are as limited as mine.