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
6/**
7 * Link Button GUI
8 * @author  Jörg Lützenkirchen <luetzenkirchen@leifos.com>
9 * @version $Id: class.ilTabsGUI.php 45109 2013-09-30 15:46:28Z akill $
10 * @package ServicesUIComponent
11 */
12class ilJsLinkButton extends ilButton
13{
14    protected $target;
15
16    public static function getInstance()
17    {
18        return new self(self::TYPE_LINK);
19    }
20
21    /**
22     * Set target
23     * @param string $a_value
24     */
25    public function setTarget($a_value)
26    {
27        $this->target = trim($a_value);
28    }
29
30    /**
31     * Get target
32     * @return string
33     */
34    public function getTarget()
35    {
36        return $this->target;
37    }
38
39    /**
40     * Prepare caption for render
41     * @return string
42     */
43    protected function renderCaption()
44    {
45        return '&nbsp;' . $this->getCaption() . '&nbsp;';
46    }
47
48    public function render()
49    {
50        $this->prepareRender();
51
52        $attr = array();
53
54        $attr["target"] = $this->getTarget();
55        $attr["name"] = $this->getName();
56        $attr["onclick"] = $this->getOnClick();
57
58        return '<a' . $this->renderAttributes($attr) . '>' .
59        $this->renderCaption() . '</a>';
60    }
61}
62