5 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004NodeGUI.php");
6 require_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
7 require_once(
"./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
45 $this->ctrl = $DIC->ctrl();
46 $this->tpl = $DIC[
"tpl"];
47 $this->tabs = $DIC->tabs();
48 $this->lng = $DIC->language();
49 $this->
help = $DIC[
"ilHelp"];
50 $this->error = $DIC[
"ilErr"];
53 $ilCtrl->saveParameter($this,
"obj_id");
76 $tpl->loadStandardTemplate();
78 $next_class =
$ilCtrl->getNextClass($this);
81 switch ($next_class) {
84 switch (
$_GET[
"notes_mode"]) {
86 $ilTabs->setTabActive(
"sahs_organization");
91 case 'ilobjectmetadatagui':
94 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
97 $this->node_object->getType(),
98 $this->node_object->getId()
100 $md_gui->
addMDObserver($this->node_object,
'MDUpdateListener',
'General');
101 $ilCtrl->forwardCommand($md_gui);
104 case 'ilscorm2004pagegui':
105 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php");
109 $ilCtrl->forwardCommand($page_obj);
113 case "ilassgenfeedbackpagegui":
117 $cmd =
$ilCtrl->getCmd(
"showOrganization");
118 $ret = $this->$cmd();
135 $ilTabs->setTabActive(
"sahs_desc_objectives");
137 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
142 $cb->
setInfo(
$lng->txt(
"sahs_hide_objectives_page_info"));
144 $cb->setChecked($this->node_object->getHideObjectivePage());
150 $ta->setInfo(
$lng->txt(
"sahs_list_info"));
151 $form->setTitle(
$lng->txt(
"properties"));
153 include_once
"./Services/MetaData/classes/class.ilMD.php";
154 $meta =
new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
155 $desc_ids = $meta->
getGeneral()->getDescriptionIds();
156 $ta->setValue($meta->getGeneral()->getDescription($desc_ids[0])->getDescription());
160 $sh->setTitle(
$lng->txt(
"sahs_learning_objectives"));
163 $objectives = $this->node_object->getObjectives();
165 foreach ($objectives as $ob) {
167 $mappings = $ob->getMappings();
169 foreach ($mappings as $map) {
170 $mapinfo .= $map->getTargetObjectiveID();
173 if ($mapinfo == null) {
176 $mapinfo =
"global to " . $mapinfo;
182 "obj_" . $ob->getId()
186 $ta->setInfo(
$lng->txt(
"sahs_list_info"));
188 $ta->setValue($ob->getObjectiveID());
190 $form->setFormAction(
$ilCtrl->getFormAction($this));
191 $form->addCommandButton(
195 $tpl->setContent($form->getHTML());
207 foreach (
$_POST as $key => $value) {
208 if (preg_match(
'/(obj_)(.+)/', $key, $match)) {
209 $objective =
new ilScorm2004Objective($this->node_object->getId(), $match[2]);
215 $objective->updateObjective();
221 $this->node_object->update();
223 include_once
"./Services/MetaData/classes/class.ilMD.php";
224 $meta =
new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
226 $desc_ids = $gen->getDescriptionIds();
227 $des = $gen->getDescription($desc_ids[0]);
245 $tree =
new ilTree($this->slm_object->getId());
246 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
247 $tree->setTreeTablePK(
"slm_id");
249 foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()),
true,
'page') as $page) {
252 if (count($qids) > 0) {
254 foreach ($qids as $qid) {
264 $tab->setData($questions);
265 $this->tpl->setContent(
$tab->getHTML());
271 $slm_tree =
new ilTree($this->node_object->getId(), $this->slm_object->getId());
272 $slm_tree->setTreeTablePK(
"slm_id");
273 $slm_tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
288 $ilHelp->setScreenIdComponent(
"sahsed");
293 $ilCtrl->getLinkTarget($this,
'showOrganization'),
301 "sahs_desc_objectives",
302 $ilCtrl->getLinkTarget($this,
'showProperties'),
310 $ilCtrl->getLinkTarget($this,
'sahs_questions'),
318 $ilCtrl->getLinkTarget($this,
'sco_resources'),
324 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
327 $this->node_object->getType(),
328 $this->node_object->getId()
330 $mdtab = $mdgui->
getTab();
343 $ilCtrl->getLinkTarget($this,
"showExportList"),
351 $ilCtrl->getLinkTarget($this,
"import"),
357 $ilTabs->addNonTabbedLink(
359 $lng->txt(
"cont_preview"),
360 $ilCtrl->getLinkTarget($this,
'sco_preview'),
366 $lng->txt(
"sahs_unit") .
": " . $this->node_object->getTitle()
378 $this->slm_object->executeDragDrop(
379 $_POST[
"il_hform_source_id"],
380 $_POST[
"il_hform_target_id"],
382 $_POST[
"il_hform_as_subitem"]
384 $ilCtrl->redirect($this,
"showOrganization");
399 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
401 $tpl->setBodyClass(
"");
402 $tpl->setCurrentBlock(
"ContentStyle");
404 "LOCATION_CONTENT_STYLESHEET",
407 $tpl->parseCurrentBlock();
410 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
413 $tpl->addJavaScript(
"./Modules/Scorm2004/scripts/questions/pure.js");
414 $tpl->addJavaScript(
"./Modules/Scorm2004/scripts/pager.js");
415 $tpl->addJavaScript(
"./Services/COPage/js/ilCOPagePres.js");
417 $tpl->addCss(
"./Modules/Test/templates/default/ta.css");
419 $tpl->addOnLoadCode(
"pager.Init();");
421 $tree =
new ilTree($this->slm_object->getId());
422 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
423 $tree->setTreeTablePK(
"slm_id");
424 include_once
"./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
425 include_once
"./Services/MetaData/classes/class.ilMD.php";
427 $meta =
new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
428 $desc_ids = $meta->
getGeneral()->getDescriptionIds();
429 $sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
432 $sco_tpl =
new ilTemplate(
"tpl.sco.html",
true,
true,
"Modules/Scorm2004");
442 $this->node_object->getType()
447 $terms = $this->node_object->getGlossaryTermIds();
450 foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()),
true,
'page') as $page) {
452 $this->node_object->getType(),
455 $this->slm_object->getId()
459 $page_obj->setStyleId($this->slm_object->getStyleSheetId());
460 if (count($terms) > 1) {
461 $page_obj->setGlossaryOverviewInfo(
466 $sco_tpl->setCurrentBlock(
"page_preview");
467 $html =
$ilCtrl->getHTML($page_obj);
469 $sco_tpl->setVariable(
"PAGE_PRV", $html);
470 $sco_tpl->parseCurrentBlock();
473 $output = $sco_tpl->get();
479 require_once
'./Modules/Scorm2004/classes/class.ilQuestionExporter.php';
480 $output = preg_replace_callback(
"/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this),
'insertQuestion'), $output);
485 $tpl->addJavaScript(
"./Modules/Scorm2004/scripts/questions/question_handling.js");
486 $tpl->addCss(
"./Modules/Scorm2004/templates/default/question_handling.css");
488 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
492 $output .=
'<script type="text/javascript" src="./Modules/Scorm2004/scripts/questions/question_handling.js"></script>';
493 $tpl->addOnLoadCode(
"ilias.questions.refresh_lang();");
494 $tpl->setVariable(
"CONTENT", $output);
495 $tpl->printToStdout();
503 return $q_exporter->exportQuestion($matches[2]);
511 switch (
$_POST[
'select_export']) {
512 case "exportScorm12":
513 case "exportScorm2004_3rd":
514 case "exportScorm2004_4th":
517 $this->ctrl->redirect($this,
$_POST[
'select_export']);
520 $this->ctrl->redirect($this,
'showExportList');
535 $template =
new ilTemplate(
"tpl.scorm2004_export_buttons.html",
true,
true,
'Modules/Scorm2004');
538 "exportScorm2004_3rd" =>
$lng->txt(
"scorm_create_export_file_scrom2004"),
539 "exportScorm2004_4th" =>
$lng->txt(
"scorm_create_export_file_scrom2004_4th"),
540 "exportScorm12" =>
$lng->txt(
"scorm_create_export_file_scrom12"),
541 "exportPDF" =>
$lng->txt(
"scorm_create_export_file_pdf"),
542 "exportHTML" =>
$lng->txt(
"scorm_create_export_file_html")
544 foreach ($buttons as $value => $text) {
545 $template->setCurrentBlock(
'option');
546 $template->setVariable(
'OPTION_VALUE', $value);
548 $template->parseCurrentBlock();
550 $template->setVariable(
'EXPORT_TITLE',
$lng->txt(
'export'));
551 $template->setVariable(
'EXPORT_LABEL',
$lng->txt(
'type'));
552 $template->setVariable(
'FORMACTION',
$ilCtrl->getFormAction($this,
'selectExport'));
554 $export_files = $this->node_object->getExportFiles();
556 include_once
"./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
559 foreach ($export_files as $exp_file) {
560 $filetype = $exp_file[
'type'];
565 $file_arr = explode(
"__", $exp_file[
"file"]);
568 $table_gui->setData(
$data);
569 $tpl->setVariable(
'ADM_CONTENT', $template->get() .
"\n" . $table_gui->getHTML());
575 $export->buildExportFile();
576 $this->ctrl->redirect($this,
"showExportList");
583 $export->buildExportFile();
584 $this->ctrl->redirect($this,
"showExportList");
590 $export->buildExportFile();
591 $this->ctrl->redirect($this,
"showExportList");
597 $export->buildExportFile();
598 $this->ctrl->redirect($this,
"showExportList");
604 $export->buildExportFile();
605 $this->ctrl->redirect($this,
"showExportList");
611 $export->buildExportFile();
612 $this->ctrl->redirect($this,
"showExportList");
617 $file = str_replace(
"..",
"",
$_GET[
'file']);
618 $export =
new ilSCORM2004Export($this->node_object);
619 $export_dir = $export->getExportDirectoryForType(
$_GET[
'type']);
631 if (!isset(
$_POST[
"file"])) {
633 $this->ctrl->redirect($this,
"showExportList");
637 $export_files = $this->node_object->getExportFiles();
639 include_once
"./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
642 foreach ($export_files as $exp_file) {
643 foreach (
$_POST[
'file'] as $delete_file) {
644 if (strcmp($delete_file, $exp_file[
'file']) == 0) {
649 $file_arr = explode(
"__", $exp_file[
"file"]);
654 $table_gui->setData(
$data);
655 $tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
664 $this->ctrl->redirect($this,
"showExportList");
674 include_once
"./Services/Utilities/classes/class.ilUtil.php";
675 $export =
new ilSCORM2004Export($this->node_object);
676 foreach (
$_POST[
'file'] as $idx => $file) {
677 $export_dir = $export->getExportDirectoryForType(
$_POST[
'type'][$idx]);
678 $exp_file = $export_dir .
"/" . $file;
679 if (@is_file($exp_file)) {
683 ilUtil::sendSuccess(
$lng->txt(
'msg_deleted_export_files'),
true);
684 $this->ctrl->redirect($this,
"showExportList");
689 $export_files = array();
691 require_once
"./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
692 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
693 include_once
"./Modules/File/classes/class.ilObjFile.php";
694 $tree =
new ilTree($this->slm_object->getId());
695 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
696 $tree->setTreeTablePK(
"slm_id");
698 foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()),
true,
'page') as $page) {
700 $page_obj->buildDom();
701 $mob_ids = $page_obj->collectMediaObjects(
false);
702 foreach ($mob_ids as $mob_id) {
707 $export_files[
$i][
"date"] = $media_obj->getCreateDate();
708 $export_files[
$i][
"size"] = @filesize($path);
709 $export_files[
$i][
"file"] = $media_obj->getTitle();
710 $export_files[
$i][
"type"] = $media_obj->getDescription();
711 $export_files[
$i][
"path"] = $path;
712 $this->ctrl->setParameter(
717 $export_files[
$i][
"link"] = $this->ctrl->getLinkTarget($this,
"downloadResource");
721 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
723 foreach ($file_ids as $file_id) {
724 $file_obj =
new ilObjFile($file_id,
false);
725 $export_files[
$i][
"date"] = $file_obj->getCreateDate();
726 $export_files[
$i][
"size"] = $file_obj->getFileSize();
727 $export_files[
$i][
"file"] = $file_obj->getFileName();
728 $export_files[
$i][
"type"] = $file_obj->getFileType();
729 $export_files[
$i][
"file_id"] = $file_id;
730 $this->ctrl->setParameter($this,
"file_id", $file_id);
731 $export_files[
$i][
"link"] = $this->ctrl->getLinkTarget($this,
"downloadFile",
"");
737 return $export_files;
746 $tab = new \ILIAS\Scorm2004\Editor\ilSCORMMediaOverviewTableGUI($this,
"sco_resources");
747 $tab->setData($export_files);
749 $this->tpl->setContent(
$tab->getHTML());
756 if (
$_GET[
"file_id"] > 0) {
761 foreach ($export_files as
$f) {
762 if (is_object($file)) {
763 if ($f[
"file"] == $file->getFileName()) {
767 if ($f[
"path"] ==
$_GET[
"resource"]) {
768 if (is_file($f[
"path"])) {
779 $file = explode(
"_",
$_GET[
"file_id"]);
780 require_once(
"./Modules/File/classes/class.ilObjFile.php");
781 $fileObj =
new ilObjFile($file[count($file) - 1],
false);
782 $fileObj->sendFile();
786 public function import()
794 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.scormeditor_sco_import.html",
"Modules/Scorm2004");
797 $tpl->setVariable(
"ALT_IMG",
$lng->txt(
"obj_sahs"));
799 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
801 $tpl->setVariable(
"BTN_NAME",
"importSave");
806 $tpl->setVariable(
"TXT_UPLOAD",
$lng->txt(
"upload"));
807 $tpl->setVariable(
"TXT_CANCEL",
$lng->txt(
"cancel"));
808 $tpl->setVariable(
"TXT_IMPORT_SCO",
$lng->txt(
"import_sco_object"));
809 $tpl->setVariable(
"TXT_SELECT_FILE",
$lng->txt(
"select_file"));
810 $tpl->setVariable(
"TXT_VALIDATE_FILE",
$lng->txt(
"cont_validate_file"));
813 $umf = get_cfg_var(
"upload_max_filesize");
815 $pms = get_cfg_var(
"post_max_size");
818 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024);
820 $umf_parts = preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
821 $pms_parts = preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
823 if (count($umf_parts) == 2) {
824 $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
826 if (count($pms_parts) == 2) {
827 $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
831 $max_filesize = min($umf, $pms);
833 if (!$max_filesize) {
834 $max_filesize = max($umf, $pms);
838 $max_filesize = sprintf(
"%.1f MB", $max_filesize / 1024 / 1024);
841 $tpl->setVariable(
"TXT_FILE_INFO",
$lng->txt(
"file_notice") .
" $max_filesize");
850 $source = $_FILES[
"scormfile"][
"tmp_name"];
852 $ilErr->raiseError(
"No file selected!",
$ilErr->MESSAGE);
855 switch ($_FILES[
"scormfile"][
"error"]) {
856 case UPLOAD_ERR_INI_SIZE:
857 $ilErr->raiseError(
$lng->txt(
"err_max_file_size_exceeds"),
$ilErr->MESSAGE);
860 case UPLOAD_ERR_FORM_SIZE:
861 $ilErr->raiseError(
$lng->txt(
"err_max_file_size_exceeds"),
$ilErr->MESSAGE);
864 case UPLOAD_ERR_PARTIAL:
868 case UPLOAD_ERR_NO_FILE:
873 $file = pathinfo($_FILES[
"scormfile"][
"name"]);
874 $name = substr($file[
"basename"], 0, strlen($file[
"basename"]) - strlen($file[
"extension"]) - 1);
875 $file_path = $this->slm_object->getDataDirectory() .
"/" . $this->node_object->getId() .
"/" . $_FILES[
"scormfile"][
"name"];
881 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Package.php");
883 $newPack->il_importSco($this->slm_object->getId(), $this->node_object->getId(), $this->slm_object->getDataDirectory() .
"/" . $this->node_object->getId());
885 $this->ctrl->redirect($this,
"showOrganization");
893 $this->ctrl->redirect($this,
"showOrganization");
917 $lng = $DIC->language();
919 $tpl =
new ilTemplate(
"tpl.sco_glossary_overview.html",
true,
true,
"Modules/Scorm2004");
921 $terms = $a_sco->getGlossaryTermIds();
923 foreach ($terms as $k => $t) {
924 $tpl->setCurrentBlock(
"link");
925 $tpl->setVariable(
"TXT_LINK", $t);
926 $tpl->setVariable(
"ID_LINK",
"glo_ov_t" . $k);
927 $tpl->parseCurrentBlock();
931 $tpl->setVariable(
"TXT_SCO_GLOSSARY",
$lng->txtlng(
"content",
"cont_sco_glossary", $lk));
932 $tpl->setVariable(
"TXT_CLOSE",
$lng->txtlng(
"common",
"close", $lk));
934 if (count($terms) > 1) {
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
__construct($a_slm_obj, $a_node_id=0)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
Scorm 2004 Question Exporter.
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
proceedDragDrop()
Perform drag and drop action.
special template class to simplify handling of ITX/PEAR
Class ilSCORM2004NodeGUI.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getGloOverviewOv($a_sco)
des
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static renderMetaPage($a_tpl, $a_sco, $a_asset_type="", $mode="")
Render meta page (description/objectives at beginning)
selectExport()
Select the export type of the SCORM 2004 module.
setLocator()
Set Locator Items.
static getGlossaryOverviewId()
Get sco glossary overlay id.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
cancelDeleteExportFile()
cancel deletion of export files
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static insertQuestion($matches)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
setCols($a_cols)
Set Cols.
setPresentationTitle($a_title="")
static createDirectory($a_dir, $a_mod=0755)
create directory
Export class for SCORM 2004 object.
static clear($a_var)
Unset a value.
showOrganization()
Confirm deletion screen (delete page or structure objects)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
updateProperties()
update Properties
static renderNavigation($a_tpl, $a_spacer_img="", $a_lang="")
Render navigation.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
setRows($a_rows)
Set Rows.
Class ilSCORM2004Page GUI class.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
__construct(Container $dic, ilPlugin $plugin)
This class represents a text area property in a property form.
static getLocalMaphilightPath()
Get local path of maphilight file.
static getGlossaryHTML($a_sco)
Get glossary html (only in export mode)
static getAffectiveLocalization($a_id)
Get affective localization.
deleteExportFile()
delete export files
showProperties()
Show learning objectives.
executeCommand()
execute command
confirmDeleteExportFile()
confirmation screen for export file deletion
static questionsJS(array $a_qids=null)
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static initExport()
Init export.
sco_preview()
SCO preview.
static initJavascript()
Init javascript.