42         $this->
user = $DIC->user();
    43         $this->
ctrl = $DIC->ctrl();
    44         $this->
lng = $DIC->language();
    45         $this->
tabs = $DIC->tabs();
    46         $this->log = $DIC[
"ilLog"];
    47         $this->tpl = $DIC->ui()->mainTemplate();
    49         $this->tree = $a_tree;
    55         $this->obj = $a_st_object;
    65         $next_class = $this->
ctrl->getNextClass($this);
    66         $cmd = $this->
ctrl->getCmd();
    68         switch ($next_class) {
    69             case 'ilobjectmetadatagui':
    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":
    84                 $this->
ctrl->forwardCommand($this->condHI);
    85                 $ilTabs->setTabActive(
'preconditions');
    89                 if ($cmd == 
'listConditions') {
    92                     $this->condHI->executeCommand();
    93                 } elseif (($cmd == 
"create") && ($this->requested_new_type == 
"pg")) {
    96                     $pg_gui->executeCommand();
   106         if ($this->requested_obj_id != 0) {
   129         $ilCtrl->setParameter($this, 
"backcmd", 
"showHierarchy");
   133         $form_gui->setTitle($this->obj->getTitle());
   135         $form_gui->setTree($this->tree);
   136         $form_gui->setCurrentTopNodeId($this->obj->getId());
   137         $form_gui->addMultiCommand(
$lng->
txt(
"delete"), 
"delete");
   138         $form_gui->addMultiCommand(
$lng->
txt(
"cut"), 
"cutItems");
   139         $form_gui->addMultiCommand(
$lng->
txt(
"copy"), 
"copyItems");
   140         $form_gui->addMultiCommand(
$lng->
txt(
"cont_de_activate"), 
"activatePages");
   141         if ($this->content_object->getLayoutPerPage()) {
   142             $form_gui->addMultiCommand(
$lng->
txt(
"cont_set_layout"), 
"setPageLayout");
   145         $form_gui->addCommand(
$lng->
txt(
"cont_save_all_titles"), 
"saveAllTitles");
   146         $form_gui->addHelpItem(
$lng->
txt(
"cont_chapters_after_pages"));
   147         $up_gui = 
"ilobjlearningmodulegui";
   148         $ilCtrl->setParameterByClass($up_gui, 
"active_node", $this->obj->getId());
   149         $ilCtrl->setParameterByClass($up_gui, 
"active_node", null);
   151         $ctpl = 
new ilTemplate(
"tpl.chap_and_pages.html", 
true, 
true, 
"Modules/LearningModule");
   152         $ctpl->setVariable(
"HIERARCHY_FORM", $form_gui->getHTML());
   153         $ilCtrl->setParameter($this, 
"obj_id", $this->requested_obj_id);
   156         $this->tpl->setContent($ml_head . $ctpl->get());
   157         $this->tpl->addOnloadCode(
"window.setTimeout(() => { il.repository.core.trigger('il-lm-editor-tree'); }, 500);");
   164         string $a_return = 
"view"   169         $items = $this->request->getIds();
   170         if (count($items) == 0) {
   171             $this->tpl->setOnScreenMessage(
'failure', 
$lng->
txt(
"no_checkbox"), 
true);
   172             $ilCtrl->redirect($this, 
"showHierarchy");
   176         foreach ($items as $k => $item) {
   181         foreach ($todel as $k) {
   186             $this->tpl->setOnScreenMessage(
'failure', 
$lng->
txt(
"cont_choose_pages_or_chapters_only"), 
true);
   187             $ilCtrl->redirect($this, 
"showHierarchy");
   192         $this->tpl->setOnScreenMessage(
'info', 
$lng->
txt(
"cont_selected_items_have_been_cut"), 
true);
   194         $ilCtrl->redirect($this, $a_return);
   201         string $a_return = 
"view"   206         $items = $this->request->getIds();
   207         if (count($items) == 0) {
   208             $this->tpl->setOnScreenMessage(
'failure', 
$lng->
txt(
"no_checkbox"), 
true);
   209             $ilCtrl->redirect($this, 
"showHierarchy");
   213         foreach ($items as $k => $item) {
   218         foreach ($todel as $k) {
   223             $this->tpl->setOnScreenMessage(
'failure', 
$lng->
txt(
"cont_choose_pages_or_chapters_only"), 
true);
   224             $ilCtrl->redirect($this, 
"showHierarchy");
   230         $this->tpl->setOnScreenMessage(
'info', 
$lng->
txt(
"cont_selected_items_have_been_copied"), 
true);
   231         $ilCtrl->redirect($this, $a_return);
   241         $titles = $this->request->getTitles();
   244         $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"lm_save_titles"), 
true);
   245         $ilCtrl->redirect($this, 
"showHierarchy");
   258         $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.structure_edit.html", 
"Modules/LearningModule");
   261         $this->tpl->setCurrentBlock(
"form");
   262         $this->
ctrl->setParameter($this, 
"backcmd", 
"subchap");
   263         $this->tpl->setVariable(
"FORMACTION", $this->
ctrl->getFormAction($this));
   264         $this->tpl->setVariable(
"HEADER_TEXT", $this->
lng->txt(
"cont_subchapters"));
   268         $childs = $this->tree->getChilds($this->obj->getId());
   269         foreach ($childs as $child) {
   270             if ($child[
"type"] != 
"st") {
   273             $this->tpl->setCurrentBlock(
"table_row");
   276             $this->tpl->setVariable(
"CHECKBOX_ID", $child[
"obj_id"]);
   280             $this->
ctrl->setParameterByClass(
"ilStructureObjectGUI", 
"obj_id", $child[
"obj_id"]);
   281             $link = $this->
ctrl->getLinkTargetByClass(
"ilStructureObjectGUI", 
"view");
   282             $this->tpl->setVariable(
"LINK_TARGET", $link);
   285             $this->tpl->setVariable(
   290                     $this->content_object->isActiveNumbering()
   294             $this->tpl->parseCurrentBlock();
   299             $this->tpl->setCurrentBlock(
"notfound");
   300             $this->tpl->setVariable(
"NUM_COLS", 3);
   301             $this->tpl->setVariable(
"TXT_OBJECT_NOT_FOUND", $this->
lng->txt(
"obj_not_found"));
   302             $this->tpl->parseCurrentBlock();
   307         $this->tpl->setVariable(
"NUM_COLS", 3);
   308         $acts = array(
"delete" => 
"delete", 
"cutChapter" => 
"cut",
   309                 "copyChapter" => 
"copyChapter");
   310         if ($ilUser->clipboardHasObjectsOfType(
"st")) {
   311             $acts[
"pasteChapter"] = 
"pasteChapter";
   317         $this->tpl->setVariable(
"NUM_COLS", 3);
   318         $subobj = array(
"st");
   320         $this->tpl->setCurrentBlock(
"add_object");
   321         $this->tpl->setVariable(
"SELECT_OBJTYPE", $opts);
   322         $this->tpl->setVariable(
"BTN_NAME", 
"create");
   323         $this->tpl->setVariable(
"TXT_ADD", $this->
lng->txt(
"insert"));
   324         $this->tpl->parseCurrentBlock();
   326         $this->tpl->setCurrentBlock(
"form");
   327         $this->tpl->parseCurrentBlock();
   329         $ilCtrl->setParameter($this, 
"obj_id", $this->requested_obj_id);
   338             $this->obj->setType(
"st");
   339             $this->obj->setTitle($form->
getInput(
"title"));
   340             $this->obj->setDescription($form->
getInput(
"desc"));
   341             $this->obj->setLMId($this->content_object->getId());
   342             $this->obj->create();
   350         if ($this->requested_obj_id > 0) {
   351             $this->
ctrl->redirect($this, 
"subchap");
   367             $tree = 
new ilTree($this->content_object->getId());
   372             $parent_id = ($this->requested_obj_id > 0)
   373                 ? $this->requested_obj_id
   377             if (count($childs) != 0) {
   378                 $target = $childs[count($childs) - 1][
"obj_id"];
   385         parent::putInTree($target);
   402         if (!$ilUser->clipboardHasObjectsOfType(
"pg")) {
   431         $ids = $this->request->getIds();
   432         if (count($ids) > 0) {
   433             $act_items = array();
   435             foreach ($ids as 
$id) {
   436                 $path = $this->tree->getPathId($id);
   438                 foreach (
$path as $path_id) {
   439                     if ($path_id != $id && in_array($path_id, $ids)) {
   449             foreach ($act_items as $id) {
   450                 $childs = $this->tree->getChilds($id);
   451                 foreach ($childs as $child) {
   455                             $this->content_object->getType()
   459                             $this->content_object->getType(),
   467                         $this->content_object->getType()
   471                         $this->content_object->getType(),
   477             $this->tpl->setOnScreenMessage(
'failure', 
$lng->
txt(
"no_checkbox"), 
true);
   480         $this->
ctrl->redirect($this, 
"view");
   486         $this->condHI->setBackButtons(array());
   487         $this->condHI->setAutomaticValidation(
false);
   488         $this->condHI->setTargetType(
"st");
   489         $this->condHI->setTargetRefId($this->content_object->getRefId());
   490         $this->condHI->setTargetId($this->obj->getId());
   491         $this->condHI->setTargetTitle($this->obj->getTitle());
   500         if ($this->requested_obj_id != 0) {
   501             if ($this->requested_new_type == 
"pg") {
   502                 $this->
ctrl->redirect($this, 
"view");
   504                 $this->
ctrl->redirect($this, 
"subchap");
   516             "cont_pages_and_subchapters",
   517             $this->
ctrl->getLinkTarget($this, 
'showHierarchy'),
   518             array(
"view", 
"showHierarchy"),
   525             $this->
ctrl->getLinkTarget($this, 
'listConditions'),
   531         $mdgui = 
new ilObjectMetaDataGUI($this->content_object, $this->obj->getType(), $this->obj->getId());
   532         $mdtab = $mdgui->
getTab();
   543         $this->tpl->setTitle(
   544             $this->
lng->txt($this->obj->getType()) . 
": " . $this->obj->getTitle()
   548         $ilTabs->addNonTabbedLink(
   550             $lng->
txt(
"cont_presentation_view"),
   551             ILIAS_HTTP_PATH . 
"/goto.php?target=st_" . $this->obj->getId(),
   561         int $a_target_ref_id = 0
   564         $main_tpl = $DIC->ui()->mainTemplate();
   566         $lng = $DIC->language();
   567         $ilAccess = $DIC->access();
   568         $ctrl = $DIC->ctrl();
   577         if (in_array($a_target_ref_id, $ref_ids)) {
   578             $ref_ids = array_merge(array($a_target_ref_id), $ref_ids);
   582         foreach ($ref_ids as 
$ref_id) {
   584             if ($ilAccess->checkAccess(
"read", 
"", $ref_id)) {
   592             $main_tpl->setOnScreenMessage(
'failure', sprintf(
   593                 $lng->
txt(
"msg_no_perm_read_item"),
   606         bool $a_as_sub = 
false   616                 $parent_id = $node_id;
   619                 $ilCtrl->redirect($this, 
"showHierarchy");
   624                 $parent_id = $this->tree->getParentId($node_id);
   627                 $parent_id = $node_id;
   631         for ($i = 1; $i <= $num; $i++) {
   633             $chap->setType(
"st");
   634             $chap->setTitle(
$lng->
txt(
"cont_new_chap"));
   635             $chap->setLMId($this->content_object->getId());
   640         $ilCtrl->redirect($this, 
"view");
   655         bool $a_as_sub = 
false,
   656         string $a_return = 
"view"   662         $ilLog->
write(
"Insert Chapter From Clipboard");
   670                 $parent_id = $node_id;
   673                 $ilCtrl->redirect($this, 
"showHierarchy");
   678                 $parent_id = $this->tree->getParentId($node_id);
   681                 $parent_id = $node_id;
   685                 $childs = $this->tree->getChildsByType($parent_id, 
"pg");
   686                 if (count($childs) != 0) {
   687                     $target = $childs[count($childs) - 1][
"obj_id"];
   693         $chapters = $ilUser->getClipboardObjects(
"st", 
true);
   694         $copied_nodes = array();
   696         foreach ($chapters as $chap) {
   697             $ilLog->write(
"Call pasteTree, Target LM: " . $this->content_object->getId() . 
", Chapter ID: " . $chap[
"id"]
   698                 . 
", Parent ID: " . $parent_id . 
", Target: " . $target);
   699             $cid = ilLMObject::pasteTree(
   700                 $this->content_object,
   704                 (
string) ($chap[
"insert_time"] ?? 
""),
   713             $ilUser->clipboardDeleteObjectsOfType(
"pg");
   714             $ilUser->clipboardDeleteObjectsOfType(
"st");
   718         $this->content_object->checkTree();
   719         $ilCtrl->redirect($this, $a_return);
   736             $parent_id = $this->tree->getParentId($node_id);
   739             $parent_id = $node_id;
   743         for ($i = 1; $i <= $num; $i++) {
   745             $page->setType(
"pg");
   746             $page->setTitle(
$lng->
txt(
"cont_new_page"));
   747             $page->setLMId($this->content_object->getId());
   753             $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"lm_page_added"), 
true);
   755             $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"lm_pages_added"), 
true);
   758         $ilCtrl->redirect($this, 
"showHierarchy");
   770             $parent_id = $this->tree->getParentId($node_id);
   773             $parent_id = $node_id;
   778         $pages = $ilUser->getClipboardObjects(
"pg");
   779         $copied_nodes = array();
   780         foreach ($pages as $pg) {
   781             $cid = ilLMObject::pasteTree(
   782                 $this->content_object,
   786                 (
string) ($pg[
"insert_time"] ?? 
""),
   795             $ilUser->clipboardDeleteObjectsOfType(
"pg");
   796             $ilUser->clipboardDeleteObjectsOfType(
"st");
   800         $ilCtrl->redirect($this, 
"view");
   808         $this->content_object->executeDragDrop(
   809             $req->getHFormPar(
"source_id"),
   810             $req->getHFormPar(
"target_id"),
   811             $req->getHFormPar(
"fc"),
   812             $req->getHFormPar(
"as_subitem")
   814         $ilCtrl->redirect($this, 
"showHierarchy");
   830         $ids = $this->request->getIds();
   831         if (count($ids) == 0) {
   832             $this->tpl->setOnScreenMessage(
'failure', 
$lng->
txt(
"no_checkbox"), 
true);
   833             $ilCtrl->redirect($this, 
"showHierarchy");
   851         $ids = $this->request->getIds();
   852         foreach ($ids as 
$id) {
   855             $this->
form->addItem($hi);
   860             $this->content_object->getLayout()
   863         $this->
form->addItem($layout);
   865         $this->
form->addCommandButton(
"savePageLayout", 
$lng->
txt(
"save"));
   866         $this->
form->addCommandButton(
"showHierarchy", 
$lng->
txt(
"cancel"));
   868         $this->
form->setTitle(
$lng->
txt(
"cont_set_layout"));
   869         $this->
form->setFormAction($ilCtrl->getFormAction($this));
   880         $ids = $this->request->getIds();
   881         $layout = $this->request->getLayout();
   882         foreach ($ids as 
$id) {
   886                 $this->content_object
   889         $this->tpl->setOnScreenMessage(
'success', 
$lng->
txt(
"msg_obj_modified"), 
true);
   890         $ilCtrl->redirect($this, 
"showHierarchy");
   898         $ilCtrl->redirect($this, 
"showHierarchy");
   905         $ilCtrl->
setParameter($this, 
"transl", $this->requested_totransl);
   906         $ilCtrl->redirect($this, 
"showHierarchy");
   938         $fields[
"title"] = 
$f->input()->field()->text(
$lng->
txt(
"title"), 
"");
   941             $fields[
"layout_id"] = $ts;
   945         $section1 = 
$f->input()->field()->section($fields, 
$lng->
txt(
"cont_insert_pagelayout"));
   948         return $f->input()->container()->form()->standard($form_action, [
"sec" => $section1]);
   961         $form = $form->withRequest($DIC->http()->request());
   962         $data = $form->getData();
   963         $layout_id = 
$data[
"sec"][
"layout_id"];
   964         $node_id = $this->request->getNodeId();
   966             $this->content_object->getId(),
   967             $this->request->getMulti(),
   969             $this->request->getFirstChild(),
   971             $data[
"sec"][
"title"]
   974         if ($this->request->getMulti() <= 1) {
   975             $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"lm_page_added"), 
true);
   977             $this->tpl->setOnScreenMessage(
"success", $this->
lng->txt(
"lm_pages_added"), 
true);
   981         $ilCtrl->redirect($this, 
"showHierarchy", 
"node_" . $node_id);
 
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied. 
 
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status 
 
static setAction(string $a_action)
 
EditingGUIRequest $request
 
static _getPresentationTitle(int $a_st_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
 
saveAllTitles()
Save all titles of chapters/pages. 
 
initConditionHandlerInterface()
 
class ilConditionHandlerGUI 
 
static getLayoutOption(string $a_txt, string $a_var, string $a_def_option="")
 
insertChapter(bool $a_as_sub=false)
Insert (multiple) chapters at node. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
 
initSetPageLayoutForm()
Init set page layout form. 
 
ilGlobalTemplateInterface $tpl
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
static saveTitles(ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
Save titles for lm objects. 
 
write(string $message, $level=ilLogLevel::INFO, array $context=[])
write log message 
 
checkTree()
check the content object tree 
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory) 
 
static uniqueTypesCheck(array $a_items)
Check for unique types (all pages or all chapters) 
 
static _goto(string $a_target, int $a_target_ref_id=0)
 
User Interface for Structure Objects Editing. 
 
setTreeTablePK(string $a_column_name)
set column containing primary key in tree table 
 
setParameterByClass(string $a_class, string $a_parameter, $a_value)
 
insertSubchapter()
Insert (multiple) subchapters at node. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static getLayoutCssFix()
Get layout css fix (workaround for broken radio options) 
 
static clipboardCut(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard. 
 
cancel()
cancel creation of new page or chapter 
 
Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD) 
 
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree 
 
cutItems(string $a_return="view")
Copy items to clipboard, then cut them from the current tree. 
 
setStructureObject(ilStructureObject $a_st_object)
 
setPageLayout()
Set layout for multipl pages. 
 
catch(\Exception $e) $req
 
__construct(ilObjLearningModule $a_content_obj, ilLMTree $a_tree)
 
getChildsByType(int $a_node_id, string $a_type)
get child nodes of given node by object type 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setTableNames(string $a_table_tree, string $a_table_obj_data, string $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
 
ilConditionHandlerGUI $condHI
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _lookupTitle(int $obj_id)
 
setContent(string $a_html)
Sets content for standard template. 
 
insertPageFromTemplate()
Insert (multiple) pages templates at node. 
 
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting. 
 
static insertPagesFromTemplate(int $lm_id, int $num, int $node_id, bool $first_child, int $layout_id, string $title="")
Insert (multiple) pages templates at node. 
 
setBackTarget(string $a_title, string $a_target, string $a_frame="")
 
clearTargets()
clear all targets 
 
putInTree(?int $target=null)
put chapter into tree 
 
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status 
 
static getMultiLangHeader(int $a_lm_id, object $a_gui_class, string $a_mode="")
 
copyChapter()
copy a single chapter (selection) 
 
User Interface for Learning Module Page Objects Editing. 
 
savePageLayout()
Save page layout. 
 
form( $class_path, string $cmd, string $submit_caption="")
 
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
saveParameter(object $a_gui_obj, $a_parameter)
 
static _lookupType(int $a_obj_id, int $a_lm_id=0)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
subchap()
display subchapters of structure object 
 
static _lookupContObjID(int $a_id)
get learning module id for lm object 
 
showActions(array $a_actions)
show possible action (form buttons) 
 
copyItems(string $a_return="view")
Copy items to clipboard. 
 
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
 
insertTemplate()
Displays GUI to select template for page. 
 
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root. 
 
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard. 
 
insertChapterClip(bool $a_as_sub=false, string $a_return="view")
Insert Chapter from clipboard.