ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilLinkButton.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "Services/UIComponent/Button/classes/class.ilButton.php";
5
14{
15 protected $url; // [string]
16 protected $target; // [string]
17
18 public static function getInstance()
19 {
20 return new self(self::TYPE_LINK);
21 }
22
23
24 //
25 // properties
26 //
27
33 public function setUrl($a_value)
34 {
35 $this->url = trim($a_value);
36 }
37
43 public function getUrl()
44 {
45 return $this->url;
46 }
47
53 public function setTarget($a_value)
54 {
55 $this->target = trim($a_value);
56 }
57
63 public function getTarget()
64 {
65 return $this->target;
66 }
67
68
69 //
70 // render
71 //
72
78 protected function renderCaption()
79 {
80 return '&nbsp;'.$this->getCaption().'&nbsp;';
81 }
82
83 public function render()
84 {
85 $this->prepareRender();
86
87 $attr = array();
88 $attr["href"] = $this->getUrl() ? $this->getUrl() : "#";
89 $attr["target"] = $this->getTarget();
90
91 return '<a'.$this->renderAttributes($attr).'>'.
92 $this->renderCaption().'</a>';
93 }
94}
const TYPE_LINK
prepareRender()
Prepare render
getTarget()
Get target.
setTarget($a_value)
Set target.
renderCaption()
Prepare caption for render.
render()
Render HTML.
setUrl($a_value)
Set URL.
static getInstance()
Factory.