ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
48 function ilObjObjectFolderGUI($a_data,$a_id,$a_call_by_reference)
49 {
50 $this->type = "objf";
51 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
52 }
53
59 function viewObject()
60 {
61 global $rbacsystem;
62
63 if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
64 {
65 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
66 }
67
68 //prepare objectlist
69 $this->data = array();
70 $this->data["data"] = array();
71 $this->data["ctrl"] = array();
72
73 $this->data["cols"] = array("type","title","last_change");
74
75 $this->maxcount = count($this->data["data"]);
76
77 // now compute control information
78 foreach ($this->data["data"] as $key => $val)
79 {
80 $this->data["ctrl"][$key] = array(
81 "ref_id" => $this->id,
82 "obj_id" => $val["obj_id"],
83 "type" => $val["type"],
84 );
85
86 unset($this->data["data"][$key]["obj_id"]);
87 $this->data["data"][$key]["last_change"] = ilDatePresentation::formatDate(new ilDateTime($this->data["data"][$key]["last_change"],IL_CAL_DATETIME));
88 }
89
90 $this->displayList();
91 }
92
98 function displayList()
99 {
100 include_once "./Services/Table/classes/class.ilTableGUI.php";
101 return;
102
103 // load template for table
104 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
105
106 // load template for table content data
107 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
108
109 $num = 0;
110
111 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
112 $this->tpl->setVariable("FORMACTION",
113 $this->ctrl->getFormAction($this));
114
115 // create table
116 $tbl = new ilTableGUI();
117
118 // title & header columns
119 $tbl->setTitle($this->object->getTitle());
120
121 foreach ($this->data["cols"] as $val)
122 {
123 $header_names[] = $this->lng->txt($val);
124 }
125
126 $tbl->setHeaderNames($header_names);
127
128 //$header_params = array("ref_id" => $this->ref_id);
129 $header_params = $this->ctrl->getParameterArray($this, "view");
130 $tbl->setHeaderVars($this->data["cols"],$header_params);
131 $tbl->setColumnWidth(array("15","75%","25%"));
132
133 // control
134 $tbl->setOrderColumn($_GET["sort_by"]);
135 $tbl->setOrderDirection($_GET["sort_order"]);
136 $tbl->setLimit($_GET["limit"]);
137 $tbl->setOffset($_GET["offset"]);
138 $tbl->setMaxCount($this->maxcount);
139
140 // footer
141 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
142 //$tbl->disable("footer");
143
144 // render table
145 $tbl->render();
146
147 if (is_array($this->data["data"][0]))
148 {
149 //table cell
150 for ($i=0; $i < count($this->data["data"]); $i++)
151 {
152 $data = $this->data["data"][$i];
153 $ctrl = $this->data["ctrl"][$i];
154
155 // color changing
156 $css_row = ilUtil::switchColor($i+1,"tblrow1","tblrow2");
157
158 $this->tpl->setCurrentBlock("table_cell");
159 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
160 $this->tpl->parseCurrentBlock();
161
162 foreach ($data as $key => $val)
163 {
164 //build link
165 /*
166
167 $n = 0;
168
169 foreach ($ctrl as $key2 => $val2)
170 {
171 $link .= $key2."=".$val2;
172
173 if ($n < count($ctrl)-1)
174 {
175 $link .= "&";
176 $n++;
177 }
178 }
179
180 if ($key == "title")
181 {
182 $name_field = explode("#separator#",$val);
183 }
184
185 if ($key == "title" || $key == "type")
186 {
187 $this->tpl->setCurrentBlock("begin_link");
188 $this->tpl->setVariable("LINK_TARGET", $link);
189
190 $this->tpl->parseCurrentBlock();
191 $this->tpl->touchBlock("end_link");
192 }
193
194 $this->tpl->setCurrentBlock("text");
195
196 if ($key == "type")
197 {
198 $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath);
199 }
200
201 if ($key == "title")
202 {
203 $this->tpl->setVariable("TEXT_CONTENT", $name_field[0]);
204
205 $this->tpl->setCurrentBlock("subtitle");
206 $this->tpl->setVariable("DESC", $name_field[1]);
207 $this->tpl->parseCurrentBlock();
208 }
209 else
210 {
211 $this->tpl->setVariable("TEXT_CONTENT", $val);
212 }
213
214 $this->tpl->parseCurrentBlock();
215
216 $this->tpl->setCurrentBlock("table_cell");
217 $this->tpl->parseCurrentBlock();
218 */
219 } //foreach
220
221 $this->tpl->setCurrentBlock("tbl_content");
222 $this->tpl->setVariable("CSS_ROW", $css_row);
223 $this->tpl->parseCurrentBlock();
224 } //for
225
226 } //if is_array
227 else
228 {
229 $this->tpl->setCurrentBlock("notfound");
230 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
231 $this->tpl->setVariable("NUM_COLS", $num);
232 $this->tpl->parseCurrentBlock();
233 }
234 }
235
236 function &executeCommand()
237 {
238 $next_class = $this->ctrl->getNextClass($this);
239 $cmd = $this->ctrl->getCmd();
240 $this->prepareOutput();
241
242 switch($next_class)
243 {
244 case 'ilpermissiongui':
245 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
246 $perm_gui =& new ilPermissionGUI($this);
247 $ret =& $this->ctrl->forwardCommand($perm_gui);
248 break;
249
250 default:
251 if(!$cmd)
252 {
253 $cmd = "view";
254 }
255 $cmd .= "Object";
256 $this->$cmd();
257
258 break;
259 }
260 return true;
261 }
262
268 function getTabs(&$tabs_gui)
269 {
270 global $rbacsystem;
271
272 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
273 {
274 $tabs_gui->addTarget("settings",
275 $this->ctrl->getLinkTarget($this, "view"), array("view",""), "", "");
276
277 $tabs_gui->addTarget("perm_settings",
278 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
279 }
280 }
281} // END class.ilObjObjectFolderGUI
282?>
$_GET["client_id"]
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Class ilObjObjectFolderGUI.
ilObjObjectFolderGUI($a_data, $a_id, $a_call_by_reference)
Constructor.
getTabs(&$tabs_gui)
get tabs @access public
displayList()
display object list
viewObject()
list childs of current object
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
prepareOutput()
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)
$tbl
Definition: example_048.php:81
redirection script todo: (a better solution should control the processing via a xml file)
$cmd
Definition: sahs_server.php:35