19 require_once(
"./Services/Object/classes/class.ilObjectGUI.php");
20 require_once(
"./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLM.php");
21 require_once(
"./Services/Table/classes/class.ilTableGUI.php");
22 require_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
38 $this->ctrl->saveParameter($this, array(
"ref_id"));
41 $lng->loadLanguageModule(
"content");
45 $this->output_prepared = $a_prepare_output;
54 global
$ilUser, $ilLocator, $ilTabs;
56 $next_class = $this->ctrl->getNextClass($this);
57 $cmd = $this->ctrl->getCmd();
59 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" ||
66 if (!in_array(
$cmd, array(
"",
"framset")) || $next_class !=
"")
77 if(IS_PAYMENT_ENABLED)
79 include_once
'Services/Payment/classes/class.ilPaymentObject.php';
82 $this->tpl->getStandardTemplate();
84 include_once
'Services/Payment/classes/class.ilShopPurchaseGUI.php';
86 $ret = $this->ctrl->forwardCommand($pp);
96 $ilTabs->activateTab(
'id_meta_data');
97 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
99 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
100 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
102 $this->ctrl->forwardCommand($md_gui);
105 case "ilfilesystemgui":
107 $ilTabs->activateTab(
'id_list_files');
110 $fs_gui->setUseUploadDirectory(
true);
111 $fs_gui->setTableId(
"htlmfs".$this->object->getId());
112 if ($this->object->getStartFile() !=
"")
114 $fs_gui->labelFile($this->object->getStartFile(),
115 $this->lng->txt(
"cont_startfile"));
117 $fs_gui->addCommand($this,
"setStartFile", $this->lng->txt(
"cont_set_start_file"));
119 $this->ctrl->forwardCommand($fs_gui);
122 require_once(
"./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
127 $pcommand = $fs_gui->getLastPerformedCommand();
128 if (is_array($pcommand))
130 $valid = array(
"index.htm",
"index.html",
"start.htm",
"start.html");
131 if($pcommand[
"cmd"] ==
"create_file")
133 $file = strtolower(basename($pcommand[
"name"]));
136 $this->
object->setStartFile($pcommand[
"name"]);
137 $do_update = $pcommand[
"name"];
140 else if($pcommand[
"cmd"] ==
"unzip_file")
142 $zip_file = strtolower(basename($pcommand[
"name"]));
143 $suffix = strrpos($zip_file,
".");
146 $zip_file = substr($zip_file, 0, $suffix);
148 foreach($pcommand[
"added"] as
$file)
151 if(stristr($file,
".htm"))
153 $chk_file = strtolower(basename($file));
154 $suffix = strrpos($chk_file,
".");
157 $chk_file = substr($chk_file, 0, $suffix);
160 if(in_array(basename($file),
$valid) ||
161 ($zip_file && $chk_file && $chk_file == $zip_file))
163 $this->
object->setStartFile($file);
173 ilUtil::sendInfo(sprintf($this->lng->txt(
"cont_start_file_set_to"), $do_update),
true);
175 $this->
object->update();
176 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
181 case "ilinfoscreengui":
185 case "illearningprogressgui":
186 $ilTabs->activateTab(
'id_learning_progress');
187 include_once
'./Services/Tracking/classes/class.ilLearningProgressGUI.php';
189 $this->object->getRefId(),
190 $_GET[
'user_id'] ?
$_GET[
'user_id'] : $ilUser->getId());
191 $this->ctrl->forwardCommand($new_gui);
194 case 'ilpermissiongui':
195 $ilTabs->activateTab(
'id_permissions');
196 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
198 $ret =& $this->ctrl->forwardCommand($perm_gui);
202 $ilTabs->activateTab(
'id_license');
203 include_once(
"./Services/License/classes/class.ilLicenseGUI.php");
205 $ret =& $this->ctrl->forwardCommand($license_gui);
209 $ilTabs->activateTab(
"export");
210 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
212 $exp_gui->addFormat(
"xml");
213 $exp_gui->addFormat(
"html",
"", $this,
"exportHTML");
214 $ret = $this->ctrl->forwardCommand($exp_gui);
218 case "ilcommonactiondispatchergui":
219 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
221 $this->ctrl->forwardCommand($gui);
225 $cmd = $this->ctrl->getCmd(
"frameset");
226 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" ||
240 $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
255 $ilCtrl->redirectByClass(
"ilrepositorygui",
"frameset");
265 global $rbacsystem,
$tree,
$tpl, $ilTabs;
267 $ilTabs->activateTab(
"id_settings");
271 $tpl->setContent($this->form->getHTML());
281 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
288 $ti->setRequired(
true);
289 $this->form->addItem($ti);
295 $this->form->addItem($ta);
301 $this->form->addItem($cb);
304 require_once(
"./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
308 if ($startfile !=
"")
310 $ne->
setValue(basename($startfile));
314 $ne->setValue(basename($this->lng->txt(
"no_start_file")));
316 $this->form->addItem($ne);
318 include_once(
"Services/License/classes/class.ilLicenseAccess.php");
322 $lic->
setInfo($lng->txt(
"cont_license_info"));
323 $this->form->addItem($lic);
325 if(!$ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id))
327 $lic->setDisabled(
true);
332 $bib->
setInfo($lng->txt(
"cont_biblio_info"));
333 $this->form->addItem($bib);
335 $this->form->addCommandButton(
"saveProperties", $lng->txt(
"save"));
336 $this->form->addCommandButton(
"toFilesystem", $lng->txt(
"cont_set_start_file"));
338 $this->form->setTitle($lng->txt(
"cont_lm_properties"));
339 $this->form->setFormAction($ilCtrl->getFormAction($this,
"saveProperties"));
347 require_once(
"./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
351 $values[
"cobj_online"] = $this->
object->getOnline();
352 if ($startfile !=
"")
354 $startfile = basename($startfile);
358 $startfile = $this->lng->txt(
"no_start_file");
361 $values[
"cobj_online"] = $this->
object->getOnline();
362 $values[
"startfile"] = $startfile;
363 $values[
"title"] = $this->
object->getTitle();
364 $values[
"desc"] = $this->
object->getDescription();
365 $values[
"lic"] = $this->
object->getShowLicense();
366 $values[
"bib"] = $this->
object->getShowBibliographicalData();
368 $this->form->setValuesByArray($values);
381 $ilCtrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
389 global
$tpl, $ilAccess, $ilTabs;
392 if ($this->form->checkInput())
394 $this->
object->setTitle($this->form->getInput(
"title"));
395 $this->
object->setDescription($this->form->getInput(
"desc"));
397 $this->
object->setShowBibliographicalData($this->form->getInput(
"bib"));
399 $lic = $this->form->getItemByPostVar(
"lic");
400 if($lic && !$lic->getDisabled())
402 $this->
object->setShowLicense($this->form->getInput(
"lic"));
405 $this->
object->update();
407 $this->ctrl->redirect($this,
"properties");
410 $ilTabs->activateTab(
"id_settings");
411 $this->form->setValuesByPost();
412 $tpl->setContent($this->form->getHtml());
424 if (!$rbacsystem->checkAccess(
"visible,write",$this->object->getRefId()))
426 $this->ilias->raiseError($this->lng->txt(
"permission_denied"),$this->ilias->error_obj->MESSAGE);
455 if(!$newObj->getStartFile())
459 include_once
"Services/Utilities/classes/class.ilFileUtils.php";
461 if(is_array($files[
"file"]))
464 if(stristr($newObj->getTitle(),
".zip"))
466 $zip_file = strtolower($newObj->getTitle());
467 $suffix = strrpos($zip_file,
".");
470 $zip_file = substr($zip_file, 0, $suffix);
473 $valid = array(
"index.htm",
"index.html",
"start.htm",
"start.html");
474 foreach($files[
"file"] as $idx =>
$file)
477 if(stristr(
$file,
".htm"))
479 $chk_file = strtolower(
$file);
480 $suffix = strrpos($chk_file,
".");
483 $chk_file = substr($chk_file, 0, $suffix);
487 ($chk_file && $zip_file && $chk_file == $zip_file))
489 $newObj->setStartFile(str_replace($newObj->getDataDirectory().
"/",
"", $files[
"path"][$idx]).
$file);
499 ilUtil::redirect(
"ilias.php?baseClass=ilHTLMEditorGUI&ref_id=".$newObj->getRefId());
516 $this->
object->setStartFile($a_file);
517 $this->
object->update();
518 $this->ctrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
526 $this->
setFormAction(
"permSave",
"fblm_edit.php?cmd=permSave&ref_id=".
$_GET[
"ref_id"].
527 "&obj_id=".
$_GET[
"obj_id"]);
528 $this->
setFormAction(
"addRole",
"fblm_edit.php?ref_id=".$_GET[
"ref_id"].
529 "&obj_id=".$_GET[
"obj_id"].
"&cmd=addRole");
540 $ilTabs->activateTab(
"id_bib_data");
542 include_once
"./Modules/LearningModule/classes/class.ilBibItemGUI.php";
544 $bib_gui->setObject($this->
object);
545 $bibItemIndex =
$_POST[
"bibItemIndex"] ?
$_POST[
"bibItemIndex"] :
$_GET[
"bibItemIndex"];
547 if ($bibItemIndex < 0)
551 $bibItemIndex = $bib_gui->save($bibItemIndex);
555 $a_target =
"adm_object.php?ref_id=" . $this->
object->getRefId();
558 $bib_gui->edit(
"ADM_CONTENT",
"adm_content", $a_target, $bibItemIndex);
580 $ilTabs->activateTab(
"id_bib_data");
582 include_once
"./Modules/LearningModule/classes/class.ilBibItemGUI.php";
584 $bib_gui->setObject($this->
object);
585 $bibItemIndex =
$_POST[
"bibItemIndex"] ?
$_POST[
"bibItemIndex"] :
$_GET[
"bibItemIndex"];
587 if ($bibItemIndex < 0)
593 $a_target =
"adm_object.php?ref_id=" . $this->
object->getRefId();
596 $bib_gui->edit(
"ADM_CONTENT",
"adm_content", $a_target, $bibItemIndex);
618 $ilTabs->activateTab(
"id_bib_data");
620 include_once
"./Modules/LearningModule/classes/class.ilBibItemGUI.php";
622 $bib_gui->setObject($this->
object);
623 $bibItemIndex =
$_POST[
"bibItemIndex"] ?
$_POST[
"bibItemIndex"] :
$_GET[
"bibItemIndex"];
624 $bib_gui->bib_obj->delete(
$_GET[
"bibItemName"],
$_GET[
"bibItemPath"], $bibItemIndex);
625 if (strpos($bibItemIndex,
",") > 0)
627 $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex,
","));
631 $a_target =
"adm_object.php?ref_id=" . $this->
object->getRefId();
634 $bib_gui->edit(
"ADM_CONTENT",
"adm_content", $a_target, max(0, $bibItemIndex - 1));
656 $ilTabs->activateTab(
"id_bib_data");
658 $bibItemName =
$_POST[
"bibItemName"] ?
$_POST[
"bibItemName"] :
$_GET[
"bibItemName"];
659 $bibItemIndex =
$_POST[
"bibItemIndex"] ?
$_POST[
"bibItemIndex"] :
$_GET[
"bibItemIndex"];
660 if ($bibItemName ==
"BibItem")
662 include_once
"./Modules/LearningModule/classes/class.ilBibItem.php";
664 $bib_item->setId($this->object->getId());
665 $bib_item->setType($this->object->getType());
669 include_once
"./Modules/LearningModule/classes/class.ilBibItemGUI.php";
671 $bib_gui->setObject($this->
object);
672 if ($bibItemIndex ==
"")
674 $bibItemPath =
$_POST[
"bibItemPath"] ?
$_POST[
"bibItemPath"] :
$_GET[
"bibItemPath"];
677 if ($bibItemName !=
"")
679 $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
680 $data = $bib_gui->bib_obj->getElement(
"BibItem");
681 $bibItemIndex = (count(
$data) - 1);
689 $a_target =
"adm_object.php?ref_id=" . $this->
object->getRefId();
692 $bib_gui->edit(
"ADM_CONTENT",
"adm_content", $a_target, $bibItemIndex);
714 $ilCtrl->setCmdClass(
"ilfilesystemgui");
715 $ilCtrl->setCmd(
"listFiles");
726 $this->tpl->getStandardTemplate();
734 include_once
"Services/License/classes/class.ilLicense.php";
736 $this->
object->getRefId());
739 if ($ilUser->getId() != ANONYMOUS_USER_ID)
741 include_once
"Services/Tracking/classes/class.ilLearningProgress.php";
743 $this->
object->getRefId(),
"htlm");
746 require_once(
"./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
748 if ($startfile !=
"")
762 $this->ctrl->setCmd(
"showSummary");
763 $this->ctrl->setCmdClass(
"ilinfoscreengui");
780 global $ilToolbar, $ilAccess, $ilTabs;
782 $ilTabs->activateTab(
'id_info');
784 $this->lng->loadLanguageModule(
"meta");
785 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
788 $info->enablePrivateNotes();
789 $info->enableLearningProgress();
792 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
794 $info->enableNewsEditing();
797 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
798 if ($enable_internal_rss)
800 $info->setBlockProperty(
"news",
"settings",
true);
805 if ($ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
808 include_once
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
810 $button->setCaption(
"view");
811 $button->setPrimary(
true);
812 $button->setUrl(
"ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID());
813 $button->setTarget(
"ilContObj".$this->object->getId());
814 $ilToolbar->addButtonInstance($button);
818 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
821 $this->ctrl->forwardCommand($info);
834 $this->tpl->setTitle($this->object->getTitle());
844 $ilHelp->setScreenIdComponent(
"htlm");
846 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
848 $ilTabs->addTab(
"id_list_files",
849 $lng->txt(
"cont_list_files"),
850 $this->ctrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles"));
853 if($ilAccess->checkAccess(
'visible',
'', $this->ref_id))
855 $ilTabs->addTab(
"id_info",
856 $lng->txt(
"info_short"),
857 $this->ctrl->getLinkTargetByClass(array(
"ilobjfilebasedlmgui",
"ilinfoscreengui"),
"showSummary"));
860 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
862 $ilTabs->addTab(
"id_settings",
863 $lng->txt(
"settings"),
864 $this->ctrl->getLinkTarget($this,
"properties"));
867 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
870 $ilTabs->addTab(
"id_learning_progress",
871 $lng->txt(
"learning_progress"),
872 $this->ctrl->getLinkTargetByClass(array(
'ilobjfilebasedlmgui',
'illearningprogressgui'),
''));
875 include_once(
"Services/License/classes/class.ilLicenseAccess.php");
876 if ($ilAccess->checkAccess(
'edit_permission',
'', $this->ref_id) &&
878 $this->
object->getShowLicense())
880 $ilTabs->addTab(
"id_license",
881 $lng->txt(
"license"),
882 $this->ctrl->getLinkTargetByClass(
'illicensegui',
''));
885 if($ilAccess->checkAccess(
'write',
'', $this->ref_id))
887 $ilTabs->addTab(
"id_meta_data",
888 $lng->txt(
"meta_data"),
889 $this->ctrl->getLinkTargetByClass(
'ilmdeditorgui',
''));
891 if($this->object->getShowBibliographicalData())
893 $ilTabs->addTab(
"id_bib_data",
894 $lng->txt(
"bib_data"),
895 $this->ctrl->getLinkTarget($this,
"editBibItem"));
901 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
903 $ilTabs->addTab(
"export",
905 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
908 if ($ilAccess->checkAccess(
'edit_permission',
'', $this->object->getRefId()))
910 $ilTabs->addTab(
"id_permissions",
911 $lng->txt(
"perm_settings"),
912 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"));
915 require_once(
"./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
918 if ($startfile !=
"")
920 $ilTabs->addNonTabbedLink(
"presentation_view",
921 $this->lng->txt(
"glo_presentation_view"),
922 "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
934 public static function _goto($a_target)
938 if ($ilAccess->checkAccess(
"read",
"", $a_target) ||
939 $ilAccess->checkAccess(
"visible",
"", $a_target))
943 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
950 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
957 if (is_object($this->
object))
959 $ilLocator->addItem($this->object->getTitle(),
960 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
"",
$_GET[
"ref_id"]);
996 $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
1003 $newObj->setDescription(
"");
1005 $newObj->populateByDirectoy($a_dir,
$filename);
1024 $inst_id = IL_INST_ID;
1026 include_once(
"./Services/Export/classes/class.ilExport.php");
1029 $this->
object->getType());
1031 $this->
object->getType());
1033 $subdir = $this->
object->getType().
"_".$this->
object->getId();
1036 $target_dir = $export_dir.
"/".$subdir;
1041 $source_dir = $this->
object->getDataDirectory();
1047 $zip_file = $export_dir.
"/".$date.
"__".IL_INST_ID.
"__".
1048 $this->
object->getType().
"_".$this->
object->getId().
".zip";