ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 

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

Constructor & Destructor Documentation

◆ __construct()

ilPageLayoutAdministrationGUI::__construct ( )

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

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

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

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

227 : void
228 {
229 if (!$a_form) {
230 $a_form = $this->initAddPageLayoutForm();
231 }
232 $this->tpl->setContent($a_form->getHTML());
233 }

◆ cancelCreate()

ilPageLayoutAdministrationGUI::cancelCreate ( )

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

336 : void
337 {
338 $this->listLayouts();
339 }

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

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

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

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

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

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

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

167 : void
168 {
169 $this->activate(false);
170 }

◆ deletePgl()

ilPageLayoutAdministrationGUI::deletePgl ( )

display deletion confirmation screen

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

175 : void
176 {
177 $ids = $this->admin_request->getLayoutIds();
178 if (count($ids) == 0) {
179 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_checkbox"), true);
180 $this->ctrl->redirect($this, "listLayouts");
181 }
182
183 unset($this->data);
184
185 // display confirmation message
186 $cgui = new ilConfirmationGUI();
187 $cgui->setFormAction($this->ctrl->getFormAction($this));
188 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
189 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeletePg");
190 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeletePg");
191
192 foreach ($ids as $id) {
193 $pg_obj = new ilPageLayout($id);
194 $pg_obj->readObject();
195
196 $caption = $pg_obj->getTitle();
197
198 $cgui->addItem("pglayout[]", $id, $caption);
199 }
200
201 $this->tpl->setContent($cgui->getHTML());
202 }
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 341 of file class.ilPageLayoutAdministrationGUI.php.

341 : void
342 {
343 $this->checkPermission("sty_write_page_layout");
344
345 $this->ctrl->saveParameterByClass(ilPageLayoutGUI::class, "obj_id");
346 $this->ctrl->redirectByClass(ilPageLayoutGUI::class, "edit");
347 $this->executeCommand();
348 }
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 65 of file class.ilPageLayoutAdministrationGUI.php.

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

354 : void
355 {
356 $exp = new ilExport();
357
358 $tmpdir = ilFileUtils::ilTempnam();
359 ilFileUtils::makeDir($tmpdir);
360 $succ = $exp->exportEntity(
361 "pgtp",
362 $this->admin_request->getObjId(),
363 "4.2.0",
364 "components/ILIAS/COPage",
365 "Title",
366 $tmpdir
367 );
368
369 if (is_file($succ["directory"] . "/" . $succ["file"])) {
371 $succ["directory"] . "/" . $succ["file"],
372 $succ["file"],
373 "",
374 false,
375 false,
376 false
377 );
378 }
379 if (is_file($succ["directory"] . "/" . $succ["file"])) {
380 unlink($succ["directory"] . "/" . $succ["file"]);
381 }
382 if (is_dir($succ["directory"])) {
383 //unlink($succ["directory"]);
384 }
385 }
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 421 of file class.ilPageLayoutAdministrationGUI.php.

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

390 : void
391 {
392 $form = $this->initPageLayoutImportForm();
393 $this->tpl->setContent($form->getHTML());
394 }

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )

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

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

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

130 : void
131 {
132 // show toolbar, if write permission is given
133 if ($this->checkPermission("sty_write_page_layout", false)) {
134 $this->toolbar->addButton(
135 $this->lng->txt("sty_add_pgl"),
136 $this->ctrl->getLinkTarget($this, "addPageLayout")
137 );
138 $this->toolbar->addButton(
139 $this->lng->txt("sty_import_page_layout"),
140 $this->ctrl->getLinkTarget($this, "importPageLayoutForm")
141 );
142 }
143
144 $oa_tpl = new ilTemplate("tpl.stys_pglayout.html", true, true, "components/ILIAS/COPage/Layout");
145
146 $pglayout_table = new ilPageLayoutTableGUI($this, "listLayouts");
147 $oa_tpl->setVariable("PGLAYOUT_TABLE", $pglayout_table->getHTML());
148 $this->tpl->setContent($oa_tpl->get());
149 }
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 30 of file class.ilPageLayoutAdministrationGUI.php.

◆ $ctrl

ilCtrl ilPageLayoutAdministrationGUI::$ctrl
protected

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

◆ $DIC

ILIAS DI Container ilPageLayoutAdministrationGUI::$DIC
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilPageLayoutAdministrationGUI::$lng
protected

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

◆ $pg_content

ilPageLayoutPage ilPageLayoutAdministrationGUI::$pg_content
protected

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

◆ $pg_id

int ilPageLayoutAdministrationGUI::$pg_id = null
protected

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

◆ $rbacsystem

ilRbacSystem ilPageLayoutAdministrationGUI::$rbacsystem
protected

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

◆ $ref_id

int ilPageLayoutAdministrationGUI::$ref_id
protected

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

◆ $settings

ilContentStyleSettings ilPageLayoutAdministrationGUI::$settings
protected

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

◆ $tabs

ilTabsGUI ilPageLayoutAdministrationGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilPageLayoutAdministrationGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilPageLayoutAdministrationGUI::$tpl
protected

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


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