ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
15 
16  function __construct($a_parent_obj, $a_parent_cmd)
17  {
18  global $ilCtrl, $lng, $rbacsystem;
19 
20  $lng->loadLanguageModule("content");
21 
22  parent::__construct($a_parent_obj, $a_parent_cmd);
23  $this->addColumn("", "", "2%");
24 
25  $this->addColumn($lng->txt("active"));
26  $this->addColumn($lng->txt("thumbnail"));
27  $this->addColumn($lng->txt("title"));
28  $this->addColumn($lng->txt("description"));
29  $this->addColumn($lng->txt("obj_sty"));
30  $this->addColumn($lng->txt("type"));
31  $this->addColumn($lng->txt("modules"));
32  $this->addColumn($lng->txt("actions"));
33 
34  // show command buttons, if write permission is given
35  if ($a_parent_obj->checkPermission("sty_write_page_layout", false))
36  {
37  $this->addMultiCommand("activate", $lng->txt("activate"));
38  $this->addMultiCommand("deactivate", $lng->txt("deactivate"));
39  $this->addMultiCommand("deletePgl", $lng->txt("delete"));
40  $this->addCommandButton("savePageLayoutTypes", $lng->txt("cont_save_types"));
41  }
42 
43  $this->getPageLayouts();
44 
45  $this->setSelectAllCheckbox("pglayout");
46  $this->setEnableHeader(true);
47  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
48  $this->setRowTemplate("tpl.stys_pglayout_table_row.html",
49  "Services/COPage/Layout");
50  $this->setTitle($lng->txt("page_layouts"));
51 
52  //build form
53  /*
54  $opts = ilUtil::formSelect(12,"new_type",array($lng->txt("page_layout")));
55  $this->tpl->setCurrentBlock("add_object");
56  $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
57  $this->tpl->setVariable("BTN_NAME", "createPgGUI");
58  $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
59  $this->tpl->parseCurrentBlock();
60  */
61  }
62 
66  function getPageLayouts() {
68  $this->all_mods = ilPageLayout::getAvailableModules();
69  }
70 
75  protected function fillRow($a_set)
76  {
77  global $lng, $ilCtrl;
78 
79  // action
80  $ilCtrl->setParameter($this->parent_obj, "layout_id", $a_set['layout_id']);
81 
82  if ($this->parent_obj->checkPermission("sty_write_page_layout", false))
83  {
84  $this->tpl->setCurrentBlock("action");
85  $this->tpl->setVariable("HREF_ACTION",
86  $ilCtrl->getLinkTarget($this->parent_obj, "exportLayout"));
87  $this->tpl->setVariable("TXT_ACTION", $lng->txt("export"));
88  $this->tpl->parseCurrentBlock();
89  }
90 
91  $ilCtrl->setParameter($this->parent_obj, "layout_id", "");
92 
93  // modules
94  $this->tpl->setCurrentBlock("mod");
95  foreach($this->all_mods as $mod_id => $mod_caption)
96  {
97  if(($mod_id == ilPageLayout::MODULE_SCORM && $a_set["mod_scorm"]) ||
98  ($mod_id == ilPageLayout::MODULE_PORTFOLIO && $a_set["mod_portfolio"]))
99  {
100  $this->tpl->setVariable("MOD_STATUS", " checked=\"checked\"");
101  }
102  $this->tpl->setVariable("MODULE_ID", $mod_id);
103  $this->tpl->setVariable("LAYOUT_ID", $a_set["layout_id"]);
104  $this->tpl->setVariable("MOD_NAME", $mod_caption);
105  $this->tpl->parseCurrentBlock();
106  }
107 
108  if ($a_set['active'])
109  {
110  $this->tpl->setVariable("IMG_ACTIVE",ilUtil::getImagePath("icon_ok.svg"));
111  }
112  else
113  {
114  $this->tpl->setVariable("IMG_ACTIVE",ilUtil::getImagePath("icon_not_ok.svg"));
115  }
116  $this->tpl->setVariable("VAL_TITLE", $a_set['title']);
117  $this->tpl->setVariable("VAL_DESCRIPTION", $a_set['description']);
118  $this->tpl->setVariable("CHECKBOX_ID", $a_set['layout_id']);
119 
120  $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set['layout_id']);
121  if ($this->parent_obj->checkPermission("sty_write_page_layout", false))
122  {
123  $this->tpl->setVariable("HREF_EDIT_PGLAYOUT", $ilCtrl->getLinkTarget($this->parent_obj, "editPg"));
124  }
125 
126  $pgl_obj = new ilPageLayout($a_set['layout_id']);
127  $this->tpl->setVariable("VAL_PREVIEW_HTML",$pgl_obj->getPreview());
128 
129  if ($a_set["style_id"] > 0)
130  {
131  $this->tpl->setVariable("STYLE",
132  ilObject::_lookupTitle($a_set["style_id"]));
133  }
134 
135  $this->tpl->setVariable("TYPE",
136  ilUtil::formSelect($a_set["special_page"], "type[".$a_set["layout_id"]."]",
137  array("0" => $lng->txt("cont_layout_template"),
138  "1" => $lng->txt("cont_special_page")),
139  false, true)
140  );
141 
142  }
143 
144 }
145 ?>
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd)
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)
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.
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.
global $lng
Definition: privfeed.php:17
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.
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.