ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilBookmarkBlockGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("Services/Block/classes/class.ilBlockGUI.php");
6
17{
18 static $block_type = "pdbookm";
19
24 {
25 global $ilCtrl, $lng, $ilUser;
26
27 parent::ilBlockGUI();
28
29 $this->setImage(ilUtil::getImagePath("icon_bm.svg"));
30 $this->setTitle($lng->txt("my_bms"));
31 $this->setEnableNumInfo(false);
32 $this->setLimit(99999);
34
35 $this->id = (empty($_GET["bmf_id"]))
36 ? $bmf_id = 1
37 : $_GET["bmf_id"];
38 }
39
45 static function getBlockType()
46 {
47 return self::$block_type;
48 }
49
55 static function isRepositoryObject()
56 {
57 return false;
58 }
59
60
64 static function getScreenMode()
65 {
66 switch($_GET["cmd"])
67 {
68 default:
69 return IL_SCREEN_SIDE;
70 break;
71 }
72 }
73
77 function &executeCommand()
78 {
79 global $ilCtrl;
80
81 $next_class = $ilCtrl->getNextClass();
82 $cmd = $ilCtrl->getCmd("getHTML");
83
84 return $this->$cmd();
85 }
86
87 function getHTML()
88 {
89 // workaround to show details row
90 $this->setData(array("dummy"));
91 if ($this->getCurrentDetailLevel() == 0)
92 {
93 return "";
94 }
95 else
96 {
97 return parent::getHTML();
98 }
99 }
100
105 {
106 global $ilUser;
107
108 include_once("./Services/Bookmarks/classes/class.ilBookmarkFolder.php");
110 $this->num_bookmarks = $bm_items["bookmarks"];
111 $this->num_folders = $bm_items["folders"];
112
113 if ($this->getCurrentDetailLevel() > 1 &&
114 ($this->num_bookmarks > 0 || $this->num_folders > 0))
115 {
116 if ($ilUser->getPref("il_pd_bkm_mode") == 'tree')
117 {
119 }
120 else
121 {
122 $this->setRowTemplate("tpl.bookmark_pd_list.html", "Services/Bookmarks");
123 $this->getListRowData();
124 $this->setColSpan(2);
125 parent::fillDataSection();
126 }
127 }
128 else
129 {
130 if ($this->num_bookmarks == 0 && $this->num_folders == 0)
131 {
132 $this->setEnableDetailRow(false);
133 }
134 $this->setDataSection($this->getOverview());
135 }
136 }
137
142 {
143 global $ilCtrl, $ilUser;
144
145 include_once("./Services/Bookmarks/classes/class.ilBookmarkBlockExplorerGUI.php");
146 $exp = new ilBookmarkBlockExplorerGUI($this, "getPDBookmarkListHTMLTree");
147 if (!$exp->handleCommand())
148 {
149 return "<div id='tree_div'>".$exp->getHTML()."</div>";
150 }
151 }
152
156 function fillFooter()
157 {
158 global $ilCtrl, $lng, $ilUser;
159
160 $this->setFooterLinks();
161 $this->fillFooterLinks();
162 $this->tpl->setVariable("FCOLSPAN", $this->getColSpan());
163 if ($this->tpl->blockExists("block_footer"))
164 {
165 $this->tpl->setCurrentBlock("block_footer");
166 $this->tpl->parseCurrentBlock();
167 }
168 }
169
173 function setFooterLinks()
174 {
175 global $ilUser, $ilCtrl, $lng;
176
177 if ($this->num_bookmarks == 0 && $this->num_folders == 0)
178 {
179 return;
180 }
181
182 // flat
183 $this->addFooterLink( $lng->txt("list"),
184 $ilCtrl->getLinkTarget($this, "setPdFlatMode"),
185 $ilCtrl->getLinkTarget($this, "setPdFlatMode",
186 "", true),
187 "block_".$this->getBlockType()."_".$this->block_id,
188 false, false, ($ilUser->getPref("il_pd_bkm_mode") != 'tree'));
189
190 // as tree
191 $this->addFooterLink($lng->txt("tree"),
192 $ilCtrl->getLinkTarget($this,
193 "setPdTreeMode"),
194 "",
195 "block_".$this->getBlockType()."_".$this->block_id,
196 false, false, ($ilUser->getPref("il_pd_bkm_mode") == 'tree')
197 );
198 }
199
203 function getListRowData()
204 {
205 global $ilUser, $lng, $ilCtrl;
206
207 include_once("./Services/Bookmarks/classes/class.ilBookmarkFolder.php");
208
209 $data = array();
210
211 $sess_cur_bm_folder = "";
212 if (isset($_SESSION["ilCurBMFolder"]))
213 {
214 $sess_cur_bm_folder = $_SESSION["ilCurBMFolder"];
215 }
216
217 $bm_items = ilBookmarkFolder::getObjects($sess_cur_bm_folder);
218
219 if (!ilBookmarkFolder::isRootFolder($sess_cur_bm_folder)
220 && !empty($_SESSION["ilCurBMFolder"]))
221 {
222 $ilCtrl->setParameter($this, "curBMFolder",
223 ilBookmarkFolder::_getParentId($sess_cur_bm_folder));
224
225 $data[] = array(
226 "img" => ilUtil::getImagePath("icon_bmf.svg"),
227 "alt" => $lng->txt("bmf"),
228 "title" => "..",
229 "link" => $ilCtrl->getLinkTarget($this, "setCurrentBookmarkFolder"));
230
231 $this->setTitle($this->getTitle().": ".ilBookmarkFolder::_lookupTitle($sess_cur_bm_folder));
232 }
233
234 foreach ($bm_items as $bm_item)
235 {
236 switch ($bm_item["type"])
237 {
238 case "bmf":
239 $ilCtrl->setParameter($this, "curBMFolder", $bm_item["obj_id"]);
240 $data[] = array(
241 "img" => ilUtil::getImagePath("icon_bmf.svg"),
242 "alt" => $lng->txt("bmf"),
243 "title" => ilUtil::prepareFormOutput($bm_item["title"]),
244 "desc" => ilUtil::prepareFormOutput($bm_item["desc"]),
245 "link" => $ilCtrl->getLinkTarget($this,
246 "setCurrentBookmarkFolder"),
247 "target" => "");
248 break;
249
250 case "bm":
251 $data[] = array(
252 "img" => ilUtil::getImagePath("spacer.png"),
253 "alt" => $lng->txt("bm"),
254 "title" => ilUtil::prepareFormOutput($bm_item["title"]),
255 "desc" => ilUtil::prepareFormOutput($bm_item["desc"]),
256 "link" => ilUtil::prepareFormOutput($bm_item["target"]),
257 "target" => "_blank");
258 break;
259 }
260 }
261
262 $this->setData($data);
263 }
264
268 function fillRow($a_set)
269 {
270 global $ilUser;
271
272 $this->tpl->setVariable("IMG_BM", $a_set["img"]);
273 $this->tpl->setVariable("IMG_ALT", $a_set["alt"]);
274 $this->tpl->setVariable("BM_TITLE", $a_set["title"]);
275 $this->tpl->setVariable("BM_LINK", $a_set["link"]);
276 $this->tpl->setVariable("BM_TARGET", ilUtil::prepareFormOutput($a_set["target"]));
277
278 if ($this->getCurrentDetailLevel() > 2)
279 {
280 $this->tpl->setVariable("BM_DESCRIPTION", ilUtil::prepareFormOutput($a_set["desc"]));
281 }
282 else
283 {
284 $this->tpl->setVariable("BM_TOOLTIP", ilUtil::prepareFormOutput($a_set["desc"]));
285 }
286 }
287
291 function getOverview()
292 {
293 global $ilUser, $lng, $ilCtrl;
294
295 return '<div class="small">'.$this->num_bookmarks." ".$lng->txt("bm_num_bookmarks").", ".
296 $this->num_folders." ".$lng->txt("bm_num_bookmark_folders")."</div>";
297 }
298
302 function setPdFlatMode()
303 {
304 global $ilCtrl, $ilUser;
305
306 $ilUser->writePref("il_pd_bkm_mode", 'flat');
307 if ($ilCtrl->isAsynch())
308 {
309 echo $this->getHTML();
310 exit;
311 }
312 else
313 {
314 $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
315 }
316 }
317
321 function setPdTreeMode()
322 {
323 global $ilCtrl, $ilUser;
324
325 $ilUser->writePref("il_pd_bkm_mode", 'tree');
326 if ($ilCtrl->isAsynch())
327 {
328 echo $this->getHTML();
329 exit;
330 }
331 else
332 {
333 $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
334 }
335 }
336
341 {
342 global $ilCtrl;
343
344 $_SESSION["ilCurBMFolder"] = $_GET["curBMFolder"];
345 $ilCtrl->redirectByClass("ilpersonaldesktopgui", "show");
346 }
347
348}
349
350?>
$_GET["client_id"]
const IL_SCREEN_SIDE
This class represents a block method of a block.
setRowTemplate($a_rowtemplatename, $a_rowtemplatedir="")
Set Row Template Name.
setLimit($a_limit)
Set Limit.
setImage($a_image)
Set Image.
getCurrentDetailLevel()
Get Current Detail Level.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
setData($a_data)
Set Data.
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
getTitle()
Get Title.
addFooterLink($a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
Add a footer text/link.
setColSpan($a_colspan)
Set Columns Span.
setTitle($a_title)
Set Title.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
getColSpan()
Get Columns Span.
Bookmark block explorer GUI class.
BlockGUI class for Bookmarks block.
setFooterLinks()
Set footer links.
fillDataSection()
Fill data section.
setPdTreeMode()
set current desktop view mode to tree
getHTML()
Handle config status.
getListRowData()
Get list data (for flat list).
static isRepositoryObject()
Is block used in repository object?
fillRow($a_set)
get flat bookmark list for personal desktop
static getBlockType()
Get block type.
setCurrentBookmarkFolder()
set current bookmarkfolder on personal desktop
getPDBookmarkListHTMLTree()
get tree bookmark list for personal desktop
setPdFlatMode()
set current desktop view mode to flat
& executeCommand()
execute command
static getScreenMode()
Get Screen Mode for current command.
_lookupTitle($a_bmf_id)
lookup bookmark folder title
_getNumberOfObjects()
Get number of folders and bookmarks for current user.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15