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