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

content/classes/class.ilContObjLocatorGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 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 
00033 class ilContObjLocatorGUI
00034 {
00035         var $mode;
00036         var $temp_var;
00037         var $tree;
00038         var $lng;
00039         var $tpl;
00040 
00041 
00042         function ilContObjLocatorGUI($a_tree)
00043         {
00044                 global $lng, $tpl, $ilCtrl;
00045 
00046                 $this->ctrl =& $ilCtrl;
00047                 $this->tree =& $a_tree;
00048                 $this->mode = "std";
00049                 $this->temp_var = "LOCATOR";
00050                 $this->lng =& $lng;
00051                 $this->tpl =& $tpl;
00052                 $this->show_user = false;
00053         }
00054 
00055         function setTemplateVariable($a_temp_var)
00056         {
00057                 $this->temp_var = $a_temp_var;
00058         }
00059 
00060         function setObjectID($a_obj_id)
00061         {
00062                 $this->obj_id = $a_obj_id;
00063         }
00064 
00065         function setContentObject($a_cont_obj)
00066         {
00067                 $this->cont_obj =& $a_cont_obj;
00068         }
00069 
00073         function display($a_gui_class)
00074         {
00075                 global $lng;
00076 
00077                 $this->tpl->addBlockFile($this->temp_var, "locator", "tpl.locator.html");
00078 
00079                 if (($this->obj_id != 0) && $this->tree->isInTree($this->obj_id))
00080                 {
00081                         $path = $this->tree->getPathFull($this->obj_id);
00082                 }
00083                 else
00084                 {
00085                         $path = $this->tree->getPathFull($this->tree->getRootId());
00086                         if ($this->obj_id != 0)
00087                         {
00088                                 $path[] = array("type" => "pg", "child" => $this->obj_id,
00089                                         "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
00090                         }
00091                 }
00092 
00093                 $modifier = 1;
00094 
00095                 foreach ($path as $key => $row)
00096                 {
00097                         if ($key < count($path)-$modifier)
00098                         {
00099                                 $this->tpl->touchBlock("locator_separator");
00100                         }
00101 
00102                         $this->tpl->setCurrentBlock("locator_item");
00103                         $transit = "";
00104                         if ($row["child"] == 1)
00105                         {
00106                                 $title = $this->cont_obj->getTitle();
00107                                 $cmd = "properties";
00108                                 $cmdClass = $a_gui_class;
00109                         }
00110                         else
00111                         {
00112                                 $title = $row["title"];
00113                                 switch($row["type"])
00114                                 {
00115                                         case "st":
00116                                                 $cmdClass = "ilStructureObjectGUI";
00117                                                 $cmd = "view";
00118                                                 if ($this->ctrl->getCmdClass() != "ilstructureobjectgui")
00119                                                 {
00120                                                         $transit = array($a_gui_class);
00121                                                 }
00122                                                 break;
00123 
00124                                         case "pg":
00125                                                 $cmdClass = "ilLMPageObjectGUI";
00126                                                 $cmd = "view";
00127                                                 if ($this->ctrl->getCmdClass() != "illmpageobjectgui")
00128                                                 {
00129                                                         $transit = array($a_gui_class);
00130                                                 }
00131                                                 break;
00132                                 }
00133                         }
00134                         $this->tpl->setVariable("ITEM", $title);
00135                         $obj_str = ($row["child"] == 1)
00136                                 ? ""
00137                                 : "&obj_id=".$row["child"];
00138 
00139                         $this->ctrl->setParameterByClass($cmdClass, "obj_id", $row["child"]);
00140                         $link = $this->ctrl->getLinkTargetByClass($cmdClass, $cmd, $transit);
00141                         $this->ctrl->setParameterByClass($cmdClass, "obj_id", $_GET["obj_id"]);
00142                         $this->tpl->setVariable("LINK_ITEM", $link);
00143                         $this->tpl->parseCurrentBlock();
00144                 }
00145 
00146                 $this->tpl->setCurrentBlock("locator");
00147                 $this->tpl->parseCurrentBlock();
00148         }
00149 
00150 }
00151 ?>

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