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());
207 if (!is_array($items)) {
209 $ilCtrl->redirect($this,
"showHierarchy");
213 foreach ($items as $k => $item) {
218 foreach ($todel as $k) {
224 $ilCtrl->redirect($this,
"showHierarchy");
232 $ilCtrl->redirect($this, $a_return);
244 if (!is_array($items)) {
246 $ilCtrl->redirect($this,
"showHierarchy");
250 foreach ($items as $k => $item) {
255 foreach ($todel as $k) {
261 $ilCtrl->redirect($this,
"showHierarchy");
268 $ilCtrl->redirect($this, $a_return);
280 ilUtil::sendSuccess($this->lng->txt(
"lm_save_titles"),
true);
281 $ilCtrl->redirect($this,
"showHierarchy");
296 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.structure_edit.html",
"Modules/LearningModule");
299 $this->tpl->setCurrentBlock(
"form");
300 $this->ctrl->setParameter($this,
"backcmd",
"subchap");
301 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
302 $this->tpl->setVariable(
"HEADER_TEXT", $this->lng->txt(
"cont_subchapters"));
306 $childs = $this->tree->getChilds($this->obj->getId());
307 foreach ($childs as $child) {
308 if ($child[
"type"] !=
"st") {
311 $this->tpl->setCurrentBlock(
"table_row");
316 $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
317 $this->tpl->setVariable(
"CSS_ROW", $css_row);
321 $this->ctrl->setParameterByClass(
"ilStructureObjectGUI",
"obj_id", $child[
"obj_id"]);
322 $link = $this->ctrl->getLinkTargetByClass(
"ilStructureObjectGUI",
"view");
323 $this->tpl->setVariable(
"LINK_TARGET", $link);
326 $this->tpl->setVariable(
331 $this->content_object->isActiveNumbering()
335 $this->tpl->parseCurrentBlock();
338 $this->tpl->setCurrentBlock(
"notfound");
339 $this->tpl->setVariable(
"NUM_COLS", 3);
340 $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->lng->txt(
"obj_not_found"));
341 $this->tpl->parseCurrentBlock();
346 $this->tpl->setVariable(
"NUM_COLS", 3);
347 $acts = array(
"delete" =>
"delete",
"cutChapter" =>
"cut",
348 "copyChapter" =>
"copyChapter");
349 if (
$ilUser->clipboardHasObjectsOfType(
"st")) {
350 $acts[
"pasteChapter"] =
"pasteChapter";
356 $this->tpl->setVariable(
"NUM_COLS", 3);
358 $subobj = array(
"st");
361 $this->tpl->setCurrentBlock(
"add_object");
362 $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
364 $this->tpl->setVariable(
"BTN_NAME",
"create");
365 $this->tpl->setVariable(
"TXT_ADD", $this->lng->txt(
"insert"));
366 $this->tpl->parseCurrentBlock();
371 $this->tpl->setCurrentBlock(
"form");
372 $this->tpl->parseCurrentBlock();
374 $ilCtrl->setParameter($this,
"obj_id",
$_GET[
"obj_id"]);
383 $this->tpl->setCurrentBlock(
"begin_link");
384 $this->tpl->setVariable(
"LINK_TARGET", $link);
385 $this->tpl->parseCurrentBlock();
386 $this->tpl->touchBlock(
"end_link");
389 $this->tpl->setCurrentBlock(
"text");
390 $this->tpl->setVariable(
"TEXT_CONTENT", $val);
391 $this->tpl->parseCurrentBlock();
392 $this->tpl->setCurrentBlock(
"table_cell");
393 $this->tpl->parseCurrentBlock();
404 $this->obj->setType(
"st");
407 $this->obj->setLMId($this->content_object->getId());
408 $this->obj->create();
415 if (!empty(
$_GET[
"obj_id"])) {
416 $this->ctrl->redirect($this,
"subchap");
430 $tree =
new ilTree($this->content_object->getId());
431 $tree->setTableNames(
'lm_tree',
'lm_data');
432 $tree->setTreeTablePK(
"lm_id");
435 $parent_id = (!empty(
$_GET[
"obj_id"]))
437 :
$tree->getRootId();
439 $childs =
$tree->getChildsByType($parent_id,
"pg");
440 if (count($childs) != 0) {
441 $_GET[
"target"] = $childs[count($childs) - 1][
"obj_id"];
444 if (empty(
$_GET[
"target"])) {
475 if (!
$ilUser->clipboardHasObjectsOfType(
"pg")) {
476 $ilErr->raiseError($this->lng->txt(
"no_page_in_clipboard"),
$ilErr->MESSAGE);
516 if (is_array(
$_POST[
"id"])) {
517 $act_items = array();
519 foreach (
$_POST[
"id"] as $id) {
520 $path = $this->tree->getPathId($id);
522 foreach ($path as $path_id) {
523 if ($path_id != $id && in_array($path_id,
$_POST[
"id"])) {
533 foreach ($act_items as $id) {
534 $childs = $this->tree->getChilds($id);
535 foreach ($childs as $child) {
539 $this->content_object->getType()
543 $this->content_object->getType(),
551 $this->content_object->getType()
555 $this->content_object->getType(),
564 $this->ctrl->redirect($this,
"view");
574 $this->condHI->setBackButtons(array());
575 $this->condHI->setAutomaticValidation(
false);
576 $this->condHI->setTargetType(
"st");
577 $this->condHI->setTargetRefId($this->content_object->getRefId());
578 $this->condHI->setTargetId($this->obj->getId());
579 $this->condHI->setTargetTitle($this->obj->getTitle());
588 if (
$_GET[
"obj_id"] != 0) {
589 if (
$_GET[
"new_type"] ==
"pg") {
590 $this->ctrl->redirect($this,
"view");
592 $this->ctrl->redirect($this,
"subchap");
609 "cont_pages_and_subchapters",
610 $this->ctrl->getLinkTarget($this,
'showHierarchy'),
611 array(
"view",
"showHierarchy"),
618 $this->ctrl->getLinkTarget($this,
'listConditions'),
624 $mdgui =
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
625 $mdtab = $mdgui->getTab();
636 $this->tpl->setTitle(
637 $this->lng->txt($this->obj->getType()) .
": " . $this->obj->getTitle()
641 $ilTabs->addNonTabbedLink(
643 $lng->txt(
"cont_presentation_view"),
654 public static function _goto($a_target, $a_target_ref_id =
"")
658 $rbacsystem =
$DIC->rbac()->system();
661 $ilAccess =
$DIC->access();
670 if (in_array($a_target_ref_id, $ref_ids)) {
671 $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
675 foreach ($ref_ids as $ref_id) {
677 if ($ilAccess->checkAccess(
"read",
"", $ref_id)) {
680 $_GET[
"baseClass"] =
"ilLMPresentationGUI";
681 $_GET[
"obj_id"] = $a_target;
682 $_GET[
"ref_id"] = $ref_id;
683 include_once(
"ilias.php");
689 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
691 $lng->txt(
"msg_no_perm_read_item"),
714 $parent_id = $node_id;
717 $ilCtrl->redirect($this,
"showHierarchy");
722 $parent_id = $this->tree->getParentId($node_id);
725 $parent_id = $node_id;
729 for (
$i = 1;
$i <= $num;
$i++) {
731 $chap->setType(
"st");
732 $chap->setTitle(
$lng->txt(
"cont_new_chap"));
733 $chap->setLMId($this->content_object->getId());
738 $ilCtrl->redirect($this,
"view");
760 $ilLog->write(
"Insert Chapter From Clipboard");
768 $parent_id = $node_id;
771 $ilCtrl->redirect($this,
"showHierarchy");
776 $parent_id = $this->tree->getParentId($node_id);
779 $parent_id = $node_id;
783 $childs = $this->tree->getChildsByType($parent_id,
"pg");
784 if (count($childs) != 0) {
785 $target = $childs[count($childs) - 1][
"obj_id"];
791 $chapters =
$ilUser->getClipboardObjects(
"st",
true);
792 $copied_nodes = array();
794 foreach ($chapters as $chap) {
795 $ilLog->write(
"Call pasteTree, Target LM: " . $this->content_object->getId() .
", Chapter ID: " . $chap[
"id"]
796 .
", Parent ID: " . $parent_id .
", Target: " . $target);
798 $this->content_object,
802 $chap[
"insert_time"],
811 $ilUser->clipboardDeleteObjectsOfType(
"pg");
812 $ilUser->clipboardDeleteObjectsOfType(
"st");
816 $this->content_object->checkTree();
817 $ilCtrl->redirect($this, $a_return);
841 $parent_id = $this->tree->getParentId($node_id);
844 $parent_id = $node_id;
848 for (
$i = 1;
$i <= $num;
$i++) {
850 $page->setType(
"pg");
851 $page->setTitle(
$lng->txt(
"cont_new_page"));
852 $page->setLMId($this->content_object->getId());
857 $ilCtrl->redirect($this,
"showHierarchy");
872 $parent_id = $this->tree->getParentId($node_id);
875 $parent_id = $node_id;
880 $pages =
$ilUser->getClipboardObjects(
"pg");
881 $copied_nodes = array();
882 foreach ($pages as $pg) {
884 $this->content_object,
897 $ilUser->clipboardDeleteObjectsOfType(
"pg");
898 $ilUser->clipboardDeleteObjectsOfType(
"st");
902 $ilCtrl->redirect($this,
"view");
914 $this->content_object->executeDragDrop(
915 $_POST[
"il_hform_source_id"],
916 $_POST[
"il_hform_target_id"],
918 $_POST[
"il_hform_as_subitem"]
920 $ilCtrl->redirect($this,
"showHierarchy");
936 if (!is_array(
$_POST[
"id"])) {
938 $ilCtrl->redirect($this,
"showHierarchy");
943 $tpl->setContent($this->form->getHTML());
956 if (is_array(
$_POST[
"id"])) {
957 foreach (
$_POST[
"id"] as $id) {
960 $this->form->addItem($hi);
964 $lng->txt(
"cont_layout"),
966 $this->content_object->getLayout()
969 $this->form->addItem($layout);
971 $this->form->addCommandButton(
"savePageLayout",
$lng->txt(
"save"));
972 $this->form->addCommandButton(
"showHierarchy",
$lng->txt(
"cancel"));
974 $this->form->setTitle(
$lng->txt(
"cont_set_layout"));
975 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
986 foreach (
$_POST[
"id"] as $id) {
991 $this->content_object
994 ilUtil::sendSuccess(
$lng->txt(
"msg_obj_modified"),
true);
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");
1037 $tabs->clearTargets();
1038 $tabs->setBackTarget(
$lng->txt(
"back"),
$ctrl->getLinkTarget($this,
"showHierarchy"));
1043 $ctrl->saveParameter($this,
"obj_id");
1056 $f =
$ui->factory();
1060 $fields[
"title"] =
$f->input()->field()->text(
$lng->txt(
"title"),
"");
1062 if (!is_null($ts)) {
1063 $fields[
"layout_id"] = $ts;
1067 $section1 =
$f->input()->field()->section($fields,
$lng->txt(
"cont_insert_pagelayout"));
1069 $form_action =
$ctrl->getLinkTarget($this,
"insertPageFromTemplate");
1070 return $f->input()->container()->form()->standard($form_action, [
"sec" => $section1]);
1083 $form = $form->withRequest(
$DIC->http()->request());
1084 $data = $form->getData();
1085 $layout_id =
$data[
"sec"][
"layout_id"];
1086 $node_id = $_REQUEST[
"node_id"];
1088 $this->content_object->getId(),
1089 (
int) $_REQUEST[
"multi"],
1091 $_REQUEST[
"first_child"],
1093 $data[
"sec"][
"title"]
1096 $ilCtrl->setParameter($this,
"highlight", $page_ids);
1097 $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 _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
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