ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilPermanentLinkGUI Class Reference

Class for permanent links. More...

+ Collaboration diagram for ilPermanentLinkGUI:

Public Member Functions

 __construct ($a_type, $a_id, $a_append="", $a_target="")
 Example: type = "wiki", id (ref_id) = "234", append = "_Start_Page". More...
 
 setIncludePermanentLinkText ($a_includepermanentlinktext)
 Set Include permanent link text. More...
 
 getIncludePermanentLinkText ()
 Get Include permanent link text. More...
 
 setType ($a_type)
 Set Type. More...
 
 getType ()
 Get Type. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setAppend ($a_append)
 Set Append. More...
 
 getAppend ()
 Get Append. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setTitle ($a_val)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setAlignCenter ($a_val)
 Set center alignment. More...
 
 getAlignCenter ()
 Get center alignment. More...
 
 getHTML ()
 Get HTML for link. More...
 

Static Public Member Functions

static _getBookmarksSelectionList ($title, $href)
 returns the active bookmark links. More...
 

Protected Attributes

 $align_center = true
 

Detailed Description

Class for permanent links.

Version
$Id$

@ilCtrl_Calls ilPermanentLinkGUI: ilNoteGUI, ilColumnGUI, ilPublicUserProfileGUI

Definition at line 17 of file class.ilPermanentLinkGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPermanentLinkGUI::__construct (   $a_type,
  $a_id,
  $a_append = "",
  $a_target = "" 
)

Example: type = "wiki", id (ref_id) = "234", append = "_Start_Page".

Definition at line 24 of file class.ilPermanentLinkGUI.php.

25 {
26 $this->setType($a_type);
27 $this->setId($a_id);
28 $this->setAppend($a_append);
29 $this->setIncludePermanentLinkText(true);
30 $this->setTarget($a_target);
31 }
setIncludePermanentLinkText($a_includepermanentlinktext)
Set Include permanent link text.
setAppend($a_append)
Set Append.
setTarget($a_target)
Set Target.

References setAppend(), setId(), setIncludePermanentLinkText(), setTarget(), and setType().

+ Here is the call graph for this function:

Member Function Documentation

◆ _getBookmarksSelectionList()

static ilPermanentLinkGUI::_getBookmarksSelectionList (   $title,
  $href 
)
static

returns the active bookmark links.

if only one link is enabled, a single link is returned. otherwise a the html of an advanced selection list is returned.

Definition at line 242 of file class.ilPermanentLinkGUI.php.

243 {
244 global $ilDB, $lng, $ilSetting;
245
246 require_once 'Services/PermanentLink/classes/class.ilPermanentLink.php';
247
248 // social bookmarkings
249
251
252 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
253
254 $current_selection_list = new ilAdvancedSelectionListGUI();
255 //$current_selection_list->setListTitle($lng->txt("bm_add_to_social_bookmarks"));
256 $current_selection_list->setId("socialbm_actions");
257 $current_selection_list->setUseImages(true);
258
259 $cnt = 0;
260
261 if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID && !$ilSetting->get('disable_bookmarks'))
262 {
263 $linktpl = 'ilias.php?cmd=redirect&baseClass=ilPersonalDesktopGUI&redirectClass=ilbookmarkadministrationgui&redirectCmd=newFormBookmark&param_bmf_id=1&param_return_to=true&param_bm_title='. urlencode(urlencode($title)) . '&param_bm_link=' . urlencode(urlencode($href))."&param_return_to_url=".urlencode(urlencode($_SERVER['REQUEST_URI']));
264 $current_selection_list->addItem($lng->txt("bm_add_to_ilias"), '', $linktpl, ilUtil::getImagePath('socialbookmarks/icon_bm_15x15.gif') , $lng->txt("bm_add_to_ilias"), '_top');
265 $cnt++;
266 }
267
268 foreach ($rset as $row)
269 {
270 $linktpl = $row->sbm_link;
271 $linktpl = str_replace('{LINK}', urlencode($href), $linktpl);
272 $linktpl = str_replace('{TITLE}', urlencode($title), $linktpl);
273 $current_selection_list->addItem($row->sbm_title, '', $linktpl, $row->sbm_icon, $row->title, '_blank');
274 $cnt++;
275 }
276
277 if ($cnt == 1 && $_SESSION["AccountId"] != ANONYMOUS_USER_ID && !$ilSetting->get('disable_bookmarks'))
278 {
279 $loc_tpl = new ilTemplate('tpl.single_link.html', true, true, 'Services/PermanentLink');
280 $loc_tpl->setVariable("TXT_ADD_TO_ILIAS_BM", $lng->txt("bm_add_to_ilias"));
281 $loc_tpl->setVariable("URL_ADD_TO_BM", 'ilias.php?cmd=redirect&baseClass=ilPersonalDesktopGUI&redirectClass=ilbookmarkadministrationgui&redirectCmd=newFormBookmark&param_bmf_id=1&param_return_to=true&param_bm_title='. urlencode(urlencode($title)) . '&param_bm_link=' . urlencode(urlencode($href))."&param_return_to_url=".urlencode(urlencode($_SERVER['REQUEST_URI'])));
282 $loc_tpl->setVariable("ICON", ilUtil::getImagePath('icon_bm.svg'));
283 return $loc_tpl->get();
284 }
285 else if ($cnt >= 1)
286 {
287 return $current_selection_list->getHTML();
288 }
289 else
290 return '';
291
292 }
$_SESSION["AccountId"]
User interface class for advanced drop-down selection lists.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $lng
Definition: privfeed.php:40
global $ilSetting
Definition: privfeed.php:40
global $ilDB
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, $_SESSION, $ilDB, $ilSetting, $lng, $row, ilPermanentLink\getActiveBookmarks(), and ilUtil\getImagePath().

Referenced by ilInfoScreenGUI\addObjectSections(), and getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAlignCenter()

ilPermanentLinkGUI::getAlignCenter ( )

Get center alignment.

Returns
boolean align the link at center

Definition at line 168 of file class.ilPermanentLinkGUI.php.

References $align_center.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getAppend()

ilPermanentLinkGUI::getAppend ( )

Get Append.

Returns
string Append

Definition at line 108 of file class.ilPermanentLinkGUI.php.

109 {
110 return $this->append;
111 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getHTML()

ilPermanentLinkGUI::getHTML ( )

Get HTML for link.

Definition at line 176 of file class.ilPermanentLinkGUI.php.

177 {
178 global $lng, $ilCtrl, $ilObjDataCache;
179
180 $tpl = new ilTemplate("tpl.permanent_link.html", true, true,
181 "Services/PermanentLink");
182
183 include_once('./Services/Link/classes/class.ilLink.php');
184 $href = ilLink::_getStaticLink($this->getId(), $this->getType(),
185 true, $this->getAppend());
186 if ($this->getIncludePermanentLinkText())
187 {
188 $tpl->setVariable("TXT_PERMA", $lng->txt("perma_link").":");
189 }
190
191 $title = '';
192
193 // fetch default title for bookmark
194
195 if ($this->getTitle() != "")
196 {
197 $title = $this->getTitle();
198 }
199 else
200 {
201 $obj_id = $ilObjDataCache->lookupObjId($this->getId());
202 $title = $ilObjDataCache->lookupTitle($obj_id);
203 }
204 #if (!$title)
205 # $bookmark->setTitle("untitled");
206
207 $tpl->setVariable("TXT_BOOKMARK_DEFAULT", $title);
208
209 $tpl->setVariable("LINK", $href);
210
211 if ($this->getAlignCenter())
212 {
213 $tpl->setVariable("ALIGN", "center");
214 }
215 else
216 {
217 $tpl->setVariable("ALIGN", "left");
218 }
219
220 if ($this->getTarget() != "")
221 {
222 $tpl->setVariable("TARGET", 'target="'.$this->getTarget().'"');
223 }
224
225
226 // bookmark links
227 $bm_html = self::_getBookmarksSelectionList($title, $href);
228
229 if ($bm_html)
230 {
231 $tpl->setVariable('SELECTION_LIST', $bm_html);
232 }
233
234 return $tpl->get();
235 }
global $tpl
Definition: ilias.php:8
getAlignCenter()
Get center alignment.
static _getBookmarksSelectionList($title, $href)
returns the active bookmark links.
getIncludePermanentLinkText()
Get Include permanent link text.
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, $tpl, _getBookmarksSelectionList(), ilLink\_getStaticLink(), getAlignCenter(), getAppend(), getId(), getIncludePermanentLinkText(), getTarget(), getTitle(), and getType().

+ Here is the call graph for this function:

◆ getId()

ilPermanentLinkGUI::getId ( )

Get Id.

Returns
string Id

Definition at line 88 of file class.ilPermanentLinkGUI.php.

89 {
90 return $this->id;
91 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getIncludePermanentLinkText()

ilPermanentLinkGUI::getIncludePermanentLinkText ( )

Get Include permanent link text.

Returns
boolean Include permanent link text

Definition at line 48 of file class.ilPermanentLinkGUI.php.

49 {
50 return $this->includepermanentlinktext;
51 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTarget()

ilPermanentLinkGUI::getTarget ( )

Get Target.

Returns
string Target

Definition at line 128 of file class.ilPermanentLinkGUI.php.

129 {
130 return $this->target;
131 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTitle()

ilPermanentLinkGUI::getTitle ( )

Get title.

Returns
string title

Definition at line 148 of file class.ilPermanentLinkGUI.php.

149 {
150 return $this->title;
151 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getType()

ilPermanentLinkGUI::getType ( )

Get Type.

Returns
string Type

Definition at line 68 of file class.ilPermanentLinkGUI.php.

69 {
70 return $this->type;
71 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ setAlignCenter()

ilPermanentLinkGUI::setAlignCenter (   $a_val)

Set center alignment.

Parameters
booleanalign the link at center

Definition at line 158 of file class.ilPermanentLinkGUI.php.

159 {
160 $this->align_center = $a_val;
161 }

◆ setAppend()

ilPermanentLinkGUI::setAppend (   $a_append)

Set Append.

Parameters
string$a_appendAppend

Definition at line 98 of file class.ilPermanentLinkGUI.php.

99 {
100 $this->append = $a_append;
101 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setId()

ilPermanentLinkGUI::setId (   $a_id)

Set Id.

Parameters
string$a_idId

Definition at line 78 of file class.ilPermanentLinkGUI.php.

79 {
80 $this->id = $a_id;
81 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setIncludePermanentLinkText()

ilPermanentLinkGUI::setIncludePermanentLinkText (   $a_includepermanentlinktext)

Set Include permanent link text.

Parameters
boolean$a_includepermanentlinktextInclude permanent link text

Definition at line 38 of file class.ilPermanentLinkGUI.php.

39 {
40 $this->includepermanentlinktext = $a_includepermanentlinktext;
41 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setTarget()

ilPermanentLinkGUI::setTarget (   $a_target)

Set Target.

Parameters
string$a_targetTarget

Definition at line 118 of file class.ilPermanentLinkGUI.php.

119 {
120 $this->target = $a_target;
121 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setTitle()

ilPermanentLinkGUI::setTitle (   $a_val)

Set title.

Parameters
stringtitle

Definition at line 138 of file class.ilPermanentLinkGUI.php.

139 {
140 $this->title = $a_val;
141 }

◆ setType()

ilPermanentLinkGUI::setType (   $a_type)

Set Type.

Parameters
string$a_typeType

Definition at line 58 of file class.ilPermanentLinkGUI.php.

59 {
60 $this->type = $a_type;
61 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $align_center

ilPermanentLinkGUI::$align_center = true
protected

Definition at line 19 of file class.ilPermanentLinkGUI.php.

Referenced by getAlignCenter().


The documentation for this class was generated from the following file: