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 "ilconditionhandlergui":
82 include_once
'./Services/AccessControl/classes/class.ilConditionHandlerGUI.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 $ilCtrl->setParameterByClass($up_gui,
"active_node",
"");
175 $ctpl =
new ilTemplate(
"tpl.chap_and_pages.html",
true,
true,
"Modules/LearningModule");
176 $ctpl->setVariable(
"HIERARCHY_FORM", $form_gui->getHTML());
177 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
179 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
182 $this->tpl->setContent($ml_head.$ctpl->get());
193 if (!is_array($items))
196 $ilCtrl->redirect($this,
"showHierarchy");
200 foreach($items as $k => $item)
207 foreach($todel as $k)
215 $ilCtrl->redirect($this,
"showHierarchy");
223 $ilCtrl->redirect($this, $a_return);
234 if (!is_array($items))
237 $ilCtrl->redirect($this,
"showHierarchy");
241 foreach($items as $k => $item)
248 foreach($todel as $k)
256 $ilCtrl->redirect($this,
"showHierarchy");
263 $ilCtrl->redirect($this, $a_return);
275 $ilCtrl->redirect($this,
"showHierarchy");
287 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.structure_edit.html",
"Modules/LearningModule");
290 $this->tpl->setCurrentBlock(
"form");
291 $this->ctrl->setParameter($this,
"backcmd",
"subchap");
292 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
293 $this->tpl->setVariable(
"HEADER_TEXT", $this->lng->txt(
"cont_subchapters"));
297 $childs = $this->tree->getChilds($this->obj->getId());
298 foreach ($childs as $child)
300 if($child[
"type"] !=
"st")
304 $this->tpl->setCurrentBlock(
"table_row");
309 $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
310 $this->tpl->setVariable(
"CSS_ROW", $css_row);
314 $this->ctrl->setParameterByClass(
"ilStructureObjectGUI",
"obj_id", $child[
"obj_id"]);
315 $link = $this->ctrl->getLinkTargetByClass(
"ilStructureObjectGUI",
"view");
316 $this->tpl->setVariable(
"LINK_TARGET", $link);
319 $this->tpl->setVariable(
"TEXT_CONTENT",
321 $this->content_object->isActiveNumbering()));
323 $this->tpl->parseCurrentBlock();
327 $this->tpl->setCurrentBlock(
"notfound");
328 $this->tpl->setVariable(
"NUM_COLS", 3);
329 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
330 $this->tpl->parseCurrentBlock();
335 $this->tpl->setVariable(
"NUM_COLS", 3);
336 $acts = array(
"delete" =>
"delete",
"cutChapter" =>
"cut",
337 "copyChapter" =>
"copyChapter");
338 if ($ilUser->clipboardHasObjectsOfType(
"st"))
340 $acts[
"pasteChapter"] =
"pasteChapter";
346 $this->tpl->setVariable(
"NUM_COLS", 3);
348 $subobj = array(
"st");
351 $this->tpl->setCurrentBlock(
"add_object");
352 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
354 $this->tpl->setVariable(
"BTN_NAME",
"create");
355 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"insert"));
356 $this->tpl->parseCurrentBlock();
361 $this->tpl->setCurrentBlock(
"form");
362 $this->tpl->parseCurrentBlock();
364 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
375 $this->tpl->setCurrentBlock(
"begin_link");
376 $this->tpl->setVariable(
"LINK_TARGET", $link);
377 $this->tpl->parseCurrentBlock();
378 $this->tpl->touchBlock(
"end_link");
381 $this->tpl->setCurrentBlock(
"text");
382 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
383 $this->tpl->parseCurrentBlock();
384 $this->tpl->setCurrentBlock(
"table_cell");
385 $this->tpl->parseCurrentBlock();
397 $this->obj->setType(
"st");
400 $this->obj->setLMId($this->content_object->getId());
401 $this->obj->create();
408 if (!empty(
$_GET[
"obj_id"]))
410 $this->ctrl->redirect($this,
"subchap");
426 $tree =
new ilTree($this->content_object->getId());
427 $tree->setTableNames(
'lm_tree',
'lm_data');
428 $tree->setTreeTablePK(
"lm_id");
431 $parent_id = (!empty(
$_GET[
"obj_id"]))
433 :
$tree->getRootId();
435 $childs =&
$tree->getChildsByType($parent_id,
"pg");
436 if (count($childs) != 0)
438 $_GET[
"target"] = $childs[count($childs) - 1][
"obj_id"];
441 if (empty(
$_GET[
"target"]))
472 if (!$ilUser->clipboardHasObjectsOfType(
"pg"))
474 $this->ilias->raiseError($this->lng->txt(
"no_page_in_clipboard"),$this->ilias->error_obj->MESSAGE);
514 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
515 if (is_array(
$_POST[
"id"]))
517 $act_items = array();
519 foreach(
$_POST[
"id"] as $id)
521 $path = $this->tree->getPathId($id);
523 foreach(
$path as $path_id)
525 if ($path_id != $id && in_array($path_id,
$_POST[
"id"]))
537 foreach($act_items as $id)
539 $childs = $this->tree->getChilds($id);
540 foreach($childs as $child)
545 $this->content_object->getType());
547 $this->content_object->getType(), !$act);
553 $this->content_object->getType());
555 $this->content_object->getType(), !$act);
564 $this->ctrl->redirect($this,
"view");
573 include_once(
"./Services/AccessControl/classes/class.ilConditionHandlerGUI.php");
576 $this->condHI->setBackButtons(array());
577 $this->condHI->setAutomaticValidation(
false);
578 $this->condHI->setTargetType(
"st");
579 $this->condHI->setTargetRefId($this->content_object->getRefId());
580 $this->condHI->setTargetId($this->obj->getId());
581 $this->condHI->setTargetTitle($this->obj->getTitle());
590 if (
$_GET[
"obj_id"] != 0)
592 if (
$_GET[
"new_type"] ==
"pg")
594 $this->ctrl->redirect($this,
"view");
598 $this->ctrl->redirect($this,
"subchap");
612 $ilTabs->addTarget(
"cont_pages_and_subchapters",
613 $this->ctrl->getLinkTarget($this,
'showHierarchy'),
614 array(
"view",
"showHierarchy"), get_class($this));
617 $ilTabs->addTarget(
"preconditions",
618 $this->ctrl->getLinkTarget($this,
'listConditions'),
619 "listConditions", get_class($this));
622 $ilTabs->addTarget(
"meta_data",
623 $this->ctrl->getLinkTargetByClass(
"ilmdeditorgui",
''),
624 "",
"ilmdeditorgui");
627 $this->tpl->setTitle(
628 $this->lng->txt($this->obj->getType()).
": ".$this->obj->getTitle());
631 $ilTabs->addNonTabbedLink(
"pres_mode", $lng->txt(
"cont_presentation_view"),
632 ILIAS_HTTP_PATH.
"/goto.php?target=st_".$this->obj->getId(),
"_top");
640 public static function _goto($a_target, $a_target_ref_id =
"")
651 if (in_array($a_target_ref_id, $ref_ids))
653 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
660 if ($ilAccess->checkAccess(
"read",
"", $ref_id))
664 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
665 $_GET[
"obj_id"] = $a_target;
667 include_once(
"ilias.php");
672 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
676 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
680 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
690 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
699 $parent_id = $node_id;
704 $ilCtrl->redirect($this,
"showHierarchy");
712 $parent_id = $this->tree->getParentId($node_id);
717 $parent_id = $node_id;
721 for ($i = 1; $i <= $num; $i++)
724 $chap->setType(
"st");
725 $chap->setTitle($lng->txt(
"cont_new_chap"));
726 $chap->setLMId($this->content_object->getId());
731 $ilCtrl->redirect($this,
"view");
751 $ilLog->write(
"Insert Chapter From Clipboard");
753 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
762 $parent_id = $node_id;
767 $ilCtrl->redirect($this,
"showHierarchy");
775 $parent_id = $this->tree->getParentId($node_id);
780 $parent_id = $node_id;
784 $childs = $this->tree->getChildsByType($parent_id,
"pg");
785 if (count($childs) != 0)
787 $target = $childs[count($childs) - 1][
"obj_id"];
793 $chapters = $ilUser->getClipboardObjects(
"st",
true);
794 $copied_nodes = array();
796 foreach ($chapters as $chap)
798 $ilLog->write(
"Call pasteTree, Target LM: ".$this->content_object->getId().
", Chapter ID: ".$chap[
"id"]
799 .
", Parent ID: ".$parent_id.
", Target: ".$target);
801 $target, $chap[
"insert_time"], $copied_nodes,
809 $ilUser->clipboardDeleteObjectsOfType(
"pg");
810 $ilUser->clipboardDeleteObjectsOfType(
"st");
814 $this->content_object->checkTree();
815 $ilCtrl->redirect($this, $a_return);
833 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
840 $parent_id = $this->tree->getParentId($node_id);
845 $parent_id = $node_id;
849 for ($i = 1; $i <= $num; $i++)
852 $page->setType(
"pg");
853 $page->setTitle($lng->txt(
"cont_new_page"));
854 $page->setLMId($this->content_object->getId());
859 $ilCtrl->redirect($this,
"showHierarchy");
869 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
876 $parent_id = $this->tree->getParentId($node_id);
881 $parent_id = $node_id;
886 $pages = $ilUser->getClipboardObjects(
"pg");
887 $copied_nodes = array();
888 foreach ($pages as $pg)
891 $pg[
"insert_time"], $copied_nodes,
899 $ilUser->clipboardDeleteObjectsOfType(
"pg");
900 $ilUser->clipboardDeleteObjectsOfType(
"st");
904 $ilCtrl->redirect($this,
"view");
916 $this->content_object->executeDragDrop(
$_POST[
"il_hform_source_id"],
$_POST[
"il_hform_target_id"],
918 $ilCtrl->redirect($this,
"showHierarchy");
932 if (!is_array(
$_POST[
"id"]))
935 $ilCtrl->redirect($this,
"showHierarchy");
940 $tpl->setContent($this->form->getHTML());
950 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
953 if (is_array(
$_POST[
"id"]))
955 foreach (
$_POST[
"id"] as $id)
959 $this->form->addItem($hi);
963 $this->content_object->getLayout());
965 $this->form->addItem($layout);
967 $this->form->addCommandButton(
"savePageLayout", $lng->txt(
"save"));
968 $this->form->addCommandButton(
"showHierarchy", $lng->txt(
"cancel"));
970 $this->form->setTitle($lng->txt(
"cont_set_layout"));
971 $this->form->setFormAction($ilCtrl->getFormAction($this));
982 foreach (
$_POST[
"id"] as $id)
987 $this->content_object);
990 $ilCtrl->redirect($this,
"showHierarchy");
1003 $ilCtrl->setParameter($this,
"transl",
"");
1004 $ilCtrl->redirect($this,
"showHierarchy");
1017 $ilCtrl->setParameter($this,
"transl",
$_GET[
"totransl"]);
1018 $ilCtrl->redirect($this,
"showHierarchy");