5 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
6 require_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
7 require_once(
"Services/User/classes/class.ilObjUser.php");
9 require_once(
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php");
10 require_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
43 $lng->loadLanguageModule(
"content");
44 $lng->loadLanguageModule(
"search");
47 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
57 if ($this->call_by_reference)
76 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
79 $this->tpl->setCurrentBlock(
"btn_cell");
80 $this->tpl->setVariable(
"BTN_LINK",
"ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=".$this->object->getRefID());
81 $this->tpl->setVariable(
"BTN_TARGET",
" target=\"ilContObj".$this->object->getID().
"\" ");
82 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"view"));
83 $this->tpl->parseCurrentBlock();
87 $this->tpl->setCurrentBlock(
"btn_cell");
88 $this->tpl->setVariable(
"BTN_LINK", $this->ctrl->getLinkTarget($this,
"newModuleVersion"));
89 $this->tpl->setVariable(
"BTN_TXT",$this->lng->txt(
"cont_sc_new_version"));
90 $this->tpl->parseCurrentBlock();
94 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.sahs_properties.html",
"Modules/ScormAicc");
95 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
96 $this->tpl->setVariable(
"TXT_PROPERTIES", $this->lng->txt(
"cont_lm_properties"));
99 $this->tpl->setVariable(
"TXT_ONLINE", $this->lng->txt(
"cont_online"));
100 $this->tpl->setVariable(
"CBOX_ONLINE",
"cobj_online");
101 $this->tpl->setVariable(
"VAL_ONLINE",
"y");
102 if ($this->object->getOnline())
104 $this->tpl->setVariable(
"CHK_ONLINE",
"checked");
108 $this->tpl->setVariable(
"TXT_OPEN", $this->lng->txt(
"cont_open"));
110 "0" => $this->lng->txt(
"cont_open_normal"),
111 "1" => $this->lng->txt(
"cont_open_iframe_max"),
112 "2" => $this->lng->txt(
"cont_open_iframe_defined"),
113 "5" => $this->lng->txt(
"cont_open_window_undefined"),
114 "6" => $this->lng->txt(
"cont_open_window_defined")
117 "open_mode", $open_modes,
false,
true);
118 $this->tpl->setVariable(
"SEL_OPEN", $sel_open);
121 $this->tpl->setVariable(
"TXT_WIDTH", $this->lng->txt(
"cont_open_width"));
122 $this->tpl->setVariable(
"VAL_WIDTH", $this->object->getWidth());
125 $this->tpl->setVariable(
"TXT_HEIGHT", $this->lng->txt(
"cont_open_heigth"));
126 $this->tpl->setVariable(
"VAL_HEIGHT", $this->object->getHeight());
129 $this->tpl->setVariable(
"TXT_API_ADAPTER", $this->lng->txt(
"cont_api_adapter"));
130 $this->tpl->setVariable(
"VAL_API_ADAPTER", $this->object->getAPIAdapterName());
133 $this->tpl->setVariable(
"TXT_API_PREFIX", $this->lng->txt(
"cont_api_func_prefix"));
134 $this->tpl->setVariable(
"VAL_API_PREFIX", $this->object->getAPIFunctionsPrefix());
137 $this->tpl->setVariable(
"TXT_LESSON_MODE", $this->lng->txt(
"cont_def_lesson_mode"));
138 $lesson_modes = array(
"normal" => $this->lng->txt(
"cont_sc_less_mode_normal"),
139 "browse" => $this->lng->txt(
"cont_sc_less_mode_browse"));
141 "lesson_mode", $lesson_modes,
false,
true);
142 $this->tpl->setVariable(
"SEL_LESSON_MODE", $sel_lesson);
145 $this->tpl->setVariable(
"TXT_CREDIT_MODE", $this->lng->txt(
"cont_credit_mode"));
146 $credit_modes = array(
"credit" => $this->lng->txt(
"cont_credit_on"),
147 "no_credit" => $this->lng->txt(
"cont_credit_off"));
149 "credit_mode", $credit_modes,
false,
true);
150 $this->tpl->setVariable(
"SEL_CREDIT_MODE", $sel_credit);
153 $this->tpl->setVariable(
"TXT_AUTO_REVIEW", $this->lng->txt(
"cont_sc_auto_review"));
154 $this->tpl->setVariable(
"CBOX_AUTO_REVIEW",
"auto_review");
155 $this->tpl->setVariable(
"VAL_AUTO_REVIEW",
"y");
156 if ($this->object->getAutoReview())
158 $this->tpl->setVariable(
"CHK_AUTO_REVIEW",
"checked");
162 $this->tpl->setVariable(
"MAX_ATTEMPTS", $this->lng->txt(
"cont_sc_max_attempt"));
163 $this->tpl->setVariable(
"VAL_MAX_ATTEMPT", $this->object->getMaxAttempt());
166 $this->tpl->setVariable(
"TXT_VERSION", $this->lng->txt(
"cont_sc_version"));
167 $this->tpl->setVariable(
"VAL_VERSION", $this->object->getModuleVersion());
170 $this->tpl->setVariable(
"TXT_SESSION", $this->lng->txt(
"cont_sc_usession"));
171 $this->tpl->setVariable(
"CBOX_SESSION",
"cobj_session");
172 $this->tpl->setVariable(
"VAL_SESSION",
"y");
173 if ($this->object->getSession())
175 $this->tpl->setVariable(
"CHK_SESSION",
"checked");
179 $this->tpl->setVariable(
"TXT_AUTO_CONTINUE", $this->lng->txt(
"cont_sc_auto_continue"));
180 $this->tpl->setVariable(
"CBOX_AUTO_CONTINUE",
"auto_continue");
181 $this->tpl->setVariable(
"VAL_AUTO_CONTINUE",
"y");
182 if ($this->object->getAutoContinue())
184 $this->tpl->setVariable(
"CHK_AUTO_CONTINUE",
"checked");
188 $this->tpl->setVariable(
"TXT_AUTO_LAST_VISITED", $this->lng->txt(
"cont_auto_last_visited"));
189 $this->tpl->setVariable(
"CBOX_AUTO_LAST_VISITED",
"cobj_auto_last_visited");
190 $this->tpl->setVariable(
"VAL_AUTO_LAST_VISITED",
"y");
191 if ($this->object->getAuto_last_visited())
193 $this->tpl->setVariable(
"CHK_AUTO_LAST_VISITED",
"checked");
197 $this->tpl->setVariable(
"TXT_CHECK_VALUES", $this->lng->txt(
"cont_check_values"));
198 $this->tpl->setVariable(
"CBOX_CHECK_VALUES",
"cobj_check_values");
199 $this->tpl->setVariable(
"VAL_CHECK_VALUES",
"y");
200 if ($this->object->getCheck_values())
202 $this->tpl->setVariable(
"CHK_CHECK_VALUES",
"checked");
206 $this->tpl->setVariable(
"TXT_DEBUG", $this->lng->txt(
"cont_debug"));
207 $this->tpl->setVariable(
"CBOX_DEBUG",
"cobj_debug");
208 $this->tpl->setVariable(
"VAL_DEBUG",
"y");
209 if ($this->object->getDebug())
211 $this->tpl->setVariable(
"CHK_DEBUG",
"checked");
215 if ($this->object->getDebugActivated() ==
false) {
216 $this->tpl->setVariable(
"CHK_ACTIVATED",
"disabled");
217 $this->tpl->setVariable(
"TXT_ACTIVATED", $this->lng->txt(
"cont_debug_deactivated"));
219 $this->tpl->setVariable(
"TXT_ACTIVATED", $this->lng->txt(
"cont_debug_deactivate"));
222 $this->tpl->setCurrentBlock(
"commands");
223 $this->tpl->setVariable(
"BTN_NAME",
"saveProperties");
224 $this->tpl->setVariable(
"BTN_TEXT", $this->lng->txt(
"save"));
225 $this->tpl->parseCurrentBlock();
238 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.scorm_new_version_import.html",
"Modules/ScormAicc");
241 $this->tpl->setVariable(
"ALT_IMG", $this->lng->txt(
"obj_sahs"));
243 $this->ctrl->setParameter($this,
"new_type",
"sahs");
244 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
246 $this->tpl->setVariable(
"BTN_NAME",
"newModuleVersionUpload");
247 $this->tpl->setVariable(
"TARGET",
' target="'.
250 $this->tpl->setVariable(
"TXT_SELECT_LMTYPE", $this->lng->txt(
"type"));
252 if ($type ==
"scorm2004") {
253 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"lm_type_scorm2004"));
255 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"lm_type_scorm"));
258 include_once
'Services/FileSystem/classes/class.ilUploadFiles.php';
262 foreach($files as
$file)
264 $file = htmlspecialchars($file, ENT_QUOTES,
"utf-8");
265 $this->tpl->setCurrentBlock(
"option_uploaded_file");
266 $this->tpl->setVariable(
"UPLOADED_FILENAME", $file);
267 $this->tpl->setVariable(
"TXT_UPLOADED_FILENAME", $file);
268 $this->tpl->parseCurrentBlock();
270 $this->tpl->setCurrentBlock(
"select_uploaded_file");
271 $this->tpl->setVariable(
"TXT_SELECT_FROM_UPLOAD_DIR", $this->lng->txt(
"cont_select_from_upload_dir"));
272 $this->tpl->setVariable(
"TXT_UPLOADED_FILE", $this->lng->txt(
"cont_uploaded_file"));
273 $this->tpl->parseCurrentBlock();
276 $this->tpl->setVariable(
"TXT_UPLOAD", $this->lng->txt(
"upload"));
277 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
278 $this->tpl->setVariable(
"TXT_IMPORT_LM", $this->lng->txt(
"import_sahs"));
279 $this->tpl->setVariable(
"TXT_SELECT_FILE", $this->lng->txt(
"select_file"));
282 $this->tpl->setVariable(
"TXT_FILE_INFO", $this->lng->txt(
"file_notice").
" ".$this->
getMaxFileSize());
289 $umf=get_cfg_var(
"upload_max_filesize");
291 $pms=get_cfg_var(
"post_max_size");
294 $multiplier_a=array(
"K"=>1024,
"M"=>1024*1024,
"G"=>1024*1024*1024);
296 $umf_parts=preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
297 $pms_parts=preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
299 if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
300 if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
303 $max_filesize=min($umf, $pms);
305 if (!$max_filesize) $max_filesize=max($umf, $pms);
308 return $max_filesize=sprintf(
"%.1f MB",$max_filesize/1024/1024);
314 global $_FILES, $rbacsystem;
316 $unzip = PATH_TO_UNZIP;
317 $tocheck =
"imsmanifest.xml";
319 include_once
'Services/FileSystem/classes/class.ilUploadFiles.php';
322 if (!$rbacsystem->checkAccess(
"write",
$_GET[
"ref_id"]))
324 $this->ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->WARNING);
326 elseif ($_FILES[
"scormfile"][
"name"])
329 $source = $_FILES[
"scormfile"][
"tmp_name"];
330 if (($source ==
'none') || (!$source))
337 elseif (
$_POST[
"uploaded_file"])
342 $this->ilias->raiseError($this->lng->txt(
"upload_error_file_not_found"),$this->ilias->error_obj->MESSAGE);
346 $source = CLIENT_WEB_DIR .
"/" .
$_POST[
"uploaded_file"];
348 $source_is_copy =
true;
359 $pathinfo = pathinfo($source);
360 $dir = $pathinfo[
"dirname"];
361 $file = $pathinfo[
"basename"];
369 $tmp_file = $dir.
"/".$tocheck.
".".
$_GET[
"ref_id"];
371 rename($dir.
"/".$tocheck,$tmp_file);
372 $new_manifest = file_get_contents($tmp_file);
378 $old_manifest = file_get_contents($this->object->getDataDirectory().
"/".$tocheck);
381 $check =
'/xmlns="http:\/\/www.imsglobal.org\/xsd\/imscp_v1p1"/';
382 $replace=
"xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"";
383 $reload_manifest = preg_replace($check, $replace, $new_manifest);
386 if (strcmp($new_manifest,$old_manifest) == 0 || strcmp(utf8_encode($new_manifest),$old_manifest) == 0 ||
387 strcmp ($reload_manifest, $old_manifest) == 0 || strcmp(utf8_encode($reload_manifest),$old_manifest) == 0 ){
390 $module_version = $this->
object->getModuleVersion();
392 if ($_FILES[
"scormfile"][
"name"])
395 $file_path = $this->
object->getDataDirectory().
"/".$_FILES[
"scormfile"][
"name"].
".".$module_version;
403 $file_path = $this->
object->getDataDirectory().
"/".
$_POST[
"uploaded_file"].
".".$module_version;
405 rename($source, $file_path);
413 $this->
object->setModuleVersion($module_version+1);
414 $this->
object->update();
439 $this->
object->setOpenMode(
$_POST[
"open_mode"]);
440 $this->
object->setWidth(
$_POST[
"width"]);
441 $this->
object->setHeight(
$_POST[
"height"]);
443 $this->
object->setAPIAdapterName(
$_POST[
"api_adapter"]);
444 $this->
object->setAPIFunctionsPrefix(
$_POST[
"api_func_prefix"]);
445 $this->
object->setCreditMode(
$_POST[
"credit_mode"]);
446 $this->
object->setDefaultLessonMode(
$_POST[
"lesson_mode"]);
447 $this->
object->setMaxAttempt(
$_POST[
"max_attempt"]);
453 $this->
object->update();
455 $this->ctrl->redirect($this,
"properties");
465 include_once
"./Services/Table/classes/class.ilTableGUI.php";
468 $ilTabs->setTabActive(
"cont_tracking_data");
469 $ilTabs->setSubTabActive(
"cont_tracking_bysco");
471 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingItemsPerScoTableGUI.php';
474 $this->tpl->setContent($tbl->getHTML());
486 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
488 if(!$privacy->enabledSahsProtocolData())
490 $this->ilias->raiseError($this->lng->txt(
'permission_denied'), $this->ilias->error_obj->MESSAGE);
493 global $ilTabs, $ilToolbar;
495 include_once
'./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
496 $ilToolbar->addButton(
497 $this->lng->txt(
'import'),
498 $this->ctrl->getLinkTarget($this,
'importForm')
500 $ilToolbar->addButton(
501 $this->lng->txt(
'cont_export_all'),
502 $this->ctrl->getLinkTarget($this,
'exportSelectionAll')
506 $ilTabs->setTabActive(
'cont_tracking_data');
507 $ilTabs->setSubTabActive(
'cont_tracking_byuser');
509 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php';
512 $this->tpl->setContent($tbl->getHTML());
521 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php';
533 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php';
545 if(!isset(
$_POST[
"user"]))
547 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
551 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
553 $cgui->setFormAction($this->ctrl->getFormAction($this));
554 $cgui->setHeaderText($this->lng->txt(
"info_delete_sure"));
555 $cgui->setCancel($this->lng->txt(
"cancel"),
"cancelDelete");
556 $cgui->setConfirm($this->lng->txt(
"confirm"),
"confirmedDelete");
558 foreach(
$_POST[
"user"] as $id)
565 " ".$this->lng->txt(
"cont_tracking_data").
566 ": ".$user->getLastname().
", ".$user->getFirstname();
569 $cgui->addItem(
"user[]", $id, $caption);
573 $this->tpl->setContent($cgui->getHTML());
582 $this->ctrl->redirect($this,
"showTrackingItems");
589 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
591 foreach(
$_POST[
"user"] as $user)
594 DELETE FROM scorm_tracking
597 array(
'integer',
'integer'),
598 array($user, $this->object->getID()));
603 $this->ctrl->redirect($this,
"showTrackingItems");
612 $this->ctrl->redirect($this,
"properties");
618 protected function import()
621 if($form->checkInput())
623 $source = $form->getInput(
'csv');
624 $error = $this->
object->importTrackingData($source[
'tmp_name']);
629 $this->ctrl->redirect($this,
"showTrackingItems");
638 $form->setValuesByPost();
649 $ilTabs->clearTargets();
650 $ilTabs->setBackTarget($this->lng->txt(
'back'),$this->ctrl->getLinkTarget($this,
'showTrackingItems'));
653 $this->tpl->setContent($form->getHTML());
661 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
663 $form->setFormAction($this->ctrl->getFormAction($this));
664 $form->setTitle($this->lng->txt(
'cont_import_tracking'));
665 $form->addCommandButton(
'import', $this->lng->txt(
'import'));
666 $form->addCommandButton(
'showTrackingItems', $this->lng->txt(
'cancel'));
670 $csv->setSuffixes(array(
'csv'));
671 $form->addItem($csv);
689 if(!count((array)
$_POST[
'user']))
692 $this->ctrl->redirect($this,
'showTrackingItems');
706 $ilTabs->clearTargets();
707 $ilTabs->setBackTarget(
708 $this->lng->txt(
'back'),
709 $this->ctrl->getLinkTarget($this,
'showTrackingItems')
713 $this->tpl->setContent($form->getHTML());
722 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
725 $form->setFormAction($this->ctrl->getFormAction($this,
'showTrackingItems'));
726 $form->setTitle($this->lng->txt(
'cont_export_tracking'));
727 $form->addCommandButton(
'export', $this->lng->txt(
'export'));
728 $form->addCommandButton(
'showTrackingItems', $this->lng->txt(
'cancel'));
732 $type->setValue(self::EXPORT_TYPE_RAW);
733 $form->addItem($type);
736 $type->addOption($raw);
739 $type->addOption($suc);
742 $etype->setValue($a_type);
743 $form->addItem($etype);
747 case self::EXPORT_SELECTED:
749 $users->setValue(htmlentities(serialize(
$_POST[
'user'])));
750 $form->addItem($users);
763 if($form->checkInput())
769 return $this->
object->exportSelectedRaw(
true);
773 $users = (array) unserialize(html_entity_decode($form->getInput(
'users')));
774 return $this->
object->exportSelectedRaw(
false,$users);
781 return $this->
object->exportSelected(
true);
785 $users = (array) unserialize(html_entity_decode($form->getInput(
'users')));
786 return $this->
object->exportSelected(
false,$users);
791 $this->ctrl->redirect($this,
'showTrackingItems');
798 if (!isset(
$_POST[
"user"]))
803 foreach (
$_POST[
"user"] as $user)
807 $val_set = $ilDB->queryF(
'
808 SELECT * FROM scorm_tracking
813 array(
'integer',
'integer',
'text',
'integer'),
814 array($user,0,
'package_attempts',$this->object->getID()));
816 $val_rec = $ilDB->fetchAssoc($val_set);
818 $val_rec[
"rvalue"] = str_replace(
"\r\n",
"\n", $val_rec[
"rvalue"]);
819 if ($val_rec[
"rvalue"] != null && $val_rec[
"rvalue"] != 0)
821 $new_rec = $val_rec[
"rvalue"]-1;
823 if(
$res = $ilDB->numRows($val_set) > 0)
825 $ilDB->update(
'scorm_tracking',
827 'rvalue' => array(
'clob', $new_rec)
830 'user_id' => array(
'integer', $user),
831 'sco_id' => array(
'integer', 0),
832 'obj_id' => array(
'integer', $this->object->getId()),
833 'lvalue' => array(
'text',
'package_attempts')
839 $ilDB->insert(
'scorm_tracking', array(
840 'rvalue' => array(
'clob', $new_rec),
841 'user_id' => array(
'integer', $user),
842 'sco_id' => array(
'integer', 0),
843 'obj_id' => array(
'integer', $this->object->getId()),
844 'lvalue' => array(
'text',
'package_attempts')
848 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
854 $this->ctrl->redirect($this,
"showTrackingItems");
865 include_once
"./Services/Table/classes/class.ilTableGUI.php";
868 $ilTabs->setTabActive(
"cont_tracking_data");
869 $ilTabs->setSubTabActive(
"cont_tracking_byuser");
871 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingItemsPerUserTableGUI.php';
875 $this->tpl->setContent($tbl->getHTML());
886 include_once
"./Services/Table/classes/class.ilTableGUI.php";
889 $ilTabs->setTabActive(
"cont_tracking_data");
890 $ilTabs->setSubTabActive(
"cont_tracking_bysco");
892 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingItemsScoTableGUI.php';
896 $this->tpl->setContent($tbl->getHTML());
907 include_once
"./Services/Table/classes/class.ilTableGUI.php";
910 $ilTabs->setTabActive(
"cont_tracking_data");
911 $ilTabs->setSubTabActive(
"cont_tracking_byuser");
913 $this->ctrl->setParameter($this,
'obj_id',(
int)
$_REQUEST[
'obj_id']);
914 $this->ctrl->setParameter($this,
'user_id',(
int) $_REQUEST[
'user_id']);
916 include_once
'./Modules/ScormAicc/classes/class.ilSCORMTrackingItemPerUserTableGUI.php';
918 $tbl->
setUserId((
int) $_REQUEST[
'user_id']);
919 $tbl->setScoId((
int) $_REQUEST[
'obj_id']);
921 $this->tpl->setContent($tbl->getHTML());
930 $ilTabs->addSubTabTarget(
"cont_tracking_byuser",
931 $this->ctrl->getLinkTarget($this,
"showTrackingItems"), array(
"edit",
""),
934 $ilTabs->addSubTabTarget(
"cont_tracking_bysco",
935 $this->ctrl->getLinkTarget($this,
"showTrackingItemsBySco"), array(
"edit",
""),