24include_once 
"./Services/Certificate/classes/class.ilCertificateAdapter.php";
 
   45        parent::__construct();
 
   55        return CLIENT_WEB_DIR . 
"/certificates/scorm/" . $this->
object->getId() . 
"/";
 
   68        $vars[
"SCORM_POINTS"] = number_format(80.7, 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand")) . 
" %";
 
   69        $vars[
"SCORM_POINTS_MAX"] = number_format(90, 0, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand"));
 
   71        $insert_tags = array();
 
   72        foreach ($vars as 
$id => $caption) {
 
   73            $insert_tags[
"[" . 
$id . 
"]"] = $caption;
 
   76        include_once 
'Services/Object/classes/class.ilObjectLP.php';
 
   78        $collection = $olp->getCollectionInstance();
 
   81            foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
 
   82                if ($collection->isAssignedEntry($item_id)) {
 
   83                    $insert_tags[
'[SCO_T_' . $counter . 
']'] = $sahs_item[
'title'];
 
   84                    $insert_tags[
'[SCO_P_' . $counter . 
']'] = number_format(30.3, 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand"));
 
   85                    $insert_tags[
'[SCO_PM_' . $counter . 
']'] = number_format(90.9, 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand"));
 
   86                    $insert_tags[
'[SCO_PP_' . $counter . 
']'] = number_format(33.3333, 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand")) . 
" %";
 
  105        $this->lng->loadLanguageModule(
'certificate');
 
  107        $points = $this->
object->getPointsInPercent();
 
  109        if (is_null($points)) {
 
  110            $txtPoints = $this->lng->txt(
"certificate_points_notavailable");
 
  112            $txtPoints = number_format($points, 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand")) . 
" %";
 
  115        $max_points = $this->
object->getMaxPoints();
 
  117        if (is_null($max_points)) {
 
  118            $txtMaxPoints = $this->lng->txt(
"certificate_points_notavailable");
 
  120            if ($max_points != floor($max_points)) {
 
  121                $txtMaxPoints = number_format($max_points, 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand"));
 
  123                $txtMaxPoints = $max_points;
 
  127        $user_data = 
$params[
"user_data"];
 
  132        $vars[
"SCORM_POINTS"] = $txtPoints;
 
  133        $vars[
"SCORM_POINTS_MAX"] = $txtMaxPoints;
 
  135        foreach ($vars as 
$id => $caption) {
 
  136            $insert_tags[
"[" . 
$id . 
"]"] = $caption;
 
  139        include_once 
'Services/Object/classes/class.ilObjectLP.php';
 
  141        $collection = $olp->getCollectionInstance();
 
  144            foreach ($collection->getPossibleItems() as $item_id => $sahs_item) {
 
  145                if ($collection->isAssignedEntry($item_id)) {
 
  146                    $insert_tags[
'[SCO_T_' . $counter . 
']'] = $sahs_item[
'title'];
 
  147                    $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id, 
$GLOBALS[
'DIC'][
'ilUser']->getId());
 
  148                    if ($a_scores[
"raw"] == 
null) {
 
  149                        $insert_tags[
'[SCO_P_' . $counter . 
']'] = $this->lng->txt(
"certificate_points_notavailable");
 
  151                        $insert_tags[
'[SCO_P_' . $counter . 
']'] = number_format($a_scores[
"raw"], 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand"));
 
  153                    if ($a_scores[
"max"] == 
null) {
 
  154                        $insert_tags[
'[SCO_PM_' . $counter . 
']'] = $this->lng->txt(
"certificate_points_notavailable");
 
  156                        $insert_tags[
'[SCO_PM_' . $counter . 
']'] = number_format($a_scores[
"max"], 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand"));
 
  158                    if ($a_scores[
"scaled"] == 
null) {
 
  159                        $insert_tags[
'[SCO_PP_' . $counter . 
']'] = $this->lng->txt(
"certificate_points_notavailable");
 
  161                        $insert_tags[
'[SCO_PP_' . $counter . 
']'] = number_format(($a_scores[
"scaled"] * 100), 1, $this->lng->txt(
"lang_sep_decimal"), $this->lng->txt(
"lang_sep_thousand")) . 
" %";
 
  180        $vars[
"SCORM_TITLE"] = $this->lng->txt(
"certificate_ph_scormtitle");
 
  181        $vars[
"SCORM_POINTS"] = $this->lng->txt(
"certificate_ph_scormpoints");
 
  182        $vars[
"SCORM_POINTS_MAX"] = $this->lng->txt(
"certificate_ph_scormmaxpoints");
 
  186        foreach ($vars as 
$id => $caption) {
 
  192        $template->setVariable(
"PH_INTRODUCTION", $this->lng->txt(
"certificate_ph_introduction"));
 
  194        include_once 
'Services/Object/classes/class.ilObjectLP.php';
 
  196        $collection = $olp->getCollectionInstance();
 
  198            $items = $collection->getPossibleItems();
 
  203            $template->setVariable(
'PH_NO_SCO', $this->lng->txt(
'certificate_ph_no_sco'));
 
  207            $template->setVariable(
'PH_SCOS', $this->lng->txt(
'certificate_ph_scos'));
 
  209            $template->setCurrentBlock(
'SCO_HEADER');
 
  210            $template->setVariable(
'PH_TITLE_SCO', $this->lng->txt(
'certificate_ph_title_sco'));
 
  212            $template->setVariable(
'PH_SCO_TITLE', $this->lng->txt(
'certificate_ph_sco_title'));
 
  213            $template->setVariable(
'PH_SCO_POINTS_RAW', $this->lng->txt(
'certificate_ph_sco_points_raw'));
 
  214            $template->setVariable(
'PH_SCO_POINTS_MAX', $this->lng->txt(
'certificate_ph_sco_points_max'));
 
  215            $template->setVariable(
'PH_SCO_POINTS_SCALED', $this->lng->txt(
'certificate_ph_sco_points_scaled'));
 
  221            foreach ($items as $item_id => $sahs_item) {
 
  222                if ($collection->isAssignedEntry($item_id)) {
 
  224                    $template->setVariable(
'SCO_TITLE', $sahs_item[
'title']);
 
  225                    $template->setVariable(
'PH_SCO_TITLE', 
'[SCO_T_' . $counter . 
']');
 
  226                    $template->setVariable(
'PH_SCO_POINTS_RAW', 
'[SCO_P_' . $counter . 
']');
 
  227                    $template->setVariable(
'PH_SCO_POINTS_MAX', 
'[SCO_PM_' . $counter . 
']');
 
  228                    $template->setVariable(
'PH_SCO_POINTS_SCALED', 
'[SCO_PP_' . $counter . 
']');
 
  249        $short_name = 
new ilTextInputGUI($this->lng->txt(
"certificate_short_name"), 
"short_name");
 
  250        $short_name->setRequired(
true);
 
  251        require_once 
"./Services/Utilities/classes/class.ilStr.php";
 
  252        $short_name->setValue(strlen($form_fields[
"short_name"]) ? $form_fields[
"short_name"] : 
ilStr::subStr($this->object->getTitle(), 0, 30));
 
  253        $short_name->setSize(30);
 
  254        if (strlen($form_fields[
"short_name"])) {
 
  255            $short_name->setInfo(str_replace(
"[SHORT_TITLE]", $form_fields[
"short_name"], $this->lng->txt(
"certificate_short_name_description")));
 
  257            $short_name->setInfo($this->lng->txt(
"certificate_short_name_description"));
 
  260            $short_name->checkInput();
 
  262        $form->addItem($short_name);
 
  283        $form_fields[
"certificate_enabled_scorm"] = 
$_POST[
"certificate_enabled_scorm"];
 
  284        $form_fields[
"short_name"] = 
$_POST[
"short_name"];
 
  298        $form_fields[
"certificate_enabled_scorm"] = $scormSetting->get(
"certificate_" . $this->object->getId());
 
  299        $form_fields[
"short_name"] = $scormSetting->get(
"certificate_short_name_" . $this->object->getId());
 
  312        $scormSetting->set(
"certificate_" . $this->object->getId(), $form_fields[
"certificate_enabled_scorm"]);
 
  313        $scormSetting->set(
"certificate_short_name_" . $this->object->getId(), $form_fields[
"short_name"]);
 
  335        return $this->
object->getId();
 
  346        $basename = parent::getCertificateFilename(
$params);
 
  348        $user_data = 
$params[
"user_data"];
 
  349        if (!is_array($user_data)) {
 
  353            $short_title = $scormSetting->get(
"certificate_short_name_" . $this->object->getId());
 
  354            return strftime(
"%y%m%d", time()) . 
"_" . $this->lng->txt(
"certificate_var_user_lastname") . 
"_" . $short_title . 
"_" . $basename;
 
  356            return strftime(
"%y%m%d", time()) . 
"_" . $user_data[
"lastname"] . 
"_" . 
$params[
"short_title"] . 
"_.$basename";
 
  368        $scormSetting->delete(
"certificate_" . $this->object->getId());
 
  379        return $a_params[
"user_data"][
"usr_id"];
 
An exception for terminatinating execution or to throw for unit testing.
Adapter class to provide certificate data for the certificate generator.
getBaseVariablesForPresentation($a_user_data, $a_last_access=null, $a_completion_date=false)
Get variable values.
getBaseVariablesForPreview($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable dummys.
getUserCompletionDate($a_user_id, $a_object_id=null)
Get completion for user.
getBaseVariablesDescription($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable descriptions.
static getInstance($a_obj_id)
SCORM certificate adapter.
addFormFieldsFromObject(&$form_fields)
Allows to add additional form values to the array of form values evaluating the associated adapter cl...
addAdditionalFormElements(&$form, $form_fields)
Allows to add additional form fields to the certificate editor form This method will be called when t...
addFormFieldsFromPOST(&$form_fields)
Allows to add additional form values to the array of form values evaluating a HTTP POST action.
getCertificateVariablesDescription()
Returns a description of the available certificate parameters.
getCertificateVariablesForPreview()
Returns an array containing all variables and values which can be exchanged in the certificate.
getCertificateFilename($params=array())
Set the name of the certificate file This method will be called when the certificate will be generate...
getUserIdForParams($a_params)
Get user id for params.
hasAdditionalFormElements()
bool
getCertificateID()
Returns a certificate ID This value will be used to generate unique file names for the certificates.
deleteCertificate()
Is called when the certificate is deleted Add some adapter specific code if more work has to be done ...
getCertificatePath()
Returns the certificate path (with a trailing path separator)
__construct($object)
ilSCORMCertificateAdapter contructor
getAdapterType()
Returns the adapter type This value will be used to generate file names for the certificates.
getCertificateVariablesForPresentation($params=array())
Returns an array containing all variables and values which can be exchanged in the certificate The va...
saveFormFields(&$form_fields)
Allows to save additional adapter form fields This method will be called when the certificate editor ...
static subStr($a_str, $a_start, $a_length=null)
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
if(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
if(isset($_POST['submit'])) $form