ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.GUIService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
27 {
28  protected array $page_layouts;
29 
30  public function __construct(
31  protected InternalDomainService $domain,
32  protected InternalGUIService $gui
33  ) {
34  $this->page_layouts = \ilPageLayout::activeLayouts(
36  );
37  }
38 
39  public function request(
40  ?array $passed_query_params = null,
41  ?array $passed_post_data = null
43  return new EditingGUIRequest(
44  $this->gui->http(),
45  $this->domain->refinery(),
46  $passed_query_params,
47  $passed_post_data
48  );
49  }
50 
51  public function editSubObjectsGUI(
52  string $sub_type,
54  string $table_title
56  return new EditSubObjectsGUI(
57  $this->domain,
58  $this->gui,
59  $sub_type,
60  $lm,
61  $table_title
62  );
63  }
64 
65  public function subObjectTableGUI(
66  string $title,
67  int $lm_id,
68  string $type,
69  object $parent_gui
71  $lng = $this->domain->lng();
72  $user = $this->domain->user();
73  $transl = $this->request()->getTranslation();
74  $table = new \ILIAS\LearningModule\Table\TableAdapterGUI(
75  "subobj",
76  $title,
77  $this->domain->subObjectRetrieval(
78  $lm_id,
79  $type,
80  $this->request()->getObjId(),
81  $transl
82  ),
83  $parent_gui
84  );
85  $table = $table
86  ->ordering("saveOrder")
87  ->iconColumn("type", $lng->txt("type"))
88  ->textColumn("title", $lng->txt("title"));
89  if (!in_array($transl, ["-", ""])) {
90  $table = $table->textColumn("trans_title", $lng->txt("title") .
91  " (" . $lng->txt("meta_l_" . $transl) . ")");
92  }
93 
94  if ($type === "st") {
95  $acts = [
96  [
97  "editPages",
98  $lng->txt("edit"),
99  [\ilObjLearningModuleGUI::class, \ilStructureObjectGUI::class, EditSubObjectsGUI::class],
100  "editPages",
101  "obj_id"
102  ],
103  [
104  "insertChapterAfter",
105  $lng->txt("lm_insert_chapter_after"),
106  [EditSubObjectsGUI::class],
107  "insertChapterAfter",
108  "target_id"
109  ],
110  [
111  "insertChapterBefore",
112  $lng->txt("lm_insert_chapter_before"),
113  [EditSubObjectsGUI::class],
114  "insertChapterBefore",
115  "target_id"
116  ]
117  ];
118  if ($user->clipboardHasObjectsOfType("st")) {
119  $acts[] = [
120  "insertChapterClipAfter",
121  $lng->txt("lm_insert_chapter_clip_after"),
122  [EditSubObjectsGUI::class],
123  "insertChapterClipAfter",
124  "target_id"
125  ];
126  $acts[] = [
127  "insertChapterClipBefore",
128  $lng->txt("lm_insert_chapter_clip_before"),
129  [EditSubObjectsGUI::class],
130  "insertChapterClipBefore",
131  "target_id"
132  ];
133  }
134  } else {
135  $acts = [
136  [
137  "editPage",
138  $lng->txt("edit"),
139  [\ilObjLearningModuleGUI::class, \ilLMPageObjectGUI::class],
140  "edit",
141  "obj_id"
142  ],
143  [
144  "insertPageAfter",
145  $lng->txt("lm_insert_page_after"),
146  [EditSubObjectsGUI::class],
147  "insertPageAfter",
148  "target_id"
149  ],
150  [
151  "insertPageBefore",
152  $lng->txt("lm_insert_page_before"),
153  [EditSubObjectsGUI::class],
154  "insertPageBefore",
155  "target_id"
156  ]
157  ];
158  if ($user->clipboardHasObjectsOfType("pg")) {
159  $acts[] = [
160  "insertPageClipAfter",
161  $lng->txt("lm_insert_page_clip_after"),
162  [EditSubObjectsGUI::class],
163  "insertPageClipAfter",
164  "target_id"
165  ];
166  $acts[] = [
167  "insertPageClipBefore",
168  $lng->txt("lm_insert_page_clip_before"),
169  [EditSubObjectsGUI::class],
170  "insertPageClipBefore",
171  "target_id"
172  ];
173  }
174  if (count($this->page_layouts) > 0) {
175  $acts[] = [
176  "insertLayoutAfter",
177  $lng->txt("lm_insert_layout_after"),
178  [EditSubObjectsGUI::class],
179  "insertLayoutAfter",
180  "target_id"
181  ];
182  $acts[] = [
183  "insertLayoutBefore",
184  $lng->txt("lm_insert_layout_before"),
185  [EditSubObjectsGUI::class],
186  "insertLayoutBefore",
187  "target_id"
188  ];
189  }
190  }
191  foreach ($acts as $a) {
192  $table = $table->singleAction($a[0], $a[1])
193  ->redirect($a[2], $a[3], $a[4]);
194  }
195  $table = $table
196  ->standardAction(
197  "delete",
198  $lng->txt("delete")
199  )
200  ->singleAction(
201  "editTitle",
202  $lng->txt("cont_edit_title"),
203  true
204  )
205  ->standardAction(
206  "cutItems",
207  $lng->txt("cut")
208  )
209  ->standardAction(
210  "copyItems",
211  $lng->txt("copy")
212  );
213  if ($type === "pg") {
214  $table = $table->standardAction(
215  "activatePages",
216  $lng->txt("cont_de_activate")
217  );
218  }
219  return $table;
220  }
221 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
subObjectTableGUI(string $title, int $lm_id, string $type, object $parent_gui)
editSubObjectsGUI(string $sub_type, \ilObjLearningModule $lm, string $table_title)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static activeLayouts(int $a_module=0)
Get active layouts.
__construct(protected InternalDomainService $domain, protected InternalGUIService $gui)
global $lng
Definition: privfeed.php:31
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
request(?array $passed_query_params=null, ?array $passed_post_data=null)