ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSkillCertificateAdapter Class Reference

Skill certificate adapter. More...

+ Inheritance diagram for ilSkillCertificateAdapter:
+ Collaboration diagram for ilSkillCertificateAdapter:

Public Member Functions

 __construct ($a_skill, $a_skill_level_id)
 Contructor. More...
 
 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...
 
 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...
 
 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...
 
 getCertificateFilename ($params=array())
 Set the name of the certificate file This method will be called when the certificate will be generated. 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...
 
- Public Member Functions inherited from ilCertificateAdapter
 __construct ()
 ilCertificateAdapter constructor. More...
 
 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 Attributes

 $object
 
- Protected Attributes inherited from ilCertificateAdapter
 $lng
 

Private Attributes

 $skill
 
 $skill_level_id
 

Additional Inherited Members

- Protected Member Functions inherited from ilCertificateAdapter
 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

Skill certificate adapter.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilSkillCertificateAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillCertificateAdapter::__construct (   $a_skill,
  $a_skill_level_id 
)

Contructor.

Parameters
objectskill object
objectskill level id

Definition at line 26 of file class.ilSkillCertificateAdapter.php.

27  {
28  $this->skill = $a_skill;
29  $this->skill_level_id = $a_skill_level_id;
30  parent::__construct();
31  $this->lng->loadLanguageModule('skmg');
32  }

Member Function Documentation

◆ addAdditionalFormElements()

ilSkillCertificateAdapter::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

Definition at line 147 of file class.ilSkillCertificateAdapter.php.

148  {
149  }

◆ addFormFieldsFromObject()

ilSkillCertificateAdapter::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

Definition at line 171 of file class.ilSkillCertificateAdapter.php.

172  {
173  }

◆ addFormFieldsFromPOST()

ilSkillCertificateAdapter::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

Definition at line 159 of file class.ilSkillCertificateAdapter.php.

160  {
161  }

◆ deleteCertificate()

ilSkillCertificateAdapter::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.

Definition at line 232 of file class.ilSkillCertificateAdapter.php.

233  {
234  }

◆ getAdapterType()

ilSkillCertificateAdapter::getAdapterType ( )

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

Definition at line 192 of file class.ilSkillCertificateAdapter.php.

193  {
194  return "skill";
195  }

◆ getCertificateFilename()

ilSkillCertificateAdapter::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

Definition at line 214 of file class.ilSkillCertificateAdapter.php.

References $params, and time.

215  {
216  $basename = parent::getCertificateFilename($params);
217 
218  $user_data = $params["user_data"];
219  if (!is_array($user_data)) {
220  $short_title = $this->skill->getShortTitleForCertificate();
221  return strftime("%y%m%d", time()) . "_" . $this->lng->txt("certificate_var_user_lastname") . "_" . $short_title . "_" . $basename;
222  } else {
223  return strftime("%y%m%d", time()) . "_" . $user_data["lastname"] . "_" . $params["short_title"] . "_" . $basename;
224  }
225  }
$params
Definition: disable.php:11
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

◆ getCertificateID()

ilSkillCertificateAdapter::getCertificateID ( )

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

Definition at line 203 of file class.ilSkillCertificateAdapter.php.

References $skill_level_id.

◆ getCertificatePath()

ilSkillCertificateAdapter::getCertificatePath ( )

Returns the certificate path (with a trailing path separator)

Returns
string The certificate path

Definition at line 39 of file class.ilSkillCertificateAdapter.php.

40  {
41  return CLIENT_WEB_DIR . "/certificates/skill/" . $this->skill->getId() .
42  "/" . $this->skill_level_id . "/";
43  }

◆ getCertificateVariablesDescription()

ilSkillCertificateAdapter::getCertificateVariablesDescription ( )

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

Definition at line 116 of file class.ilSkillCertificateAdapter.php.

References $id, $template, and ilCertificateAdapter\getBaseVariablesDescription().

117  {
118  $this->lng->loadLanguageModule("skmg");
119 
120  $vars = $this->getBaseVariablesDescription();
121  $vars["SKILL_TITLE"] = $this->lng->txt("skmg_cert_skill_title");
122  $vars["SKILL_LEVEL_TITLE"] = $this->lng->txt("skmg_cert_skill_level_title");
123  $vars["SKILL_TRIGGER_TITLE"] = $this->lng->txt("skmg_cert_skill_trigger_title");
124 
125  $template = new ilTemplate("tpl.certificate_edit.html", true, true, "Services/Skill");
126  $template->setCurrentBlock("items");
127  foreach ($vars as $id => $caption) {
128  $template->setVariable("ID", $id);
129  $template->setVariable("TXT", $caption);
130  $template->parseCurrentBlock();
131  }
132 
133  $template->setVariable("PH_INTRODUCTION", $this->lng->txt("certificate_ph_introduction"));
134 
135  return $template->get();
136  }
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
special template class to simplify handling of ITX/PEAR
getBaseVariablesDescription($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable descriptions.
+ Here is the call graph for this function:

◆ getCertificateVariablesForPresentation()

ilSkillCertificateAdapter::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.

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

Definition at line 78 of file class.ilSkillCertificateAdapter.php.

References $id, $old, $params, ilDatePresentation\formatDate(), ilCertificateAdapter\getBaseVariablesForPresentation(), IL_CAL_DATETIME, ilUtil\prepareFormOutput(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

79  {
80  $this->lng->loadLanguageModule('certificate');
81 
82  $user_data = $params["user_data"];
83 
84  $vars = $this->getBaseVariablesForPresentation($user_data, $params["last_access"], null);
85  $vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
86  $vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
87  $vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
88 
89  // custom completion date
90  $achievement_date = ilBasicSkill::lookupLevelAchievementDate($user_data["usr_id"], $this->skill_level_id);
91  if ($achievement_date !== false) {
94 
95  $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($achievement_date, IL_CAL_DATETIME));
96  $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($achievement_date, IL_CAL_DATETIME));
97 
99  } else {
100  $vars["DATE_COMPLETED"] = "";
101  $vars["DATETIME_COMPLETED"] = "";
102  }
103 
104  foreach ($vars as $id => $caption) {
105  $insert_tags["[" . $id . "]"] = $caption;
106  }
107  return $insert_tags;
108  }
$params
Definition: disable.php:11
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
if(!array_key_exists('StateId', $_REQUEST)) $id
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
Class for single dates.
Date and time handling
$old
getBaseVariablesForPresentation($a_user_data, $a_last_access=null, $a_completion_date=false)
Get variable values.
+ Here is the call graph for this function:

◆ getCertificateVariablesForPreview()

ilSkillCertificateAdapter::getCertificateVariablesForPreview ( )

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

Definition at line 51 of file class.ilSkillCertificateAdapter.php.

References $id, $old, array, ilCertificateAdapter\getBaseVariablesForPreview(), ilUtil\prepareFormOutput(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

52  {
55 
56  $vars = $this->getBaseVariablesForPreview();
57  $vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
58  $vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
59  $vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
60 
62 
63  $insert_tags = array();
64  foreach ($vars as $id => $caption) {
65  $insert_tags["[" . $id . "]"] = $caption;
66  }
67  return $insert_tags;
68  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
if(!array_key_exists('StateId', $_REQUEST)) $id
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
$old
Create styles array
The data for the language used.
getBaseVariablesForPreview($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable dummys.
+ Here is the call graph for this function:

◆ saveFormFields()

ilSkillCertificateAdapter::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

Definition at line 182 of file class.ilSkillCertificateAdapter.php.

183  {
184  }

Field Documentation

◆ $object

ilSkillCertificateAdapter::$object
protected

Definition at line 16 of file class.ilSkillCertificateAdapter.php.

◆ $skill

ilSkillCertificateAdapter::$skill
private

Definition at line 17 of file class.ilSkillCertificateAdapter.php.

◆ $skill_level_id

ilSkillCertificateAdapter::$skill_level_id
private

Definition at line 18 of file class.ilSkillCertificateAdapter.php.

Referenced by getCertificateID().


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