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"];
51 $ilCtrl = $DIC->ctrl();
53 $ilCtrl->saveParameter($this,
"obj_id");
54 $this->ctrl = &$ilCtrl;
76 $tpl->loadStandardTemplate();
78 $next_class = $ilCtrl->getNextClass($this);
79 $cmd = $ilCtrl->getCmd();
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");
418 $tpl->addOnLoadCode(
"pager.Init();");
420 $tree =
new ilTree($this->slm_object->getId());
421 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
422 $tree->setTreeTablePK(
"slm_id");
423 include_once
"./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
424 include_once
"./Services/MetaData/classes/class.ilMD.php";
426 $meta =
new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
427 $desc_ids = $meta->
getGeneral()->getDescriptionIds();
428 $sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
431 $sco_tpl =
new ilTemplate(
"tpl.sco.html",
true,
true,
"Modules/Scorm2004");
441 $this->node_object->getType()
446 $terms = $this->node_object->getGlossaryTermIds();
449 foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()),
true,
'page') as $page) {
451 $this->node_object->getType(),
454 $this->slm_object->getId()
458 $page_obj->setStyleId($this->slm_object->getStyleSheetId());
459 if (count($terms) > 1) {
460 $page_obj->setGlossaryOverviewInfo(
465 $sco_tpl->setCurrentBlock(
"page_preview");
466 $html = $ilCtrl->getHTML($page_obj);
468 $sco_tpl->setVariable(
"PAGE_PRV", $html);
469 $sco_tpl->parseCurrentBlock();
472 $output = $sco_tpl->get();
478 require_once
'./Modules/Scorm2004/classes/class.ilQuestionExporter.php';
479 $output = preg_replace_callback(
"/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this),
'insertQuestion'), $output);
484 $tpl->addJavaScript(
"./Modules/Scorm2004/scripts/questions/question_handling.js");
485 $tpl->addCss(
"./Modules/Scorm2004/templates/default/question_handling.css");
487 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
491 $output .=
'<script type="text/javascript" src="./Modules/Scorm2004/scripts/questions/question_handling.js"></script>';
492 $tpl->addOnLoadCode(
"ilias.questions.refresh_lang();");
493 $tpl->setVariable(
"CONTENT", $output);
494 $tpl->printToStdout();
502 return $q_exporter->exportQuestion($matches[2]);
510 switch (
$_POST[
'select_export']) {
511 case "exportScorm12":
512 case "exportScorm2004_3rd":
513 case "exportScorm2004_4th":
516 $this->ctrl->redirect($this,
$_POST[
'select_export']);
519 $this->ctrl->redirect($this,
'showExportList');
534 $template =
new ilTemplate(
"tpl.scorm2004_export_buttons.html",
true,
true,
'Modules/Scorm2004');
537 "exportScorm2004_3rd" =>
$lng->txt(
"scorm_create_export_file_scrom2004"),
538 "exportScorm2004_4th" =>
$lng->txt(
"scorm_create_export_file_scrom2004_4th"),
539 "exportScorm12" =>
$lng->txt(
"scorm_create_export_file_scrom12"),
540 "exportPDF" =>
$lng->txt(
"scorm_create_export_file_pdf"),
541 "exportHTML" =>
$lng->txt(
"scorm_create_export_file_html")
543 foreach ($buttons as $value => $text) {
544 $template->setCurrentBlock(
'option');
545 $template->setVariable(
'OPTION_VALUE', $value);
547 $template->parseCurrentBlock();
549 $template->setVariable(
'EXPORT_TITLE',
$lng->txt(
'export'));
550 $template->setVariable(
'EXPORT_LABEL',
$lng->txt(
'type'));
551 $template->setVariable(
'FORMACTION', $ilCtrl->getFormAction($this,
'selectExport'));
553 $export_files = $this->node_object->getExportFiles();
555 include_once
"./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
558 foreach ($export_files as $exp_file) {
559 $filetype = $exp_file[
'type'];
564 $file_arr = explode(
"__", $exp_file[
"file"]);
567 $table_gui->setData(
$data);
568 $tpl->setVariable(
'ADM_CONTENT', $template->get() .
"\n" . $table_gui->getHTML());
574 $export->buildExportFile();
575 $this->ctrl->redirect($this,
"showExportList");
582 $export->buildExportFile();
583 $this->ctrl->redirect($this,
"showExportList");
589 $export->buildExportFile();
590 $this->ctrl->redirect($this,
"showExportList");
596 $export->buildExportFile();
597 $this->ctrl->redirect($this,
"showExportList");
603 $export->buildExportFile();
604 $this->ctrl->redirect($this,
"showExportList");
610 $export->buildExportFile();
611 $this->ctrl->redirect($this,
"showExportList");
616 $file = basename(
$_GET[
'file']);
617 $export =
new ilSCORM2004Export($this->node_object);
618 $export_dir = $export->getExportDirectoryForType(
$_GET[
'type']);
630 if (!isset(
$_POST[
"file"])) {
632 $this->ctrl->redirect($this,
"showExportList");
636 $export_files = $this->node_object->getExportFiles();
638 include_once
"./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
641 foreach ($export_files as $exp_file) {
642 foreach (
$_POST[
'file'] as $delete_file) {
643 if (strcmp($delete_file, $exp_file[
'file']) == 0) {
648 $file_arr = explode(
"__", $exp_file[
"file"]);
653 $table_gui->setData(
$data);
654 $tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
663 $this->ctrl->redirect($this,
"showExportList");
673 include_once
"./Services/Utilities/classes/class.ilUtil.php";
674 $export =
new ilSCORM2004Export($this->node_object);
675 foreach (
$_POST[
'file'] as $idx => $file) {
676 $export_dir = $export->getExportDirectoryForType(
$_POST[
'type'][$idx]);
677 $exp_file = $export_dir .
"/" . $file;
678 if (@is_file($exp_file)) {
682 ilUtil::sendSuccess(
$lng->txt(
'msg_deleted_export_files'),
true);
683 $this->ctrl->redirect($this,
"showExportList");
688 $export_files = array();
690 require_once
"./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
691 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
692 include_once
"./Modules/File/classes/class.ilObjFile.php";
693 $tree =
new ilTree($this->slm_object->getId());
694 $tree->setTableNames(
'sahs_sc13_tree',
'sahs_sc13_tree_node');
695 $tree->setTreeTablePK(
"slm_id");
697 foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()),
true,
'page') as $page) {
699 $page_obj->buildDom();
700 $mob_ids = $page_obj->collectMediaObjects(
false);
701 foreach ($mob_ids as $mob_id) {
706 $export_files[
$i][
"date"] = $media_obj->getCreateDate();
707 $export_files[
$i][
"size"] = @filesize($path);
708 $export_files[
$i][
"file"] = $media_obj->getTitle();
709 $export_files[
$i][
"type"] = $media_obj->getDescription();
710 $export_files[
$i][
"path"] = $path;
711 $this->ctrl->setParameter(
716 $export_files[
$i][
"link"] = $this->ctrl->getLinkTarget($this,
"downloadResource");
720 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
722 foreach ($file_ids as $file_id) {
723 $file_obj =
new ilObjFile($file_id,
false);
724 $export_files[
$i][
"date"] = $file_obj->getCreateDate();
725 $export_files[
$i][
"size"] = $file_obj->getFileSize();
726 $export_files[
$i][
"file"] = $file_obj->getFileName();
727 $export_files[
$i][
"type"] = $file_obj->getFileType();
728 $export_files[
$i][
"file_id"] = $file_id;
729 $this->ctrl->setParameter($this,
"file_id", $file_id);
730 $export_files[
$i][
"link"] = $this->ctrl->getLinkTarget($this,
"downloadFile",
"");
736 return $export_files;
745 $tab = new \ILIAS\Scorm2004\Editor\ilSCORMMediaOverviewTableGUI($this,
"sco_resources");
746 $tab->setData($export_files);
748 $this->tpl->setContent($tab->getHTML());
755 if (
$_GET[
"file_id"] > 0) {
760 foreach ($export_files as
$f) {
761 if (is_object($file)) {
762 if ($f[
"file"] == $file->getFileName()) {
766 if ($f[
"path"] ==
$_GET[
"resource"]) {
767 if (is_file($f[
"path"])) {
778 $file = explode(
"_",
$_GET[
"file_id"]);
779 require_once(
"./Modules/File/classes/class.ilObjFile.php");
780 $fileObj =
new ilObjFile($file[count($file) - 1],
false);
781 $fileObj->sendFile();
785 public function import()
793 $tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.scormeditor_sco_import.html",
"Modules/Scorm2004");
796 $tpl->setVariable(
"ALT_IMG",
$lng->txt(
"obj_sahs"));
798 $tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
800 $tpl->setVariable(
"BTN_NAME",
"importSave");
805 $tpl->setVariable(
"TXT_UPLOAD",
$lng->txt(
"upload"));
806 $tpl->setVariable(
"TXT_CANCEL",
$lng->txt(
"cancel"));
807 $tpl->setVariable(
"TXT_IMPORT_SCO",
$lng->txt(
"import_sco_object"));
808 $tpl->setVariable(
"TXT_SELECT_FILE",
$lng->txt(
"select_file"));
809 $tpl->setVariable(
"TXT_VALIDATE_FILE",
$lng->txt(
"cont_validate_file"));
812 $umf = get_cfg_var(
"upload_max_filesize");
814 $pms = get_cfg_var(
"post_max_size");
817 $multiplier_a = array(
"K" => 1024,
"M" => 1024 * 1024,
"G" => 1024 * 1024 * 1024);
819 $umf_parts = preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
820 $pms_parts = preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
822 if (count($umf_parts) == 2) {
823 $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
825 if (count($pms_parts) == 2) {
826 $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
830 $max_filesize = min($umf, $pms);
832 if (!$max_filesize) {
833 $max_filesize = max($umf, $pms);
837 $max_filesize = sprintf(
"%.1f MB", $max_filesize / 1024 / 1024);
840 $tpl->setVariable(
"TXT_FILE_INFO",
$lng->txt(
"file_notice") .
" $max_filesize");
849 $source = $_FILES[
"scormfile"][
"tmp_name"];
851 $ilErr->raiseError(
"No file selected!",
$ilErr->MESSAGE);
854 switch ($_FILES[
"scormfile"][
"error"]) {
855 case UPLOAD_ERR_INI_SIZE:
856 $ilErr->raiseError(
$lng->txt(
"err_max_file_size_exceeds"),
$ilErr->MESSAGE);
859 case UPLOAD_ERR_FORM_SIZE:
860 $ilErr->raiseError(
$lng->txt(
"err_max_file_size_exceeds"),
$ilErr->MESSAGE);
863 case UPLOAD_ERR_PARTIAL:
867 case UPLOAD_ERR_NO_FILE:
872 $file = pathinfo($_FILES[
"scormfile"][
"name"]);
873 $name = substr($file[
"basename"], 0, strlen($file[
"basename"]) - strlen($file[
"extension"]) - 1);
874 $file_path = $this->slm_object->getDataDirectory() .
"/" . $this->node_object->getId() .
"/" . $_FILES[
"scormfile"][
"name"];
880 include_once(
"./Modules/Scorm2004/classes/ilSCORM13Package.php");
882 $newPack->il_importSco($this->slm_object->getId(), $this->node_object->getId(), $this->slm_object->getDataDirectory() .
"/" . $this->node_object->getId());
884 $this->ctrl->redirect($this,
"showOrganization");
892 $this->ctrl->redirect($this,
"showOrganization");
916 $lng = $DIC->language();
918 $tpl =
new ilTemplate(
"tpl.sco_glossary_overview.html",
true,
true,
"Modules/Scorm2004");
920 $terms = $a_sco->getGlossaryTermIds();
922 foreach ($terms as $k => $t) {
923 $tpl->setCurrentBlock(
"link");
924 $tpl->setVariable(
"TXT_LINK", $t);
925 $tpl->setVariable(
"ID_LINK",
"glo_ov_t" . $k);
926 $tpl->parseCurrentBlock();
930 $tpl->setVariable(
"TXT_SCO_GLOSSARY",
$lng->txtlng(
"content",
"cont_sco_glossary", $lk));
931 $tpl->setVariable(
"TXT_CLOSE",
$lng->txtlng(
"common",
"close", $lk));
933 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 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 deliverFileAttached($path_to_file, $download_file_name='', $mime_type='', $delete_file=false)
void
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 unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
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.