ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilImageLinkButton.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.ilLinkButton.php";
5
14{
15 protected $src; // [string]
16 protected $force_title; // [bool]
17
18 public static function getInstance()
19 {
20 return new self(self::TYPE_LINK);
21 }
22
23
24 //
25 // properties
26 //
27
34 public function setImage($a_value, $a_is_internal = true)
35 {
36 if((bool)$a_is_internal)
37 {
38 $a_value = ilUtil::getImagePath($a_value);
39 }
40 $this->src = trim($a_value);
41 }
42
48 public function getImage()
49 {
50 return $this->src;
51 }
52
53 public function forceTitle($a_value)
54 {
55 $this->force_title = (bool)$a_value;
56 }
57
58 public function hasForceTitle()
59 {
60 return $this->force_title;
61 }
62
63
64 //
65 // render
66 //
67
68 protected function prepareRender()
69 {
70 // get rid of parent "submit" css class...
71 }
72
73 protected function renderCaption()
74 {
75 $attr = array();
76 $attr["src"] = $this->getImage();
77 $attr["alt"] = $this->getCaption();
78 if($this->hasForceTitle())
79 {
80 $attr["title"] = $this->getCaption();
81 }
82 return '<img'.$this->renderAttributesHelper($attr).' />';
83 }
84}
getCaption($a_translate=true)
Get caption.
prepareRender()
Prepare render
renderCaption()
Prepare caption for render.
static getInstance()
Factory.
setImage($a_value, $a_is_internal=true)
Set image.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)