24 include_once
"./Services/Certificate/classes/class.ilCertificateAdapter.php";
54 return CLIENT_WEB_DIR .
"/certificates/scorm/" . $this->
object->getId() .
"/";
66 include_once
"./classes/class.ilFormat.php";
82 "[SCORM_POINTS]" => number_format(80.7, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand")) .
" %",
101 $lng->loadLanguageModule(
'certificate');
102 $user_data = $params[
"user_data"];
103 $points = $this->
object->getPointsInPercent();
107 $txtPoints = $lng->txt(
"certificate_points_notavailable");
111 $txtPoints = number_format(
$points, 1, $lng->txt(
"lang_sep_decimal"), $lng->txt(
"lang_sep_thousand")) .
" %";
114 if (strlen($user_data[
"gender"]))
116 $salutation = $lng->txt(
"salutation_" . $user_data[
"gender"]);
118 $y =
""; $m =
"";
$d =
"";
119 if (preg_match(
"/(\\d{4})-(\\d{2})-(\\d{2})/", $user_data[
"birthday"], $matches))
125 include_once
"./classes/class.ilFormat.php";
126 $insert_tags = array(
127 "[USER_FULLNAME]" =>
ilUtil::prepareFormOutput(trim($user_data[
"title"] .
" " . $user_data[
"firstname"] .
" " . $user_data[
"lastname"])),
132 "[USER_BIRTHDAY]" =>
ilUtil::prepareFormOutput((strlen(
$y.$m.$d)) ? str_replace(
"m", $m, str_replace(
"d",
$d, str_replace(
"Y",
$y, $lng->txt(
"lang_dateformat")))) : $lng->txt(
"not_available")),
141 "[SCORM_POINTS]" => $txtPoints,
158 $template =
new ilTemplate(
"tpl.certificate_edit.html", TRUE, TRUE,
"Modules/ScormAicc");
159 $template->setVariable(
"PH_INTRODUCTION", $lng->txt(
"certificate_ph_introduction"));
160 $template->setVariable(
"PH_USER_FULLNAME", $lng->txt(
"certificate_ph_fullname"));
161 $template->setVariable(
"PH_USER_FIRSTNAME", $lng->txt(
"certificate_ph_firstname"));
162 $template->setVariable(
"PH_USER_LASTNAME", $lng->txt(
"certificate_ph_lastname"));
163 $template->setVariable(
"PH_RESULT_PASSED", $lng->txt(
"certificate_ph_passed"));
164 $template->setVariable(
"PH_RESULT_POINTS", $lng->txt(
"certificate_ph_resultpoints"));
165 $template->setVariable(
"PH_RESULT_PERCENT", $lng->txt(
"certificate_ph_resultpercent"));
166 $template->setVariable(
"PH_USER_TITLE", $lng->txt(
"certificate_ph_title"));
167 $template->setVariable(
"PH_USER_BIRTHDAY", $lng->txt(
"certificate_ph_birthday"));
168 $template->setVariable(
"PH_USER_SALUTATION", $lng->txt(
"certificate_ph_salutation"));
169 $template->setVariable(
"PH_USER_STREET", $lng->txt(
"certificate_ph_street"));
170 $template->setVariable(
"PH_USER_INSTITUTION", $lng->txt(
"certificate_ph_institution"));
171 $template->setVariable(
"PH_USER_DEPARTMENT", $lng->txt(
"certificate_ph_department"));
172 $template->setVariable(
"PH_USER_CITY", $lng->txt(
"certificate_ph_city"));
173 $template->setVariable(
"PH_USER_ZIPCODE", $lng->txt(
"certificate_ph_zipcode"));
174 $template->setVariable(
"PH_USER_COUNTRY", $lng->txt(
"certificate_ph_country"));
175 $template->setVariable(
"PH_USER_LASTACCESS", $lng->txt(
"certificate_ph_lastaccess"));
176 $template->setVariable(
"PH_SCORM_TITLE", $lng->txt(
"certificate_ph_scormtitle"));
177 $template->setVariable(
"PH_SCORM_POINTS", $lng->txt(
"certificate_ph_scormpoints"));
178 $template->setVariable(
"PH_DATE", $lng->txt(
"certificate_ph_date"));
179 $template->setVariable(
"PH_DATETIME", $lng->txt(
"certificate_ph_datetime"));
180 return $template->get();
195 $short_name =
new ilTextInputGUI($lng->txt(
"certificate_short_name"),
"short_name");
197 require_once
"./Services/Utilities/classes/class.ilStr.php";
198 $short_name->setValue(strlen($form_fields[
"short_name"]) ? $form_fields[
"short_name"] :
ilStr::subStr($this->object->getTitle(), 0, 30));
199 $short_name->setSize(30);
200 if (strlen($form_fields[
"short_name"])) {
201 $short_name->setInfo(str_replace(
"[SHORT_TITLE]", $form_fields[
"short_name"], $lng->txt(
"certificate_short_name_description")));
203 $short_name->setInfo($lng->txt(
"certificate_short_name_description"));
205 if (count(
$_POST)) $short_name->checkInput();
206 $form->addItem($short_name);
208 $visibility =
new ilCheckboxInputGUI($lng->txt(
"certificate_enabled_scorm"),
"certificate_enabled_scorm");
209 $visibility->
setInfo($lng->txt(
"certificate_enabled_scorm_introduction"));
210 $visibility->setValue(1);
211 if ($form_fields[
"certificate_enabled_scorm"])
213 $visibility->setChecked(TRUE);
215 if (count(
$_POST)) $visibility->checkInput();
216 $form->addItem($visibility);
229 $form_fields[
"certificate_enabled_scorm"] =
$_POST[
"certificate_enabled_scorm"];
230 $form_fields[
"short_name"] =
$_POST[
"short_name"];
245 $form_fields[
"certificate_enabled_scorm"] = $scormSetting->get(
"certificate_" . $this->object->getId());
246 $form_fields[
"short_name"] = $scormSetting->get(
"certificate_short_name_" . $this->object->getId());
260 $scormSetting->set(
"certificate_" . $this->object->getId(), $form_fields[
"certificate_enabled_scorm"]);
261 $scormSetting->set(
"certificate_short_name_" . $this->object->getId(), $form_fields[
"short_name"]);
283 return $this->
object->getId();
296 $user_data = $params[
"user_data"];
297 if (!is_array($user_data))
301 $short_title = $scormSetting->get(
"certificate_short_name_" . $this->object->getId());
302 return strftime(
"%y%m%d", time()) .
"_" . $lng->txt(
"certificate_var_user_lastname") .
"_" . $short_title .
"_Zertifikat.pdf";
306 return strftime(
"%y%m%d", time()) .
"_" . $user_data[
"lastname"] .
"_" . $params[
"short_title"] .
"_Zertifikat.pdf";
319 $scormSetting->delete(
"certificate_" . $this->object->getId());