Integration of data in the certificate templates

Introduction

The Certificate module places a free layout of text above a full page background image.

The text must be written in simple HTML, using a reduced set of tags. The underlying technology is the writeHTMLCell function of the TCPDF library that allows some limited formatting of HTML formatted text content in the PDF document.

Note that placement may not be always accurate.

Future version

Last experiments have been successful using a data ⇒ formatting function + location placement using simple Json descriptors. This method, with an addition of a coordinates grid printed on a test version of the document leaded to quite good results, and making tuning of the document much more accurate thatn the HTML template. We will integrate this method in the nest releases.

HTML tags

Among the recognized (most common) tags:

Titles: <H1> to <H3> (return of H4, H5 and H6 is not guaranteed)

Paragraphs : <P>

The spacers : <BR>

Simple lists : <UL>, <OL>, <LI>

The <CENTER> or <RIGHT> sections are recognized

The COLOR attribute is recognized

Mustache Tag

{{pagebreak}} for a page break

Variable placeholders

The placeholders are processed at production time of the output document. Header, content and footer boxes are processed by the replacement function.

The replacement of the tags cannot process any content calling images by the IMG tag, which is NOT supported by the underlying TCPDF generator. Combining additional (images) can only be obtained by programming. The module already allows the integration of a logo, a signature and a verification QRcode.

Many environmental variables can be inserted into the text by tags:

User data

{{info:user_fullname}} : Full user name

{{info:user_firstname}} : First name

{{info:user_lastname}} : Name

<noki>user_idnumber</nowiki> : External identifier number

{{info:user_country}} : Country code

{{info:user_city}} : City

{{info:user_institution}} : Institution

{{info:user_department}} : Department

Data related to custom profile fields

{{info:user_<custom field short name>}} new

E.g. : {{info:user_birthday}} E.g.: {{user:gender}} (custom fields)

Note: In general, user data can also be retrieved in the form:

<nowiki>{{user:<fieldname>}}</nowiki>

Local data of the activity instance

{{info:certificate_date}} : Date of issuance of the certificate

{{info:certificate_outcome}} : Purpose of the certificate

<nouki>certificate_credit_hours</nowiki> : Time credit filled in for the certificate

<nouki>certificate_user_credit_hours</nowiki> : Time credit filled in for a user (overload)

<nouki>certificate_user_credit_hours_text</nowiki> : Information time credit (hour credit overload: X h)

{{info:certificate_credit_days}} : Day credit filled in for the certificate

{{info:certificate_user_credit_days}} : Information day credit for a user (overload)

<nouki>certificate_user_credit_days_text</nowiki> : Credit of days filled (credit overload of days : X j)

{{info:certificate_code}} : Unique certificate code

{{info:certificate_certifier}} : Identity of the attesting authority

{{info:certificate_teachers}} : List of teachers

Course data

<nouki>course_shortname</nowiki> : Short name of the course

{{info:course_fullname}} : Full name of the course * <nowiki>{{info:course_summary}} : Course summary

{{info:course_category}} : Course category

{{info:course_idnumber}} : External course identifier

<nouki>grade_race</nowiki> : Grade obtained from the course

<nouki>module_grade_cmid</nowiki> : Note obtained on the module id indicated (PRO only)

Site or general context data

{{info:site_fullname}} : Full name of the site

{{info:site_shortname}} : Short name of the site

{{info:site_city}} : City of the site, taken as the “default city” of the global settings.

{{info:site_country}} : Country of the site, taken as the “default country code” of the global settings.

Completion and registration data

{{info:user_enrolment_date}} : (Last) Date of registration in the course

{{info:user_enrolment_end_date}} : End date of enrollment in the course

{{info:completion_date}} : Course completion date. new

{{info:legalstartdate}} : Administrative departure date of the training. (PRO only) new

{{info:legalenddate}} : Administrative end date of the training. (PRO only) new

<noki>module_completion_date_cmid</nowiki>: Date of completion of a specific course module given by ID. (PRO Only)

Specific data when using the revision tray solution

{{info:uqm_exam_grade_A}}: Using the revision board - Note first series of note

{{info:uqm_exam_grade_C}}: Using the revision tray - Note second series of note

Special data (requires the availability of complementary plugins)

Group-related special data

<nouki>group_specific</nowiki> : Group-specific text. Is obtained from an instance of the block HTML block by group found in the course (the first).

Special course data

{{info:current_total_time}} : Total time spent in the course, according to the block calculations Block Use_Stats / User time stats

Generic integration of data from compatible plugins (PRO only)

It is now possible, for the plugins that have developed the PDCertificate data query API, to provide some data to be integrated in the output document. The nature of the data depends on each plugin whose developers determine the semantics of the exported data and the corresponding keys.

The general form of a data recovery tag of any plugin is:

{{plugin:<pluginname>:<datakey>:<contextinfo>}}

pluginname is the plugin's moodle name (e.g. local_onboarding)

datakey is a data key, usually formed by a simple token. Some complex data may be provided as objects, adressable by “data member” using a “pipe” syntax (e.g. session|idnumber or institution|name). (See note below to know why it was not e.g. dotted as usual)

contextinfo In general, the API invoked in the plugin requires an instance and a userid. The PDcertificate provides its own identity, and the “userid” of the certificate document being produced. If not sufficiant, you may add static context information when calling the plugin API.

The definition of the integrable dataset of a plugin SHOULD BE documented in the plugin's documentation.

Compatible plugins :

Local Registration Plug (Onboarding)

Note : why not a dotted syntax name1.name2'? The point used in mustache templates has its own meaning for mustache. Its use collides with the syntax of defining a simple data for injection into the certificate. The use of the “pipe” (|) is neutral for mustache.

Data related to activated license version: Management of absences

Individual locking of certificates, in the case of absence.

Time spent by partially absent learning at a training that will be called by the dynamic field {{info:certificate_user_credit_hours}}. This time information actually granted to the trainee can be entered in the parameters of the certificate of each trainee.

(Information in “days” can also be given, with the fields {{info:certificate_credit_days}} and {{info:certificate_user_credit_days}}, when accounting is done in the day. Both information can be combined in the most demanding cases)

Credits

Valéry Frémaux (Valery@activeproLearn.com): Development & testing

Florence Labord (Florence@activeproLearn.com) : Functional Review, Documentation

Retour à l'index du guide technique - Revenir à l'index du composant- Revenir à l'index des plugins - Revenir au catalogue