ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPageLayoutAdministrationGUI Class Reference

Administration for page layouts. More...

+ Collaboration diagram for ilPageLayoutAdministrationGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 checkPermission ($a_perm, $a_throw_exc=true)
 Check permission. More...
 
 listLayouts ()
 view list of page layouts More...
 
 activate ($a_activate=true)
 Activate layout. More...
 
 deactivate ()
 Deactivate layout. More...
 
 deletePgl ()
 display deletion confirmation screen More...
 
 cancelDeletePg ()
 cancel deletion of Page Layout More...
 
 confirmedDeletePg ()
 conform deletion of Page Layout More...
 
 addPageLayout ($a_form=null)
 
 initAddPageLayoutForm ()
 
 createPg ()
 
 cancelCreate ()
 Cancel creation. More...
 
 editPg ()
 Edit page. More...
 
 savePageLayoutTypes ()
 Save page layout types. More...
 
 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

 $ctrl
 
 $rbacsystem
 
 $toolbar
 
 $lng
 
 $tpl
 
 $DIC
 
 $ref_id
 

Detailed Description

Administration for page layouts.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ @ilCtrl_Calls ilPageLayoutAdministrationGUI: ilPageLayoutGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPageLayoutAdministrationGUI::__construct ( )

Constructor.

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

54 {
55 global $DIC;
56
57 $this->dic = $DIC;
58 $this->ctrl = $DIC->ctrl();
59 $this->rbacsystem = $DIC->rbac()->system();
60 $this->toolbar = $DIC->toolbar();
61 $this->lng = $DIC->language();
62 $this->tpl = $DIC["tpl"];
63 $this->ref_id = (int) $_GET["ref_id"];
64 $this->tabs = $DIC["ilTabs"];
65
66
67 include_once("./Services/Style/Content/classes/class.ilContentStyleSettings.php");
68 $this->settings = new ilContentStyleSettings();
69 }
$_GET["client_id"]
settings()
Definition: settings.php:2

References $_GET, $DIC, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ activate()

ilPageLayoutAdministrationGUI::activate (   $a_activate = true)

Activate layout.

Parameters
bool$a_activate

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

170 {
171 if (!isset($_POST["pglayout"])) {
172 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
173 } else {
174 ilUtil::sendSuccess($this->lng->txt("sty_opt_saved"), true);
175 foreach ($_POST["pglayout"] as $item) {
176 $pg_layout = new ilPageLayout($item);
177 $pg_layout->activate($a_activate);
178 }
179 }
180 $this->ctrl->redirect($this, "listLayouts");
181 }
$_POST["username"]
Class ilPageLayout.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_POST, and ilUtil\sendInfo().

Referenced by deactivate().

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

◆ addPageLayout()

ilPageLayoutAdministrationGUI::addPageLayout (   $a_form = null)
Parameters
null | ilPropertyFormGUI$a_form

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

250 {
251 if (!$a_form) {
252 $a_form = $this->initAddPageLayoutForm();
253 }
254
255 $this->tpl->setContent($a_form->getHTML());
256 }

References initAddPageLayoutForm().

Referenced by createPg().

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

◆ cancelCreate()

ilPageLayoutAdministrationGUI::cancelCreate ( )

Cancel creation.

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

380 {
381 $this->listLayouts();
382 }

References listLayouts().

+ Here is the call graph for this function:

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

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

228 {
229 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
230 $this->ctrl->redirect($this, "listLayouts");
231 }

References ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ checkPermission()

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

Check permission.

Parameters
string$a_permpermission(s)
Returns
bool
Exceptions
ilObjectException

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

128 {
129 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id)) {
130 if ($a_throw_exc) {
131 include_once "Services/Object/exceptions/class.ilObjectException.php";
132 throw new ilObjectException($this->lng->txt("permission_denied"));
133 }
134 return false;
135 }
136 return true;
137 }
Base exception class for object service.

Referenced by editPg(), executeCommand(), and listLayouts().

+ Here is the caller graph for this function:

◆ confirmedDeletePg()

ilPageLayoutAdministrationGUI::confirmedDeletePg ( )

conform deletion of Page Layout

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

237 {
238 foreach ($_POST["pglayout"] as $id) {
239 $pg_obj = new ilPageLayout($id);
240 $pg_obj->delete();
241 }
242
243 $this->ctrl->redirect($this, "listLayouts");
244 }
if(!array_key_exists('StateId', $_REQUEST)) $id

References $_POST, and $id.

◆ createPg()

ilPageLayoutAdministrationGUI::createPg ( )

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

338 {
339 $form_gui = $this->initAddPageLayoutForm();
340 if (!$form_gui->checkInput()) {
341 $form_gui->setValuesByPost();
342 $this->addPageLayout($form_gui);
343 return;
344 }
345
346 //create Page-Layout-Object first
347 $pg_object = new ilPageLayout();
348 $pg_object->setTitle($form_gui->getInput('pgl_title'));
349 $pg_object->setDescription($form_gui->getInput('pgl_desc'));
350 $pg_object->setSpecialPage($form_gui->getInput('special_page'));
351 $pg_object->setModules($form_gui->getInput('module'));
352 $pg_object->update();
353
354 include_once("./Services/COPage/Layout/classes/class.ilPageLayoutPage.php");
355
356 //create Page
357 if (!is_object($pg_content)) {
358 $this->pg_content = new ilPageLayoutPage();
359 }
360
361 $this->pg_content->setId($pg_object->getId());
362
363 $tmpl = $form_gui->getInput('pgl_template');
364 if ($tmpl != "-1") {
365 $layout_obj = new ilPageLayout($tmpl);
366 $this->pg_content->setXMLContent($layout_obj->getXMLContent());
367 $this->pg_content->create(false);
368 } else {
369 $this->pg_content->create(false);
370 }
371
372 $this->ctrl->setParameterByClass("ilpagelayoutgui", "obj_id", $pg_object->getId());
373 $this->ctrl->redirectByClass("ilpagelayoutgui", "edit");
374 }
Page layout page object.

References addPageLayout(), and initAddPageLayoutForm().

+ Here is the call graph for this function:

◆ deactivate()

ilPageLayoutAdministrationGUI::deactivate ( )

Deactivate layout.

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

187 {
188 $this->activate(false);
189 }
activate($a_activate=true)
Activate layout.

References activate().

+ Here is the call graph for this function:

◆ deletePgl()

ilPageLayoutAdministrationGUI::deletePgl ( )

display deletion confirmation screen

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

195 {
196 if (!isset($_POST["pglayout"])) {
197 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
198 $this->ctrl->redirect($this, "listLayouts");
199 }
200
201 unset($this->data);
202
203 // display confirmation message
204 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
205 $cgui = new ilConfirmationGUI();
206 $cgui->setFormAction($this->ctrl->getFormAction($this));
207 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
208 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeletePg");
209 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeletePg");
210
211 foreach ($_POST["pglayout"] as $id) {
212 $pg_obj = new ilPageLayout($id);
213 $pg_obj->readObject();
214
215 $caption = ilUtil::getImageTagByType("stys", $this->tpl->tplPath) .
216 " " . $pg_obj->getTitle();
217
218 $cgui->addItem("pglayout[]", $id, $caption);
219 }
220
221 $this->tpl->setContent($cgui->getHTML());
222 }
Confirmation screen class.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$this data['403_header']

References $_POST, $id, data, ilUtil\getImageTagByType(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ editPg()

ilPageLayoutAdministrationGUI::editPg ( )

Edit page.

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

388 {
389 $this->checkPermission("sty_write_page_layout");
390
391 $this->ctrl->setCmdClass("ilpagelayoutgui");
392 $this->ctrl->setCmd("edit");
393 $this->executeCommand();
394 }
checkPermission($a_perm, $a_throw_exc=true)
Check permission.

References checkPermission(), and executeCommand().

+ Here is the call graph for this function:

◆ executeCommand()

ilPageLayoutAdministrationGUI::executeCommand ( )

Execute command.

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

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

References $_GET, $ret, and checkPermission().

Referenced by editPg().

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

◆ exportLayout()

ilPageLayoutAdministrationGUI::exportLayout ( )

Export page layout template object.

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

432 {
433 include_once("./Services/Export/classes/class.ilExport.php");
434 $exp = new ilExport();
435
436 $tmpdir = ilUtil::ilTempnam();
437 ilUtil::makeDir($tmpdir);
438
439 $succ = $exp->exportEntity(
440 "pgtp",
441 (int) $_GET["layout_id"],
442 "4.2.0",
443 "Services/COPage",
444 "Title",
445 $tmpdir
446 );
447
448 if ($succ["success"]) {
450 $succ["directory"] . "/" . $succ["file"],
451 $succ["file"],
452 "",
453 false,
454 false,
455 false
456 );
457 }
458 if (is_file($succ["directory"] . "/" . $succ["file"])) {
459 unlink($succ["directory"] . "/" . $succ["file"]);
460 }
461 if (is_dir($succ["directory"])) {
462 unlink($succ["directory"]);
463 }
464 }
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References $_GET, ilUtil\deliverFile(), ilUtil\ilTempnam(), and ilUtil\makeDir().

+ Here is the call graph for this function:

◆ importPageLayout()

ilPageLayoutAdministrationGUI::importPageLayout ( )

Import page layout.

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

502 {
504 if ($form->checkInput()) {
505 include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
506 $pg = ilPageLayout::import($_FILES["file"]["name"], $_FILES["file"]["tmp_name"]);
507 if ($pg > 0) {
508 ilUtil::sendSuccess($this->lng->txt("sty_imported_layout"), true);
509 }
510 $this->ctrl->redirect($this, "listLayouts");
511 } else {
512 $form->setValuesByPost();
513 $this->tpl->setContent($form->getHtml());
514 }
515 }
initPageLayoutImportForm()
Init page layout import form.
static import($a_filename, $a_filepath)
Import page layout.
if(isset($_POST['submit'])) $form

References $form, ilPageLayout\import(), and initPageLayoutImportForm().

+ Here is the call graph for this function:

◆ importPageLayoutForm()

ilPageLayoutAdministrationGUI::importPageLayoutForm ( )

Import page layout.

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

470 {
472 $this->tpl->setContent($form->getHTML());
473 }

References $form, and initPageLayoutImportForm().

+ Here is the call graph for this function:

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )
Returns
ilPropertyFormGUI

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

262 {
263 $this->lng->loadLanguageModule("content");
264
265 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
266 $form_gui = new ilPropertyFormGUI();
267 $form_gui->setFormAction($this->ctrl->getFormAction($this));
268 $form_gui->setTitle($this->lng->txt("sty_create_pgl"));
269
270 $title_input = new ilTextInputGUI($this->lng->txt("title"), "pgl_title");
271 $title_input->setSize(50);
272 $title_input->setMaxLength(128);
273 $title_input->setValue($this->layout_object->title);
274 $title_input->setTitle($this->lng->txt("title"));
275 $title_input->setRequired(true);
276
277 $desc_input = new ilTextAreaInputGUI($this->lng->txt("description"), "pgl_desc");
278 $desc_input->setValue($this->layout_object->description);
279 $desc_input->setRows(3);
280 $desc_input->setCols(37);
281
282 // special page?
283 $options = array(
284 "0" => $this->lng->txt("cont_layout_template"),
285 "1" => $this->lng->txt("cont_special_page"),
286 );
287 $si = new ilSelectInputGUI($this->lng->txt("type"), "special_page");
288 $si->setOptions($options);
289
290 // modules
291 $mods = new ilCheckboxGroupInputGUI($this->lng->txt("modules"), "module");
292 // $mods->setRequired(true);
293 foreach (ilPageLayout::getAvailableModules() as $mod_id => $mod_caption) {
294 $mod = new ilCheckboxOption($mod_caption, $mod_id);
295 $mods->addOption($mod);
296 }
297
298 $ttype_input = new ilSelectInputGUI($this->lng->txt("sty_based_on"), "pgl_template");
299
300 $arr_templates = ilPageLayout::getLayouts();
301 $arr_templates1 = ilPageLayout::getLayouts(false, true);
302 foreach ($arr_templates1 as $v) {
303 $arr_templates[] = $v;
304 }
305
306 $options = array();
307 $options['-1'] = $this->lng->txt("none");
308
309 foreach ($arr_templates as $templ) {
310 $templ->readObject();
311 $key = $templ->getId();
312 $value = $templ->getTitle();
313 $options[$key] = $value;
314 }
315
316 $ttype_input->setOptions($options);
317 $ttype_input->setValue(-1);
318 $ttype_input->setRequired(true);
319
320 $desc_input->setTitle($this->lng->txt("description"));
321 $desc_input->setRequired(false);
322
323 $form_gui->addItem($title_input);
324 $form_gui->addItem($desc_input);
325 $form_gui->addItem($si);
326 $form_gui->addItem($mods);
327 $form_gui->addItem($ttype_input);
328
329
330 $form_gui->addCommandButton("createPg", $this->lng->txt("save"));
331 $form_gui->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
332
333 return $form_gui;
334 }
This class represents a property in a property form.
This class represents an option in a checkbox group.
static getAvailableModules()
static getLayouts($a_active=false, $a_special_page=false, $a_module=null)
Get layouts.
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.
$key
Definition: croninfo.php:18

References $key, PHPMailer\PHPMailer\$options, $si, ilPageLayout\getAvailableModules(), and ilPageLayout\getLayouts().

Referenced by addPageLayout(), and createPg().

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

◆ initPageLayoutImportForm()

ilPageLayoutAdministrationGUI::initPageLayoutImportForm ( )

Init page layout import form.

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

479 {
480 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
481 $form = new ilPropertyFormGUI();
482
483 // template file
484 $fi = new ilFileInputGUI($this->lng->txt("file"), "file");
485 $fi->setSuffixes(array("zip"));
486 $fi->setRequired(true);
487 $form->addItem($fi);
488
489 $form->addCommandButton("importPageLayout", $this->lng->txt("import"));
490 $form->addCommandButton("listLayouts", $this->lng->txt("cancel"));
491
492 $form->setTitle($this->lng->txt("sty_import_page_layout"));
493 $form->setFormAction($this->ctrl->getFormAction($this));
494
495 return $form;
496 }
This class represents a file property in a property form.

References $form.

Referenced by importPageLayout(), and importPageLayoutForm().

+ Here is the caller graph for this function:

◆ listLayouts()

ilPageLayoutAdministrationGUI::listLayouts ( )

view list of page layouts

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

143 {
144 // show toolbar, if write permission is given
145 if ($this->checkPermission("sty_write_page_layout", false)) {
146 $this->toolbar->addButton(
147 $this->lng->txt("sty_add_pgl"),
148 $this->ctrl->getLinkTarget($this, "addPageLayout")
149 );
150 $this->toolbar->addButton(
151 $this->lng->txt("sty_import_page_layout"),
152 $this->ctrl->getLinkTarget($this, "importPageLayoutForm")
153 );
154 }
155
156 $oa_tpl = new ilTemplate("tpl.stys_pglayout.html", true, true, "Services/COPage/Layout");
157
158 include_once("./Services/COPage/Layout/classes/class.ilPageLayoutTableGUI.php");
159 $pglayout_table = new ilPageLayoutTableGUI($this, "listLayouts");
160 $oa_tpl->setVariable("PGLAYOUT_TABLE", $pglayout_table->getHTML());
161 $this->tpl->setContent($oa_tpl->get());
162 }
TableGUI class for page layouts.
special template class to simplify handling of ITX/PEAR

References checkPermission().

Referenced by cancelCreate().

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

◆ savePageLayoutTypes()

ilPageLayoutAdministrationGUI::savePageLayoutTypes ( )

Save page layout types.

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

400 {
403
404 include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
405
406 if (is_array($_POST["type"])) {
407 foreach ($_POST["type"] as $id => $t) {
408 if ($id > 0) {
409 $l = new ilPageLayout($id);
410 $l->readObject();
411 $l->setSpecialPage($t);
412 if (is_array($_POST["module"][$id])) {
413 $l->setModules(array_keys($_POST["module"][$id]));
414 } else {
415 $l->setModules();
416 }
417 $l->update();
418 }
419 }
420
421 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
422 }
423
424 $this->ctrl->redirect($this, "listLayouts");
425 }
global $l
Definition: afr.php:30
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ctrl, $id, $ilCtrl, $l, $lng, and $t.

Field Documentation

◆ $ctrl

ilPageLayoutAdministrationGUI::$ctrl
protected

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

Referenced by savePageLayoutTypes().

◆ $DIC

ilPageLayoutAdministrationGUI::$DIC
protected

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

Referenced by __construct().

◆ $lng

ilPageLayoutAdministrationGUI::$lng
protected

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

Referenced by savePageLayoutTypes().

◆ $rbacsystem

ilPageLayoutAdministrationGUI::$rbacsystem
protected

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

◆ $ref_id

ilPageLayoutAdministrationGUI::$ref_id
protected

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

◆ $toolbar

ilPageLayoutAdministrationGUI::$toolbar
protected

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

◆ $tpl

ilPageLayoutAdministrationGUI::$tpl
protected

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


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