|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ajax\common\html; |
|
4
|
|
|
|
|
5
|
|
|
use Ajax\JsUtils; |
|
6
|
|
|
|
|
7
|
|
|
class HtmlSingleElement extends BaseHtml { |
|
8
|
|
|
|
|
9
|
|
|
public function __construct($identifier, $tagName="br") { |
|
10
|
|
|
parent::__construct($identifier); |
|
11
|
|
|
$this->tagName=$tagName; |
|
12
|
|
|
$this->_template='<%tagName% id="%identifier%" %properties%/>'; |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
public function setClass($classNames) { |
|
16
|
|
|
if(\is_array($classNames)){ |
|
17
|
|
|
$classNames=implode(" ", $classNames); |
|
18
|
|
|
} |
|
19
|
|
|
$this->setProperty("class", $classNames); |
|
20
|
|
|
return $this; |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function addClass($classNames) { |
|
24
|
|
|
if(\is_array($classNames)){ |
|
25
|
|
|
$classNames=implode(" ", $classNames); |
|
26
|
|
|
} |
|
27
|
|
|
$this->addToProperty("class", $classNames); |
|
28
|
|
|
return $this; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function setRole($value) { |
|
32
|
|
|
$this->setProperty("role", $value); |
|
33
|
|
|
return $this; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
public function setTitle($value) { |
|
37
|
|
|
$this->setProperty("title", $value); |
|
38
|
|
|
return $this; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function setStyle($value){ |
|
42
|
|
|
$this->setProperty("style", $value); |
|
43
|
|
|
return $this; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* {@inheritDoc} |
|
48
|
|
|
* @see \Ajax\common\html\BaseHtml::run() |
|
49
|
|
|
*/ |
|
50
|
|
|
public function run(JsUtils $js) { |
|
51
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/* |
|
55
|
|
|
* (non-PHPdoc) |
|
56
|
|
|
* @see \Ajax\bootstrap\html\BaseHtml::fromArray() |
|
57
|
|
|
*/ |
|
58
|
|
|
public function fromArray($array) { |
|
59
|
|
|
$array=parent::fromArray($array); |
|
60
|
|
|
foreach ( $array as $key => $value ) { |
|
61
|
|
|
$this->setProperty($key, $value); |
|
62
|
|
|
} |
|
63
|
|
|
return $array; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function setSize($size) { |
|
|
|
|
|
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.