ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ilPageLayoutAdministrationGUI Class Reference

Administration for page layouts. More...

+ Collaboration diagram for ilPageLayoutAdministrationGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 checkPermission (string $a_perm, bool $a_throw_exc=true)
 Check permission. More...
 
 listLayouts ()
 
 activate (array $ids, bool $a_activate=true)
 
 deactivate (array $ids)
 
 deletePgl (array $ids)
 display deletion confirmation screen More...
 
 cancelDeletePg ()
 cancel deletion of Page Layout More...
 
 confirmedDeletePg ()
 conform deletion of Page Layout More...
 
 addPageLayout (?ilPropertyFormGUI $a_form=null)
 
 initAddPageLayoutForm ()
 
 createPg ()
 
 cancelCreate ()
 
 editPg (int $id)
 
 exportLayout (int $id)
 Export page layout template object. More...
 
 importPageLayoutForm ()
 Import page layout. More...
 
 initPageLayoutImportForm ()
 Init page layout import form. More...
 
 importPageLayout ()
 Import page layout. More...
 

Protected Member Functions

 getTable ()
 

Protected Attributes

ILIAS COPage Layout GUIService $gui
 
AdministrationGUIRequest $admin_request
 
int $pg_id = null
 
ilContentStyleSettings $settings
 
ilTabsGUI $tabs
 
ilPageLayoutPage $pg_content
 
ilCtrl $ctrl
 
ilRbacSystem $rbacsystem
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ILIAS DI Container $DIC
 
int $ref_id
 
ilExportHandler $export_handler
 

Detailed Description

Administration for page layouts.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de @ilCtrl_Calls ilPageLayoutAdministrationGUI: ilPageLayoutGUI

Definition at line 29 of file class.ilPageLayoutAdministrationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPageLayoutAdministrationGUI::__construct ( )

Definition at line 46 of file class.ilPageLayoutAdministrationGUI.php.

47 {
48 global $DIC;
49
50 $this->ctrl = $DIC->ctrl();
51 $this->rbacsystem = $DIC->rbac()->system();
52 $this->toolbar = $DIC->toolbar();
53 $this->lng = $DIC->language();
54 $this->tpl = $DIC["tpl"];
55 $this->tabs = $DIC->tabs();
56 $this->lng->loadLanguageModule("style");
57 $this->gui = $DIC->copage()->internal()->gui()->layout();
58
59 $this->settings = new ilContentStyleSettings();
60 $this->admin_request = $DIC
61 ->copage()
62 ->internal()
63 ->gui()
64 ->layout()
65 ->adminRequest();
66 $this->ref_id = $this->admin_request->getRefId();
67 $this->export_handler = new ilExportHandler();
68 }

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilPageLayoutAdministrationGUI::activate ( array  $ids,
bool  $a_activate = true 
)

Definition at line 165 of file class.ilPageLayoutAdministrationGUI.php.

168 : void {
169 if (count($ids) == 0) {
170 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_checkbox"), true);
171 } else {
172 $this->tpl->setOnScreenMessage('success', $this->lng->txt("sty_opt_saved"), true);
173 foreach ($ids as $item) {
174 $pg_layout = new ilPageLayout($item);
175 $pg_layout->activate($a_activate);
176 }
177 }
178 $this->ctrl->redirect($this, "listLayouts");
179 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addPageLayout()

ilPageLayoutAdministrationGUI::addPageLayout ( ?ilPropertyFormGUI  $a_form = null)

Definition at line 236 of file class.ilPageLayoutAdministrationGUI.php.

236 : void
237 {
238 if (!$a_form) {
239 $a_form = $this->initAddPageLayoutForm();
240 }
241 $this->tpl->setContent($a_form->getHTML());
242 }

◆ cancelCreate()

ilPageLayoutAdministrationGUI::cancelCreate ( )

Definition at line 346 of file class.ilPageLayoutAdministrationGUI.php.

346 : void
347 {
348 $this->listLayouts();
349 }

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

Definition at line 216 of file class.ilPageLayoutAdministrationGUI.php.

216 : void
217 {
218 $this->tpl->setOnScreenMessage('info', $this->lng->txt("msg_cancel"), true);
219 $this->ctrl->redirect($this, "listLayouts");
220 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ checkPermission()

ilPageLayoutAdministrationGUI::checkPermission ( string  $a_perm,
bool  $a_throw_exc = true 
)

Check permission.

Exceptions
ilObjectException

Definition at line 122 of file class.ilPageLayoutAdministrationGUI.php.

125 : bool {
126 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
127 if ($a_throw_exc) {
128 throw new ilObjectException($this->lng->txt("permission_denied"));
129 }
130 return false;
131 }
132 return true;
133 }
Base exception class for object service.

References ILIAS\Repository\lng().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmedDeletePg()

ilPageLayoutAdministrationGUI::confirmedDeletePg ( )

conform deletion of Page Layout

Definition at line 225 of file class.ilPageLayoutAdministrationGUI.php.

225 : void
226 {
227 $ids = $this->getTable()->getItemIds();
228 foreach ($ids as $id) {
229 $pg_obj = new ilPageLayout($id);
230 $pg_obj->delete();
231 }
232
233 $this->ctrl->redirect($this, "listLayouts");
234 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ createPg()

ilPageLayoutAdministrationGUI::createPg ( )

Definition at line 312 of file class.ilPageLayoutAdministrationGUI.php.

312 : void
313 {
314 $form_gui = $this->initAddPageLayoutForm();
315 if (!$form_gui->checkInput()) {
316 $form_gui->setValuesByPost();
317 $this->addPageLayout($form_gui);
318 return;
319 }
320
321 //create Page-Layout-Object first
322 $pg_object = new ilPageLayout();
323 $pg_object->setTitle($form_gui->getInput('pgl_title'));
324 $pg_object->setDescription($form_gui->getInput('pgl_desc'));
325 $pg_object->setModules($form_gui->getInput('module'));
326 $pg_object->update();
327
328 //create Page
329 //if (!is_object($pg_content)) {
330 $this->pg_content = new ilPageLayoutPage();
331 //}
332
333 $this->pg_content->setId($pg_object->getId());
334
335 $tmpl = $form_gui->getInput('pgl_template');
336 if ($tmpl != "-1") {
337 $layout_obj = new ilPageLayout($tmpl);
338 $this->pg_content->setXMLContent($layout_obj->getXMLContent());
339 }
340 $this->pg_content->create(false);
341
342 $this->ctrl->setParameterByClass("ilpagelayoutgui", "obj_id", $pg_object->getId());
343 $this->ctrl->redirectByClass("ilpagelayoutgui", "edit");
344 }
addPageLayout(?ilPropertyFormGUI $a_form=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ deactivate()

ilPageLayoutAdministrationGUI::deactivate ( array  $ids)

Definition at line 181 of file class.ilPageLayoutAdministrationGUI.php.

181 : void
182 {
183 $this->activate($ids, false);
184 }
activate(array $ids, bool $a_activate=true)

◆ deletePgl()

ilPageLayoutAdministrationGUI::deletePgl ( array  $ids)

display deletion confirmation screen

Definition at line 189 of file class.ilPageLayoutAdministrationGUI.php.

189 : void
190 {
191 if (count($ids) == 0) {
192 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
193 $this->ctrl->redirect($this, "listLayouts");
194 }
195
196 $table = $this->getTable();
197
198 $items = [];
199 foreach ($ids as $id) {
200 $pg_obj = new ilPageLayout($id);
201 $pg_obj->readObject();
202 $items[$id] = $pg_obj->getTitle();
203 }
204
205 $table->renderDeletionConfirmation(
206 $this->lng->txt("info_delete_sure"),
207 $this->lng->txt("info_delete_sure"),
208 "confirmedDeletePg",
209 $items
210 );
211 }

References $id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ editPg()

ilPageLayoutAdministrationGUI::editPg ( int  $id)

Definition at line 351 of file class.ilPageLayoutAdministrationGUI.php.

351 : void
352 {
353 $this->checkPermission("sty_write_page_layout");
354
355 $this->ctrl->setParameterByClass(ilPageLayoutGUI::class, "obj_id", $id);
356 $this->ctrl->redirectByClass(ilPageLayoutGUI::class, "edit");
357 $this->executeCommand();
358 }
checkPermission(string $a_perm, bool $a_throw_exc=true)
Check permission.

References $id, and ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilPageLayoutAdministrationGUI::executeCommand ( )

Definition at line 70 of file class.ilPageLayoutAdministrationGUI.php.

70 : void
71 {
72 $next_class = $this->ctrl->getNextClass($this);
73 $cmd = $this->ctrl->getCmd("listLayouts");
74
75 if ($cmd == "listLayouts") {
76 $this->checkPermission("read");
77 } else {
78 $this->checkPermission("sty_write_page_layout");
79 }
80
81 switch ($next_class) {
82 case 'ilpagelayoutgui':
83 $this->tabs->clearTargets();
84 $this->tabs->setBackTarget(
85 $this->lng->txt("page_layouts"),
86 $this->ctrl->getLinkTarget($this, "listLayouts")
87 );
88
89 $this->ctrl->setReturn($this, "listLayouts");
90 if ($this->pg_id != null) {
91 $layout_gui = new ilPageLayoutGUI("stys", $this->pg_id);
92 } else {
93 $layout_gui = new ilPageLayoutGUI(
94 "stys",
95 $this->admin_request->getObjId()
96 );
97 }
98 $layout_gui->setTabs();
99 $layout_gui->setEditPreview(true);
100 $this->ctrl->saveParameter($this, "obj_id");
101 $ret = $this->ctrl->forwardCommand($layout_gui);
102 if ($ret != "") {
103 $this->tpl->setContent($ret);
104 }
105 break;
106
107 default:
108 if (in_array($cmd, array("listLayouts", "editPg", "addPageLayout", "cancelCreate", "createPg", "exportLayout",
109 "activate", "deactivate", "importPageLayoutForm", "deletePgl", "cancelDeletePg",
110 "confirmedDeletePg", "importPageLayout"))) {
111 $this->$cmd();
112 } else {
113 die("Unknown command " . $cmd);
114 }
115 }
116 }
Class ilPageLayoutGUI GUI class.

References checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ exportLayout()

ilPageLayoutAdministrationGUI::exportLayout ( int  $id)

Export page layout template object.

Definition at line 364 of file class.ilPageLayoutAdministrationGUI.php.

364 : void
365 {
366 $exp = new ilExport();
367
368 $tmpdir = ilFileUtils::ilTempnam();
369 ilFileUtils::makeDir($tmpdir);
370 $exp->setExportConfigs($this->export_handler->consumer()->exportConfig()->allExportConfigs());
371 $succ = $exp->exportEntity(
372 "pgtp",
373 $id,
374 "4.2.0",
375 "components/ILIAS/COPage",
376 "Title",
377 $tmpdir
378 );
379
380 if (is_file($succ["directory"] . "/" . $succ["file"])) {
382 $succ["directory"] . "/" . $succ["file"],
383 $succ["file"],
384 "",
385 false,
386 false,
387 false
388 );
389 }
390 if (is_file($succ["directory"] . "/" . $succ["file"])) {
391 unlink($succ["directory"] . "/" . $succ["file"]);
392 }
393 if (is_dir($succ["directory"])) {
394 //unlink($succ["directory"]);
395 }
396 }
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.

References $id, ilFileDelivery\deliverFileLegacy(), ilFileUtils\ilTempnam(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ getTable()

ilPageLayoutAdministrationGUI::getTable ( )
protected

Definition at line 135 of file class.ilPageLayoutAdministrationGUI.php.

136 {
137 return $this->gui->pageLayoutTableBuilder(
138 $this,
139 "listLayouts"
140 )->getTable();
141 }

◆ importPageLayout()

ilPageLayoutAdministrationGUI::importPageLayout ( )

Import page layout.

Definition at line 432 of file class.ilPageLayoutAdministrationGUI.php.

432 : void
433 {
434 $form = $this->initPageLayoutImportForm();
435 if ($form->checkInput()) {
436 ilPageLayout::import($_FILES["file"]["name"], $_FILES["file"]["tmp_name"]);
437 $this->tpl->setOnScreenMessage('success', $this->lng->txt("sty_imported_layout"), true);
438 $this->ctrl->redirect($this, "listLayouts");
439 } else {
440 $form->setValuesByPost();
441 $this->tpl->setContent($form->getHTML());
442 }
443 }
initPageLayoutImportForm()
Init page layout import form.
static import(string $a_filename, string $a_filepath)
Import page layout.

References ILIAS\Repository\ctrl(), ilPageLayout\import(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ importPageLayoutForm()

ilPageLayoutAdministrationGUI::importPageLayoutForm ( )

Import page layout.

Definition at line 401 of file class.ilPageLayoutAdministrationGUI.php.

401 : void
402 {
403 $form = $this->initPageLayoutImportForm();
404 $this->tpl->setContent($form->getHTML());
405 }

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )

Definition at line 244 of file class.ilPageLayoutAdministrationGUI.php.

245 {
246 $this->lng->loadLanguageModule("content");
247 $this->lng->loadLanguageModule("copg");
248
249 $form_gui = new ilPropertyFormGUI();
250 $form_gui->setFormAction($this->ctrl->getFormAction($this));
251 $form_gui->setTitle($this->lng->txt("sty_create_pgl"));
252
253 $title_input = new ilTextInputGUI($this->lng->txt("title"), "pgl_title");
254 $title_input->setSize(50);
255 $title_input->setMaxLength(128);
256 //$title_input->setValue($this->layout_object->title);
257 $title_input->setTitle($this->lng->txt("title"));
258 $title_input->setRequired(true);
259
260 $desc_input = new ilTextAreaInputGUI($this->lng->txt("description"), "pgl_desc");
261 //$desc_input->setValue($this->layout_object->description);
262 $desc_input->setRows(3);
263 $desc_input->setCols(37);
264
265
266 // modules
267 $mods = new ilCheckboxGroupInputGUI($this->lng->txt("copg_obj_types"), "module");
268 // $mods->setRequired(true);
269 foreach (ilPageLayout::getAvailableModules() as $mod_id => $mod_caption) {
270 $mod = new ilCheckboxOption($mod_caption, $mod_id);
271 $mods->addOption($mod);
272 }
273
274 $ttype_input = new ilSelectInputGUI($this->lng->txt("sty_based_on"), "pgl_template");
275
276 $arr_templates = ilPageLayout::getLayouts();
277 $arr_templates1 = ilPageLayout::getLayouts(false, true);
278 foreach ($arr_templates1 as $v) {
279 $arr_templates[] = $v;
280 }
281
282 $options = array();
283 $options['-1'] = $this->lng->txt("none");
284
285 foreach ($arr_templates as $templ) {
286 $templ->readObject();
287 $key = $templ->getId();
288 $value = $templ->getTitle();
289 $options[$key] = $value;
290 }
291
292 $ttype_input->setOptions($options);
293 $ttype_input->setValue(-1);
294 $ttype_input->setRequired(true);
295
296 $desc_input->setTitle($this->lng->txt("description"));
297 $desc_input->setRequired(false);
298
299 $form_gui->addItem($title_input);
300 $form_gui->addItem($desc_input);
301 $form_gui->addItem($mods);
302 $form_gui->addItem($ttype_input);
303
304
305 $form_gui->addCommandButton("createPg", $this->lng->txt("save"));
306 $form_gui->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
307
308 return $form_gui;
309 }
This class represents a property in a property form.
This class represents an option in a checkbox group.
static getLayouts(bool $a_active=false, int $a_module=0)
static getAvailableModules()
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References ILIAS\UI\Implementation\Component\Input\Field\$options, ILIAS\Repository\ctrl(), ilPageLayout\getAvailableModules(), ilPageLayout\getLayouts(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initPageLayoutImportForm()

ilPageLayoutAdministrationGUI::initPageLayoutImportForm ( )

Init page layout import form.

Definition at line 410 of file class.ilPageLayoutAdministrationGUI.php.

411 {
412 $form = new ilPropertyFormGUI();
413
414 // template file
415 $fi = new ilFileInputGUI($this->lng->txt("file"), "file");
416 $fi->setSuffixes(array("zip"));
417 $fi->setRequired(true);
418 $form->addItem($fi);
419
420 $form->addCommandButton("importPageLayout", $this->lng->txt("import"));
421 $form->addCommandButton("listLayouts", $this->lng->txt("cancel"));
422
423 $form->setTitle($this->lng->txt("sty_import_page_layout"));
424 $form->setFormAction($this->ctrl->getFormAction($this));
425
426 return $form;
427 }
This class represents a file property in a property form.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ listLayouts()

ilPageLayoutAdministrationGUI::listLayouts ( )

Definition at line 143 of file class.ilPageLayoutAdministrationGUI.php.

143 : void
144 {
145 // show toolbar, if write permission is given
146 if ($this->checkPermission("sty_write_page_layout", false)) {
147 $this->toolbar->addButton(
148 $this->lng->txt("sty_add_pgl"),
149 $this->ctrl->getLinkTarget($this, "addPageLayout")
150 );
151 $this->toolbar->addButton(
152 $this->lng->txt("sty_import_page_layout"),
153 $this->ctrl->getLinkTarget($this, "importPageLayoutForm")
154 );
155 }
156
157 $table = $this->getTable();
158 if ($table->handleCommand()) {
159 return;
160 }
161
162 $this->tpl->setContent($table->render());
163 }

References ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Field Documentation

◆ $admin_request

AdministrationGUIRequest ilPageLayoutAdministrationGUI::$admin_request
protected

Definition at line 32 of file class.ilPageLayoutAdministrationGUI.php.

◆ $ctrl

ilCtrl ilPageLayoutAdministrationGUI::$ctrl
protected

Definition at line 37 of file class.ilPageLayoutAdministrationGUI.php.

◆ $DIC

ILIAS DI Container ilPageLayoutAdministrationGUI::$DIC
protected

Definition at line 42 of file class.ilPageLayoutAdministrationGUI.php.

Referenced by __construct().

◆ $export_handler

ilExportHandler ilPageLayoutAdministrationGUI::$export_handler
protected

Definition at line 44 of file class.ilPageLayoutAdministrationGUI.php.

◆ $gui

ILIAS COPage Layout GUIService ilPageLayoutAdministrationGUI::$gui
protected

Definition at line 31 of file class.ilPageLayoutAdministrationGUI.php.

◆ $lng

ilLanguage ilPageLayoutAdministrationGUI::$lng
protected

Definition at line 40 of file class.ilPageLayoutAdministrationGUI.php.

◆ $pg_content

ilPageLayoutPage ilPageLayoutAdministrationGUI::$pg_content
protected

Definition at line 36 of file class.ilPageLayoutAdministrationGUI.php.

◆ $pg_id

int ilPageLayoutAdministrationGUI::$pg_id = null
protected

Definition at line 33 of file class.ilPageLayoutAdministrationGUI.php.

◆ $rbacsystem

ilRbacSystem ilPageLayoutAdministrationGUI::$rbacsystem
protected

Definition at line 38 of file class.ilPageLayoutAdministrationGUI.php.

◆ $ref_id

int ilPageLayoutAdministrationGUI::$ref_id
protected

Definition at line 43 of file class.ilPageLayoutAdministrationGUI.php.

◆ $settings

ilContentStyleSettings ilPageLayoutAdministrationGUI::$settings
protected

Definition at line 34 of file class.ilPageLayoutAdministrationGUI.php.

◆ $tabs

ilTabsGUI ilPageLayoutAdministrationGUI::$tabs
protected

Definition at line 35 of file class.ilPageLayoutAdministrationGUI.php.

◆ $toolbar

ilToolbarGUI ilPageLayoutAdministrationGUI::$toolbar
protected

Definition at line 39 of file class.ilPageLayoutAdministrationGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilPageLayoutAdministrationGUI::$tpl
protected

Definition at line 41 of file class.ilPageLayoutAdministrationGUI.php.


The documentation for this class was generated from the following file: