ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4include_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 {
97 $ilCtrl = $this->ctrl;
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 ($mod_id == ilPageLayout::MODULE_LM && $a_set["mod_lm"])) {
120 $this->tpl->setVariable("MOD_STATUS", " checked=\"checked\"");
121 }
122 $this->tpl->setVariable("MODULE_ID", $mod_id);
123 $this->tpl->setVariable("LAYOUT_ID", $a_set["layout_id"]);
124 $this->tpl->setVariable("MOD_NAME", $mod_caption);
125 $this->tpl->parseCurrentBlock();
126 }
127
128 if ($a_set['active']) {
129 $this->tpl->setVariable("IMG_ACTIVE", ilUtil::getImagePath("icon_ok.svg"));
130 } else {
131 $this->tpl->setVariable("IMG_ACTIVE", ilUtil::getImagePath("icon_not_ok.svg"));
132 }
133 $this->tpl->setVariable("VAL_TITLE", $a_set['title']);
134 $this->tpl->setVariable("VAL_DESCRIPTION", $a_set['description']);
135 $this->tpl->setVariable("CHECKBOX_ID", $a_set['layout_id']);
136
137 $ilCtrl->setParameter($this->parent_obj, "obj_id", $a_set['layout_id']);
138 if ($this->parent_obj->checkPermission("sty_write_page_layout", false)) {
139 $this->tpl->setVariable("HREF_EDIT_PGLAYOUT", $ilCtrl->getLinkTarget($this->parent_obj, "editPg"));
140 }
141
142 $pgl_obj = new ilPageLayout($a_set['layout_id']);
143 $this->tpl->setVariable("VAL_PREVIEW_HTML", $pgl_obj->getPreview());
144
145 if ($a_set["style_id"] > 0) {
146 $this->tpl->setVariable(
147 "STYLE",
148 ilObject::_lookupTitle($a_set["style_id"])
149 );
150 }
151
152 $this->tpl->setVariable(
153 "TYPE",
155 $a_set["special_page"],
156 "type[" . $a_set["layout_id"] . "]",
157 array("0" => $lng->txt("cont_layout_template"),
158 "1" => $lng->txt("cont_special_page")),
159 false,
160 true
161 )
162 );
163 }
164}
An exception for terminatinating execution or to throw for unit testing.
static _lookupTitle($a_id)
lookup object title
TableGUI class for page layouts.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
fillRow($a_set)
Standard Version of Fill Row.
getPageLayouts()
Get a List of all Page Layouts.
Class ilPageLayout.
static getAvailableModules()
static getLayoutsAsArray($a_active=0)
Static access functions.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command 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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
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.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc