00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00037 include_once "classes/class.ilObjectListGUI.php";
00038
00039 class ilObjiLincClassroomListGUI extends ilObjectListGUI
00040 {
00045 function ilObjiLincClassroomListGUI()
00046 {
00047 $this->ilinc_crs_id = $_GET['ref_id'];
00048 $this->ilObjectListGUI();
00049 }
00050
00054 function init()
00055 {
00056 $this->delete_enabled = false;
00057 $this->cut_enabled = false;
00058 $this->subscribe_enabled = false;
00059 $this->link_enabled = false;
00060 $this->payment_enabled = false;
00061 $this->type = "icla";
00062 $this->gui_class_name = "ilobjilincclassroomgui";
00063
00064
00065 include_once('class.ilObjiLincClassroomAccess.php');
00066 $this->commands = ilObjiLincClassroomAccess::_getCommands();
00067 }
00068
00079 function getListItemHTML($a_icrs_ref_id, $a_icla_id, $a_title, $a_description,$a_item)
00080 {
00081
00082
00083 $this->adm_commands_included = false;
00084
00085
00086 $this->tpl =& new ilTemplate ("tpl.container_list_item.html", true, true);
00087 $this->initItem($a_icrs_ref_id, $a_icla_id, $a_title, $a_description);
00088
00089
00090 $this->insertCommands();
00091
00092
00093 $this->insertTitle();
00094
00095 if (!$this->isMode(IL_LIST_AS_TRIGGER))
00096 {
00097 if ($this->getDescriptionStatus())
00098 {
00099 $this->insertDescription();
00100 }
00101 }
00102
00103
00104 if ($this->getPropertiesStatus())
00105 {
00106 $this->insertProperties($a_item);
00107 }
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 return $this->tpl->get();
00119 }
00120
00129 function initItem($a_icrs_ref_id, $a_icla_id, $a_title, $a_description)
00130 {
00131 $this->ref_id = $a_icla_id;
00132 $this->obj_id = $a_icrs_ref_id;
00133 $this->title = $a_title;
00134 $this->description = $a_description;
00135
00136
00137 $this->adm_commands_included = false;
00138 }
00139
00163 function getCommands()
00164 {
00165 global $ilAccess, $ilBench;
00166
00167 $ref_commands = array();
00168
00169 foreach($this->commands as $command)
00170 {
00171 $permission = $command["permission"];
00172 $cmd = $command["cmd"];
00173 $lang_var = $command["lang_var"];
00174
00175
00176
00177 $item_data = $this->container_obj->items['icla'][$this->ref_id];
00178 $ilAccess->enable("cache",false);
00179 $access = $ilAccess->doStatusCheck($permission, $cmd, $this->obj_id, $item_data,$this->ref_id,"icla");
00180 $ilAccess->enable("cache",true);
00181
00182 if ($access)
00183 {
00184 $cmd_link = $this->getCommandLink($command["cmd"]);
00185 $cmd_frame = $this->getCommandFrame($command["cmd"]);
00186 $access_granted = true;
00187 }
00188 else
00189 {
00190 $access_granted = false;
00191
00192 }
00193
00194 $ref_commands[] = array(
00195 "permission" => $permission,
00196 "cmd" => $cmd,
00197 "link" => $cmd_link,
00198 "frame" => $cmd_frame,
00199 "lang_var" => $lang_var,
00200 "granted" => $access_granted,
00201 "access_info" => $info_object,
00202 "default" => $command["default"]
00203 );
00204 }
00205
00206 return $ref_commands;
00207 }
00208
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00237 function insertCommands()
00238 {
00239 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", $this->ref_id);
00240
00241 $commands = $this->getCommands($this->ref_id, $this->obj_id);
00242
00243 $this->default_command = false;
00244
00245 foreach($commands as $command)
00246 {
00247 if ($command["granted"] == true )
00248 {
00249 if (!$command["default"] === true)
00250 {
00251 $cmd_link = $command["link"];
00252 $this->insertCommand($cmd_link, $this->lng->txt($command["lang_var"]),
00253 $command["frame"]);
00254 }
00255 else
00256 {
00257
00258
00259 $this->default_command = $command;
00260 }
00261 }
00262 }
00263
00264 if (!$this->isMode(IL_LIST_AS_TRIGGER))
00265 {
00266
00267 if ($this->delete_enabled)
00268 {
00269 $this->insertDeleteCommand();
00270 }
00271 }
00272 }
00273
00286 function getCommandLink($a_cmd)
00287 {
00288
00289
00290
00291
00292 $this->ctrl->setParameterByClass($this->gui_class_name,"ref_id",$this->ilinc_crs_id);
00293 $this->ctrl->setParameterByClass($this->gui_class_name,"class_id",$this->ref_id);
00294
00295
00296 $cmd_link = $this->ctrl->getLinkTargetByClass($this->gui_class_name,
00297 $a_cmd);
00298 return $cmd_link;
00299 }
00300
00301 function getCommandFrame($a_cmd)
00302 {
00303 switch($a_cmd)
00304 {
00305 case "joinClassroom":
00306 case "agendaClassroom":
00307 $frame = "_blank";
00308 break;
00309
00310 default:
00311 $frame = "";
00312 break;
00313 }
00314
00315 return $frame;
00316 }
00317
00329 function getProperties($a_item = '')
00330 {
00331
00332
00333 global $ilias;
00334
00335 $props = array();
00336
00337
00338 include_once ('ilinc/classes/class.ilObjiLincClassroom.php');
00339 $docent = ilObjiLincClassroom::_getDocent($a_item['instructoruserid']);
00340
00341 if (!$docent)
00342 {
00343 $props[] = array("alert" => true, "property" => $this->lng->txt(ILINC_MEMBER_DOCENT), "value" => $this->lng->txt('ilinc_no_docent_assigned'));
00344 }
00345 else
00346 {
00347 $props[] = array("alert" => false, "property" => $this->lng->txt(ILINC_MEMBER_DOCENT), "value" => $docent);
00348 }
00349
00350
00351 if ($a_item['alwaysopen'])
00352 {
00353 $props[] = array("alert" => false, "property" => $this->lng->txt("status"),
00354 "value" => $this->lng->txt("ilinc_classroom_always_open"));
00355 }
00356 else
00357 {
00358 $props[] = array("alert" => true, "property" => $this->lng->txt("status"),
00359 "value" => $this->lng->txt("ilinc_classroom_closed"));
00360 }
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394 return $props;
00395 }
00396 }
00397 ?>