24 include_once
"./Services/Certificate/classes/class.ilCertificateAdapter.php";
45 parent::__construct();
55 return CLIENT_WEB_DIR .
"/certificates/scorm/" . $this->
object->getId() .
"/";
70 $vars[
"SCORM_POINTS"] = number_format(80.7, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand")) .
" %";
71 $vars[
"SCORM_POINTS_MAX"] = number_format(90, 0, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand"));
73 $insert_tags =
array();
74 foreach($vars as $id => $caption)
76 $insert_tags[
"[".$id.
"]"] = $caption;
79 include_once
'Services/Object/classes/class.ilObjectLP.php';
81 $collection = $olp->getCollectionInstance();
85 foreach($collection->getPossibleItems() as $item_id => $sahs_item)
87 if($collection->isAssignedEntry($item_id)) {
88 $insert_tags[
'[SCO_T_'.$counter.
']'] = $sahs_item[
'title'];
89 $insert_tags[
'[SCO_P_'.$counter.
']'] = number_format(30.3, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand"));
90 $insert_tags[
'[SCO_PM_'.$counter.
']'] = number_format(90.9, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand"));
91 $insert_tags[
'[SCO_PP_'.$counter.
']'] = number_format(33.3333, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand")) .
" %";
112 $lng->loadLanguageModule(
'certificate');
114 $points = $this->
object->getPointsInPercent();
116 if (is_null($points))
118 $txtPoints = $lng->txt(
"certificate_points_notavailable");
122 $txtPoints = number_format($points, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand")) .
" %";
125 $max_points = $this->
object->getMaxPoints();
127 if (is_null($max_points))
129 $txtMaxPoints = $lng->txt(
"certificate_points_notavailable");
133 if($max_points != floor($max_points))
135 $txtMaxPoints = number_format($max_points, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand"));
139 $txtMaxPoints = $max_points;
143 $user_data =
$params[
"user_data"];
148 $vars[
"SCORM_POINTS"] = $txtPoints;
149 $vars[
"SCORM_POINTS_MAX"] = $txtMaxPoints;
151 foreach($vars as $id => $caption)
153 $insert_tags[
"[".$id.
"]"] = $caption;
156 include_once
'Services/Object/classes/class.ilObjectLP.php';
158 $collection = $olp->getCollectionInstance();
162 foreach($collection->getPossibleItems() as $item_id => $sahs_item)
164 if($collection->isAssignedEntry($item_id)) {
165 $insert_tags[
'[SCO_T_'.$counter.
']'] = $sahs_item[
'title'];
166 $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id, $ilUser->getId());
167 if ($a_scores[
"raw"] == null) $insert_tags[
'[SCO_P_'.$counter.
']'] = $lng->txt(
"certificate_points_notavailable");
168 else $insert_tags[
'[SCO_P_'.$counter.
']'] = number_format($a_scores[
"raw"], 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand"));
169 if ($a_scores[
"max"] == null) $insert_tags[
'[SCO_PM_'.$counter.
']'] = $lng->txt(
"certificate_points_notavailable");
170 else $insert_tags[
'[SCO_PM_'.$counter.
']'] = number_format($a_scores[
"max"], 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand"));
171 if ($a_scores[
"scaled"] == null) $insert_tags[
'[SCO_PP_'.$counter.
']'] = $lng->txt(
"certificate_points_notavailable");
172 else $insert_tags[
'[SCO_PP_'.$counter.
']'] = number_format(($a_scores[
"scaled"]*100), 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand")) .
" %";
192 $vars[
"SCORM_TITLE"] = $lng->txt(
"certificate_ph_scormtitle");
193 $vars[
"SCORM_POINTS"] = $lng->txt(
"certificate_ph_scormpoints");
194 $vars[
"SCORM_POINTS_MAX"] = $lng->txt(
"certificate_ph_scormmaxpoints");
196 $template =
new ilTemplate(
"tpl.certificate_edit.html", TRUE, TRUE,
"Modules/ScormAicc");
197 $template->setCurrentBlock(
"items");
198 foreach($vars as $id => $caption)
200 $template->setVariable(
"ID", $id);
201 $template->setVariable(
"TXT", $caption);
202 $template->parseCurrentBlock();
205 $template->setVariable(
"PH_INTRODUCTION", $lng->txt(
"certificate_ph_introduction"));
207 include_once
'Services/Object/classes/class.ilObjectLP.php';
209 $collection = $olp->getCollectionInstance();
212 $items = $collection->getPossibleItems();
216 $template->setCurrentBlock(
'NO_SCO');
217 $template->setVariable(
'PH_NO_SCO',$lng->txt(
'certificate_ph_no_sco'));
218 $template->parseCurrentBlock();
221 $template->setCurrentBlock(
'SCOS');
222 $template->setVariable(
'PH_SCOS',$lng->txt(
'certificate_ph_scos'));
223 $template->parseCurrentBlock();
224 $template->setCurrentBlock(
'SCO_HEADER');
225 $template->setVariable(
'PH_TITLE_SCO',$lng->txt(
'certificate_ph_title_sco'));
227 $template->setVariable(
'PH_SCO_TITLE',$lng->txt(
'certificate_ph_sco_title'));
228 $template->setVariable(
'PH_SCO_POINTS_RAW',$lng->txt(
'certificate_ph_sco_points_raw'));
229 $template->setVariable(
'PH_SCO_POINTS_MAX',$lng->txt(
'certificate_ph_sco_points_max'));
230 $template->setVariable(
'PH_SCO_POINTS_SCALED',$lng->txt(
'certificate_ph_sco_points_scaled'));
231 $template->parseCurrentBlock();
237 foreach($items as $item_id => $sahs_item)
239 if($collection->isAssignedEntry($item_id)) {
240 $template->setCurrentBlock(
"SCO");
241 $template->setVariable(
'SCO_TITLE',$sahs_item[
'title']);
242 $template->setVariable(
'PH_SCO_TITLE',
'[SCO_T_'.
$counter.
']');
243 $template->setVariable(
'PH_SCO_POINTS_RAW',
'[SCO_P_'.
$counter.
']');
244 $template->setVariable(
'PH_SCO_POINTS_MAX',
'[SCO_PM_'.
$counter.
']');
245 $template->setVariable(
'PH_SCO_POINTS_SCALED',
'[SCO_PP_'.
$counter.
']');
246 $template->parseCurrentBlock();
252 return $template->get();
267 $short_name =
new ilTextInputGUI($lng->txt(
"certificate_short_name"),
"short_name");
269 require_once
"./Services/Utilities/classes/class.ilStr.php";
270 $short_name->setValue(strlen($form_fields[
"short_name"]) ? $form_fields[
"short_name"] :
ilStr::subStr($this->
object->getTitle(), 0, 30));
271 $short_name->setSize(30);
272 if (strlen($form_fields[
"short_name"])) {
273 $short_name->setInfo(str_replace(
"[SHORT_TITLE]", $form_fields[
"short_name"], $lng->txt(
"certificate_short_name_description")));
275 $short_name->setInfo($lng->txt(
"certificate_short_name_description"));
277 if (count(
$_POST)) $short_name->checkInput();
278 $form->addItem($short_name);
280 $visibility =
new ilCheckboxInputGUI($lng->txt(
"certificate_enabled_scorm"),
"certificate_enabled_scorm");
281 $visibility->
setInfo($lng->txt(
"certificate_enabled_scorm_introduction"));
282 $visibility->setValue(1);
283 if ($form_fields[
"certificate_enabled_scorm"])
285 $visibility->setChecked(TRUE);
287 if (count(
$_POST)) $visibility->checkInput();
288 $form->addItem($visibility);
301 $form_fields[
"certificate_enabled_scorm"] =
$_POST[
"certificate_enabled_scorm"];
302 $form_fields[
"short_name"] =
$_POST[
"short_name"];
317 $form_fields[
"certificate_enabled_scorm"] = $scormSetting->get(
"certificate_" . $this->
object->getId());
318 $form_fields[
"short_name"] = $scormSetting->get(
"certificate_short_name_" . $this->
object->getId());
332 $scormSetting->set(
"certificate_" . $this->
object->getId(), $form_fields[
"certificate_enabled_scorm"]);
333 $scormSetting->set(
"certificate_short_name_" . $this->
object->getId(), $form_fields[
"short_name"]);
355 return $this->
object->getId();
368 $basename = parent::getCertificateFilename(
$params);
370 $user_data =
$params[
"user_data"];
371 if (!is_array($user_data))
375 $short_title = $scormSetting->get(
"certificate_short_name_" . $this->
object->getId());
376 return strftime(
"%y%m%d",
time()) .
"_" . $lng->txt(
"certificate_var_user_lastname") .
"_" . $short_title .
"_" . $basename;
380 return strftime(
"%y%m%d",
time()) .
"_" . $user_data[
"lastname"] .
"_" .
$params[
"short_title"] .
"_.$basename";
393 $scormSetting->delete(
"certificate_" . $this->
object->getId());
404 return $a_params[
"user_data"][
"usr_id"];
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getCertificateVariablesForPreview()
Returns an array containing all variables and values which can be exchanged in the certificate...
getUserCompletionDate($a_user_id, $a_object_id=null)
Get completion for user.
addFormFieldsFromPOST(&$form_fields)
Allows to add additional form values to the array of form values evaluating a HTTP POST action...
addAdditionalFormElements(&$form, $form_fields)
Allows to add additional form fields to the certificate editor form This method will be called when t...
deleteCertificate()
Is called when the certificate is deleted Add some adapter specific code if more work has to be done ...
getCertificateVariablesDescription()
Returns a description of the available certificate parameters.
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
getBaseVariablesDescription($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable descriptions.
getCertificateVariablesForPresentation($params=array())
Returns an array containing all variables and values which can be exchanged in the certificate The va...
Create styles array
The data for the language used.
__construct(&$object)
ilSCORMCertificateAdapter contructor
getCertificatePath()
Returns the certificate path (with a trailing path separator)
getCertificateID()
Returns a certificate ID This value will be used to generate unique file names for the certificates...
addFormFieldsFromObject(&$form_fields)
Allows to add additional form values to the array of form values evaluating the associated adapter cl...
getUserIdForParams($a_params)
Get user id for params.
Create new PHPExcel object
obj_idprivate
Adapter class to provide certificate data for the certificate generator.
SCORM certificate adapter.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
getBaseVariablesForPreview($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable dummys.
saveFormFields(&$form_fields)
Allows to save additional adapter form fields This method will be called when the certificate editor ...
getBaseVariablesForPresentation($a_user_data, $a_last_access=null, $a_completion_date=false)
Get variable values.
static subStr($a_str, $a_start, $a_length=NULL)
static getInstance($a_obj_id)
getAdapterType()
Returns the adapter type This value will be used to generate 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 generate...