ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
35 var $mode;
37 var $tree;
38 var $lng;
39 var $tpl;
40
41
42 function ilContObjLocatorGUI($a_tree)
43 {
44 global $lng, $tpl, $ilCtrl;
45
46 $this->ctrl =& $ilCtrl;
47 $this->tree =& $a_tree;
48 $this->mode = "std";
49 $this->temp_var = "LOCATOR";
50 $this->lng =& $lng;
51 $this->tpl =& $tpl;
52 $this->show_user = false;
53 }
54
55 function setTemplateVariable($a_temp_var)
56 {
57 $this->temp_var = $a_temp_var;
58 }
59
60 function setObjectID($a_obj_id)
61 {
62 $this->obj_id = $a_obj_id;
63 }
64
65 function setContentObject($a_cont_obj)
66 {
67 $this->cont_obj =& $a_cont_obj;
68 }
69
73 function display($a_gui_class)
74 {
75 global $lng;
76
77 $this->tpl->addBlockFile($this->temp_var, "locator", "tpl.locator.html", "Services/Locator");
78
79 if (($this->obj_id != 0) && $this->tree->isInTree($this->obj_id))
80 {
81 $path = $this->tree->getPathFull($this->obj_id);
82 }
83 else
84 {
85 $path = $this->tree->getPathFull($this->tree->getRootId());
86 if ($this->obj_id != 0)
87 {
88 $path[] = array("type" => "pg", "child" => $this->obj_id,
89 "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
90 }
91 }
92
93 $modifier = 1;
94
95 foreach ($path as $key => $row)
96 {
97 if ($key < count($path)-$modifier)
98 {
99 $this->tpl->touchBlock("locator_separator");
100 }
101
102 $this->tpl->setCurrentBlock("locator_item");
103 $transit = "";
104 if ($row["child"] == 1)
105 {
106 $title = $this->cont_obj->getTitle();
107 $cmd = "properties";
108 $cmdClass = $a_gui_class;
109 }
110 else
111 {
112 $title = $row["title"];
113 switch($row["type"])
114 {
115 case "st":
116 $cmdClass = "ilStructureObjectGUI";
117 $cmd = "view";
118 if ($this->ctrl->getCmdClass() != "ilstructureobjectgui")
119 {
120 $transit = array($a_gui_class);
121 }
122 break;
123
124 case "pg":
125 $cmdClass = "ilLMPageObjectGUI";
126 $cmd = "view";
127 if ($this->ctrl->getCmdClass() != "illmpageobjectgui")
128 {
129 $transit = array($a_gui_class);
130 }
131 break;
132 }
133 }
134 $this->tpl->setVariable("ITEM", $title);
135 $obj_str = ($row["child"] == 1)
136 ? ""
137 : "&obj_id=".$row["child"];
138
139 $this->ctrl->setParameterByClass($cmdClass, "obj_id", $row["child"]);
140 $link = $this->ctrl->getLinkTargetByClass($cmdClass, $cmd, $transit);
141 $this->ctrl->setParameterByClass($cmdClass, "obj_id", $_GET["obj_id"]);
142 $this->tpl->setVariable("LINK_ITEM", $link);
143 $this->tpl->parseCurrentBlock();
144 }
145
146 $this->tpl->setCurrentBlock("locator");
147 $this->tpl->parseCurrentBlock();
148 }
149
150}
151?>
$_GET["client_id"]
Content Object Locator GUI.
display($a_gui_class)
display locator
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="-")
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
global $ilCtrl
Definition: ilias.php:18
$cmd
Definition: sahs_server.php:35
$path
Definition: index.php:22