Table des matières

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:

Mustache Tag

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

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

Course data

Site or general context data

Completion and registration data

Specific data when using the revision tray solution

Special data (requires the availability of complementary plugins)

Special course data

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>}}

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

Compatible plugins :

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.

(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


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