ILIAS  release_8 Revision v8.24
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
54 $this->settings = new ilContentStyleSettings();
55 $this->admin_request = $DIC
56 ->copage()
57 ->internal()
58 ->gui()
59 ->layout()
60 ->adminRequest();
61 $this->ref_id = $this->admin_request->getRefId();
62 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

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

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

◆ cancelCreate()

ilPageLayoutAdministrationGUI::cancelCreate ( )

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

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

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

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

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

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

119 : bool {
120 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
121 if ($a_throw_exc) {
122 throw new ilObjectException($this->lng->txt("permission_denied"));
123 }
124 return false;
125 }
126 return true;
127 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

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

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

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

◆ deletePgl()

ilPageLayoutAdministrationGUI::deletePgl ( )

display deletion confirmation screen

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

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

340 : void
341 {
342 $this->checkPermission("sty_write_page_layout");
343
344 $this->ctrl->setCmdClass("ilpagelayoutgui");
345 $this->ctrl->setCmd("edit");
346 $this->executeCommand();
347 }
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 64 of file class.ilPageLayoutAdministrationGUI.php.

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

353 : void
354 {
355 $exp = new ilExport();
356
357 $tmpdir = ilFileUtils::ilTempnam();
358 ilFileUtils::makeDir($tmpdir);
359 $succ = $exp->exportEntity(
360 "pgtp",
361 $this->admin_request->getObjId(),
362 "4.2.0",
363 "Services/COPage",
364 "Title",
365 $tmpdir
366 );
367
368 if (is_file($succ["directory"] . "/" . $succ["file"])) {
370 $succ["directory"] . "/" . $succ["file"],
371 $succ["file"],
372 "",
373 false,
374 false,
375 false
376 );
377 }
378 if (is_file($succ["directory"] . "/" . $succ["file"])) {
379 unlink($succ["directory"] . "/" . $succ["file"]);
380 }
381 if (is_dir($succ["directory"])) {
382 //unlink($succ["directory"]);
383 }
384 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 420 of file class.ilPageLayoutAdministrationGUI.php.

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

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

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )

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

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

References ILIAS\LTI\ToolProvider\$key, 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 398 of file class.ilPageLayoutAdministrationGUI.php.

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

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