ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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$ 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.

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

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  }
settings()
Definition: settings.php:2
$_GET["client_id"]
+ 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 171 of file class.ilPageLayoutAdministrationGUI.php.

References $_POST, and ilUtil\sendInfo().

Referenced by deactivate().

172  {
173  if (!isset($_POST["pglayout"])) {
174  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
175  } else {
176  ilUtil::sendSuccess($this->lng->txt("sty_opt_saved"), true);
177  foreach ($_POST["pglayout"] as $item) {
178  $pg_layout = new ilPageLayout($item);
179  $pg_layout->activate($a_activate);
180  }
181  }
182  $this->ctrl->redirect($this, "listLayouts");
183  }
Class ilPageLayout.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ 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 251 of file class.ilPageLayoutAdministrationGUI.php.

References initAddPageLayoutForm().

Referenced by createPg().

252  {
253  if (!$a_form) {
254  $a_form = $this->initAddPageLayoutForm();
255  }
256 
257  $this->tpl->setContent($a_form->getHTML());
258  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelCreate()

ilPageLayoutAdministrationGUI::cancelCreate ( )

Cancel creation.

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

References listLayouts().

382  {
383  $this->listLayouts();
384  }
+ Here is the call graph for this function:

◆ cancelDeletePg()

ilPageLayoutAdministrationGUI::cancelDeletePg ( )

cancel deletion of Page Layout

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

References ilUtil\sendInfo().

230  {
231  ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
232  $this->ctrl->redirect($this, "listLayouts");
233  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ 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 129 of file class.ilPageLayoutAdministrationGUI.php.

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

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

◆ confirmedDeletePg()

ilPageLayoutAdministrationGUI::confirmedDeletePg ( )

conform deletion of Page Layout

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

References $_POST.

239  {
240  foreach ($_POST["pglayout"] as $id) {
241  $pg_obj = new ilPageLayout($id);
242  $pg_obj->delete();
243  }
244 
245  $this->ctrl->redirect($this, "listLayouts");
246  }
Class ilPageLayout.
$_POST["username"]

◆ createPg()

ilPageLayoutAdministrationGUI::createPg ( )

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

References addPageLayout(), and initAddPageLayoutForm().

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

◆ deactivate()

ilPageLayoutAdministrationGUI::deactivate ( )

Deactivate layout.

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

References activate().

189  {
190  $this->activate(false);
191  }
activate($a_activate=true)
Activate layout.
+ Here is the call graph for this function:

◆ deletePgl()

ilPageLayoutAdministrationGUI::deletePgl ( )

display deletion confirmation screen

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

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

197  {
198  if (!isset($_POST["pglayout"])) {
199  ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
200  $this->ctrl->redirect($this, "listLayouts");
201  }
202 
203  unset($this->data);
204 
205  // display confirmation message
206  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
207  $cgui = new ilConfirmationGUI();
208  $cgui->setFormAction($this->ctrl->getFormAction($this));
209  $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
210  $cgui->setCancel($this->lng->txt("cancel"), "cancelDeletePg");
211  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeletePg");
212 
213  foreach ($_POST["pglayout"] as $id) {
214  $pg_obj = new ilPageLayout($id);
215  $pg_obj->readObject();
216 
217  $caption = ilUtil::getImageTagByType("stys", $this->tpl->tplPath) .
218  " " . $pg_obj->getTitle();
219 
220  $cgui->addItem("pglayout[]", $id, $caption);
221  }
222 
223  $this->tpl->setContent($cgui->getHTML());
224  }
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...
Class ilPageLayout.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ editPg()

ilPageLayoutAdministrationGUI::editPg ( )

Edit page.

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

References checkPermission(), and executeCommand().

390  {
391  $this->checkPermission("sty_write_page_layout");
392 
393  $this->ctrl->setCmdClass("ilpagelayoutgui");
394  $this->ctrl->setCmd("edit");
395  $this->executeCommand();
396  }
checkPermission($a_perm, $a_throw_exc=true)
Check permission.
+ Here is the call graph for this function:

◆ executeCommand()

ilPageLayoutAdministrationGUI::executeCommand ( )

Execute command.

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

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

Referenced by editPg().

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  if ($ret != "") {
107  $this->tpl->setContent($ret);
108  }
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  $this->$cmd();
116  } else {
117  die("Unknown command " . $cmd);
118  }
119  }
120  }
$_GET["client_id"]
Class ilPageLayoutGUI GUI class.
checkPermission($a_perm, $a_throw_exc=true)
Check permission.
$ret
Definition: parser.php:6
+ 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 433 of file class.ilPageLayoutAdministrationGUI.php.

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

434  {
435  include_once("./Services/Export/classes/class.ilExport.php");
436  $exp = new ilExport();
437 
438  $tmpdir = ilUtil::ilTempnam();
439  ilUtil::makeDir($tmpdir);
440 
441  $succ = $exp->exportEntity(
442  "pgtp",
443  (int) $_GET["layout_id"],
444  "4.2.0",
445  "Services/COPage",
446  "Title",
447  $tmpdir
448  );
449 
450  if ($succ["success"]) {
452  $succ["directory"] . "/" . $succ["file"],
453  $succ["file"],
454  "",
455  false,
456  false,
457  false
458  );
459  }
460  if (is_file($succ["directory"] . "/" . $succ["file"])) {
461  unlink($succ["directory"] . "/" . $succ["file"]);
462  }
463  if (is_dir($succ["directory"])) {
464  unlink($succ["directory"]);
465  }
466  }
$_GET["client_id"]
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
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.
+ Here is the call graph for this function:

◆ importPageLayout()

ilPageLayoutAdministrationGUI::importPageLayout ( )

Import page layout.

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

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

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

◆ importPageLayoutForm()

ilPageLayoutAdministrationGUI::importPageLayoutForm ( )

Import page layout.

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

References initPageLayoutImportForm().

472  {
473  $form = $this->initPageLayoutImportForm();
474  $this->tpl->setContent($form->getHTML());
475  }
initPageLayoutImportForm()
Init page layout import form.
+ Here is the call graph for this function:

◆ initAddPageLayoutForm()

ilPageLayoutAdministrationGUI::initAddPageLayoutForm ( )
Returns
ilPropertyFormGUI

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

References $si, ilPageLayout\getAvailableModules(), ilPageLayout\getLayouts(), and ilTextAreaInputGUI\setValue().

Referenced by addPageLayout(), and createPg().

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

References ilFileInputGUI\setSuffixes().

Referenced by importPageLayout(), and importPageLayoutForm().

481  {
482  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
483  $form = new ilPropertyFormGUI();
484 
485  // template file
486  $fi = new ilFileInputGUI($this->lng->txt("file"), "file");
487  $fi->setSuffixes(array("zip"));
488  $fi->setRequired(true);
489  $form->addItem($fi);
490 
491  $form->addCommandButton("importPageLayout", $this->lng->txt("import"));
492  $form->addCommandButton("listLayouts", $this->lng->txt("cancel"));
493 
494  $form->setTitle($this->lng->txt("sty_import_page_layout"));
495  $form->setFormAction($this->ctrl->getFormAction($this));
496 
497  return $form;
498  }
This class represents a property form user interface.
This class represents a file property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listLayouts()

ilPageLayoutAdministrationGUI::listLayouts ( )

view list of page layouts

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

References checkPermission().

Referenced by cancelCreate().

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

References $_POST, $ctrl, $ilCtrl, and $lng.

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

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: