ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilContObjLocatorGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 
34 {
38  protected $ctrl;
39 
40  public $mode;
41  public $temp_var;
42  public $tree;
43  public $lng;
44  public $tpl;
45 
46 
47  public function __construct($a_tree)
48  {
49  global $DIC;
50 
51  $lng = $DIC->language();
52  $tpl = $DIC["tpl"];
53  $ilCtrl = $DIC->ctrl();
54 
55  $this->ctrl = $ilCtrl;
56  $this->tree = $a_tree;
57  $this->mode = "std";
58  $this->temp_var = "LOCATOR";
59  $this->lng = $lng;
60  $this->tpl = $tpl;
61  $this->show_user = false;
62  }
63 
64  public function setTemplateVariable($a_temp_var)
65  {
66  $this->temp_var = $a_temp_var;
67  }
68 
69  public function setObjectID($a_obj_id)
70  {
71  $this->obj_id = $a_obj_id;
72  }
73 
74  public function setContentObject($a_cont_obj)
75  {
76  $this->cont_obj = $a_cont_obj;
77  }
78 
82  public function display($a_gui_class)
83  {
84  $lng = $this->lng;
85 
86  $this->tpl->addBlockFile($this->temp_var, "locator", "tpl.locator.html", "Services/Locator");
87 
88  if (($this->obj_id != 0) && $this->tree->isInTree($this->obj_id)) {
89  $path = $this->tree->getPathFull($this->obj_id);
90  } else {
91  $path = $this->tree->getPathFull($this->tree->getRootId());
92  if ($this->obj_id != 0) {
93  $path[] = array("type" => "pg", "child" => $this->obj_id,
94  "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
95  }
96  }
97 
98  $modifier = 1;
99 
100  foreach ($path as $key => $row) {
101  if ($key < count($path) - $modifier) {
102  $this->tpl->touchBlock("locator_separator");
103  }
104 
105  $this->tpl->setCurrentBlock("locator_item");
106  $transit = "";
107  if ($row["child"] == 1) {
108  $title = $this->cont_obj->getTitle();
109  $cmd = "properties";
110  $cmdClass = $a_gui_class;
111  } else {
112  $title = $row["title"];
113  switch ($row["type"]) {
114  case "st":
115  $cmdClass = "ilStructureObjectGUI";
116  $cmd = "view";
117  if ($this->ctrl->getCmdClass() != "ilstructureobjectgui") {
118  $transit = array($a_gui_class);
119  }
120  break;
121 
122  case "pg":
123  $cmdClass = "ilLMPageObjectGUI";
124  $cmd = "view";
125  if ($this->ctrl->getCmdClass() != "illmpageobjectgui") {
126  $transit = array($a_gui_class);
127  }
128  break;
129  }
130  }
131  $this->tpl->setVariable("ITEM", $title);
132  $obj_str = ($row["child"] == 1)
133  ? ""
134  : "&obj_id=" . $row["child"];
135 
136  $this->ctrl->setParameterByClass($cmdClass, "obj_id", $row["child"]);
137  $link = $this->ctrl->getLinkTargetByClass($cmdClass, $cmd, $transit);
138  $this->ctrl->setParameterByClass($cmdClass, "obj_id", $_GET["obj_id"]);
139  $this->tpl->setVariable("LINK_ITEM", $link);
140  $this->tpl->parseCurrentBlock();
141  }
142 
143  $this->tpl->setCurrentBlock("locator");
144  $this->tpl->parseCurrentBlock();
145  }
146 }
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
display($a_gui_class)
display locator
Content Object Locator GUI.
$row
static _getPresentationTitle( $a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn&#39;t have to be page title, it may be chapter title + page title or chapter tit...
$key
Definition: croninfo.php:18