6 require_once(
"./Modules/LearningModule/classes/class.ilLMObjectGUI.php");
7 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
34 parent::ilLMObjectGUI($a_content_obj);
35 $this->tree =& $a_tree;
45 $this->obj =& $a_st_object;
63 $next_class = $this->ctrl->getNextClass($this);
64 $cmd = $this->ctrl->getCmd();
68 case 'ilobjectmetadatagui':
72 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
73 $md_gui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
74 $md_gui->
addMDObserver($this->obj,
'MDUpdateListener',
'General');
75 $md_gui->addMDObserver($this->obj,
'MDUpdateListener',
'Educational');
76 $this->ctrl->forwardCommand($md_gui);
79 case "ilconditionhandlergui":
81 include_once
'./Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
85 $this->ctrl->forwardCommand($this->condHI);
86 $ilTabs->setTabActive(
'preconditions');
90 if(
$cmd ==
'listConditions')
94 $ret =& $this->condHI->executeCommand();
96 elseif((
$cmd ==
"create") && (
$_POST[
"new_type"] ==
"pg"))
100 $ret =& $pg_gui->executeCommand();
116 if (
$_GET[
"obj_id"] !=
"")
148 $ilCtrl->setParameter($this,
"backcmd",
"showHierarchy");
150 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
153 $form_gui->setTitle($this->obj->getTitle());
155 $form_gui->setTree($this->tree);
156 $form_gui->setCurrentTopNodeId($this->obj->getId());
157 $form_gui->addMultiCommand($lng->txt(
"delete"),
"delete");
158 $form_gui->addMultiCommand($lng->txt(
"cut"),
"cutItems");
159 $form_gui->addMultiCommand($lng->txt(
"copy"),
"copyItems");
160 $form_gui->addMultiCommand($lng->txt(
"cont_de_activate"),
"activatePages");
161 if ($this->content_object->getLayoutPerPage())
163 $form_gui->addMultiCommand($lng->txt(
"cont_set_layout"),
"setPageLayout");
166 $form_gui->addCommand($lng->txt(
"cont_save_all_titles"),
"saveAllTitles");
167 $form_gui->addHelpItem($lng->txt(
"cont_chapters_after_pages"));
168 $up_gui = ($this->content_object->getType() ==
"dbk")
170 :
"ilobjlearningmodulegui";
171 $ilCtrl->setParameterByClass($up_gui,
"active_node", $this->obj->getId());
172 $ilCtrl->setParameterByClass($up_gui,
"active_node",
"");
174 $ctpl =
new ilTemplate(
"tpl.chap_and_pages.html",
true,
true,
"Modules/LearningModule");
175 $ctpl->setVariable(
"HIERARCHY_FORM", $form_gui->getHTML());
176 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
178 include_once(
"./Modules/LearningModule/classes/class.ilObjContentObjectGUI.php");
181 $this->tpl->setContent($ml_head.$ctpl->get());
192 if (!is_array($items))
195 $ilCtrl->redirect($this,
"showHierarchy");
199 foreach($items as $k => $item)
206 foreach($todel as $k)
214 $ilCtrl->redirect($this,
"showHierarchy");
222 $ilCtrl->redirect($this, $a_return);
233 if (!is_array($items))
236 $ilCtrl->redirect($this,
"showHierarchy");
240 foreach($items as $k => $item)
247 foreach($todel as $k)
255 $ilCtrl->redirect($this,
"showHierarchy");
262 $ilCtrl->redirect($this, $a_return);
274 $ilCtrl->redirect($this,
"showHierarchy");
286 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.structure_edit.html",
"Modules/LearningModule");
289 $this->tpl->setCurrentBlock(
"form");
290 $this->ctrl->setParameter($this,
"backcmd",
"subchap");
291 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
292 $this->tpl->setVariable(
"HEADER_TEXT", $this->lng->txt(
"cont_subchapters"));
296 $childs = $this->tree->getChilds($this->obj->getId());
297 foreach ($childs as $child)
299 if($child[
"type"] !=
"st")
303 $this->tpl->setCurrentBlock(
"table_row");
308 $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
309 $this->tpl->setVariable(
"CSS_ROW", $css_row);
313 $this->ctrl->setParameterByClass(
"ilStructureObjectGUI",
"obj_id", $child[
"obj_id"]);
314 $link = $this->ctrl->getLinkTargetByClass(
"ilStructureObjectGUI",
"view");
315 $this->tpl->setVariable(
"LINK_TARGET", $link);
318 $this->tpl->setVariable(
"TEXT_CONTENT",
320 $this->content_object->isActiveNumbering()));
322 $this->tpl->parseCurrentBlock();
326 $this->tpl->setCurrentBlock(
"notfound");
327 $this->tpl->setVariable(
"NUM_COLS", 3);
328 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
329 $this->tpl->parseCurrentBlock();
334 $this->tpl->setVariable(
"NUM_COLS", 3);
335 $acts = array(
"delete" =>
"delete",
"cutChapter" =>
"cut",
336 "copyChapter" =>
"copyChapter");
337 if ($ilUser->clipboardHasObjectsOfType(
"st"))
339 $acts[
"pasteChapter"] =
"pasteChapter";
345 $this->tpl->setVariable(
"NUM_COLS", 3);
347 $subobj = array(
"st");
350 $this->tpl->setCurrentBlock(
"add_object");
351 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
353 $this->tpl->setVariable(
"BTN_NAME",
"create");
354 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"insert"));
355 $this->tpl->parseCurrentBlock();
360 $this->tpl->setCurrentBlock(
"form");
361 $this->tpl->parseCurrentBlock();
363 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
374 $this->tpl->setCurrentBlock(
"begin_link");
375 $this->tpl->setVariable(
"LINK_TARGET", $link);
376 $this->tpl->parseCurrentBlock();
377 $this->tpl->touchBlock(
"end_link");
380 $this->tpl->setCurrentBlock(
"text");
381 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
382 $this->tpl->parseCurrentBlock();
383 $this->tpl->setCurrentBlock(
"table_cell");
384 $this->tpl->parseCurrentBlock();
396 $this->obj->setType(
"st");
399 $this->obj->setLMId($this->content_object->getId());
400 $this->obj->create();
407 if (!empty(
$_GET[
"obj_id"]))
409 $this->ctrl->redirect($this,
"subchap");
425 $tree =
new ilTree($this->content_object->getId());
427 $tree->setTreeTablePK(
"lm_id");
430 $parent_id = (!empty(
$_GET[
"obj_id"]))
432 : $tree->getRootId();
434 $childs =& $tree->getChildsByType($parent_id,
"pg");
435 if (count($childs) != 0)
437 $_GET[
"target"] = $childs[count($childs) - 1][
"obj_id"];
440 if (empty(
$_GET[
"target"]))
471 if (!$ilUser->clipboardHasObjectsOfType(
"pg"))
473 $this->
ilias->raiseError($this->lng->txt(
"no_page_in_clipboard"),$this->
ilias->error_obj->MESSAGE);
513 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
514 if (is_array(
$_POST[
"id"]))
516 $act_items = array();
518 foreach(
$_POST[
"id"] as $id)
520 $path = $this->tree->getPathId($id);
522 foreach(
$path as $path_id)
524 if ($path_id != $id && in_array($path_id,
$_POST[
"id"]))
536 foreach($act_items as $id)
538 $childs = $this->tree->getChilds($id);
539 foreach($childs as $child)
544 $this->content_object->getType());
546 $this->content_object->getType(), !$act);
552 $this->content_object->getType());
554 $this->content_object->getType(), !$act);
563 $this->ctrl->redirect($this,
"view");
572 include_once(
"./Services/AccessControl/classes/class.ilConditionHandlerGUI.php");
575 $this->condHI->setBackButtons(array());
576 $this->condHI->setAutomaticValidation(
false);
577 $this->condHI->setTargetType(
"st");
578 $this->condHI->setTargetRefId($this->content_object->getRefId());
579 $this->condHI->setTargetId($this->obj->getId());
580 $this->condHI->setTargetTitle($this->obj->getTitle());
589 if (
$_GET[
"obj_id"] != 0)
591 if (
$_GET[
"new_type"] ==
"pg")
593 $this->ctrl->redirect($this,
"view");
597 $this->ctrl->redirect($this,
"subchap");
611 $ilTabs->addTarget(
"cont_pages_and_subchapters",
612 $this->ctrl->getLinkTarget($this,
'showHierarchy'),
613 array(
"view",
"showHierarchy"), get_class($this));
616 $ilTabs->addTarget(
"preconditions",
617 $this->ctrl->getLinkTarget($this,
'listConditions'),
618 "listConditions", get_class($this));
621 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
622 $mdgui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
623 $mdtab = $mdgui->
getTab();
626 $ilTabs->addTarget(
"meta_data",
628 "",
"ilmdeditorgui");
632 $this->tpl->setTitle(
633 $this->lng->txt($this->obj->getType()).
": ".$this->obj->getTitle());
636 $ilTabs->addNonTabbedLink(
"pres_mode", $lng->txt(
"cont_presentation_view"),
637 ILIAS_HTTP_PATH.
"/goto.php?target=st_".$this->obj->getId(),
"_top");
645 public static function _goto($a_target, $a_target_ref_id =
"")
656 if (in_array($a_target_ref_id, $ref_ids))
658 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
665 if ($ilAccess->checkAccess(
"read",
"", $ref_id))
669 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
670 $_GET[
"obj_id"] = $a_target;
672 include_once(
"ilias.php");
677 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
681 include_once(
"./Services/Object/classes/class.ilObjectGUI.php");
685 $ilErr->raiseError($lng->txt(
"msg_no_perm_read_lm"), $ilErr->FATAL);
695 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
704 $parent_id = $node_id;
709 $ilCtrl->redirect($this,
"showHierarchy");
717 $parent_id = $this->tree->getParentId($node_id);
722 $parent_id = $node_id;
726 for ($i = 1; $i <= $num; $i++)
729 $chap->setType(
"st");
730 $chap->setTitle($lng->txt(
"cont_new_chap"));
731 $chap->setLMId($this->content_object->getId());
736 $ilCtrl->redirect($this,
"view");
756 $ilLog->write(
"Insert Chapter From Clipboard");
758 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
767 $parent_id = $node_id;
772 $ilCtrl->redirect($this,
"showHierarchy");
780 $parent_id = $this->tree->getParentId($node_id);
785 $parent_id = $node_id;
789 $childs = $this->tree->getChildsByType($parent_id,
"pg");
790 if (count($childs) != 0)
792 $target = $childs[count($childs) - 1][
"obj_id"];
798 $chapters = $ilUser->getClipboardObjects(
"st",
true);
799 $copied_nodes = array();
801 foreach ($chapters as $chap)
803 $ilLog->write(
"Call pasteTree, Target LM: ".$this->content_object->getId().
", Chapter ID: ".$chap[
"id"]
804 .
", Parent ID: ".$parent_id.
", Target: ".$target);
806 $target, $chap[
"insert_time"], $copied_nodes,
814 $ilUser->clipboardDeleteObjectsOfType(
"pg");
815 $ilUser->clipboardDeleteObjectsOfType(
"st");
819 $this->content_object->checkTree();
820 $ilCtrl->redirect($this, $a_return);
838 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
845 $parent_id = $this->tree->getParentId($node_id);
850 $parent_id = $node_id;
854 for ($i = 1; $i <= $num; $i++)
857 $page->setType(
"pg");
858 $page->setTitle($lng->txt(
"cont_new_page"));
859 $page->setLMId($this->content_object->getId());
864 $ilCtrl->redirect($this,
"showHierarchy");
874 include_once(
"./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php");
881 $parent_id = $this->tree->getParentId($node_id);
886 $parent_id = $node_id;
891 $pages = $ilUser->getClipboardObjects(
"pg");
892 $copied_nodes = array();
893 foreach ($pages as $pg)
896 $pg[
"insert_time"], $copied_nodes,
904 $ilUser->clipboardDeleteObjectsOfType(
"pg");
905 $ilUser->clipboardDeleteObjectsOfType(
"st");
909 $ilCtrl->redirect($this,
"view");
921 $this->content_object->executeDragDrop(
$_POST[
"il_hform_source_id"],
$_POST[
"il_hform_target_id"],
923 $ilCtrl->redirect($this,
"showHierarchy");
937 if (!is_array(
$_POST[
"id"]))
940 $ilCtrl->redirect($this,
"showHierarchy");
945 $tpl->setContent($this->form->getHTML());
955 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
958 if (is_array(
$_POST[
"id"]))
960 foreach (
$_POST[
"id"] as $id)
964 $this->form->addItem($hi);
968 $this->content_object->getLayout());
970 $this->form->addItem($layout);
972 $this->form->addCommandButton(
"savePageLayout", $lng->txt(
"save"));
973 $this->form->addCommandButton(
"showHierarchy", $lng->txt(
"cancel"));
975 $this->form->setTitle($lng->txt(
"cont_set_layout"));
976 $this->form->setFormAction($ilCtrl->getFormAction($this));
987 foreach (
$_POST[
"id"] as $id)
992 $this->content_object);
995 $ilCtrl->redirect($this,
"showHierarchy");
1008 $ilCtrl->setParameter($this,
"transl",
"");
1009 $ilCtrl->redirect($this,
"showHierarchy");
1022 $ilCtrl->setParameter($this,
"transl",
$_GET[
"totransl"]);
1023 $ilCtrl->redirect($this,
"showHierarchy");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 _getPresentationTitle($a_st_id, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_lm_id=0, $a_lang="-")
get presentation title
static getMultiLangHeader($a_lm_id, $a_gui_class)
Get multi lang header.
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.
ilStructureObjectGUI(&$a_content_obj, &$a_tree)
Constructor public.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
Class ilStructureObjectGUI.
insertPage()
Insert (multiple) pages 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 getLayoutOption($a_txt, $a_var, $a_def_option="")
Save help mapping.
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.
& executeCommand()
execute command
static _goto($a_target, $a_target_ref_id="")
redirect script
cancel()
cancel creation of new page or chapter
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
clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
insertSubchapterClip()
Insert Chapter from clipboard.
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
_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)
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.
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
_lookupContObjID($a_id)
get learning module / digibook id for lm object
cutItems($a_return="view")
Copy items to clipboard, then cut them from the current tree.
redirection script todo: (a better solution should control the processing via a xml file) ...
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
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
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) ...
activatePages()
activates or deactivates pages
insertChapter($a_as_sub=false)
Insert (multiple) chapters at node.
putInTree()
put chapter into tree
showHierarchy()
Show subhiearchy of pages and subchapters.