ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilPageLayoutTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Table/classes/class.ilTable2GUI.php");
5 
14 {
18  protected $ctrl;
19 
23  protected $rbacsystem;
24 
25 
26  public function __construct($a_parent_obj, $a_parent_cmd)
27  {
28  global $DIC;
29 
30  $this->ctrl = $DIC->ctrl();
31  $this->lng = $DIC->language();
32  $this->rbacsystem = $DIC->rbac()->system();
33  $ilCtrl = $DIC->ctrl();
34  $lng = $DIC->language();
35  $rbacsystem = $DIC->rbac()->system();
36 
37  $lng->loadLanguageModule("content");
38 
39  parent::__construct($a_parent_obj, $a_parent_cmd);
40  $this->addColumn("", "", "2%");
41 
42  $this->addColumn($lng->txt("active"));
43  $this->addColumn($lng->txt("thumbnail"));
44  $this->addColumn($lng->txt("title"));
45  $this->addColumn($lng->txt("description"));
46  $this->addColumn($lng->txt("obj_sty"));
47  $this->addColumn($lng->txt("type"));
48  $this->addColumn($lng->txt("modules"));
49  $this->addColumn($lng->txt("actions"));
50 
51  // show command buttons, if write permission is given
52  if ($a_parent_obj->checkPermission("sty_write_page_layout", false)) {
53  $this->addMultiCommand("activate", $lng->txt("activate"));
54  $this->addMultiCommand("deactivate", $lng->txt("deactivate"));
55  $this->addMultiCommand("deletePgl", $lng->txt("delete"));
56  $this->addCommandButton("savePageLayoutTypes", $lng->txt("cont_save_types"));
57  }
58 
59  $this->getPageLayouts();
60 
61  $this->setSelectAllCheckbox("pglayout");
62  $this->setEnableHeader(true);
63  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
64  $this->setRowTemplate(
65  "tpl.stys_pglayout_table_row.html",
66  "Services/COPage/Layout"
67  );
68  $this->setTitle($lng->txt("page_layouts"));
69 
70  //build form
71  /*
72  $opts = ilUtil::formSelect(12,"new_type",array($lng->txt("page_layout")));
73  $this->tpl->setCurrentBlock("add_object");
74  $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
75  $this->tpl->setVariable("BTN_NAME", "createPgGUI");
76  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
77  $this->tpl->parseCurrentBlock();
78  */
79  }
80 
84  public function getPageLayouts()
85  {
87  $this->all_mods = ilPageLayout::getAvailableModules();
88  }
89 
94  protected function fillRow($a_set)
95  {
96  $lng = $this->lng;
98 
99  // action
100  $ilCtrl->setParameter($this->parent_obj, "layout_id", $a_set['layout_id']);
101 
102  if ($this->parent_obj->checkPermission("sty_write_page_layout", false)) {
103  $this->tpl->setCurrentBlock("action");
104  $this->tpl->setVariable(
105  "HREF_ACTION",
106  $ilCtrl->getLinkTarget($this->parent_obj, "exportLayout")
107  );
108  $this->tpl->setVariable("TXT_ACTION", $lng->txt("export"));
109  $this->tpl->parseCurrentBlock();
110  }
111 
112  $ilCtrl->setParameter($this->parent_obj, "layout_id", "");
113 
114  // modules
115  $this->tpl->setCurrentBlock("mod");
116  foreach ($this->all_mods as $mod_id => $mod_caption) {
117  if (($mod_id == ilPageLayout::MODULE_SCORM && $a_set["mod_scorm"]) ||
118  ($mod_id == ilPageLayout::MODULE_PORTFOLIO && $a_set["mod_portfolio"])) {
119  $this->tpl->setVariable("MOD_STATUS", " checked=\"checked\"");
120  }
121  $this->tpl->setVariable("MODULE_ID", $mod_id);
122  $this->tpl->setVariable("LAYOUT_ID", $a_set["layout_id"]);
123  $this->tpl->setVariable("MOD_NAME", $mod_caption);
124  $this->tpl->parseCurrentBlock();
125  }
126 
127  if ($a_set['active']) {
128  $this->tpl->setVariable("IMG_ACTIVE", ilUtil::getImagePath("icon_ok.svg"));
129  } else {
130  $this->tpl->setVariable("IMG_ACTIVE", ilUtil::getImagePath("icon_not_ok.svg"));
131  }
132  $this->tpl->setVariable("VAL_TITLE", $a_set['title']);
133  $this->tpl->setVariable("VAL_DESCRIPTION", $a_set['description']);
134  $this->tpl->setVariable("CHECKBOX_ID", $a_set['layout_id']);
135 
136  $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set['layout_id']);
137  if ($this->parent_obj->checkPermission("sty_write_page_layout", false)) {
138  $this->tpl->setVariable("HREF_EDIT_PGLAYOUT", $ilCtrl->getLinkTarget($this->parent_obj, "editPg"));
139  }
140 
141  $pgl_obj = new ilPageLayout($a_set['layout_id']);
142  $this->tpl->setVariable("VAL_PREVIEW_HTML", $pgl_obj->getPreview());
143 
144  if ($a_set["style_id"] > 0) {
145  $this->tpl->setVariable(
146  "STYLE",
147  ilObject::_lookupTitle($a_set["style_id"])
148  );
149  }
150 
151  $this->tpl->setVariable(
152  "TYPE",
154  $a_set["special_page"],
155  "type[" . $a_set["layout_id"] . "]",
156  array("0" => $lng->txt("cont_layout_template"),
157  "1" => $lng->txt("cont_special_page")),
158  false,
159  true
160  )
161  );
162  }
163 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd)
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
Class ilPageLayout.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
TableGUI class for page layouts.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getPageLayouts()
Get a List of all Page Layouts.
static getAvailableModules()
addMultiCommand($a_cmd, $a_text)
Add Command button.
fillRow($a_set)
Standard Version of Fill Row.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
static getLayoutsAsArray($a_active=0)
Static access functions.
setEnableHeader($a_enableheader)
Set Enable Header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.