50 $this->tree =
$DIC->repositoryTree();
51 $this->
user = $DIC->user();
52 $this->ctrl =
$DIC->ctrl();
53 $this->lng =
$DIC->language();
54 $this->
error = $DIC[
"ilErr"];
55 $this->tabs =
$DIC->tabs();
56 $this->log =
$DIC[
"ilLog"];
57 $this->tpl =
$DIC[
"tpl"];
59 $this->tree = $a_tree;
69 $this->obj = $a_st_object;
87 $next_class = $this->ctrl->getNextClass($this);
88 $cmd = $this->ctrl->getCmd();
90 switch ($next_class) {
91 case 'ilobjectmetadatagui':
95 $md_gui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
96 $md_gui->addMDObserver($this->obj,
'MDUpdateListener',
'General');
97 $md_gui->addMDObserver($this->obj,
'MDUpdateListener',
'Educational');
98 $this->ctrl->forwardCommand($md_gui);
101 case "ilconditionhandlergui":
106 $this->ctrl->forwardCommand($this->condHI);
107 $ilTabs->setTabActive(
'preconditions');
111 if ($cmd ==
'listConditions') {
114 $this->condHI->executeCommand();
115 } elseif (($cmd ==
"create") && (
$_POST[
"new_type"] ==
"pg")) {
118 $pg_gui->executeCommand();
132 if (
$_GET[
"obj_id"] !=
"") {
167 $ilCtrl->setParameter($this,
"backcmd",
"showHierarchy");
170 $form_gui->setFormAction($ilCtrl->getFormAction($this));
171 $form_gui->setTitle($this->obj->getTitle());
173 $form_gui->setTree($this->tree);
174 $form_gui->setCurrentTopNodeId($this->obj->getId());
175 $form_gui->addMultiCommand(
$lng->txt(
"delete"),
"delete");
176 $form_gui->addMultiCommand(
$lng->txt(
"cut"),
"cutItems");
177 $form_gui->addMultiCommand(
$lng->txt(
"copy"),
"copyItems");
178 $form_gui->addMultiCommand(
$lng->txt(
"cont_de_activate"),
"activatePages");
179 if ($this->content_object->getLayoutPerPage()) {
180 $form_gui->addMultiCommand(
$lng->txt(
"cont_set_layout"),
"setPageLayout");
183 $form_gui->addCommand(
$lng->txt(
"cont_save_all_titles"),
"saveAllTitles");
184 $form_gui->addHelpItem(
$lng->txt(
"cont_chapters_after_pages"));
185 $up_gui =
"ilobjlearningmodulegui";
186 $ilCtrl->setParameterByClass($up_gui,
"active_node", $this->obj->getId());
187 $ilCtrl->setParameterByClass($up_gui,
"active_node",
"");
189 $ctpl =
new ilTemplate(
"tpl.chap_and_pages.html",
true,
true,
"Modules/LearningModule");
190 $ctpl->setVariable(
"HIERARCHY_FORM", $form_gui->getHTML());
191 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
195 $this->tpl->setContent($ml_head . $ctpl->get());
196 $this->tpl->addOnloadCode(
"window.setTimeout(() => { $('body').trigger('il-lm-editor-tree'); }, 500);");
208 if (!is_array($items)) {
210 $ilCtrl->redirect($this,
"showHierarchy");
214 foreach ($items as $k => $item) {
219 foreach ($todel as $k) {
225 $ilCtrl->redirect($this,
"showHierarchy");
233 $ilCtrl->redirect($this, $a_return);
245 if (!is_array($items)) {
247 $ilCtrl->redirect($this,
"showHierarchy");
251 foreach ($items as $k => $item) {
256 foreach ($todel as $k) {
262 $ilCtrl->redirect($this,
"showHierarchy");
269 $ilCtrl->redirect($this, $a_return);
281 ilUtil::sendSuccess($this->lng->txt(
"lm_save_titles"),
true);
282 $ilCtrl->redirect($this,
"showHierarchy");
297 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.structure_edit.html",
"Modules/LearningModule");
300 $this->tpl->setCurrentBlock(
"form");
301 $this->ctrl->setParameter($this,
"backcmd",
"subchap");
302 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
303 $this->tpl->setVariable(
"HEADER_TEXT", $this->lng->txt(
"cont_subchapters"));
307 $childs = $this->tree->getChilds($this->obj->getId());
308 foreach ($childs as $child) {
309 if ($child[
"type"] !=
"st") {
312 $this->tpl->setCurrentBlock(
"table_row");
317 $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
318 $this->tpl->setVariable(
"CSS_ROW", $css_row);
322 $this->ctrl->setParameterByClass(
"ilStructureObjectGUI",
"obj_id", $child[
"obj_id"]);
323 $link = $this->ctrl->getLinkTargetByClass(
"ilStructureObjectGUI",
"view");
324 $this->tpl->setVariable(
"LINK_TARGET", $link);
327 $this->tpl->setVariable(
332 $this->content_object->isActiveNumbering()
336 $this->tpl->parseCurrentBlock();
339 $this->tpl->setCurrentBlock(
"notfound");
340 $this->tpl->setVariable(
"NUM_COLS", 3);
341 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
342 $this->tpl->parseCurrentBlock();
347 $this->tpl->setVariable(
"NUM_COLS", 3);
348 $acts = array(
"delete" =>
"delete",
"cutChapter" =>
"cut",
349 "copyChapter" =>
"copyChapter");
350 if (
$ilUser->clipboardHasObjectsOfType(
"st")) {
351 $acts[
"pasteChapter"] =
"pasteChapter";
357 $this->tpl->setVariable(
"NUM_COLS", 3);
359 $subobj = array(
"st");
362 $this->tpl->setCurrentBlock(
"add_object");
363 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
365 $this->tpl->setVariable(
"BTN_NAME",
"create");
366 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"insert"));
367 $this->tpl->parseCurrentBlock();
372 $this->tpl->setCurrentBlock(
"form");
373 $this->tpl->parseCurrentBlock();
375 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
384 $this->tpl->setCurrentBlock(
"begin_link");
385 $this->tpl->setVariable(
"LINK_TARGET", $link);
386 $this->tpl->parseCurrentBlock();
387 $this->tpl->touchBlock(
"end_link");
390 $this->tpl->setCurrentBlock(
"text");
391 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
392 $this->tpl->parseCurrentBlock();
393 $this->tpl->setCurrentBlock(
"table_cell");
394 $this->tpl->parseCurrentBlock();
405 $this->obj->setType(
"st");
408 $this->obj->setLMId($this->content_object->getId());
409 $this->obj->create();
416 if (!empty(
$_GET[
"obj_id"])) {
417 $this->ctrl->redirect($this,
"subchap");
431 $tree =
new ilTree($this->content_object->getId());
432 $tree->setTableNames(
'lm_tree',
'lm_data');
433 $tree->setTreeTablePK(
"lm_id");
436 $parent_id = (!empty(
$_GET[
"obj_id"]))
438 :
$tree->getRootId();
440 $childs =
$tree->getChildsByType($parent_id,
"pg");
441 if (count($childs) != 0) {
442 $_GET[
"target"] = $childs[count($childs) - 1][
"obj_id"];
445 if (empty(
$_GET[
"target"])) {
476 if (!
$ilUser->clipboardHasObjectsOfType(
"pg")) {
477 $ilErr->raiseError($this->lng->txt(
"no_page_in_clipboard"),
$ilErr->MESSAGE);
517 if (is_array(
$_POST[
"id"])) {
518 $act_items = array();
520 foreach (
$_POST[
"id"] as $id) {
521 $path = $this->tree->getPathId($id);
523 foreach ($path as $path_id) {
524 if ($path_id != $id && in_array($path_id,
$_POST[
"id"])) {
534 foreach ($act_items as $id) {
535 $childs = $this->tree->getChilds($id);
536 foreach ($childs as $child) {
540 $this->content_object->getType()
544 $this->content_object->getType(),
552 $this->content_object->getType()
556 $this->content_object->getType(),
565 $this->ctrl->redirect($this,
"view");
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) {
590 if (
$_GET[
"new_type"] ==
"pg") {
591 $this->ctrl->redirect($this,
"view");
593 $this->ctrl->redirect($this,
"subchap");
610 "cont_pages_and_subchapters",
611 $this->ctrl->getLinkTarget($this,
'showHierarchy'),
612 array(
"view",
"showHierarchy"),
619 $this->ctrl->getLinkTarget($this,
'listConditions'),
625 $mdgui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
626 $mdtab = $mdgui->getTab();
637 $this->tpl->setTitle(
638 $this->lng->txt($this->obj->getType()) .
": " . $this->obj->getTitle()
642 $ilTabs->addNonTabbedLink(
644 $lng->txt(
"cont_presentation_view"),
645 ILIAS_HTTP_PATH .
"/goto.php?target=st_" . $this->obj->getId(),
655 public static function _goto($a_target, $a_target_ref_id =
"")
659 $rbacsystem =
$DIC->rbac()->system();
662 $ilAccess =
$DIC->access();
671 if (in_array($a_target_ref_id, $ref_ids)) {
672 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
676 foreach ($ref_ids as $ref_id) {
678 if ($ilAccess->checkAccess(
"read",
"", $ref_id)) {
681 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
682 $_GET[
"obj_id"] = $a_target;
683 $_GET[
"ref_id"] = $ref_id;
684 include_once(
"ilias.php");
692 $lng->txt(
"msg_no_perm_read_item"),
715 $parent_id = $node_id;
718 $ilCtrl->redirect($this,
"showHierarchy");
723 $parent_id = $this->tree->getParentId($node_id);
726 $parent_id = $node_id;
730 for (
$i = 1;
$i <= $num;
$i++) {
732 $chap->setType(
"st");
733 $chap->setTitle(
$lng->txt(
"cont_new_chap"));
734 $chap->setLMId($this->content_object->getId());
739 $ilCtrl->redirect($this,
"view");
761 $ilLog->write(
"Insert Chapter From Clipboard");
769 $parent_id = $node_id;
772 $ilCtrl->redirect($this,
"showHierarchy");
777 $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) {
786 $target = $childs[count($childs) - 1][
"obj_id"];
792 $chapters =
$ilUser->getClipboardObjects(
"st",
true);
793 $copied_nodes = array();
795 foreach ($chapters as $chap) {
796 $ilLog->write(
"Call pasteTree, Target LM: " . $this->content_object->getId() .
", Chapter ID: " . $chap[
"id"]
797 .
", Parent ID: " . $parent_id .
", Target: " . $target);
799 $this->content_object,
803 $chap[
"insert_time"],
812 $ilUser->clipboardDeleteObjectsOfType(
"pg");
813 $ilUser->clipboardDeleteObjectsOfType(
"st");
817 $this->content_object->checkTree();
818 $ilCtrl->redirect($this, $a_return);
842 $parent_id = $this->tree->getParentId($node_id);
845 $parent_id = $node_id;
849 for (
$i = 1;
$i <= $num;
$i++) {
851 $page->setType(
"pg");
852 $page->setTitle(
$lng->txt(
"cont_new_page"));
853 $page->setLMId($this->content_object->getId());
858 $ilCtrl->redirect($this,
"showHierarchy");
873 $parent_id = $this->tree->getParentId($node_id);
876 $parent_id = $node_id;
881 $pages =
$ilUser->getClipboardObjects(
"pg");
882 $copied_nodes = array();
883 foreach ($pages as $pg) {
885 $this->content_object,
898 $ilUser->clipboardDeleteObjectsOfType(
"pg");
899 $ilUser->clipboardDeleteObjectsOfType(
"st");
903 $ilCtrl->redirect($this,
"view");
915 $this->content_object->executeDragDrop(
916 $_POST[
"il_hform_source_id"],
917 $_POST[
"il_hform_target_id"],
919 $_POST[
"il_hform_as_subitem"]
921 $ilCtrl->redirect($this,
"showHierarchy");
937 if (!is_array(
$_POST[
"id"])) {
939 $ilCtrl->redirect($this,
"showHierarchy");
944 $tpl->setContent($this->form->getHTML());
957 if (is_array(
$_POST[
"id"])) {
958 foreach (
$_POST[
"id"] as $id) {
961 $this->form->addItem($hi);
965 $lng->txt(
"cont_layout"),
967 $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 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
996 $ilCtrl->redirect($this,
"showHierarchy");
1009 $ilCtrl->setParameter($this,
"transl",
"");
1010 $ilCtrl->redirect($this,
"showHierarchy");
1023 $ilCtrl->setParameter($this,
"transl",
$_GET[
"totransl"]);
1024 $ilCtrl->redirect($this,
"showHierarchy");
1038 $tabs->clearTargets();
1039 $tabs->setBackTarget(
$lng->txt(
"back"),
$ctrl->getLinkTarget($this,
"showHierarchy"));
1044 $ctrl->saveParameter($this,
"obj_id");
1057 $f =
$ui->factory();
1061 $fields[
"title"] =
$f->input()->field()->text(
$lng->txt(
"title"),
"");
1063 if (!is_null($ts)) {
1064 $fields[
"layout_id"] = $ts;
1068 $section1 =
$f->input()->field()->section($fields,
$lng->txt(
"cont_insert_pagelayout"));
1070 $form_action =
$ctrl->getLinkTarget($this,
"insertPageFromTemplate");
1071 return $f->input()->container()->form()->standard($form_action, [
"sec" => $section1]);
1084 $form = $form->withRequest(
$DIC->http()->request());
1085 $data = $form->getData();
1086 $layout_id =
$data[
"sec"][
"layout_id"];
1087 $node_id = $_REQUEST[
"node_id"];
1089 $this->content_object->getId(),
1090 (
int) $_REQUEST[
"multi"],
1092 $_REQUEST[
"first_child"],
1094 $data[
"sec"][
"title"]
1097 $ilCtrl->setParameter($this,
"highlight", $page_ids);
1098 $ilCtrl->redirect($this,
"showHierarchy",
"node_" . $node_id);
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
class ilConditionHandlerGUI
static setAction($a_action)
showActions($a_actions)
show possible action (form buttons)
checkTree()
check the content object tree
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static clipboardCut($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
static saveTitles($a_lm, $a_titles, $a_lang="-")
Save titles for lm objects.
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters)
static updateInternalLinks($a_copied_nodes, $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static writeLayout($a_obj_id, $a_layout, $a_lm=null)
Write layout setting.
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 getLayoutCssFix()
Get layout css fix (workaround for broken radio options)
static insertPagesFromTemplate($lm_id, $num, $node_id, $first_child, $layout_id, $title="")
Insert (multiple) pages templates at node.
static getMultiLangHeader($a_lm_id, $a_gui_class, $a_mode="")
Get multi lang header.
static getLayoutOption($a_txt, $a_var, $a_def_option="")
Get layout option.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _writeActive( $a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
Class ilStructureObjectGUI.
proceedDragDrop()
Perform drag and drop action.
initSetPageLayoutForm()
Init set page layout form.
add_cell($val, $link="")
output a cell in object list
copyItems($a_return="view")
Copy items to clipboard.
insertSubchapterClip()
Insert Chapter from clipboard.
insertPageFromTemplate()
Insert (multiple) pages templates at node.
initConditionHandlerInterface()
executeCommand()
execute command
create()
create new page or chapter in chapter
activatePages()
activates or deactivates pages
__construct(&$a_content_obj, &$a_tree)
Constructor @access public.
savePageLayout()
Save page layout.
initInsertTemplateForm()
Init insert template form.
editMasterLanguage()
Edit master language.
saveAllTitles()
Save all titles of chapters/pages.
putInTree()
put chapter into tree
insertChapterClip($a_as_sub=false, $a_return="view")
Insert Chapter from clipboard.
cancel()
cancel creation of new page or chapter
insertPage()
Insert (multiple) pages at node.
insertSubchapter()
Insert (multiple) subchapters at node.
copyChapter()
copy a single chapter (selection)
showHierarchy()
Show subhiearchy of pages and subchapters.
insertTemplate()
Displays GUI to select template for page.
static _goto($a_target, $a_target_ref_id="")
redirect script
switchToLanguage()
Switch to language.
cutChapter()
Cut chapter(s)
insertChapter($a_as_sub=false)
Insert (multiple) chapters at node.
insertPageClip()
Insert pages from clipboard.
pasteChapter()
paste chapter
cutItems($a_return="view")
Copy items to clipboard, then cut them from the current tree.
setPageLayout()
Set layout for multipl pages.
setStructureObject(&$a_st_object)
set structure object
getType()
this function is called by condition handler gui interface
static _getPresentationTitle( $a_st_id, $a_mode=self::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
special template class to simplify handling of ITX/PEAR
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc