ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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)
 getCertificateVariablesForPreview ()
 Returns an array containing all variables and values which can be exchanged in the certificate.
 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.
 getCertificateVariablesDescription ()
 Returns a description of the available certificate parameters.
 getAdapterType ()
 Returns the adapter type This value will be used to generate file names for the certificates.
 getCertificateID ()
 Returns a certificate ID This value will be used to generate unique file names for the certificates.
 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.
 addFormFieldsFromPOST (&$form_fields)
 Allows to add additional form values to the array of form values evaluating a HTTP POST action.
 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.
 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.
 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.
 getCertificateFilename ($params=array())
 Set the name of the certificate file This method will be called when the certificate will be generated.
 getUserIdForParams ($a_params)
 Get user id for params.

Protected Member Functions

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

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

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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, and ilExerciseCertificateAdapter.

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

{
}
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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, and ilExerciseCertificateAdapter.

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

{
}
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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, and ilExerciseCertificateAdapter.

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

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

{
}
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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, ilExerciseCertificateAdapter, and ilCourseCertificateAdapter.

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.

References $lng.

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

{
global $lng;
$vars = array(
"USER_LOGIN" => $lng->txt("certificate_ph_login"),
"USER_FULLNAME" => $lng->txt("certificate_ph_fullname"),
"USER_FIRSTNAME" => $lng->txt("certificate_ph_firstname"),
"USER_LASTNAME" => $lng->txt("certificate_ph_lastname"),
"USER_TITLE" => $lng->txt("certificate_ph_title"),
"USER_SALUTATION" => $lng->txt("certificate_ph_salutation"),
"USER_BIRTHDAY" => $lng->txt("certificate_ph_birthday"),
"USER_INSTITUTION" => $lng->txt("certificate_ph_institution"),
"USER_DEPARTMENT" => $lng->txt("certificate_ph_department"),
"USER_STREET" => $lng->txt("certificate_ph_street"),
"USER_CITY" => $lng->txt("certificate_ph_city"),
"USER_ZIPCODE" => $lng->txt("certificate_ph_zipcode"),
"USER_COUNTRY" => $lng->txt("certificate_ph_country")
);
if($a_enable_last_access)
{
$vars["USER_LASTACCESS"] = $lng->txt("certificate_ph_lastaccess");
}
$vars["DATE"] = $lng->txt("certificate_ph_date");
$vars["DATETIME"] = $lng->txt("certificate_ph_datetime");
if($a_enable_completion_date)
{
$vars["DATE_COMPLETED"] = $lng->txt("certificate_ph_date_completed");
$vars["DATETIME_COMPLETED"] = $lng->txt("certificate_ph_datetime_completed");
}
return $vars;
}

+ Here is the caller graph for this function:

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 240 of file class.ilCertificateAdapter.php.

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

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

{
global $lng;
$salutation = "";
if (strlen($a_user_data["gender"]))
{
$salutation = $lng->txt("salutation_" . $a_user_data["gender"]);
}
$birthday = "";
if($a_user_data["birthday"])
{
$birthday = ilDatePresentation::formatDate(new ilDate($a_user_data["birthday"], IL_CAL_DATE));
}
$country = $a_user_data["sel_country"];
if($country)
{
$lng->loadLanguageModule("meta");
$country = $lng->txt("meta_c_".$country);
}
else
{
$country = $a_user_data["country"];
}
$vars = array(
"USER_LOGIN" => ilUtil::prepareFormOutput(trim($a_user_data["login"])),
"USER_FULLNAME" => ilUtil::prepareFormOutput(trim($a_user_data["title"] . " " . $a_user_data["firstname"] . " " . $a_user_data["lastname"])),
"USER_FIRSTNAME" => ilUtil::prepareFormOutput($a_user_data["firstname"]),
"USER_LASTNAME" => ilUtil::prepareFormOutput($a_user_data["lastname"]),
"USER_TITLE" => ilUtil::prepareFormOutput($a_user_data["title"]),
"USER_SALUTATION" => ilUtil::prepareFormOutput($salutation),
"USER_BIRTHDAY" => ilUtil::prepareFormOutput($birthday),
"USER_INSTITUTION" => ilUtil::prepareFormOutput($a_user_data["institution"]),
"USER_DEPARTMENT" => ilUtil::prepareFormOutput($a_user_data["department"]),
"USER_STREET" => ilUtil::prepareFormOutput($a_user_data["street"]),
"USER_CITY" => ilUtil::prepareFormOutput($a_user_data["city"]),
"USER_ZIPCODE" => ilUtil::prepareFormOutput($a_user_data["zipcode"]),
"USER_COUNTRY" => ilUtil::prepareFormOutput($country)
);
if($a_last_access)
{
$vars["USER_LASTACCESS"] = ilDatePresentation::formatDate(new ilDateTime($a_last_access, IL_CAL_DATETIME));
}
$vars["DATE"] = ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX));
$vars["DATETIME"] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX));
if($a_completion_date)
{
$vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($a_completion_date, IL_CAL_DATETIME));
$vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($a_completion_date, IL_CAL_DATETIME));
}
return $vars;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 189 of file class.ilCertificateAdapter.php.

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

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

{
global $lng;
$vars = array(
"USER_LOGIN" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_login")),
"USER_FULLNAME" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_fullname")),
"USER_FIRSTNAME" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_firstname")),
"USER_LASTNAME" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_lastname")),
"USER_TITLE" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_title")),
"USER_SALUTATION" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_salutation")),
"USER_BIRTHDAY" => ilDatePresentation::formatDate(new ilDate($lng->txt("certificate_var_user_birthday"), IL_CAL_DATE)),
"USER_INSTITUTION" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_institution")),
"USER_DEPARTMENT" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_department")),
"USER_STREET" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_street")),
"USER_CITY" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_city")),
"USER_ZIPCODE" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_zipcode")),
"USER_COUNTRY" => ilUtil::prepareFormOutput($lng->txt("certificate_var_user_country"))
);
if($a_enable_last_access)
{
$vars["USER_LASTACCESS"] = ilDatePresentation::formatDate(new ilDateTime(time() - (24 * 60 * 60 * 5), IL_CAL_UNIX));
};
$vars["DATE"] = ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX));
$vars["DATETIME"] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX));
if($a_enable_completion_date)
{
$vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate(time() - (24 * 60 * 60 * 5), IL_CAL_UNIX));
$vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime(time() - (24 * 60 * 60 * 5), IL_CAL_UNIX));
}
return $vars;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References $lng.

{
global $lng;
$lng->loadLanguageModule("certificate");
return $lng->txt("certificate_file_basename").".pdf";
}
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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, ilExerciseCertificateAdapter, and ilCourseCertificateAdapter.

ilCertificateAdapter::getCertificatePath ( )
abstract

Returns the certificate path (with a trailing path separator)

Returns
string The certificate path

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

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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, ilExerciseCertificateAdapter, and ilCourseCertificateAdapter.

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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilExerciseCertificateAdapter, ilCourseCertificateAdapter, and ilSkillCertificateAdapter.

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, ilTestCertificateAdapter, ilSCORMCertificateAdapter, and ilSkillCertificateAdapter.

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 313 of file class.ilCertificateAdapter.php.

References ilLPStatus\_lookupStatusChanged().

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

{
if(!$a_object_id)
{
$a_object_id = $this->object->getId();
}
include_once "Services/Tracking/classes/class.ilLPStatus.php";
return ilLPStatus::_lookupStatusChanged($a_object_id, $a_user_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCertificateAdapter::getUserIdForParams (   $a_params)

Get user id for params.

Parameters
@return

Reimplemented in ilSCORMCertificateAdapter, and ilTestCertificateAdapter.

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

{
return $a_params["user_id"];
}
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 ilSCORMCertificateAdapter, ilTestCertificateAdapter, ilSkillCertificateAdapter, and ilExerciseCertificateAdapter.

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

{
}

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