ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

Reimplemented from ilCertificateAdapter.

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

160 {
161 global $lng;
162 /*$short_name = new ilTextInputGUI($lng->txt("certificate_short_name"), "short_name");
163 $short_name->setRequired(TRUE);
164 require_once "./Services/Utilities/classes/class.ilStr.php";
165 $short_name->setValue(strlen($form_fields["short_name"]) ? $form_fields["short_name"] : ilStr::subStr($this->object->getTitle(), 0, 30));
166 $short_name->setSize(30);
167 if (strlen($form_fields["short_name"])) {
168 $short_name->setInfo(str_replace("[SHORT_TITLE]", $form_fields["short_name"], $lng->txt("certificate_short_name_description")));
169 } else {
170 $short_name->setInfo($lng->txt("certificate_short_name_description"));
171 }
172 if (count($_POST)) $short_name->checkInput();
173 $form->addItem($short_name);
174
175 $visibility = new ilCheckboxInputGUI($lng->txt("certificate_enabled_scorm"), "certificate_enabled_scorm");
176 $visibility->setInfo($lng->txt("certificate_enabled_scorm_introduction"));
177 $visibility->setValue(1);
178 if ($form_fields["certificate_enabled_scorm"])
179 {
180 $visibility->setChecked(TRUE);
181 }
182 if (count($_POST)) $visibility->checkInput();
183 $form->addItem($visibility);*/
184 }

References ilCertificateAdapter\$lng.

◆ 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

Reimplemented from ilCertificateAdapter.

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

209 {
210 global $ilSetting;
211 //$scormSetting = new ilSetting("scorm");
212 //$form_fields["certificate_enabled_scorm"] = $scormSetting->get("certificate_" . $this->object->getId());
213 //$form_fields["short_name"] = $scormSetting->get("certificate_short_name_" . $this->object->getId());
214 }
global $ilSetting
Definition: privfeed.php:17

References $ilSetting.

◆ 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

Reimplemented from ilCertificateAdapter.

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

195 {
196 //$form_fields["certificate_enabled_scorm"] = $_POST["certificate_enabled_scorm"];
197 //$form_fields["short_name"] = $_POST["short_name"];
198 }

◆ 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.

Reimplemented from ilCertificateAdapter.

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

283 {
284 global $ilSetting;
285 //$scormSetting = new ilSetting("scorm");
286 //$scormSetting->delete("certificate_" . $this->object->getId());
287 }

References $ilSetting.

◆ 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

Reimplemented from ilCertificateAdapter.

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

238 {
239 return "skill";
240 }

◆ 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

Reimplemented from ilCertificateAdapter.

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

260 {
261 global $lng;
262
263 $basename = parent::getCertificateFilename($params);
264
265 $user_data = $params["user_data"];
266 if (!is_array($user_data))
267 {
268 $short_title = $this->skill->getShortTitleForCertificate();
269 return strftime("%y%m%d", time()) . "_" . $lng->txt("certificate_var_user_lastname") . "_" . $short_title . "_" . $basename;
270 }
271 else
272 {
273 return strftime("%y%m%d", time()) . "_" . $user_data["lastname"] . "_" . $params["short_title"] . "_" . $basename;
274 }
275 }
$params
Definition: example_049.php:96

References ilCertificateAdapter\$lng, and $params.

◆ 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

Reimplemented from ilCertificateAdapter.

Definition at line 248 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

Reimplemented from ilCertificateAdapter.

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

Reimplemented from ilCertificateAdapter.

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

126 {
127 global $lng;
128
129 $lng->loadLanguageModule("skmg");
130
131 $vars = $this->getBaseVariablesDescription();
132 $vars["SKILL_TITLE"] = $lng->txt("skmg_cert_skill_title");
133 $vars["SKILL_LEVEL_TITLE"] = $lng->txt("skmg_cert_skill_level_title");
134 $vars["SKILL_TRIGGER_TITLE"] = $lng->txt("skmg_cert_skill_trigger_title");
135
136 $template = new ilTemplate("tpl.certificate_edit.html", TRUE, TRUE, "Services/Skill");
137 $template->setCurrentBlock("items");
138 foreach($vars as $id => $caption)
139 {
140 $template->setVariable("ID", $id);
141 $template->setVariable("TXT", $caption);
142 $template->parseCurrentBlock();
143 }
144
145 $template->setVariable("PH_INTRODUCTION", $lng->txt("certificate_ph_introduction"));
146
147 return $template->get();
148 }
getBaseVariablesDescription($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable descriptions.
special template class to simplify handling of ITX/PEAR

References ilCertificateAdapter\$lng, and ilCertificateAdapter\getBaseVariablesDescription().

+ 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

Reimplemented from ilCertificateAdapter.

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

82 {
83 global $lng;
84
85 $lng->loadLanguageModule('certificate');
86
87 $user_data = $params["user_data"];
88
89 $vars = $this->getBaseVariablesForPresentation($user_data, $params["last_access"], null);
90 $vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
91 $vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
92 $vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
93
94 // custom completion date
95 $achievement_date = ilBasicSkill::lookupLevelAchievementDate($user_data["usr_id"], $this->skill_level_id);
96 if ($achievement_date !== false)
97 {
100
101 $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($achievement_date, IL_CAL_DATETIME));
102 $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($achievement_date, IL_CAL_DATETIME));
103
105 }
106 else
107 {
108 $vars["DATE_COMPLETED"] = "";
109 $vars["DATETIME_COMPLETED"] = "";
110 }
111
112 foreach($vars as $id => $caption)
113 {
114 $insert_tags["[".$id."]"] = $caption;
115 }
116 return $insert_tags;
117 }
const IL_CAL_DATETIME
getBaseVariablesForPresentation($a_user_data, $a_last_access=null, $a_completion_date=false)
Get variable values.
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
$old

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

+ 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

Reimplemented from ilCertificateAdapter.

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

52 {
53 global $lng, $ilUser;
54
57
58 $vars = $this->getBaseVariablesForPreview();
59 $vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
60 $vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
61 $vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
62
64
65 $insert_tags = array();
66 foreach($vars as $id => $caption)
67 {
68 $insert_tags["[".$id."]"] = $caption;
69 }
70 return $insert_tags;
71 }
getBaseVariablesForPreview($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable dummys.
$ilUser
Definition: imgupload.php:18

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

+ 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

Reimplemented from ilCertificateAdapter.

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

224 {
225 global $ilSetting;
226 //$scormSetting = new ilSetting("scorm");
227 //$scormSetting->set("certificate_" . $this->object->getId(), $form_fields["certificate_enabled_scorm"]);
228 //$scormSetting->set("certificate_short_name_" . $this->object->getId(), $form_fields["short_name"]);
229 }

References $ilSetting.

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: