ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjObjectFolderGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24
36require_once "./Services/Object/classes/class.ilObjectGUI.php";
37
39{
43 protected $rbacsystem;
44
48 protected $error;
49
58 public function __construct($a_data, $a_id, $a_call_by_reference)
59 {
60 global $DIC;
61
62 $this->rbacsystem = $DIC->rbac()->system();
63 $this->error = $DIC["ilErr"];
64 $this->type = "objf";
65 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
66 }
67
73 public function viewObject()
74 {
77
78 if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
79 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
80 }
81
82 //prepare objectlist
83 $this->data = array();
84 $this->data["data"] = array();
85 $this->data["ctrl"] = array();
86
87 $this->data["cols"] = array("type","title","last_change");
88
89 $this->maxcount = count($this->data["data"]);
90
91 // now compute control information
92 foreach ($this->data["data"] as $key => $val) {
93 $this->data["ctrl"][$key] = array(
94 "ref_id" => $this->id,
95 "obj_id" => $val["obj_id"],
96 "type" => $val["type"],
97 );
98
99 unset($this->data["data"][$key]["obj_id"]);
100 $this->data["data"][$key]["last_change"] = ilDatePresentation::formatDate(new ilDateTime($this->data["data"][$key]["last_change"], IL_CAL_DATETIME));
101 }
102
103 $this->displayList();
104 }
105
111 public function displayList()
112 {
113 include_once "./Services/Table/classes/class.ilTableGUI.php";
114 return;
115
116 // load template for table
117 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
118
119 // load template for table content data
120 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
121
122 $num = 0;
123
124 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=" . $this->obj_id;
125 $this->tpl->setVariable(
126 "FORMACTION",
127 $this->ctrl->getFormAction($this)
128 );
129
130 // create table
131 $tbl = new ilTableGUI();
132
133 // title & header columns
134 $tbl->setTitle($this->object->getTitle());
135
136 foreach ($this->data["cols"] as $val) {
137 $header_names[] = $this->lng->txt($val);
138 }
139
140 $tbl->setHeaderNames($header_names);
141
142 //$header_params = array("ref_id" => $this->ref_id);
143 $header_params = $this->ctrl->getParameterArray($this, "view");
144 $tbl->setHeaderVars($this->data["cols"], $header_params);
145 $tbl->setColumnWidth(array("15","75%","25%"));
146
147 // control
148 $tbl->setOrderColumn($_GET["sort_by"]);
149 $tbl->setOrderDirection($_GET["sort_order"]);
150 $tbl->setLimit($_GET["limit"]);
151 $tbl->setOffset($_GET["offset"]);
152 $tbl->setMaxCount($this->maxcount);
153
154 // footer
155 $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
156 //$tbl->disable("footer");
157
158 // render table
159 $tbl->render();
160
161 if (is_array($this->data["data"][0])) {
162 //table cell
163 for ($i = 0; $i < count($this->data["data"]); $i++) {
164 $data = $this->data["data"][$i];
165 $ctrl = $this->data["ctrl"][$i];
166
167 // color changing
168 $css_row = ilUtil::switchColor($i + 1, "tblrow1", "tblrow2");
169
170 $this->tpl->setCurrentBlock("table_cell");
171 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
172 $this->tpl->parseCurrentBlock();
173
174 foreach ($data as $key => $val) {
175 //build link
176 /*
177
178 $n = 0;
179
180 foreach ($ctrl as $key2 => $val2)
181 {
182 $link .= $key2."=".$val2;
183
184 if ($n < count($ctrl)-1)
185 {
186 $link .= "&";
187 $n++;
188 }
189 }
190
191 if ($key == "title")
192 {
193 $name_field = explode("#separator#",$val);
194 }
195
196 if ($key == "title" || $key == "type")
197 {
198 $this->tpl->setCurrentBlock("begin_link");
199 $this->tpl->setVariable("LINK_TARGET", $link);
200
201 $this->tpl->parseCurrentBlock();
202 $this->tpl->touchBlock("end_link");
203 }
204
205 $this->tpl->setCurrentBlock("text");
206
207 if ($key == "type")
208 {
209 $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath);
210 }
211
212 if ($key == "title")
213 {
214 $this->tpl->setVariable("TEXT_CONTENT", $name_field[0]);
215
216 $this->tpl->setCurrentBlock("subtitle");
217 $this->tpl->setVariable("DESC", $name_field[1]);
218 $this->tpl->parseCurrentBlock();
219 }
220 else
221 {
222 $this->tpl->setVariable("TEXT_CONTENT", $val);
223 }
224
225 $this->tpl->parseCurrentBlock();
226
227 $this->tpl->setCurrentBlock("table_cell");
228 $this->tpl->parseCurrentBlock();
229 */
230 } //foreach
231
232 $this->tpl->setCurrentBlock("tbl_content");
233 $this->tpl->setVariable("CSS_ROW", $css_row);
234 $this->tpl->parseCurrentBlock();
235 } //for
236 } //if is_array
237 else {
238 $this->tpl->setCurrentBlock("notfound");
239 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
240 $this->tpl->setVariable("NUM_COLS", $num);
241 $this->tpl->parseCurrentBlock();
242 }
243 }
244
245 public function executeCommand()
246 {
247 $next_class = $this->ctrl->getNextClass($this);
248 $cmd = $this->ctrl->getCmd();
249 $this->prepareOutput();
250
251 switch ($next_class) {
252 case 'ilpermissiongui':
253 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
254 $perm_gui = new ilPermissionGUI($this);
255 $ret = &$this->ctrl->forwardCommand($perm_gui);
256 break;
257
258 default:
259 if (!$cmd) {
260 $cmd = "view";
261 }
262 $cmd .= "Object";
263 $this->$cmd();
264
265 break;
266 }
267 return true;
268 }
269
275 public function getTabs()
276 {
278
279 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
280 $this->tabs_gui->addTarget(
281 "settings",
282 $this->ctrl->getLinkTarget($this, "view"),
283 array("view",""),
284 "",
285 ""
286 );
287
288 $this->tabs_gui->addTarget(
289 "perm_settings",
290 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
291 array("perm","info","owner"),
292 'ilpermissiongui'
293 );
294 }
295 }
296} // END class.ilObjObjectFolderGUI
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
error($a_errmsg)
set error message @access public
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
Class ilObjObjectFolderGUI.
getTabs()
get tabs @access public
__construct($a_data, $a_id, $a_call_by_reference)
Constructor.
displayList()
display object list
viewObject()
list childs of current object
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilTableGUI.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
global $DIC
Definition: goto.php:24
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6