ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 174 of file class.ilPageLayoutAdministrationGUI.php.

175 {
176 if (!isset($_POST["pglayout"]))
177 {
178 ilUtil::sendInfo($this->lng->txt("no_checkbox"),true);
179 }
180 else
181 {
182 ilUtil::sendSuccess($this->lng->txt("sty_opt_saved"),true);
183 foreach ($_POST["pglayout"] as $item)
184 {
185 $pg_layout = new ilPageLayout($item);
186 $pg_layout->activate($a_activate);
187 }
188 }
189 $this->ctrl->redirect($this, "listLayouts");
190 }
$_POST["username"]
Class ilPageLayout.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_POST, ilUtil\sendInfo(), and ilUtil\sendSuccess().

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

262 {
263 if(!$a_form)
264 {
265 $a_form = $this->initAddPageLayoutForm();
266 }
267
268 $this->tpl->setContent($a_form->getHTML());
269 }

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

400 {
401 $this->listLayouts();
402 }

References listLayouts().

+ Here is the call graph for this function:

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

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

239 {
240 ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
241 $this->ctrl->redirect($this, "listLayouts");
242 }

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

133 {
134 if (!$this->rbacsystem->checkAccess($a_perm, $this->ref_id))
135 {
136 if ($a_throw_exc)
137 {
138 include_once "Services/Object/exceptions/class.ilObjectException.php";
139 throw new ilObjectException($this->lng->txt("permission_denied"));
140 }
141 return false;
142 }
143 return true;
144 }
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 247 of file class.ilPageLayoutAdministrationGUI.php.

248 {
249 foreach ($_POST["pglayout"] as $id)
250 {
251 $pg_obj = new ilPageLayout($id);
252 $pg_obj->delete();
253 }
254
255 $this->ctrl->redirect($this, "listLayouts");
256 }

References $_POST.

◆ createPg()

ilPageLayoutAdministrationGUI::createPg ( )

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

353 {
354 $form_gui = $this->initAddPageLayoutForm();
355 if(!$form_gui->checkInput())
356 {
357 $form_gui->setValuesByPost();
358 $this->addPageLayout($form_gui);
359 return;
360 }
361
362 //create Page-Layout-Object first
363 $pg_object = new ilPageLayout();
364 $pg_object->setTitle($form_gui->getInput('pgl_title'));
365 $pg_object->setDescription($form_gui->getInput('pgl_desc'));
366 $pg_object->setSpecialPage($form_gui->getInput('special_page'));
367 $pg_object->setModules($form_gui->getInput('module'));
368 $pg_object->update();
369
370 include_once("./Services/COPage/Layout/classes/class.ilPageLayoutPage.php");
371
372 //create Page
373 if(!is_object($pg_content))
374 {
375 $this->pg_content = new ilPageLayoutPage();
376 }
377
378 $this->pg_content->setId($pg_object->getId());
379
380 $tmpl = $form_gui->getInput('pgl_template');
381 if ($tmpl != "-1")
382 {
383 $layout_obj = new ilPageLayout($tmpl);
384 $this->pg_content->setXMLContent($layout_obj->getXMLContent());
385 $this->pg_content->create(false);
386 }
387 else
388 {
389 $this->pg_content->create(false);
390 }
391
392 $this->ctrl->setParameterByClass("ilpagelayoutgui", "obj_id", $pg_object->getId());
393 $this->ctrl->redirectByClass("ilpagelayoutgui", "edit");
394 }
Page layout page object.

References addPageLayout(), and initAddPageLayoutForm().

+ Here is the call graph for this function:

◆ deactivate()

ilPageLayoutAdministrationGUI::deactivate ( )

Deactivate layout.

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

196 {
197 $this->activate(false);
198 }
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 203 of file class.ilPageLayoutAdministrationGUI.php.

204 {
205 if(!isset($_POST["pglayout"]))
206 {
207 ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
208 $this->ctrl->redirect($this, "listLayouts");
209 }
210
211 unset($this->data);
212
213 // display confirmation message
214 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
215 $cgui = new ilConfirmationGUI();
216 $cgui->setFormAction($this->ctrl->getFormAction($this));
217 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
218 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeletePg");
219 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeletePg");
220
221 foreach($_POST["pglayout"] as $id)
222 {
223 $pg_obj = new ilPageLayout($id);
224 $pg_obj->readObject();
225
226 $caption = ilUtil::getImageTagByType("stys", $this->tpl->tplPath).
227 " ".$pg_obj->getTitle();
228
229 $cgui->addItem("pglayout[]", $id, $caption);
230 }
231
232 $this->tpl->setContent($cgui->getHTML());
233 }
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.

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

+ Here is the call graph for this function:

◆ editPg()

ilPageLayoutAdministrationGUI::editPg ( )

Edit page.

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

408 {
409 $this->checkPermission("sty_write_page_layout");
410
411 $this->ctrl->setCmdClass("ilpagelayoutgui");
412 $this->ctrl->setCmd("edit");
413 $this->executeCommand();
414 }
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 {
81 $this->checkPermission("read");
82 }
83 else
84 {
85 $this->checkPermission("sty_write_page_layout");
86 }
87
88 switch ($next_class)
89 {
90 case 'ilpagelayoutgui':
91 $this->tabs->clearTargets();
92 include_once("./Services/COPage/Layout/classes/class.ilPageLayoutGUI.php");
93// $this->tpl->getStandardTemplate();
94
95 $this->tabs->setBackTarget($this->lng->txt("page_layouts"),
96 $this->ctrl->getLinkTarget($this, "listLayouts"));
97
98 $this->ctrl->setReturn($this, "listLayouts");
99 if ($this->pg_id!=null) {
100 $layout_gui = new ilPageLayoutGUI("stys", $this->pg_id);
101 } else {
102 $layout_gui = new ilPageLayoutGUI("stys", $_GET["obj_id"]);
103 }
104 $layout_gui->setTabs();
105 $layout_gui->setEditPreview(true);
106 $this->ctrl->saveParameter($this, "obj_id");
107 $ret = $this->ctrl->forwardCommand($layout_gui);
108 $this->tpl->setContent($ret);
109 break;
110
111 default:
112 if (in_array($cmd, array("listLayouts", "editPg", "addPageLayout", "cancelCreate", "createPg", "exportLayout",
113 "savePageLayoutTypes", "activate", "deactivate", "importPageLayoutForm", "deletePgl", "cancelDeletePg",
114 "confirmedDeletePg", "importPageLayout")))
115 {
116 $this->$cmd();
117 }
118 else
119 {
120 die("Unknown command ".$cmd);
121 }
122 }
123 }
Class ilPageLayoutGUI GUI class.
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35

References $_GET, $cmd, $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 456 of file class.ilPageLayoutAdministrationGUI.php.

457 {
458 include_once("./Services/Export/classes/class.ilExport.php");
459 $exp = new ilExport();
460
461 $tmpdir = ilUtil::ilTempnam();
462 ilUtil::makeDir($tmpdir);
463
464 $succ = $exp->exportEntity("pgtp", (int) $_GET["layout_id"], "4.2.0",
465 "Services/COPage", "Title", $tmpdir);
466
467 if ($succ["success"])
468 {
469 ilUtil::deliverFile($succ["directory"]."/".$succ["file"], $succ["file"],
470 "", false, false, false);
471 }
472 if (is_file($succ["directory"]."/".$succ["file"]))
473 {
474 unlink($succ["directory"]."/".$succ["file"]);
475 }
476 if (is_dir($succ["directory"]))
477 {
478 unlink($succ["directory"]);
479 }
480 }
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable 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 517 of file class.ilPageLayoutAdministrationGUI.php.

518 {
519 $form = $this->initPageLayoutImportForm();
520 if ($form->checkInput())
521 {
522 include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
523 $pg = ilPageLayout::import($_FILES["file"]["name"], $_FILES["file"]["tmp_name"]);
524 if ($pg > 0)
525 {
526 ilUtil::sendSuccess($this->lng->txt("sty_imported_layout"), true);
527 }
528 $this->ctrl->redirect($this, "listLayouts");
529 }
530 else
531 {
532 $form->setValuesByPost();
533 $this->tpl->setContent($form->getHtml());
534 }
535 }
initPageLayoutImportForm()
Init page layout import form.
static import($a_filename, $a_filepath)
Import page layout.

References ilPageLayout\import(), initPageLayoutImportForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ importPageLayoutForm()

ilPageLayoutAdministrationGUI::importPageLayoutForm ( )

Import page layout.

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

486 {
487 $form = $this->initPageLayoutImportForm();
488 $this->tpl->setContent($form->getHTML());
489 }

References initPageLayoutImportForm().

+ Here is the call graph for this function:

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )
Returns
ilPropertyFormGUI

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

275 {
276 $this->lng->loadLanguageModule("content");
277
278 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
279 $form_gui = new ilPropertyFormGUI();
280 $form_gui->setFormAction($this->ctrl->getFormAction($this));
281 $form_gui->setTitle($this->lng->txt("sty_create_pgl"));
282
283 $title_input = new ilTextInputGUI($this->lng->txt("title"),"pgl_title");
284 $title_input->setSize(50);
285 $title_input->setMaxLength(128);
286 $title_input->setValue($this->layout_object->title);
287 $title_input->setTitle($this->lng->txt("title"));
288 $title_input->setRequired(true);
289
290 $desc_input = new ilTextAreaInputGUI($this->lng->txt("description"),"pgl_desc");
291 $desc_input->setValue($this->layout_object->description);
292 $desc_input->setRows(3);
293 $desc_input->setCols(37);
294
295 // special page?
296 $options = array(
297 "0" => $this->lng->txt("cont_layout_template"),
298 "1" => $this->lng->txt("cont_special_page"),
299 );
300 $si = new ilSelectInputGUI($this->lng->txt("type"), "special_page");
301 $si->setOptions($options);
302
303 // modules
304 $mods = new ilCheckboxGroupInputGUI($this->lng->txt("modules"), "module");
305 // $mods->setRequired(true);
306 foreach(ilPageLayout::getAvailableModules() as $mod_id => $mod_caption)
307 {
308 $mod = new ilCheckboxOption($mod_caption, $mod_id);
309 $mods->addOption($mod);
310 }
311
312 $ttype_input = new ilSelectInputGUI($this->lng->txt("sty_based_on"), "pgl_template");
313
314 $arr_templates = ilPageLayout::getLayouts();
315 $arr_templates1 = ilPageLayout::getLayouts(false, true);
316 foreach ($arr_templates1 as $v)
317 {
318 $arr_templates[] = $v;
319 }
320
321 $options = array();
322 $options['-1'] = $this->lng->txt("none");
323
324 foreach ($arr_templates as $templ) {
325 $templ->readObject();
326 $key = $templ->getId();
327 $value = $templ->getTitle();
328 $options[$key] = $value;
329 }
330
331 $ttype_input->setOptions($options);
332 $ttype_input->setValue(-1);
333 $ttype_input->setRequired(true);
334
335 $desc_input->setTitle($this->lng->txt("description"));
336 $desc_input->setRequired(false);
337
338 $form_gui->addItem($title_input);
339 $form_gui->addItem($desc_input);
340 $form_gui->addItem($si);
341 $form_gui->addItem($mods);
342 $form_gui->addItem($ttype_input);
343
344
345 $form_gui->addCommandButton("createPg", $this->lng->txt("save"));
346 $form_gui->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
347
348 return $form_gui;
349 }
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.
if(!is_array($argv)) $options

References $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 494 of file class.ilPageLayoutAdministrationGUI.php.

495 {
496 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
497 $form = new ilPropertyFormGUI();
498
499 // template file
500 $fi = new ilFileInputGUI($this->lng->txt("file"), "file");
501 $fi->setSuffixes(array("zip"));
502 $fi->setRequired(true);
503 $form->addItem($fi);
504
505 $form->addCommandButton("importPageLayout", $this->lng->txt("import"));
506 $form->addCommandButton("listLayouts", $this->lng->txt("cancel"));
507
508 $form->setTitle($this->lng->txt("sty_import_page_layout"));
509 $form->setFormAction($this->ctrl->getFormAction($this));
510
511 return $form;
512 }
This class represents a file property in a property 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 149 of file class.ilPageLayoutAdministrationGUI.php.

150 {
151 // show toolbar, if write permission is given
152 if ($this->checkPermission("sty_write_page_layout", false))
153 {
154 $this->toolbar->addButton($this->lng->txt("sty_add_pgl"),
155 $this->ctrl->getLinkTarget($this, "addPageLayout"));
156 $this->toolbar->addButton($this->lng->txt("sty_import_page_layout"),
157 $this->ctrl->getLinkTarget($this, "importPageLayoutForm"));
158 }
159
160 $oa_tpl = new ilTemplate("tpl.stys_pglayout.html", true, true, "Services/COPage/Layout");
161
162 include_once("./Services/COPage/Layout/classes/class.ilPageLayoutTableGUI.php");
163 $pglayout_table = new ilPageLayoutTableGUI($this, "listLayouts");
164 $oa_tpl->setVariable("PGLAYOUT_TABLE", $pglayout_table->getHTML());
165 $this->tpl->setContent($oa_tpl->get());
166
167 }
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 419 of file class.ilPageLayoutAdministrationGUI.php.

420 {
421 global $lng, $ilCtrl;
422
423 include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
424
425 if (is_array($_POST["type"]))
426 {
427 foreach($_POST["type"] as $id => $t)
428 {
429 if ($id > 0)
430 {
431 $l = new ilPageLayout($id);
432 $l->readObject();
433 $l->setSpecialPage($t);
434 if(is_array($_POST["module"][$id]))
435 {
436 $l->setModules(array_keys($_POST["module"][$id]));
437 }
438 else
439 {
440 $l->setModules();
441 }
442 $l->update();
443 }
444 }
445
446 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"));
447 }
448
449 $this->ctrl->redirect($this, "listLayouts");
450 }
global $l
Definition: afr.php:30
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ilCtrl, $l, $lng, $t, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilPageLayoutAdministrationGUI::$ctrl
protected

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

◆ $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: