ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 (bool $a_activate=true)
 
 deactivate ()
 
 deletePgl ()
 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 ()
 
 exportLayout ()
 Export page layout template object. More...
 
 importPageLayoutForm ()
 Import page layout. More...
 
 initPageLayoutImportForm ()
 Init page layout import form. More...
 
 importPageLayout ()
 Import page layout. More...
 

Protected Attributes

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 45 of file class.ilPageLayoutAdministrationGUI.php.

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

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 ( bool  $a_activate = true)

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

156 : void {
157 $ids = $this->admin_request->getLayoutIds();
158 if (count($ids) == 0) {
159 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_checkbox"), true);
160 } else {
161 $this->tpl->setOnScreenMessage('success', $this->lng->txt("sty_opt_saved"), true);
162 foreach ($ids as $item) {
163 $pg_layout = new ilPageLayout($item);
164 $pg_layout->activate($a_activate);
165 }
166 }
167 $this->ctrl->redirect($this, "listLayouts");
168 }
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 230 of file class.ilPageLayoutAdministrationGUI.php.

230 : void
231 {
232 if (!$a_form) {
233 $a_form = $this->initAddPageLayoutForm();
234 }
235 $this->tpl->setContent($a_form->getHTML());
236 }

◆ cancelCreate()

ilPageLayoutAdministrationGUI::cancelCreate ( )

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

340 : void
341 {
342 $this->listLayouts();
343 }

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

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

210 : void
211 {
212 $this->tpl->setOnScreenMessage('info', $this->lng->txt("msg_cancel"), true);
213 $this->ctrl->redirect($this, "listLayouts");
214 }

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 120 of file class.ilPageLayoutAdministrationGUI.php.

123 : bool {
124 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
125 if ($a_throw_exc) {
126 throw new ilObjectException($this->lng->txt("permission_denied"));
127 }
128 return false;
129 }
130 return true;
131 }
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 219 of file class.ilPageLayoutAdministrationGUI.php.

219 : void
220 {
221 $ids = $this->admin_request->getLayoutIds();
222 foreach ($ids as $id) {
223 $pg_obj = new ilPageLayout($id);
224 $pg_obj->delete();
225 }
226
227 $this->ctrl->redirect($this, "listLayouts");
228 }
$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 306 of file class.ilPageLayoutAdministrationGUI.php.

306 : void
307 {
308 $form_gui = $this->initAddPageLayoutForm();
309 if (!$form_gui->checkInput()) {
310 $form_gui->setValuesByPost();
311 $this->addPageLayout($form_gui);
312 return;
313 }
314
315 //create Page-Layout-Object first
316 $pg_object = new ilPageLayout();
317 $pg_object->setTitle($form_gui->getInput('pgl_title'));
318 $pg_object->setDescription($form_gui->getInput('pgl_desc'));
319 $pg_object->setModules($form_gui->getInput('module'));
320 $pg_object->update();
321
322 //create Page
323 //if (!is_object($pg_content)) {
324 $this->pg_content = new ilPageLayoutPage();
325 //}
326
327 $this->pg_content->setId($pg_object->getId());
328
329 $tmpl = $form_gui->getInput('pgl_template');
330 if ($tmpl != "-1") {
331 $layout_obj = new ilPageLayout($tmpl);
332 $this->pg_content->setXMLContent($layout_obj->getXMLContent());
333 }
334 $this->pg_content->create(false);
335
336 $this->ctrl->setParameterByClass("ilpagelayoutgui", "obj_id", $pg_object->getId());
337 $this->ctrl->redirectByClass("ilpagelayoutgui", "edit");
338 }
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 ( )

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

170 : void
171 {
172 $this->activate(false);
173 }

◆ deletePgl()

ilPageLayoutAdministrationGUI::deletePgl ( )

display deletion confirmation screen

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

178 : void
179 {
180 $ids = $this->admin_request->getLayoutIds();
181 if (count($ids) == 0) {
182 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
183 $this->ctrl->redirect($this, "listLayouts");
184 }
185
186 unset($this->data);
187
188 // display confirmation message
189 $cgui = new ilConfirmationGUI();
190 $cgui->setFormAction($this->ctrl->getFormAction($this));
191 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
192 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeletePg");
193 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeletePg");
194
195 foreach ($ids as $id) {
196 $pg_obj = new ilPageLayout($id);
197 $pg_obj->readObject();
198
199 $caption = $pg_obj->getTitle();
200
201 $cgui->addItem("pglayout[]", $id, $caption);
202 }
203
204 $this->tpl->setContent($cgui->getHTML());
205 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ editPg()

ilPageLayoutAdministrationGUI::editPg ( )

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

345 : void
346 {
347 $this->checkPermission("sty_write_page_layout");
348
349 $this->ctrl->saveParameterByClass(ilPageLayoutGUI::class, "obj_id");
350 $this->ctrl->redirectByClass(ilPageLayoutGUI::class, "edit");
351 $this->executeCommand();
352 }
checkPermission(string $a_perm, bool $a_throw_exc=true)
Check permission.

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilPageLayoutAdministrationGUI::executeCommand ( )

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

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

Export page layout template object.

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

358 : void
359 {
360 $exp = new ilExport();
361
362 $tmpdir = ilFileUtils::ilTempnam();
363 ilFileUtils::makeDir($tmpdir);
364 $exp->setExportConfigs($this->export_handler->consumer()->exportConfig()->allExportConfigs());
365 $succ = $exp->exportEntity(
366 "pgtp",
367 $this->admin_request->getObjId(),
368 "4.2.0",
369 "components/ILIAS/COPage",
370 "Title",
371 $tmpdir
372 );
373
374 if (is_file($succ["directory"] . "/" . $succ["file"])) {
376 $succ["directory"] . "/" . $succ["file"],
377 $succ["file"],
378 "",
379 false,
380 false,
381 false
382 );
383 }
384 if (is_file($succ["directory"] . "/" . $succ["file"])) {
385 unlink($succ["directory"] . "/" . $succ["file"]);
386 }
387 if (is_dir($succ["directory"])) {
388 //unlink($succ["directory"]);
389 }
390 }
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 ilFileDelivery\deliverFileLegacy(), ilFileUtils\ilTempnam(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ importPageLayout()

ilPageLayoutAdministrationGUI::importPageLayout ( )

Import page layout.

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

426 : void
427 {
428 $form = $this->initPageLayoutImportForm();
429 if ($form->checkInput()) {
430 ilPageLayout::import($_FILES["file"]["name"], $_FILES["file"]["tmp_name"]);
431 $this->tpl->setOnScreenMessage('success', $this->lng->txt("sty_imported_layout"), true);
432 $this->ctrl->redirect($this, "listLayouts");
433 } else {
434 $form->setValuesByPost();
435 $this->tpl->setContent($form->getHTML());
436 }
437 }
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 395 of file class.ilPageLayoutAdministrationGUI.php.

395 : void
396 {
397 $form = $this->initPageLayoutImportForm();
398 $this->tpl->setContent($form->getHTML());
399 }

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )

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

239 {
240 $this->lng->loadLanguageModule("content");
241 $this->lng->loadLanguageModule("copg");
242
243 $form_gui = new ilPropertyFormGUI();
244 $form_gui->setFormAction($this->ctrl->getFormAction($this));
245 $form_gui->setTitle($this->lng->txt("sty_create_pgl"));
246
247 $title_input = new ilTextInputGUI($this->lng->txt("title"), "pgl_title");
248 $title_input->setSize(50);
249 $title_input->setMaxLength(128);
250 //$title_input->setValue($this->layout_object->title);
251 $title_input->setTitle($this->lng->txt("title"));
252 $title_input->setRequired(true);
253
254 $desc_input = new ilTextAreaInputGUI($this->lng->txt("description"), "pgl_desc");
255 //$desc_input->setValue($this->layout_object->description);
256 $desc_input->setRows(3);
257 $desc_input->setCols(37);
258
259
260 // modules
261 $mods = new ilCheckboxGroupInputGUI($this->lng->txt("copg_obj_types"), "module");
262 // $mods->setRequired(true);
263 foreach (ilPageLayout::getAvailableModules() as $mod_id => $mod_caption) {
264 $mod = new ilCheckboxOption($mod_caption, $mod_id);
265 $mods->addOption($mod);
266 }
267
268 $ttype_input = new ilSelectInputGUI($this->lng->txt("sty_based_on"), "pgl_template");
269
270 $arr_templates = ilPageLayout::getLayouts();
271 $arr_templates1 = ilPageLayout::getLayouts(false, true);
272 foreach ($arr_templates1 as $v) {
273 $arr_templates[] = $v;
274 }
275
276 $options = array();
277 $options['-1'] = $this->lng->txt("none");
278
279 foreach ($arr_templates as $templ) {
280 $templ->readObject();
281 $key = $templ->getId();
282 $value = $templ->getTitle();
283 $options[$key] = $value;
284 }
285
286 $ttype_input->setOptions($options);
287 $ttype_input->setValue(-1);
288 $ttype_input->setRequired(true);
289
290 $desc_input->setTitle($this->lng->txt("description"));
291 $desc_input->setRequired(false);
292
293 $form_gui->addItem($title_input);
294 $form_gui->addItem($desc_input);
295 $form_gui->addItem($mods);
296 $form_gui->addItem($ttype_input);
297
298
299 $form_gui->addCommandButton("createPg", $this->lng->txt("save"));
300 $form_gui->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
301
302 return $form_gui;
303 }
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 404 of file class.ilPageLayoutAdministrationGUI.php.

405 {
406 $form = new ilPropertyFormGUI();
407
408 // template file
409 $fi = new ilFileInputGUI($this->lng->txt("file"), "file");
410 $fi->setSuffixes(array("zip"));
411 $fi->setRequired(true);
412 $form->addItem($fi);
413
414 $form->addCommandButton("importPageLayout", $this->lng->txt("import"));
415 $form->addCommandButton("listLayouts", $this->lng->txt("cancel"));
416
417 $form->setTitle($this->lng->txt("sty_import_page_layout"));
418 $form->setFormAction($this->ctrl->getFormAction($this));
419
420 return $form;
421 }
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 133 of file class.ilPageLayoutAdministrationGUI.php.

133 : void
134 {
135 // show toolbar, if write permission is given
136 if ($this->checkPermission("sty_write_page_layout", false)) {
137 $this->toolbar->addButton(
138 $this->lng->txt("sty_add_pgl"),
139 $this->ctrl->getLinkTarget($this, "addPageLayout")
140 );
141 $this->toolbar->addButton(
142 $this->lng->txt("sty_import_page_layout"),
143 $this->ctrl->getLinkTarget($this, "importPageLayoutForm")
144 );
145 }
146
147 $oa_tpl = new ilTemplate("tpl.stys_pglayout.html", true, true, "components/ILIAS/COPage/Layout");
148
149 $pglayout_table = new ilPageLayoutTableGUI($this, "listLayouts");
150 $oa_tpl->setVariable("PGLAYOUT_TABLE", $pglayout_table->getHTML());
151 $this->tpl->setContent($oa_tpl->get());
152 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR

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 31 of file class.ilPageLayoutAdministrationGUI.php.

◆ $ctrl

ilCtrl ilPageLayoutAdministrationGUI::$ctrl
protected

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

◆ $DIC

ILIAS DI Container ilPageLayoutAdministrationGUI::$DIC
protected

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

Referenced by __construct().

◆ $export_handler

ilExportHandler ilPageLayoutAdministrationGUI::$export_handler
protected

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

◆ $lng

ilLanguage ilPageLayoutAdministrationGUI::$lng
protected

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

◆ $pg_content

ilPageLayoutPage ilPageLayoutAdministrationGUI::$pg_content
protected

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

◆ $pg_id

int ilPageLayoutAdministrationGUI::$pg_id = null
protected

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

◆ $rbacsystem

ilRbacSystem ilPageLayoutAdministrationGUI::$rbacsystem
protected

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

◆ $ref_id

int ilPageLayoutAdministrationGUI::$ref_id
protected

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

◆ $settings

ilContentStyleSettings ilPageLayoutAdministrationGUI::$settings
protected

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

◆ $tabs

ilTabsGUI ilPageLayoutAdministrationGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilPageLayoutAdministrationGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilPageLayoutAdministrationGUI::$tpl
protected

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


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