ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 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.
 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.
 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.
 getCertificateFilename ($params=array())
 Set the name of the certificate file This method will be called when the certificate will be generated.
 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.
- Public Member Functions inherited from ilCertificateAdapter
 getUserIdForParams ($a_params)
 Get user id for params.

Protected Attributes

 $object

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

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

ilSkillCertificateAdapter::__construct (   $a_skill,
  $a_skill_level_id 
)

Contructor.

Parameters
objectskill object
objectskill level id

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

References $lng.

{
global $lng;
$lng->loadLanguageModule("skmg");
$this->skill = $a_skill;
$this->skill_level_id = $a_skill_level_id;
}

Member Function Documentation

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 161 of file class.ilSkillCertificateAdapter.php.

References $lng.

{
global $lng;
/*$short_name = new ilTextInputGUI($lng->txt("certificate_short_name"), "short_name");
$short_name->setRequired(TRUE);
require_once "./Services/Utilities/classes/class.ilStr.php";
$short_name->setValue(strlen($form_fields["short_name"]) ? $form_fields["short_name"] : ilStr::subStr($this->object->getTitle(), 0, 30));
$short_name->setSize(30);
if (strlen($form_fields["short_name"])) {
$short_name->setInfo(str_replace("[SHORT_TITLE]", $form_fields["short_name"], $lng->txt("certificate_short_name_description")));
} else {
$short_name->setInfo($lng->txt("certificate_short_name_description"));
}
if (count($_POST)) $short_name->checkInput();
$form->addItem($short_name);
$visibility = new ilCheckboxInputGUI($lng->txt("certificate_enabled_scorm"), "certificate_enabled_scorm");
$visibility->setInfo($lng->txt("certificate_enabled_scorm_introduction"));
$visibility->setValue(1);
if ($form_fields["certificate_enabled_scorm"])
{
$visibility->setChecked(TRUE);
}
if (count($_POST)) $visibility->checkInput();
$form->addItem($visibility);*/
}
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 210 of file class.ilSkillCertificateAdapter.php.

References $ilSetting.

{
global $ilSetting;
//$scormSetting = new ilSetting("scorm");
//$form_fields["certificate_enabled_scorm"] = $scormSetting->get("certificate_" . $this->object->getId());
//$form_fields["short_name"] = $scormSetting->get("certificate_short_name_" . $this->object->getId());
}
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 196 of file class.ilSkillCertificateAdapter.php.

{
//$form_fields["certificate_enabled_scorm"] = $_POST["certificate_enabled_scorm"];
//$form_fields["short_name"] = $_POST["short_name"];
}
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 284 of file class.ilSkillCertificateAdapter.php.

References $ilSetting.

{
global $ilSetting;
//$scormSetting = new ilSetting("scorm");
//$scormSetting->delete("certificate_" . $this->object->getId());
}
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 239 of file class.ilSkillCertificateAdapter.php.

{
return "skill";
}
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 261 of file class.ilSkillCertificateAdapter.php.

References $lng.

{
global $lng;
$basename = parent::getCertificateFilename($params);
$user_data = $params["user_data"];
if (!is_array($user_data))
{
$short_title = $this->skill->getShortTitleForCertificate();
return strftime("%y%m%d", time()) . "_" . $lng->txt("certificate_var_user_lastname") . "_" . $short_title . "_" . $basename;
}
else
{
return strftime("%y%m%d", time()) . "_" . $user_data["lastname"] . "_" . $params["short_title"] . "_" . $basename;
}
}
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 250 of file class.ilSkillCertificateAdapter.php.

References $skill_level_id.

{
}
ilSkillCertificateAdapter::getCertificatePath ( )

Returns the certificate path (with a trailing path separator)

Returns
string The certificate path

Reimplemented from ilCertificateAdapter.

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

{
return CLIENT_WEB_DIR."/certificates/skill/".$this->skill->getId().
"/".$this->skill_level_id."/";
}
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 127 of file class.ilSkillCertificateAdapter.php.

References $lng, and ilCertificateAdapter\getBaseVariablesDescription().

{
global $lng;
$lng->loadLanguageModule("skmg");
$vars = $this->getBaseVariablesDescription();
$vars["SKILL_TITLE"] = $lng->txt("skmg_cert_skill_title");
$vars["SKILL_LEVEL_TITLE"] = $lng->txt("skmg_cert_skill_level_title");
$vars["SKILL_TRIGGER_TITLE"] = $lng->txt("skmg_cert_skill_trigger_title");
$template = new ilTemplate("tpl.certificate_edit.html", TRUE, TRUE, "Services/Skill");
$template->setCurrentBlock("items");
foreach($vars as $id => $caption)
{
$template->setVariable("ID", $id);
$template->setVariable("TXT", $caption);
$template->parseCurrentBlock();
}
$template->setVariable("PH_INTRODUCTION", $lng->txt("certificate_ph_introduction"));
return $template->get();
}

+ Here is the call graph for this function:

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 83 of file class.ilSkillCertificateAdapter.php.

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

{
global $lng;
$lng->loadLanguageModule('certificate');
$user_data = $params["user_data"];
$vars = $this->getBaseVariablesForPresentation($user_data, $params["last_access"], null);
$vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
$vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
$vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
// custom completion date
$achievement_date = ilBasicSkill::lookupLevelAchievementDate($user_data["usr_id"], $this->skill_level_id);
if ($achievement_date !== false)
{
$vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($achievement_date, IL_CAL_DATETIME));
$vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($achievement_date, IL_CAL_DATETIME));
}
else
{
$vars["DATE_COMPLETED"] = "";
$vars["DATETIME_COMPLETED"] = "";
}
foreach($vars as $id => $caption)
{
$insert_tags["[".$id."]"] = $caption;
}
return $insert_tags;
}

+ Here is the call graph for this function:

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 53 of file class.ilSkillCertificateAdapter.php.

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

{
global $lng, $ilUser;
$vars = $this->getBaseVariablesForPreview();
$vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
$vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
$vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
$insert_tags = array();
foreach($vars as $id => $caption)
{
$insert_tags["[".$id."]"] = $caption;
}
return $insert_tags;
}

+ Here is the call graph for this function:

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 225 of file class.ilSkillCertificateAdapter.php.

References $ilSetting.

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

Field Documentation

ilSkillCertificateAdapter::$object
protected

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

ilSkillCertificateAdapter::$skill
private

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

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: