ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjiLincClassroomListGUI.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 
36 include_once "Services/Object/classes/class.ilObjectListGUI.php";
37 
39 {
45  {
46  $this->ilObjectListGUI();
47  }
48 
52  function init()
53  {
54  $this->copy_enabled = false;
55  $this->delete_enabled = false;
56  $this->cut_enabled = false;
57  $this->subscribe_enabled = false;
58  $this->link_enabled = false;
59  $this->payment_enabled = false;
60  $this->type = "icla";
61  $this->gui_class_name = "ilobjilincclassroomgui";
62 
63  // general commands array
64  include_once('./Modules/ILinc/classes/class.ilObjiLincClassroomAccess.php');
65  $this->commands = ilObjiLincClassroomAccess::_getCommands();
66  }
67 
78  function getListItemHTML($a_icrs_ref_id, $a_icla_id, $a_title, $a_description,$a_item)
79  {
80  // this variable stores wheter any admin commands
81  // are included in the output
82  $this->adm_commands_included = false;
83 
84  // initialization
85  $this->tpl = new ilTemplate("tpl.container_list_item.html", true, true,
86  "Services/Container");
87 
88  $this->initItem($a_icrs_ref_id, $a_icla_id, $a_title, $a_description);
89 
90  // commands
91  $cmdSelList = $this->insertCommands();
92 
93  if($this->getCommandsStatus())
94  {
95  if(!$this->getSeparateCommands())
96  {
97  $this->tpl->setVariable("COMMAND_SELECTION_LIST", $cmdSelList);
98  }
99  }
100 
101  // insert title and describtion
102  $this->insertTitle();
103 
104  if (!$this->isMode(IL_LIST_AS_TRIGGER))
105  {
106  if ($this->getDescriptionStatus())
107  {
108  $this->insertDescription();
109  }
110  }
111 
112  // properties
113  if ($this->getPropertiesStatus())
114  {
115  $this->insertProperties($a_item);
116  }
117 
118  // preconditions
119  //if ($this->getPreconditionsStatus())
120  //{
121  // $this->insertPreconditions();
122  //}
123 
124  // path
125  //$this->insertPath();
126 
127  return $this->tpl->get();
128  }
129 
138  function initItem($a_icrs_ref_id, $a_icla_id, $a_title, $a_description)
139  {
140  $this->ref_id = $a_icla_id;
141  $this->obj_id = $a_icrs_ref_id;
142  $this->title = $a_title;
143  $this->description = $a_description;
144 
145  // checks, whether any admin commands are included in the output
146  $this->adm_commands_included = false;
147  }
148 
172  function getCommands()
173  {
174  global $ilAccess, $ilBench;
175 
176  $ref_commands = array();
177 
178  foreach($this->commands as $command)
179  {
180  $permission = $command["permission"];
181  $cmd = $command["cmd"];
182  $lang_var = $command["lang_var"];
183 
184  // all access checking should be made within $ilAccess and
185  // the checkAccess of the ilObj...Access classes
186  $item_data = $this->container_obj->items['icla'][$this->ref_id];
187  $ilAccess->enable("cache",false);
188  $access = $ilAccess->doStatusCheck($permission, $cmd, $this->obj_id, $item_data,$this->ref_id,"icla");
189  $ilAccess->enable("cache",true);
190 
191  if ($access)
192  {
193  $cmd_link = $this->getCommandLink($command["cmd"]);
194  $cmd_frame = $this->getCommandFrame($command["cmd"]);
195  $access_granted = true;
196  }
197  else
198  {
199  $access_granted = false;
200  //$info_object = $ilAccess->getInfo();
201  }
202 
203  $ref_commands[] = array(
204  "permission" => $permission,
205  "cmd" => $cmd,
206  "link" => $cmd_link,
207  "frame" => $cmd_frame,
208  "lang_var" => $lang_var,
209  "granted" => $access_granted,
210  "access_info" => $info_object,
211  "default" => $command["default"]
212  );
213  }
214 
215  return $ref_commands;
216  }
217 
230  function getCommandLink($a_cmd)
231  {
232  // pass current class_id as ref_id
233  $this->ctrl->setParameterByClass($this->gui_class_name,"ref_id",$_GET['ref_id']);
234  $this->ctrl->setParameterByClass($this->gui_class_name,"class_id",$this->ref_id);
235 
236  // separate method for this line
237  $cmd_link = $this->ctrl->getLinkTargetByClass($this->gui_class_name,
238  $a_cmd);
239  return $cmd_link;
240  }
241 
242  function getCommandFrame($a_cmd)
243  {
244  switch($a_cmd)
245  {
246  case "joinClassroom":
247  case "agendaClassroom":
248  $frame = "_blank";
249  break;
250 
251  default:
252  $frame = "";
253  break;
254  }
255 
256  return $frame;
257  }
258 
270  function getProperties($a_item = '')
271  {
272  //var_dump($a_item);
273 
274  global $ilias;
275 
276  $props = array();
277 
278  // docent
279  include_once ('./Modules/ILinc/classes/class.ilObjiLincClassroom.php');
280  $docent = ilObjiLincClassroom::_getDocent($a_item['instructoruserid']);
281 
282  if (!$docent)
283  {
284  $props[] = array("alert" => true, "property" => $this->lng->txt(ILINC_MEMBER_DOCENT), "value" => $this->lng->txt('ilinc_no_docent_assigned'));
285  }
286  else
287  {
288  $props[] = array("alert" => false, "property" => $this->lng->txt(ILINC_MEMBER_DOCENT), "value" => $docent);
289  }
290 
291  // display offline/online status
292  if ($a_item['alwaysopen'])
293  {
294  $props[] = array("alert" => false, "property" => $this->lng->txt("status"),
295  "value" => $this->lng->txt("ilinc_classroom_always_open"));
296  }
297  else
298  {
299  $props[] = array("alert" => true, "property" => $this->lng->txt("status"),
300  "value" => $this->lng->txt("ilinc_classroom_closed"));
301  }
302 
303  // display cost centers if active
304  /*
305  if ($ilias->getSetting("ilinc_akclassvalues_active"))
306  {
307 $akclassvalues = ilObjiLincClassroom::_getDocent($a_item['instructoruserid']);
308 
309  $value = "";
310 
311  if (!empty($akclassvalues[0]))
312  {
313  $value = $akclassvalues[0];
314  $property = $lng->txt("ilinc_akclassvalue");
315 
316  if (!empty($akclassvalues[1]))
317  {
318  $value .= " / ".$akclassvalues[1];
319  $property = $lng->txt("ilinc_akclassvalues");
320  }
321  }
322  elseif (!empty($akclassvalues[1]))
323  {
324  $value = $akclassvalues[1];
325  $property = $lng->txt("ilinc_akclassvalue");
326  }
327  else
328  {
329  $property = $lng->txt("ilinc_akclassvalues");
330  $value = $lng->txt("ilinc_no_akclassvalues");
331  }
332  }*/
333 
334 
335  return $props;
336  }
337 } // END class.ilObjiLincClassroomListGUI
338 ?>