6 require_once(
"./Modules/LearningModule/classes/class.ilLMObjectGUI.php");
7 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
35 $this->tree =& $a_tree;
45 $this->obj =& $a_st_object;
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
71 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
74 $this->obj->getId(), $this->obj->getType());
75 $md_gui->
addObserver($this->obj,
'MDUpdateListener',
'General');
77 $this->ctrl->forwardCommand($md_gui);
80 case "ilconditionhandlerinterface":
82 include_once
'./Services/AccessControl/classes/class.ilConditionHandlerInterface.php';
86 $this->ctrl->forwardCommand($this->condHI);
87 $ilTabs->setTabActive(
'preconditions');
91 if(
$cmd ==
'listConditions')
95 $ret =& $this->condHI->executeCommand();
97 elseif((
$cmd ==
"create") && (
$_POST[
"new_type"] ==
"pg"))
101 $ret =& $pg_gui->executeCommand();
117 if (
$_GET[
"obj_id"] !=
"")
149 $ilCtrl->setParameter($this,
"backcmd",
"showHierarchy");
151 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
154 $form_gui->setTitle($this->obj->getTitle());
156 $form_gui->setTree($this->tree);
157 $form_gui->setCurrentTopNodeId($this->obj->getId());
158 $form_gui->addMultiCommand($lng->txt(
"delete"),
"delete");
159 $form_gui->addMultiCommand($lng->txt(
"cut"),
"cutItems");
160 $form_gui->addMultiCommand($lng->txt(
"copy"),
"copyItems");
161 $form_gui->addMultiCommand($lng->txt(
"cont_de_activate"),
"activatePages");
162 if ($this->content_object->getLayoutPerPage())
164 $form_gui->addMultiCommand($lng->txt(
"cont_set_layout"),
"setPageLayout");
167 $form_gui->addCommand($lng->txt(
"cont_save_all_titles"),
"saveAllTitles");
168 $form_gui->addHelpItem($lng->txt(
"cont_chapters_after_pages"));
169 $up_gui = ($this->content_object->getType() ==
"dbk")
171 :
"ilobjlearningmodulegui";
172 $ilCtrl->setParameterByClass($up_gui,
"active_node", $this->obj->getId());
173 $form_gui->setExplorerUpdater(
"tree",
"tree_div",
174 $ilCtrl->getLinkTargetByClass($up_gui,
"explorer",
"",
true));
175 $ilCtrl->setParameterByClass($up_gui,
"active_node",
"");
177 $ctpl =
new ilTemplate(
"tpl.chap_and_pages.html",
true,
true,
"Modules/LearningModule");
178 $ctpl->setVariable(
"HIERARCHY_FORM", $form_gui->getHTML());
179 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
181 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
184 $this->tpl->setContent($ml_head.$ctpl->get());
195 if (!is_array($items))
198 $ilCtrl->redirect($this,
"showHierarchy");
202 foreach($items as $k => $item)
209 foreach($todel as $k)
217 $ilCtrl->redirect($this,
"showHierarchy");
225 $ilCtrl->redirect($this, $a_return);
236 if (!is_array($items))
239 $ilCtrl->redirect($this,
"showHierarchy");
243 foreach($items as $k => $item)
250 foreach($todel as $k)
258 $ilCtrl->redirect($this,
"showHierarchy");
265 $ilCtrl->redirect($this, $a_return);
277 $ilCtrl->redirect($this,
"showHierarchy");
289 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.structure_edit.html",
"Modules/LearningModule");
292 $this->tpl->setCurrentBlock(
"form");
293 $this->ctrl->setParameter($this,
"backcmd",
"subchap");
294 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
295 $this->tpl->setVariable(
"HEADER_TEXT", $this->lng->txt(
"cont_subchapters"));
299 $childs = $this->tree->getChilds($this->obj->getId());
300 foreach ($childs as $child)
302 if($child[
"type"] !=
"st")
306 $this->tpl->setCurrentBlock(
"table_row");
311 $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
312 $this->tpl->setVariable(
"CSS_ROW", $css_row);
316 $this->ctrl->setParameterByClass(
"ilStructureObjectGUI",
"obj_id", $child[
"obj_id"]);
317 $link = $this->ctrl->getLinkTargetByClass(
"ilStructureObjectGUI",
"view");
318 $this->tpl->setVariable(
"LINK_TARGET", $link);
321 $this->tpl->setVariable(
"TEXT_CONTENT",
323 $this->content_object->isActiveNumbering()));
325 $this->tpl->parseCurrentBlock();
329 $this->tpl->setCurrentBlock(
"notfound");
330 $this->tpl->setVariable(
"NUM_COLS", 3);
331 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
332 $this->tpl->parseCurrentBlock();
337 $this->tpl->setVariable(
"NUM_COLS", 3);
338 $acts = array(
"delete" =>
"delete",
"cutChapter" =>
"cut",
339 "copyChapter" =>
"copyChapter");
340 if ($ilUser->clipboardHasObjectsOfType(
"st"))
342 $acts[
"pasteChapter"] =
"pasteChapter";
348 $this->tpl->setVariable(
"NUM_COLS", 3);
350 $subobj = array(
"st");
353 $this->tpl->setCurrentBlock(
"add_object");
354 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
356 $this->tpl->setVariable(
"BTN_NAME",
"create");
357 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"insert"));
358 $this->tpl->parseCurrentBlock();
363 $this->tpl->setCurrentBlock(
"form");
364 $this->tpl->parseCurrentBlock();
366 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
377 $this->tpl->setCurrentBlock(
"begin_link");
378 $this->tpl->setVariable(
"LINK_TARGET", $link);
379 $this->tpl->parseCurrentBlock();
380 $this->tpl->touchBlock(
"end_link");
383 $this->tpl->setCurrentBlock(
"text");
384 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
385 $this->tpl->parseCurrentBlock();
386 $this->tpl->setCurrentBlock(
"table_cell");
387 $this->tpl->parseCurrentBlock();
399 $this->obj->setType(
"st");
402 $this->obj->setLMId($this->content_object->getId());
403 $this->obj->create();
410 if (!empty(
$_GET[
"obj_id"]))
412 $this->ctrl->redirect($this,
"subchap");
428 $tree =
new ilTree($this->content_object->getId());
429 $tree->setTableNames(
'lm_tree',
'lm_data');
430 $tree->setTreeTablePK(
"lm_id");
433 $parent_id = (!empty(
$_GET[
"obj_id"]))
435 :
$tree->getRootId();
437 $childs =&
$tree->getChildsByType($parent_id,
"pg");
438 if (count($childs) != 0)
440 $_GET[
"target"] = $childs[count($childs) - 1][
"obj_id"];
443 if (empty(
$_GET[
"target"]))
474 if (!$ilUser->clipboardHasObjectsOfType(
"pg"))
476 $this->ilias->raiseError($this->lng->txt(
"no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
516 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
517 if (is_array(
$_POST[
"id"]))
519 $act_items = array();
521 foreach(
$_POST[
"id"] as $id)
523 $path = $this->tree->getPathId($id);
525 foreach(
$path as $path_id)
527 if ($path_id != $id && in_array($path_id,
$_POST[
"id"]))
539 foreach($act_items as $id)
541 $childs = $this->tree->getChilds($id);
542 foreach($childs as $child)
547 $this->content_object->getType());
549 $this->content_object->getType(), !$act);
555 $this->content_object->getType());
557 $this->content_object->getType(), !$act);
566 $this->ctrl->redirect($this,
"view");
575 include_once(
"./Services/AccessControl/classes/class.ilConditionHandlerInterface.php");
578 $this->condHI->setBackButtons(array());
579 $this->condHI->setAutomaticValidation(
false);
580 $this->condHI->setTargetType(
"st");
581 $this->condHI->setTargetRefId($this->content_object->getRefId());
582 $this->condHI->setTargetId($this->obj->getId());
583 $this->condHI->setTargetTitle($this->obj->getTitle());
592 if (
$_GET[
"obj_id"] != 0)
594 if (
$_GET[
"new_type"] ==
"pg")
596 $this->ctrl->redirect($this,
"view");
600 $this->ctrl->redirect($this,
"subchap");
614 $ilTabs->addTarget(
"cont_pages_and_subchapters",
615 $this->ctrl->getLinkTarget($this,
'showHierarchy'),
616 array(
"view",
"showHierarchy"), get_class($this));
619 $ilTabs->addTarget(
"preconditions",
620 $this->ctrl->getLinkTarget($this,
'listConditions'),
621 "listConditions", get_class($this));
624 $ilTabs->addTarget(
"meta_data",
625 $this->ctrl->getLinkTargetByClass(
"ilmdeditorgui",
''),
626 "",
"ilmdeditorgui");
629 $this->tpl->setTitle(
630 $this->lng->txt($this->obj->getType()).
": ".$this->obj->getTitle());
633 $ilTabs->addNonTabbedLink(
"pres_mode", $lng->txt(
"cont_presentation_view"),
634 ILIAS_HTTP_PATH.
"/goto.php?target=st_".$this->obj->getId(),
"_top");
642 function _goto($a_target, $a_target_ref_id =
"")
653 if (in_array($a_target_ref_id, $ref_ids))
655 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
662 if ($ilAccess->checkAccess(
"read",
"", $ref_id))
666 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
667 $_GET[
"obj_id"] = $a_target;
669 include_once(
"ilias.php");
674 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
678 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
682 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
692 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
701 $parent_id = $node_id;
706 $ilCtrl->redirect($this,
"showHierarchy");
714 $parent_id = $this->tree->getParentId($node_id);
719 $parent_id = $node_id;
723 for ($i = 1; $i <= $num; $i++)
726 $chap->setType(
"st");
727 $chap->setTitle($lng->txt(
"cont_new_chap"));
728 $chap->setLMId($this->content_object->getId());
733 $ilCtrl->redirect($this,
"view");
753 $ilLog->write(
"Insert Chapter From Clipboard");
755 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
764 $parent_id = $node_id;
769 $ilCtrl->redirect($this,
"showHierarchy");
777 $parent_id = $this->tree->getParentId($node_id);
782 $parent_id = $node_id;
786 $childs = $this->tree->getChildsByType($parent_id,
"pg");
787 if (count($childs) != 0)
789 $target = $childs[count($childs) - 1][
"obj_id"];
795 $chapters = $ilUser->getClipboardObjects(
"st",
true);
796 $copied_nodes = array();
798 foreach ($chapters as $chap)
800 $ilLog->write(
"Call pasteTree, Target LM: ".$this->content_object->getId().
", Chapter ID: ".$chap[
"id"]
801 .
", Parent ID: ".$parent_id.
", Target: ".$target);
803 $target, $chap[
"insert_time"], $copied_nodes,
811 $ilUser->clipboardDeleteObjectsOfType(
"pg");
812 $ilUser->clipboardDeleteObjectsOfType(
"st");
816 $this->content_object->checkTree();
817 $ilCtrl->redirect($this, $a_return);
835 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
842 $parent_id = $this->tree->getParentId($node_id);
847 $parent_id = $node_id;
851 for ($i = 1; $i <= $num; $i++)
854 $page->setType(
"pg");
855 $page->setTitle($lng->txt(
"cont_new_page"));
856 $page->setLMId($this->content_object->getId());
861 $ilCtrl->redirect($this,
"showHierarchy");
871 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
878 $parent_id = $this->tree->getParentId($node_id);
883 $parent_id = $node_id;
888 $pages = $ilUser->getClipboardObjects(
"pg");
889 $copied_nodes = array();
890 foreach ($pages as $pg)
893 $pg[
"insert_time"], $copied_nodes,
901 $ilUser->clipboardDeleteObjectsOfType(
"pg");
902 $ilUser->clipboardDeleteObjectsOfType(
"st");
906 $ilCtrl->redirect($this,
"view");
918 $this->content_object->executeDragDrop(
$_POST[
"il_hform_source_id"],
$_POST[
"il_hform_target_id"],
920 $ilCtrl->redirect($this,
"showHierarchy");
934 if (!is_array(
$_POST[
"id"]))
937 $ilCtrl->redirect($this,
"showHierarchy");
942 $tpl->setContent($this->form->getHTML());
952 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
955 if (is_array(
$_POST[
"id"]))
957 foreach (
$_POST[
"id"] as $id)
961 $this->form->addItem($hi);
965 $this->content_object->getLayout());
967 $this->form->addItem($layout);
969 $this->form->addCommandButton(
"savePageLayout", $lng->txt(
"save"));
970 $this->form->addCommandButton(
"showHierarchy", $lng->txt(
"cancel"));
972 $this->form->setTitle($lng->txt(
"cont_set_layout"));
973 $this->form->setFormAction($ilCtrl->getFormAction($this));
984 foreach (
$_POST[
"id"] as $id)
989 $this->content_object);
992 $ilCtrl->redirect($this,
"showHierarchy");
1005 $ilCtrl->setParameter($this,
"transl",
"");
1006 $ilCtrl->redirect($this,
"showHierarchy");
1019 $ilCtrl->setParameter($this,
"transl",
$_GET[
"totransl"]);
1020 $ilCtrl->redirect($this,
"showHierarchy");