ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCertificateAdapter Class Reference

Adapter class to provide certificate data for the certificate generator. More...

+ Inheritance diagram for ilCertificateAdapter:
+ Collaboration diagram for ilCertificateAdapter:

Public Member Functions

 getCertificatePath ()
 Returns the certificate path (with a trailing path separator) More...
 
 getCertificateVariablesForPreview ()
 Returns an array containing all variables and values which can be exchanged in the certificate. More...
 
 getCertificateVariablesForPresentation ($params=array())
 Returns an array containing all variables and values which can be exchanged in the certificate The values should be calculated from real data. More...
 
 getCertificateVariablesDescription ()
 Returns a description of the available certificate parameters. More...
 
 getAdapterType ()
 Returns the adapter type This value will be used to generate file names for the certificates. More...
 
 getCertificateID ()
 Returns a certificate ID This value will be used to generate unique file names for the certificates. More...
 
 addAdditionalFormElements (&$form, $form_fields)
 Allows to add additional form fields to the certificate editor form This method will be called when the certificate editor form will built using the ilPropertyFormGUI class. More...
 
 addFormFieldsFromPOST (&$form_fields)
 Allows to add additional form values to the array of form values evaluating a HTTP POST action. More...
 
 addFormFieldsFromObject (&$form_fields)
 Allows to add additional form values to the array of form values evaluating the associated adapter class if one exists This method will be called when the certificate editor form will be shown and the content of the form has to be retrieved from wherever the form values are saved. More...
 
 saveFormFields (&$form_fields)
 Allows to save additional adapter form fields This method will be called when the certificate editor form is complete and the form values will be saved. More...
 
 deleteCertificate ()
 Is called when the certificate is deleted Add some adapter specific code if more work has to be done when the certificate file was deleted. More...
 
 getCertificateFilename ($params=array())
 Set the name of the certificate file This method will be called when the certificate will be generated. More...
 
 getUserIdForParams ($a_params)
 Get user id for params. More...
 

Protected Member Functions

 getBaseVariablesDescription ($a_enable_last_access=true, $a_enable_completion_date=true)
 Get variable descriptions. More...
 
 getBaseVariablesForPreview ($a_enable_last_access=true, $a_enable_completion_date=true)
 Get variable dummys. More...
 
 getBaseVariablesForPresentation ($a_user_data, $a_last_access=null, $a_completion_date=false)
 Get variable values. More...
 
 getUserCompletionDate ($a_user_id, $a_object_id=null)
 Get completion for user. More...
 

Detailed Description

Adapter class to provide certificate data for the certificate generator.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 12 of file class.ilCertificateAdapter.php.

Member Function Documentation

◆ addAdditionalFormElements()

ilCertificateAdapter::addAdditionalFormElements ( $form,
  $form_fields 
)

Allows to add additional form fields to the certificate editor form This method will be called when the certificate editor form will built using the ilPropertyFormGUI class.

Additional fields will be added at the bottom of the form.

Parameters
object$formAn ilPropertyFormGUI instance
array$form_fieldsAn array containing the form values. The array keys are the names of the form fields

Reimplemented in ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

Definition at line 72 of file class.ilCertificateAdapter.php.

73 {
74
75 }

◆ addFormFieldsFromObject()

ilCertificateAdapter::addFormFieldsFromObject ( $form_fields)

Allows to add additional form values to the array of form values evaluating the associated adapter class if one exists This method will be called when the certificate editor form will be shown and the content of the form has to be retrieved from wherever the form values are saved.

Parameters
array$form_fieldsA reference to the array of form values

Reimplemented in ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

Definition at line 98 of file class.ilCertificateAdapter.php.

99 {
100
101 }

◆ addFormFieldsFromPOST()

ilCertificateAdapter::addFormFieldsFromPOST ( $form_fields)

Allows to add additional form values to the array of form values evaluating a HTTP POST action.

This method will be called when the certificate editor form will be saved using the form save button.

Parameters
array$form_fieldsA reference to the array of form values

Reimplemented in ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

Definition at line 85 of file class.ilCertificateAdapter.php.

86 {
87
88 }

◆ deleteCertificate()

ilCertificateAdapter::deleteCertificate ( )

Is called when the certificate is deleted Add some adapter specific code if more work has to be done when the certificate file was deleted.

Reimplemented in ilSCORMCertificateAdapter, and ilSkillCertificateAdapter.

Definition at line 120 of file class.ilCertificateAdapter.php.

121 {
122
123 }

◆ getAdapterType()

ilCertificateAdapter::getAdapterType ( )
abstract

Returns the adapter type This value will be used to generate file names for the certificates.

Returns
string A string value to represent the adapter type

Reimplemented in ilCourseCertificateAdapter, ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

◆ getBaseVariablesDescription()

ilCertificateAdapter::getBaseVariablesDescription (   $a_enable_last_access = true,
  $a_enable_completion_date = true 
)
protected

Get variable descriptions.

Parameters
bool$a_enable_last_access
bool$a_enable_completion_date
Returns
array

Definition at line 145 of file class.ilCertificateAdapter.php.

146 {
147 global $lng;
148
149 $vars = array(
150 "USER_LOGIN" => $lng->txt("certificate_ph_login"),
151 "USER_FULLNAME" => $lng->txt("certificate_ph_fullname"),
152 "USER_FIRSTNAME" => $lng->txt("certificate_ph_firstname"),
153 "USER_LASTNAME" => $lng->txt("certificate_ph_lastname"),
154 "USER_TITLE" => $lng->txt("certificate_ph_title"),
155 "USER_SALUTATION" => $lng->txt("certificate_ph_salutation"),
156 "USER_BIRTHDAY" => $lng->txt("certificate_ph_birthday"),
157 "USER_INSTITUTION" => $lng->txt("certificate_ph_institution"),
158 "USER_DEPARTMENT" => $lng->txt("certificate_ph_department"),
159 "USER_STREET" => $lng->txt("certificate_ph_street"),
160 "USER_CITY" => $lng->txt("certificate_ph_city"),
161 "USER_ZIPCODE" => $lng->txt("certificate_ph_zipcode"),
162 "USER_COUNTRY" => $lng->txt("certificate_ph_country"),
163 "USER_MATRICULATION" => $lng->txt("certificate_ph_matriculation")
164 );
165
166 if($a_enable_last_access)
167 {
168 $vars["USER_LASTACCESS"] = $lng->txt("certificate_ph_lastaccess");
169 }
170
171 $vars["DATE"] = $lng->txt("certificate_ph_date");
172 $vars["DATETIME"] = $lng->txt("certificate_ph_datetime");
173
174 if($a_enable_completion_date)
175 {
176 $vars["DATE_COMPLETED"] = $lng->txt("certificate_ph_date_completed");
177 $vars["DATETIME_COMPLETED"] = $lng->txt("certificate_ph_datetime_completed");
178 }
179
180 return $vars;
181 }
global $lng
Definition: privfeed.php:40

References $lng.

Referenced by ilCourseCertificateAdapter\getCertificateVariablesDescription(), ilExerciseCertificateAdapter\getCertificateVariablesDescription(), ilSCORMCertificateAdapter\getCertificateVariablesDescription(), ilTestCertificateAdapter\getCertificateVariablesDescription(), and ilSkillCertificateAdapter\getCertificateVariablesDescription().

+ Here is the caller graph for this function:

◆ getBaseVariablesForPresentation()

ilCertificateAdapter::getBaseVariablesForPresentation (   $a_user_data,
  $a_last_access = null,
  $a_completion_date = false 
)
protected

Get variable values.

Parameters
array$a_user_data
datetime$a_last_access
datetime$a_completion_date
Returns
array

Definition at line 242 of file class.ilCertificateAdapter.php.

243 {
244 global $lng;
245
248
249 $salutation = "";
250 if (strlen($a_user_data["gender"]))
251 {
252 $salutation = $lng->txt("salutation_" . $a_user_data["gender"]);
253 }
254
255 $birthday = "";
256 if($a_user_data["birthday"])
257 {
258 $birthday = ilDatePresentation::formatDate(new ilDate($a_user_data["birthday"], IL_CAL_DATE));
259 }
260
261 $country = $a_user_data["sel_country"];
262 if($country)
263 {
264 $lng->loadLanguageModule("meta");
265 $country = $lng->txt("meta_c_".$country);
266 }
267 else
268 {
269 $country = $a_user_data["country"];
270 }
271
272 $vars = array(
273 "USER_LOGIN" => ilUtil::prepareFormOutput(trim($a_user_data["login"])),
274 "USER_FULLNAME" => ilUtil::prepareFormOutput(trim($a_user_data["title"] . " " . $a_user_data["firstname"] . " " . $a_user_data["lastname"])),
275 "USER_FIRSTNAME" => ilUtil::prepareFormOutput($a_user_data["firstname"]),
276 "USER_LASTNAME" => ilUtil::prepareFormOutput($a_user_data["lastname"]),
277 "USER_TITLE" => ilUtil::prepareFormOutput($a_user_data["title"]),
278 "USER_SALUTATION" => ilUtil::prepareFormOutput($salutation),
279 "USER_BIRTHDAY" => ilUtil::prepareFormOutput($birthday),
280 "USER_INSTITUTION" => ilUtil::prepareFormOutput($a_user_data["institution"]),
281 "USER_DEPARTMENT" => ilUtil::prepareFormOutput($a_user_data["department"]),
282 "USER_STREET" => ilUtil::prepareFormOutput($a_user_data["street"]),
283 "USER_CITY" => ilUtil::prepareFormOutput($a_user_data["city"]),
284 "USER_ZIPCODE" => ilUtil::prepareFormOutput($a_user_data["zipcode"]),
285 "USER_COUNTRY" => ilUtil::prepareFormOutput($country),
286 "USER_MATRICULATION" => ilUtil::prepareFormOutput($a_user_data["matriculation"])
287 );
288
289 if($a_last_access)
290 {
291 $vars["USER_LASTACCESS"] = ilDatePresentation::formatDate(new ilDateTime($a_last_access, IL_CAL_DATETIME));
292 }
293
294 $vars["DATE"] = ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX));
295 $vars["DATETIME"] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX));
296
297
298 if($a_completion_date)
299 {
300 $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($a_completion_date, IL_CAL_DATETIME));
301 $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($a_completion_date, IL_CAL_DATETIME));
302 }
303
305
306 return $vars;
307 }
const IL_CAL_DATE
const IL_CAL_UNIX
const IL_CAL_DATETIME
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
static useRelativeDates()
check if relative dates are used
@classDescription Date and time handling
Class for single dates.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $lng, ilDatePresentation\formatDate(), IL_CAL_DATE, IL_CAL_DATETIME, IL_CAL_UNIX, ilUtil\prepareFormOutput(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by ilCourseCertificateAdapter\getCertificateVariablesForPresentation(), ilExerciseCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilTestCertificateAdapter\getCertificateVariablesForPresentation(), and ilSkillCertificateAdapter\getCertificateVariablesForPresentation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBaseVariablesForPreview()

ilCertificateAdapter::getBaseVariablesForPreview (   $a_enable_last_access = true,
  $a_enable_completion_date = true 
)
protected

Get variable dummys.

Parameters
bool$a_enable_last_access
bool$a_enable_completion_date
Returns
array

Definition at line 190 of file class.ilCertificateAdapter.php.

191 {
192 global $lng;
193
196
197 $vars = array(
198 "USER_LOGIN" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_login")),
199 "USER_FULLNAME" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_fullname")),
200 "USER_FIRSTNAME" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_firstname")),
201 "USER_LASTNAME" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_lastname")),
202 "USER_TITLE" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_title")),
203 "USER_SALUTATION" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_salutation")),
204 "USER_BIRTHDAY" => ilDatePresentation::formatDate(new ilDate($lng->txt("certificate_var_user_birthday"), IL_CAL_DATE)),
205 "USER_INSTITUTION" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_institution")),
206 "USER_DEPARTMENT" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_department")),
207 "USER_STREET" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_street")),
208 "USER_CITY" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_city")),
209 "USER_ZIPCODE" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_zipcode")),
210 "USER_COUNTRY" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_country")),
211 "USER_MATRICULATION" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_matriculation"))
212 );
213
214 if($a_enable_last_access)
215 {
216 $vars["USER_LASTACCESS"] = ilDatePresentation::formatDate(new ilDateTime(time() - (24 * 60 * 60 * 5), IL_CAL_UNIX));
217 };
218
219 $vars["DATE"] = ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX));
220 $vars["DATETIME"] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX));
221
222 if($a_enable_completion_date)
223 {
224 $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate(time() - (24 * 60 * 60 * 5), IL_CAL_UNIX));
225 $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime(time() - (24 * 60 * 60 * 5), IL_CAL_UNIX));
226 }
227
229
230 return $vars;
231 }

References $lng, ilDatePresentation\formatDate(), IL_CAL_DATE, IL_CAL_UNIX, ilUtil\prepareFormOutput(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by ilCourseCertificateAdapter\getCertificateVariablesForPreview(), ilExerciseCertificateAdapter\getCertificateVariablesForPreview(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), ilTestCertificateAdapter\getCertificateVariablesForPreview(), and ilSkillCertificateAdapter\getCertificateVariablesForPreview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCertificateFilename()

ilCertificateAdapter::getCertificateFilename (   $params = array())

Set the name of the certificate file This method will be called when the certificate will be generated.

Returns
string The certificate file name

Reimplemented in ilSCORMCertificateAdapter, and ilSkillCertificateAdapter.

Definition at line 131 of file class.ilCertificateAdapter.php.

132 {
133 global $lng;
134 $lng->loadLanguageModule("certificate");
135 return $lng->txt("certificate_file_basename").".pdf";
136 }

References $lng.

◆ getCertificateID()

ilCertificateAdapter::getCertificateID ( )
abstract

Returns a certificate ID This value will be used to generate unique file names for the certificates.

Returns
mixed A unique ID which represents a certificate

Reimplemented in ilCourseCertificateAdapter, ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

◆ getCertificatePath()

ilCertificateAdapter::getCertificatePath ( )
abstract

Returns the certificate path (with a trailing path separator)

Returns
string The certificate path

Reimplemented in ilCourseCertificateAdapter, ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

◆ getCertificateVariablesDescription()

ilCertificateAdapter::getCertificateVariablesDescription ( )
abstract

Returns a description of the available certificate parameters.

The description will be shown at the bottom of the certificate editor text area.

Returns
string The certificate parameters description

Reimplemented in ilCourseCertificateAdapter, ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

◆ getCertificateVariablesForPresentation()

ilCertificateAdapter::getCertificateVariablesForPresentation (   $params = array())
abstract

Returns an array containing all variables and values which can be exchanged in the certificate The values should be calculated from real data.

The $params parameter array should contain all necessary information to calculate the values.

Parameters
array$paramsAn array of parameters to calculate the certificate parameter values
Returns
array The certificate variables

Reimplemented in ilCourseCertificateAdapter, ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

◆ getCertificateVariablesForPreview()

ilCertificateAdapter::getCertificateVariablesForPreview ( )
abstract

Returns an array containing all variables and values which can be exchanged in the certificate.

The values will be taken for the certificate preview.

Returns
array The certificate variables

Reimplemented in ilCourseCertificateAdapter, ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

◆ getUserCompletionDate()

ilCertificateAdapter::getUserCompletionDate (   $a_user_id,
  $a_object_id = null 
)
protected

Get completion for user.

Parameters
int$a_user_id
int$a_object_id
Returns
string datetime

Definition at line 316 of file class.ilCertificateAdapter.php.

317 {
318 if(!$a_object_id)
319 {
320 $a_object_id = $this->object->getId();
321 }
322 include_once "Services/Tracking/classes/class.ilLPStatus.php";
323 return ilLPStatus::_lookupStatusChanged($a_object_id, $a_user_id);
324 }
_lookupStatusChanged($a_obj_id, $a_user_id)
Lookup status changed.

References ilLPStatus\_lookupStatusChanged().

Referenced by ilExerciseCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), and ilTestCertificateAdapter\getCertificateVariablesForPresentation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserIdForParams()

ilCertificateAdapter::getUserIdForParams (   $a_params)

Get user id for params.

Parameters

return

Reimplemented in ilSCORMCertificateAdapter, and ilTestCertificateAdapter.

Definition at line 332 of file class.ilCertificateAdapter.php.

333 {
334 return $a_params["user_id"];
335 }

◆ saveFormFields()

ilCertificateAdapter::saveFormFields ( $form_fields)

Allows to save additional adapter form fields This method will be called when the certificate editor form is complete and the form values will be saved.

Parameters
array$form_fieldsA reference to the array of form values

Reimplemented in ilExerciseCertificateAdapter, ilSCORMCertificateAdapter, ilTestCertificateAdapter, and ilSkillCertificateAdapter.

Definition at line 110 of file class.ilCertificateAdapter.php.

111 {
112
113 }

The documentation for this class was generated from the following file: