24include_once
"./Services/Certificate/classes/class.ilCertificateAdapter.php";
54 return CLIENT_WEB_DIR .
"/certificates/scorm/" . $this->
object->getId() .
"/";
69 $vars[
"SCORM_POINTS"] = number_format(80.7, 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand")) .
" %";
70 $vars[
"SCORM_POINTS_MAX"] = number_format(90, 0,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand"));
72 $insert_tags = array();
73 foreach($vars as $id => $caption)
75 $insert_tags[
"[".$id.
"]"] = $caption;
78 include_once
'Services/Object/classes/class.ilObjectLP.php';
80 $collection = $olp->getCollectionInstance();
84 foreach($collection->getPossibleItems() as $item_id => $sahs_item)
86 if($collection->isAssignedEntry($item_id)) {
87 $insert_tags[
'[SCO_T_'.$counter.
']'] = $sahs_item[
'title'];
88 $insert_tags[
'[SCO_P_'.$counter.
']'] = number_format(30.3, 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand"));
89 $insert_tags[
'[SCO_PM_'.$counter.
']'] = number_format(90.9, 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand"));
90 $insert_tags[
'[SCO_PP_'.$counter.
']'] = number_format(33.3333, 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand")) .
" %";
111 $lng->loadLanguageModule(
'certificate');
113 $points = $this->
object->getPointsInPercent();
115 if (is_null($points))
117 $txtPoints =
$lng->txt(
"certificate_points_notavailable");
121 $txtPoints = number_format($points, 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand")) .
" %";
124 $max_points = $this->
object->getMaxPoints();
126 if (is_null($max_points))
128 $txtMaxPoints =
$lng->txt(
"certificate_points_notavailable");
132 if($max_points != floor($max_points))
134 $txtMaxPoints = number_format($max_points, 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand"));
138 $txtMaxPoints = $max_points;
142 $user_data =
$params[
"user_data"];
147 $vars[
"SCORM_POINTS"] = $txtPoints;
148 $vars[
"SCORM_POINTS_MAX"] = $txtMaxPoints;
150 foreach($vars as $id => $caption)
152 $insert_tags[
"[".$id.
"]"] = $caption;
155 include_once
'Services/Object/classes/class.ilObjectLP.php';
157 $collection = $olp->getCollectionInstance();
161 foreach($collection->getPossibleItems() as $item_id => $sahs_item)
163 if($collection->isAssignedEntry($item_id)) {
164 $insert_tags[
'[SCO_T_'.$counter.
']'] = $sahs_item[
'title'];
165 $a_scores = $collection->getScoresForUserAndCP_Node_Id($item_id,
$ilUser->getId());
166 if ($a_scores[
"raw"] ==
null) $insert_tags[
'[SCO_P_'.$counter.
']'] =
$lng->txt(
"certificate_points_notavailable");
167 else $insert_tags[
'[SCO_P_'.$counter.
']'] = number_format($a_scores[
"raw"], 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand"));
168 if ($a_scores[
"max"] ==
null) $insert_tags[
'[SCO_PM_'.$counter.
']'] =
$lng->txt(
"certificate_points_notavailable");
169 else $insert_tags[
'[SCO_PM_'.$counter.
']'] = number_format($a_scores[
"max"], 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand"));
170 if ($a_scores[
"scaled"] ==
null) $insert_tags[
'[SCO_PP_'.$counter.
']'] =
$lng->txt(
"certificate_points_notavailable");
171 else $insert_tags[
'[SCO_PP_'.$counter.
']'] = number_format(($a_scores[
"scaled"]*100), 1,
$lng->txt(
"lang_sep_decimal"),
$lng->txt(
"lang_sep_thousand")) .
" %";
191 $vars[
"SCORM_TITLE"] =
$lng->txt(
"certificate_ph_scormtitle");
192 $vars[
"SCORM_POINTS"] =
$lng->txt(
"certificate_ph_scormpoints");
193 $vars[
"SCORM_POINTS_MAX"] =
$lng->txt(
"certificate_ph_scormmaxpoints");
195 $template =
new ilTemplate(
"tpl.certificate_edit.html", TRUE, TRUE,
"Modules/ScormAicc");
196 $template->setCurrentBlock(
"items");
197 foreach($vars as $id => $caption)
199 $template->setVariable(
"ID", $id);
200 $template->setVariable(
"TXT", $caption);
201 $template->parseCurrentBlock();
204 $template->setVariable(
"PH_INTRODUCTION",
$lng->txt(
"certificate_ph_introduction"));
206 include_once
'Services/Object/classes/class.ilObjectLP.php';
208 $collection = $olp->getCollectionInstance();
211 $items = $collection->getPossibleItems();
215 $template->setCurrentBlock(
'NO_SCO');
216 $template->setVariable(
'PH_NO_SCO',
$lng->txt(
'certificate_ph_no_sco'));
217 $template->parseCurrentBlock();
220 $template->setCurrentBlock(
'SCOS');
221 $template->setVariable(
'PH_SCOS',
$lng->txt(
'certificate_ph_scos'));
222 $template->parseCurrentBlock();
223 $template->setCurrentBlock(
'SCO_HEADER');
224 $template->setVariable(
'PH_TITLE_SCO',
$lng->txt(
'certificate_ph_title_sco'));
226 $template->setVariable(
'PH_SCO_TITLE',
$lng->txt(
'certificate_ph_sco_title'));
227 $template->setVariable(
'PH_SCO_POINTS_RAW',
$lng->txt(
'certificate_ph_sco_points_raw'));
228 $template->setVariable(
'PH_SCO_POINTS_MAX',
$lng->txt(
'certificate_ph_sco_points_max'));
229 $template->setVariable(
'PH_SCO_POINTS_SCALED',
$lng->txt(
'certificate_ph_sco_points_scaled'));
230 $template->parseCurrentBlock();
236 foreach($items as $item_id => $sahs_item)
238 if($collection->isAssignedEntry($item_id)) {
239 $template->setCurrentBlock(
"SCO");
240 $template->setVariable(
'SCO_TITLE',$sahs_item[
'title']);
241 $template->setVariable(
'PH_SCO_TITLE',
'[SCO_T_'.$counter.
']');
242 $template->setVariable(
'PH_SCO_POINTS_RAW',
'[SCO_P_'.$counter.
']');
243 $template->setVariable(
'PH_SCO_POINTS_MAX',
'[SCO_PM_'.$counter.
']');
244 $template->setVariable(
'PH_SCO_POINTS_SCALED',
'[SCO_PP_'.$counter.
']');
245 $template->parseCurrentBlock();
251 return $template->get();
267 $short_name->setRequired(TRUE);
268 require_once
"./Services/Utilities/classes/class.ilStr.php";
269 $short_name->setValue(strlen($form_fields[
"short_name"]) ? $form_fields[
"short_name"] :
ilStr::subStr($this->object->getTitle(), 0, 30));
270 $short_name->setSize(30);
271 if (strlen($form_fields[
"short_name"])) {
272 $short_name->setInfo(str_replace(
"[SHORT_TITLE]", $form_fields[
"short_name"],
$lng->txt(
"certificate_short_name_description")));
274 $short_name->setInfo(
$lng->txt(
"certificate_short_name_description"));
276 if (count(
$_POST)) $short_name->checkInput();
277 $form->addItem($short_name);
279 $visibility =
new ilCheckboxInputGUI(
$lng->txt(
"certificate_enabled_scorm"),
"certificate_enabled_scorm");
280 $visibility->setInfo(
$lng->txt(
"certificate_enabled_scorm_introduction"));
281 $visibility->setValue(1);
282 if ($form_fields[
"certificate_enabled_scorm"])
284 $visibility->setChecked(TRUE);
286 if (count(
$_POST)) $visibility->checkInput();
287 $form->addItem($visibility);
300 $form_fields[
"certificate_enabled_scorm"] =
$_POST[
"certificate_enabled_scorm"];
301 $form_fields[
"short_name"] =
$_POST[
"short_name"];
316 $form_fields[
"certificate_enabled_scorm"] = $scormSetting->get(
"certificate_" . $this->object->getId());
317 $form_fields[
"short_name"] = $scormSetting->get(
"certificate_short_name_" . $this->object->getId());
331 $scormSetting->set(
"certificate_" . $this->object->getId(), $form_fields[
"certificate_enabled_scorm"]);
332 $scormSetting->set(
"certificate_short_name_" . $this->object->getId(), $form_fields[
"short_name"]);
354 return $this->
object->getId();
367 $basename = parent::getCertificateFilename(
$params);
369 $user_data =
$params[
"user_data"];
370 if (!is_array($user_data))
374 $short_title = $scormSetting->get(
"certificate_short_name_" . $this->object->getId());
375 return strftime(
"%y%m%d", time()) .
"_" .
$lng->txt(
"certificate_var_user_lastname") .
"_" . $short_title .
"_" . $basename;
379 return strftime(
"%y%m%d", time()) .
"_" . $user_data[
"lastname"] .
"_" .
$params[
"short_title"] .
"_.$basename";
392 $scormSetting->delete(
"certificate_" . $this->object->getId());
403 return $a_params[
"user_data"][
"usr_id"];
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.
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 ...
__construct(&$object)
ilSCORMCertificateAdapter contructor
getCertificatePath()
Returns the certificate path (with a trailing path separator)
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