19 declare(strict_types=1);
    42         protected string $sub_type,
    44         protected string $table_title
    46         $this->sub_obj_id = $this->gui->editing()->request()->getObjId();
    47         $this->gui->ctrl()->saveParameterByClass(self::class, 
"sub_type");
    48         $this->lm_id = $lm->
getId();
    49         $this->lm_tree = $this->domain->lmTree($this->lm_id);
    50         $this->request = $this->gui->editing()->request();
    54         $this->lang = $this->request->getTranslation();
    55         $this->gui->initFetch();
    60         $ctrl = $this->gui->ctrl();
    61         $next_class = $ctrl->getNextClass($this);
    62         $cmd = $ctrl->getCmd(
"list");
    64         switch ($next_class) {
    67                     "list", 
"tableCommand", 
"editPages",
    68                     "insertChapterAfter", 
"insertChapterBefore", 
"insertFirstChapter",
    69                     "insertPageAfter", 
"insertPageBefore", 
"insertFirstPage",
    70                     "editTitle", 
"saveTitle", 
"saveOrder",
    71                     "confirmedDelete", 
"delete", 
"cancelDelete",
    72                     "insertPageClip", 
"insertPageClipBefore", 
"insertPageClipAfter",
    73                     "insertChapterClip", 
"insertChapterClipBefore", 
"insertChapterClipAfter",
    75                     "insertLayoutBefore", 
"insertLayoutAfter", 
"insertPageFromLayout",
    76                     "switchToLanguage", 
"editMasterLanguage"    85         $this->gui->ctrl()->setParameterByClass(self::class, 
"sub_type", 
"pg");
    86         $this->gui->ctrl()->redirectByClass(static::class, 
"list");
    91         return $this->gui->editing()->subObjectTableGUI(
   106         $ctrl = $this->gui->ctrl();
   107         $ctrl->setParameter($this, 
"transl", $this->request->getToTranslation());
   108         $ctrl->redirect($this, 
"list");
   113         $ctrl = $this->gui->ctrl();
   114         $ctrl->setParameter($this, 
"transl", 
"-");
   115         $ctrl->redirect($this, 
"list");
   119     protected function list(): void
   121         $lng = $this->domain->lng();
   122         $ctrl = $this->gui->ctrl();
   123         $main_tpl = $this->gui->mainTemplate();
   124         $user = $this->domain->user();
   126         $retrieval = $this->domain->subObjectRetrieval(
   135         if ($retrieval->count() === 0) {
   136             if ($this->sub_type === 
"st") {
   138                     $lng->txt(
"lm_insert_chapter"),
   139                     $ctrl->getLinkTargetByClass(self::class, 
"insertFirstChapter")
   141                 if ($user->clipboardHasObjectsOfType(
"st")) {
   143                         $lng->txt(
"lm_insert_chapter_clip"),
   144                         $ctrl->getLinkTargetByClass(self::class, 
"insertChapterClip")
   149                     $lng->txt(
"lm_insert_page"),
   150                     $ctrl->getLinkTargetByClass(self::class, 
"insertFirstPage")
   152                 if ($user->clipboardHasObjectsOfType(
"pg")) {
   154                         $lng->txt(
"lm_insert_page_clip"),
   155                         $ctrl->getLinkTargetByClass(self::class, 
"insertPageClip")
   162         $main_tpl->setContent($ml_head . $table->render());
   163         $main_tpl->addOnloadCode(
"window.setTimeout(() => { il.repository.core.trigger('il-lm-editor-tree'); }, 500);");
   169         $target_id = $this->request->getTargetId();
   171         foreach ($this->lm_tree->getChilds($parent) as $node) {
   172             if ((
int) $node[
"obj_id"] !== $target_id) {
   173                 $before_target = (
int) $node[
"obj_id"];
   186             $this->request->getTargetId()
   193         $user = $this->domain->user();
   194         $ctrl = $this->gui->ctrl();
   195         $parent_id = $this->request->getObjId();
   198         $chapters = $user->getClipboardObjects(
"st", 
true);
   199         $copied_nodes = array();
   201         foreach ($chapters as $chap) {
   202             $cid = ilLMObject::pasteTree(
   207                 (
string) ($chap[
"insert_time"] ?? 
""),
   216             $user->clipboardDeleteObjectsOfType(
"pg");
   217             $user->clipboardDeleteObjectsOfType(
"st");
   221         $this->lm->checkTree();
   222         $ctrl->redirect($this, 
"list");
   228         $target_id = $this->request->getTargetId();
   230         foreach ($this->lm_tree->getChildsByType($parent, 
"pg") as $node) {
   231             if ((
int) $node[
"obj_id"] !== $target_id) {
   232                 $before_target = (
int) $node[
"obj_id"];
   245             $this->request->getTargetId()
   252         $user = $this->domain->user();
   253         $ctrl = $this->gui->ctrl();
   255         $parent_id = $this->request->getObjId();
   258         $pages = $user->getClipboardObjects(
"pg");
   259         $copied_nodes = array();
   260         foreach ($pages as $pg) {
   261             $cid = ilLMObject::pasteTree(
   266                 (
string) ($pg[
"insert_time"] ?? 
""),
   275             $user->clipboardDeleteObjectsOfType(
"pg");
   276             $user->clipboardDeleteObjectsOfType(
"st");
   280         $ctrl->redirect($this, 
"list");
   291         $target_id = $this->request->getTargetId();
   301         $target_id = $this->request->getTargetId();
   303         foreach ($this->lm_tree->getChildsByType($parent, 
"pg") as $node) {
   304             if ((
int) $node[
"obj_id"] !== $target_id) {
   305                 $before_target = (
int) $node[
"obj_id"];
   320         $lng = $this->domain->lng();
   321         $ctrl = $this->gui->ctrl();
   323         $chap = new \ilLMPageObject($this->lm);
   324         $chap->setType(
"pg");
   325         $chap->setTitle(
$lng->txt(
"cont_new_page"));
   326         $chap->setLMId($this->lm_id);
   337         $ctrl->redirect($this, 
"list");
   348         $target_id = $this->request->getTargetId();
   359             $parent = $this->lm_tree->getRootId();
   361         $target_id = $this->request->getTargetId();
   363         foreach ($this->lm_tree->getChilds($parent) as $node) {
   364             if ((
int) $node[
"obj_id"] !== $target_id) {
   365                 $before_target = (
int) $node[
"obj_id"];
   380         $lng = $this->domain->lng();
   381         $ctrl = $this->gui->ctrl();
   382         $chap = new \ilStructureObject($this->lm);
   383         $chap->setType(
"st");
   384         $chap->setTitle(
$lng->txt(
"cont_new_chap"));
   385         $chap->setLMId($this->lm_id);
   396         $ctrl->redirect($this, 
"list");
   401         $lng = $this->domain->lng();
   402         $this->gui->ctrl()->setParameterByClass(self::class, 
"edit_id", $id);
   405         if ($ot->getContentActivated()) {
   406             $ml = 
" (".$lng->txt(
"meta_l_" .$ot->getMasterLanguage()) . 
")";
   411             ->form(self::class, 
"saveTitle")
   413         if ($ot->getContentActivated()) {
   414             foreach ($ot->getLanguages() as 
$lang) {
   415                 $code = $lang->getLanguageCode();
   416                 if ($code === $ot->getMasterLanguage()) {
   419                 $lmobjtrans = new \ilLMObjTranslation($id, $code);
   420                 $title = $lmobjtrans->getTitle();
   421                 $form = $form->text(
"title_" . $code, 
$lng->txt(
'title') . 
" (" . 
$lng->txt(
"meta_l_" . $code) . 
")",
   430         $this->gui->clearAsnyOnloadCode();
   437         $mt = $this->gui->mainTemplate();
   438         $lng = $this->domain->lng();
   440         if ($form->isValid()) {
   444             if ($ot->getContentActivated()) {
   445                 foreach ($ot->getLanguages() as 
$lang) {
   446                     $code = $lang->getLanguageCode();
   447                     if ($code === $ot->getMasterLanguage()) {
   454         $mt->setContent(
"success", 
$lng->txt(
"msg_obj_modified"), 
true);
   455         $this->gui->ctrl()->redirect($this, 
"list");
   460         $mt = $this->gui->mainTemplate();
   461         $lng = $this->domain->lng();
   462         $tree = $this->domain->lmTree($this->lm_id);
   464         $data = $table->getData();
   465         $parent = ($this->sub_obj_id > 0)
   467             : $tree->readRootId();
   468         if (!is_array(
$data)) {
   477         if ($this->sub_type === 
"pg") {
   478             foreach ($tree->getChilds($parent) as $child) {
   479                 if ($child[
"type"] == 
"st") {
   480                     $data[] = $child[
"child"];
   485             $tree->moveTree((
int) $id, $parent);
   487         $mt->setContent(
"success", 
$lng->txt(
"msg_obj_modified"), 
true);
   488         $this->gui->ctrl()->redirect($this, 
"list");
   497     public function delete(array $ids): 
void   500         $mt = $this->gui->mainTemplate();
   501         $lng = $this->domain->lng();
   502         $ctrl = $this->gui->ctrl();
   504         if (count($ids) == 0) {
   505             $mt->setOnScreenMessage(
'failure', 
$lng->txt(
"no_checkbox"), 
true);
   510             $mt->setOnScreenMessage(
'failure', 
$lng->txt(
"cont_select_item"), 
true);
   514         $form_action = $ctrl->getFormActionByClass(self::class);
   517         $cgui = new \ilConfirmationGUI();
   518         $cgui->setFormAction($form_action);
   519         $cgui->setHeaderText(
$lng->txt(
"info_delete_sure"));
   520         $cgui->setCancel(
$lng->txt(
"cancel"), 
"cancelDelete");
   521         $cgui->setConfirm(
$lng->txt(
"confirm"), 
"confirmedDelete");
   523         foreach ($ids as 
$id) {
   525                 $obj = new \ilLMObject($this->lm, $id);
   526                 $caption = $obj->getTitle();
   528                 $cgui->addItem(
"id[]", (
string) $id, $caption);
   532         $mt->setContent($cgui->getHTML());
   537         $this->gui->ctrl()->redirect($this, 
"list");
   549         $tree = $this->domain->lmTree($this->lm_id);
   550         $ids = $this->request->getIds();
   551         $mt = $this->gui->mainTemplate();
   552         $ctrl = $this->gui->ctrl();
   553         $lng = $this->domain->lng();
   556         if (count($ids) == 0) {
   557             $mt->setOnScreenMessage(
'failure', 
$lng->txt(
"no_checkbox"));
   558             $ctrl->redirect($this, 
"list");
   562         foreach ($ids as 
$id) {
   565                 $node_data = $tree->getNodeData($id);
   566                 if (is_object($obj)) {
   567                     $obj->setLMId($this->lm->getId());
   570                 if ($tree->isInTree($id)) {
   571                     $tree->deleteTree($node_data);
   577         $this->lm->checkTree();
   580         $mt->setOnScreenMessage(
'success', 
$lng->txt(
"info_deleted"), 
true);
   581         $ctrl->redirect($this, 
"list");
   589         $ctrl = $this->gui->ctrl();
   590         $mt = $this->gui->mainTemplate();
   591         $lng = $this->domain->lng();
   594         if (count($items) == 0) {
   595             $mt->setOnScreenMessage(
'failure', 
$lng->txt(
"no_checkbox"), 
true);
   596             $ctrl->redirect($this, 
"list");
   600         foreach ($items as $k => $item) {
   605         foreach ($todel as $k) {
   611         $mt->setOnScreenMessage(
'info', 
$lng->txt(
"cont_selected_items_have_been_cut"), 
true);
   613         $ctrl->redirect($this, 
"list");
   622         $ctrl = $this->gui->ctrl();
   623         $lng = $this->domain->lng();
   624         $mt = $this->gui->mainTemplate();
   627         if (count($items) == 0) {
   628             $mt->setOnScreenMessage(
'failure', 
$lng->txt(
"no_checkbox"), 
true);
   629             $ctrl->redirect($this, 
"list");
   633         foreach ($items as $k => $item) {
   638         foreach ($todel as $k) {
   645         $mt->setOnScreenMessage(
'info', 
$lng->txt(
"cont_selected_items_have_been_copied"), 
true);
   646         $ctrl->redirect($this, 
"list");
   651         $ctrl = $this->gui->ctrl();
   652         $mt = $this->gui->mainTemplate();
   653         $lng = $this->domain->lng();
   654         $lm_tree = $this->domain->lmTree($this->lm_id);
   657         if (count($ids) > 0) {
   658             $act_items = array();
   660             foreach ($ids as 
$id) {
   661                 $path = $lm_tree->getPathId($id);
   663                 foreach (
$path as $path_id) {
   664                     if ($path_id != $id && in_array($path_id, $ids)) {
   674             foreach ($act_items as $id) {
   675                 $childs = $lm_tree->getChilds($id);
   676                 foreach ($childs as $child) {
   684                             $this->lm->getType(),
   696                         $this->lm->getType(),
   702             $mt->setOnScreenMessage(
'failure', 
$lng->txt(
"no_checkbox"), 
true);
   705         $ctrl->redirect($this, 
"list");
   720         $ctrl = $this->gui->ctrl();
   721         $ui = $this->gui->ui();
   722         $mt = $this->gui->mainTemplate();
   724             $ctrl->setParameterByClass(self::class, 
"before", 
"1");
   726         $ctrl->saveParameterByClass(self::class, [
"obj_id", 
"target_id"]);
   733         $ui = $this->gui->ui();
   735         $ctrl = $this->gui->ctrl();
   736         $lng = $this->domain->lng();
   738         $fields[
"title"] = 
$f->input()->field()->text(
$lng->txt(
"title"), 
"");
   741             $fields[
"layout_id"] = $ts;
   745         $section1 = 
$f->input()->field()->section($fields, 
$lng->txt(
"cont_insert_pagelayout"));
   747         $form_action = $ctrl->getLinkTarget($this, 
"insertPageFromLayout");
   748         return $f->input()->container()->form()->standard($form_action, [
"sec" => $section1]);
   755         $ctrl = $this->gui->ctrl();
   756         $mt = $this->gui->mainTemplate();
   757         $lng = $this->domain->lng();
   761         $target_id = $this->request->getTargetId();
   763         $first_child = 
false;
   764         if ($this->request->getBefore()) {
   767             foreach ($this->lm_tree->getChildsByType($parent, 
"pg") as $node) {
   768                 if ((
int) $node[
"obj_id"] !== $target_id) {
   769                     $before_target = (
int) $node[
"obj_id"];
   770                     $first_child = 
false;
   775             $target_id = $before_target;
   779         $form = $form->withRequest($DIC->http()->request());
   780         $data = $form->getData();
   781         $layout_id = 
$data[
"sec"][
"layout_id"];
   788             $data[
"sec"][
"title"]
   791         $mt->setOnScreenMessage(
"success", 
$lng->txt(
"lm_page_added"), 
true);
   793         $ctrl->redirect($this, 
"list");
 insertLayout(bool $before=false)
 
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)
 
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui, protected string $sub_type, protected \ilObjLearningModule $lm, protected string $table_title)
 
cutItems(array $ids)
Copy items to clipboard, then cut them from the current tree. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
insertPage(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
 
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
 
insertChapter(int $parent_id=0, int $target=\ilTree::POS_LAST_NODE)
 
activatePages(array $ids)
 
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. 
 
copyItems($ids)
Copy items to clipboard. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree 
 
insertChapterClip( $target=\ilTree::POS_LAST_NODE)
 
static _lookupTitle(int $a_obj_id)
 
confirmedDelete(int $a_parent_subobj_id=0)
delete page object or structure objects 
 
static activeLayouts(int $a_module=0)
Get active layouts. 
 
static getInstance(int $obj_id)
 
static insertPagesFromTemplate(int $lm_id, int $num, int $node_id, bool $first_child, int $layout_id, string $title="")
Insert (multiple) pages templates at node. 
 
static saveTitle(int $id, string $title, string $lang="-")
 
getEditTitleForm(int $id)
 
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="")
 
insertChapterClipBefore()
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
static _lookupType(int $a_obj_id, int $a_lm_id=0)
 
insertPageClip(int $target=0)
 
EditingGUIRequest $request
 
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.