• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

ilinc/classes/class.ilObjiLincClassroomListGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                 // general commands array
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                 // this variable stores wheter any admin commands
00082                 // are included in the output
00083                 $this->adm_commands_included = false;
00084 
00085                 // initialization
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                 // commands
00090                 $this->insertCommands();
00091 
00092                 // insert title and describtion
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                 // properties
00104                 if ($this->getPropertiesStatus())
00105                 {
00106                         $this->insertProperties($a_item);
00107                 }
00108 
00109                 // preconditions
00110                 //if ($this->getPreconditionsStatus())
00111                 //{
00112                 //      $this->insertPreconditions();
00113                 //}
00114 
00115                 // path
00116                 //$this->insertPath();
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                 // checks, whether any admin commands are included in the output
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                         // all access checking should be made within $ilAccess and
00176                         // the checkAccess of the ilObj...Access classes
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                                 //$info_object = $ilAccess->getInfo();
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         function insertDeleteCommand()
00218         {
00219                 if (true)  // query here docent flag
00220                 {
00221                         $this->ctrl->setParameter($this->container_obj, "ref_id",
00222                                 $this->container_obj->object->getRefId());
00223                         $this->ctrl->setParameter($this->container_obj, "class_id", $this->ref_id);
00224                         $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "removeRoom");
00225                         $this->insertCommand($cmd_link, $this->lng->txt("delete"));
00226                         $this->adm_commands_included = false;
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                                         // this is view/show most times and will be linked
00258                                         // with the item title in insertTitle
00259                                         $this->default_command = $command;
00260                                 }
00261                         }
00262                 }
00263 
00264                 if (!$this->isMode(IL_LIST_AS_TRIGGER))
00265                 {
00266                         // delete
00267                         if ($this->delete_enabled)
00268                         {
00269                                 $this->insertDeleteCommand();
00270                         }
00271                 }
00272         }
00273         
00286         function getCommandLink($a_cmd)
00287         {
00288                 // don't use ctrl here in the moment
00289                 //return 'repository.php?ref_id='.$this->ilinc_crs_id.'&class_id='.$this->ref_id.'&cmd='.$a_cmd;
00290                 
00291                 // pass current class_id as ref_id
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                 // separate method for this line
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                 //var_dump($a_item);
00332                 
00333                 global $ilias;
00334 
00335                 $props = array();
00336 
00337                 // docent
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                 // display offline/online status
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                 // display cost centers if active
00363                 /*
00364                 if ($ilias->getSetting("ilinc_akclassvalues_active"))
00365                 {
00366 $akclassvalues = ilObjiLincClassroom::_getDocent($a_item['instructoruserid']);
00367 
00368                         $value = "";
00369                         
00370                         if (!empty($akclassvalues[0]))
00371                         {
00372                                 $value = $akclassvalues[0];
00373                                 $property = $lng->txt("ilinc_akclassvalue");
00374                                 
00375                                 if (!empty($akclassvalues[1]))
00376                                 {
00377                                         $value .= " / ".$akclassvalues[1];
00378                                         $property = $lng->txt("ilinc_akclassvalues");
00379                                 }
00380                         }
00381                         elseif (!empty($akclassvalues[1]))
00382                         {
00383                                 $value = $akclassvalues[1];
00384                                 $property = $lng->txt("ilinc_akclassvalue");
00385                         }
00386                         else
00387                         {
00388                                 $property = $lng->txt("ilinc_akclassvalues");
00389                                 $value = $lng->txt("ilinc_no_akclassvalues");
00390                         }
00391                 }*/
00392                 
00393 
00394                 return $props;
00395         }
00396 } // END class.ilObjiLincClassroomListGUI
00397 ?>

Generated on Fri Dec 13 2013 13:52:10 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1