6 require_once(
"./Modules/LearningModule/classes/class.ilLMObjectGUI.php");
7 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
54 $this->tree = $DIC->repositoryTree();
55 $this->
user = $DIC->user();
56 $this->ctrl = $DIC->ctrl();
57 $this->lng = $DIC->language();
58 $this->error = $DIC[
"ilErr"];
59 $this->tabs = $DIC->tabs();
60 $this->log = $DIC[
"ilLog"];
61 $this->tpl = $DIC[
"tpl"];
62 parent::__construct($a_content_obj);
63 $this->tree = $a_tree;
73 $this->obj = $a_st_object;
91 $next_class = $this->ctrl->getNextClass($this);
92 $cmd = $this->ctrl->getCmd();
94 switch ($next_class) {
95 case 'ilobjectmetadatagui':
99 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
100 $md_gui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
101 $md_gui->
addMDObserver($this->obj,
'MDUpdateListener',
'General');
102 $md_gui->addMDObserver($this->obj,
'MDUpdateListener',
'Educational');
103 $this->ctrl->forwardCommand($md_gui);
106 case "ilconditionhandlergui":
108 include_once
'./Services/Conditions/classes/class.ilConditionHandlerGUI.php';
112 $this->ctrl->forwardCommand($this->condHI);
113 $ilTabs->setTabActive(
'preconditions');
117 if ($cmd ==
'listConditions') {
120 $this->condHI->executeCommand();
121 } elseif (($cmd ==
"create") && (
$_POST[
"new_type"] ==
"pg")) {
124 $pg_gui->executeCommand();
138 if (
$_GET[
"obj_id"] !=
"") {
173 $ilCtrl->setParameter($this,
"backcmd",
"showHierarchy");
175 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
178 $form_gui->setTitle($this->obj->getTitle());
180 $form_gui->setTree($this->tree);
181 $form_gui->setCurrentTopNodeId($this->obj->getId());
182 $form_gui->addMultiCommand(
$lng->txt(
"delete"),
"delete");
183 $form_gui->addMultiCommand(
$lng->txt(
"cut"),
"cutItems");
184 $form_gui->addMultiCommand(
$lng->txt(
"copy"),
"copyItems");
185 $form_gui->addMultiCommand(
$lng->txt(
"cont_de_activate"),
"activatePages");
186 if ($this->content_object->getLayoutPerPage()) {
187 $form_gui->addMultiCommand(
$lng->txt(
"cont_set_layout"),
"setPageLayout");
190 $form_gui->addCommand(
$lng->txt(
"cont_save_all_titles"),
"saveAllTitles");
191 $form_gui->addHelpItem(
$lng->txt(
"cont_chapters_after_pages"));
192 $up_gui =
"ilobjlearningmodulegui";
193 $ilCtrl->setParameterByClass($up_gui,
"active_node", $this->obj->getId());
194 $ilCtrl->setParameterByClass($up_gui,
"active_node",
"");
196 $ctpl =
new ilTemplate(
"tpl.chap_and_pages.html",
true,
true,
"Modules/LearningModule");
197 $ctpl->setVariable(
"HIERARCHY_FORM", $form_gui->getHTML());
198 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
200 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
203 $this->tpl->setContent($ml_head . $ctpl->get());
215 if (!is_array($items)) {
217 $ilCtrl->redirect($this,
"showHierarchy");
221 foreach ($items as $k => $item) {
226 foreach ($todel as $k) {
232 $ilCtrl->redirect($this,
"showHierarchy");
240 $ilCtrl->redirect($this, $a_return);
252 if (!is_array($items)) {
254 $ilCtrl->redirect($this,
"showHierarchy");
258 foreach ($items as $k => $item) {
263 foreach ($todel as $k) {
269 $ilCtrl->redirect($this,
"showHierarchy");
276 $ilCtrl->redirect($this, $a_return);
288 ilUtil::sendSuccess($this->lng->txt(
"lm_save_titles"),
true);
289 $ilCtrl->redirect($this,
"showHierarchy");
304 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.structure_edit.html",
"Modules/LearningModule");
307 $this->tpl->setCurrentBlock(
"form");
308 $this->ctrl->setParameter($this,
"backcmd",
"subchap");
309 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
310 $this->tpl->setVariable(
"HEADER_TEXT", $this->lng->txt(
"cont_subchapters"));
314 $childs = $this->tree->getChilds($this->obj->getId());
315 foreach ($childs as $child) {
316 if ($child[
"type"] !=
"st") {
319 $this->tpl->setCurrentBlock(
"table_row");
324 $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
325 $this->tpl->setVariable(
"CSS_ROW", $css_row);
329 $this->ctrl->setParameterByClass(
"ilStructureObjectGUI",
"obj_id", $child[
"obj_id"]);
330 $link = $this->ctrl->getLinkTargetByClass(
"ilStructureObjectGUI",
"view");
331 $this->tpl->setVariable(
"LINK_TARGET", $link);
334 $this->tpl->setVariable(
339 $this->content_object->isActiveNumbering()
343 $this->tpl->parseCurrentBlock();
346 $this->tpl->setCurrentBlock(
"notfound");
347 $this->tpl->setVariable(
"NUM_COLS", 3);
348 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
349 $this->tpl->parseCurrentBlock();
354 $this->tpl->setVariable(
"NUM_COLS", 3);
355 $acts = array(
"delete" =>
"delete",
"cutChapter" =>
"cut",
356 "copyChapter" =>
"copyChapter");
357 if (
$ilUser->clipboardHasObjectsOfType(
"st")) {
358 $acts[
"pasteChapter"] =
"pasteChapter";
364 $this->tpl->setVariable(
"NUM_COLS", 3);
366 $subobj = array(
"st");
369 $this->tpl->setCurrentBlock(
"add_object");
370 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
372 $this->tpl->setVariable(
"BTN_NAME",
"create");
373 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"insert"));
374 $this->tpl->parseCurrentBlock();
379 $this->tpl->setCurrentBlock(
"form");
380 $this->tpl->parseCurrentBlock();
382 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
391 $this->tpl->setCurrentBlock(
"begin_link");
392 $this->tpl->setVariable(
"LINK_TARGET", $link);
393 $this->tpl->parseCurrentBlock();
394 $this->tpl->touchBlock(
"end_link");
397 $this->tpl->setCurrentBlock(
"text");
398 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
399 $this->tpl->parseCurrentBlock();
400 $this->tpl->setCurrentBlock(
"table_cell");
401 $this->tpl->parseCurrentBlock();
412 $this->obj->setType(
"st");
415 $this->obj->setLMId($this->content_object->getId());
416 $this->obj->create();
423 if (!empty(
$_GET[
"obj_id"])) {
424 $this->ctrl->redirect($this,
"subchap");
438 $tree =
new ilTree($this->content_object->getId());
439 $tree->setTableNames(
'lm_tree',
'lm_data');
440 $tree->setTreeTablePK(
"lm_id");
443 $parent_id = (!empty(
$_GET[
"obj_id"]))
445 :
$tree->getRootId();
447 $childs =
$tree->getChildsByType($parent_id,
"pg");
448 if (count($childs) != 0) {
449 $_GET[
"target"] = $childs[count($childs) - 1][
"obj_id"];
452 if (empty(
$_GET[
"target"])) {
483 if (!
$ilUser->clipboardHasObjectsOfType(
"pg")) {
484 $ilErr->raiseError($this->lng->txt(
"no_page_in_clipboard"),
$ilErr->MESSAGE);
524 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
525 if (is_array(
$_POST[
"id"])) {
526 $act_items = array();
529 $path = $this->tree->getPathId($id);
531 foreach (
$path as $path_id) {
532 if ($path_id != $id && in_array($path_id,
$_POST[
"id"])) {
542 foreach ($act_items as $id) {
543 $childs = $this->tree->getChilds($id);
544 foreach ($childs as $child) {
548 $this->content_object->getType()
552 $this->content_object->getType(),
560 $this->content_object->getType()
564 $this->content_object->getType(),
573 $this->ctrl->redirect($this,
"view");
582 include_once(
"./Services/Conditions/classes/class.ilConditionHandlerGUI.php");
585 $this->condHI->setBackButtons(array());
586 $this->condHI->setAutomaticValidation(
false);
587 $this->condHI->setTargetType(
"st");
588 $this->condHI->setTargetRefId($this->content_object->getRefId());
589 $this->condHI->setTargetId($this->obj->getId());
590 $this->condHI->setTargetTitle($this->obj->getTitle());
599 if (
$_GET[
"obj_id"] != 0) {
600 if (
$_GET[
"new_type"] ==
"pg") {
601 $this->ctrl->redirect($this,
"view");
603 $this->ctrl->redirect($this,
"subchap");
620 "cont_pages_and_subchapters",
621 $this->ctrl->getLinkTarget($this,
'showHierarchy'),
622 array(
"view",
"showHierarchy"),
629 $this->ctrl->getLinkTarget($this,
'listConditions'),
635 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
636 $mdgui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
637 $mdtab = $mdgui->
getTab();
648 $this->tpl->setTitle(
649 $this->lng->txt($this->obj->getType()) .
": " . $this->obj->getTitle()
653 $ilTabs->addNonTabbedLink(
655 $lng->txt(
"cont_presentation_view"),
656 ILIAS_HTTP_PATH .
"/goto.php?target=st_" . $this->obj->getId(),
666 public static function _goto($a_target, $a_target_ref_id =
"")
670 $rbacsystem = $DIC->rbac()->system();
672 $lng = $DIC->language();
673 $ilAccess = $DIC->access();
682 if (in_array($a_target_ref_id, $ref_ids)) {
683 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
687 foreach ($ref_ids as $ref_id) {
689 if ($ilAccess->checkAccess(
"read",
"", $ref_id)) {
692 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
693 $_GET[
"obj_id"] = $a_target;
694 $_GET[
"ref_id"] = $ref_id;
695 include_once(
"ilias.php");
701 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
703 $lng->txt(
"msg_no_perm_read_item"),
706 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
721 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
728 $parent_id = $node_id;
731 $ilCtrl->redirect($this,
"showHierarchy");
736 $parent_id = $this->tree->getParentId($node_id);
739 $parent_id = $node_id;
743 for (
$i = 1;
$i <= $num;
$i++) {
745 $chap->setType(
"st");
746 $chap->setTitle(
$lng->txt(
"cont_new_chap"));
747 $chap->setLMId($this->content_object->getId());
752 $ilCtrl->redirect($this,
"view");
774 $ilLog->write(
"Insert Chapter From Clipboard");
776 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
783 $parent_id = $node_id;
786 $ilCtrl->redirect($this,
"showHierarchy");
791 $parent_id = $this->tree->getParentId($node_id);
794 $parent_id = $node_id;
798 $childs = $this->tree->getChildsByType($parent_id,
"pg");
799 if (count($childs) != 0) {
800 $target = $childs[count($childs) - 1][
"obj_id"];
806 $chapters =
$ilUser->getClipboardObjects(
"st",
true);
807 $copied_nodes = array();
809 foreach ($chapters as $chap) {
810 $ilLog->write(
"Call pasteTree, Target LM: " . $this->content_object->getId() .
", Chapter ID: " . $chap[
"id"]
811 .
", Parent ID: " . $parent_id .
", Target: " .
$target);
813 $this->content_object,
817 $chap[
"insert_time"],
826 $ilUser->clipboardDeleteObjectsOfType(
"pg");
827 $ilUser->clipboardDeleteObjectsOfType(
"st");
831 $this->content_object->checkTree();
832 $ilCtrl->redirect($this, $a_return);
851 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
857 $parent_id = $this->tree->getParentId($node_id);
860 $parent_id = $node_id;
864 for (
$i = 1;
$i <= $num;
$i++) {
866 $page->setType(
"pg");
867 $page->setTitle(
$lng->txt(
"cont_new_page"));
868 $page->setLMId($this->content_object->getId());
873 $ilCtrl->redirect($this,
"showHierarchy");
884 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
890 $parent_id = $this->tree->getParentId($node_id);
893 $parent_id = $node_id;
898 $pages =
$ilUser->getClipboardObjects(
"pg");
899 $copied_nodes = array();
900 foreach ($pages as $pg) {
902 $this->content_object,
915 $ilUser->clipboardDeleteObjectsOfType(
"pg");
916 $ilUser->clipboardDeleteObjectsOfType(
"st");
920 $ilCtrl->redirect($this,
"view");
932 $this->content_object->executeDragDrop(
933 $_POST[
"il_hform_source_id"],
934 $_POST[
"il_hform_target_id"],
936 $_POST[
"il_hform_as_subitem"]
938 $ilCtrl->redirect($this,
"showHierarchy");
954 if (!is_array(
$_POST[
"id"])) {
956 $ilCtrl->redirect($this,
"showHierarchy");
961 $tpl->setContent($this->form->getHTML());
972 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
975 if (is_array(
$_POST[
"id"])) {
979 $this->form->addItem($hi);
983 $lng->txt(
"cont_layout"),
985 $this->content_object->getLayout()
988 $this->form->addItem($layout);
990 $this->form->addCommandButton(
"savePageLayout",
$lng->txt(
"save"));
991 $this->form->addCommandButton(
"showHierarchy",
$lng->txt(
"cancel"));
993 $this->form->setTitle(
$lng->txt(
"cont_set_layout"));
994 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
1010 $this->content_object
1013 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
1014 $ilCtrl->redirect($this,
"showHierarchy");
1027 $ilCtrl->setParameter($this,
"transl",
"");
1028 $ilCtrl->redirect($this,
"showHierarchy");
1041 $ilCtrl->setParameter($this,
"transl",
$_GET[
"totransl"]);
1042 $ilCtrl->redirect($this,
"showHierarchy");
proceedDragDrop()
Perform drag and drop action.
saveAllTitles()
Save all titles of chapters/pages.
initConditionHandlerInterface()
cutChapter()
Cut chapter(s)
class ilConditionHandlerGUI
editMasterLanguage()
Edit master language.
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
initSetPageLayoutForm()
Init set page layout form.
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters)
checkTree()
check the content object tree
static saveTitles($a_lm, $a_titles, $a_lang="-")
Save titles for lm objects.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
Class ilStructureObjectGUI.
insertPage()
Insert (multiple) pages at node.
static getLayoutOption($a_txt, $a_var, $a_def_option="")
Get layout option.
static _lookupTitle($a_id)
lookup object title
insertSubchapter()
Insert (multiple) subchapters at node.
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.
insertChapterClip($a_as_sub=false, $a_return="view")
Insert Chapter from clipboard.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _goto($a_target, $a_target_ref_id="")
redirect script
cancel()
cancel creation of new page or chapter
static _getPresentationTitle( $a_st_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
static _getAllReferences($a_id)
get all reference ids of object
setPageLayout()
Set layout for multipl pages.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getType()
this function is called by condition handler gui interface
insertSubchapterClip()
Insert Chapter from clipboard.
static getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode="")
Get multi lang header.
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
pasteChapter()
paste chapter
special template class to simplify handling of ITX/PEAR
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
cutItems($a_return="view")
Copy items to clipboard, then cut them from the current tree.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setStructureObject(&$a_st_object)
set structure object
copyItems($a_return="view")
Copy items to clipboard.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
insertPageClip()
Insert pages from clipboard.
switchToLanguage()
Switch to language.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showActions($a_actions)
show possible action (form buttons)
copyChapter()
copy a single chapter (selection)
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
savePageLayout()
Save page layout.
add_cell($val, $link="")
output a cell in object list
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
create()
create new page or chapter in chapter
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
__construct(&$a_content_obj, &$a_tree)
Constructor public.
activatePages()
activates or deactivates pages
executeCommand()
execute command
insertChapter($a_as_sub=false)
Insert (multiple) chapters at node.
static pasteTree( $a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
Paste item (tree) from clipboard to current lm.
static setAction($a_action)
putInTree()
put chapter into tree
showHierarchy()
Show subhiearchy of pages and subchapters.