1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax\semantic\html\base; |
4
|
|
|
|
5
|
|
|
use Ajax\common\html\HtmlDoubleElement; |
6
|
|
|
use Ajax\JsUtils; |
7
|
|
|
use Ajax\semantic\html\content\InternalPopup; |
8
|
|
|
use Phalcon\Mvc\View; |
9
|
|
|
use Ajax\semantic\html\elements\HtmlIcon; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class HtmlSemDoubleElement extends HtmlDoubleElement { |
13
|
|
|
protected $_popup=NULL; |
14
|
|
|
|
15
|
|
|
public function __construct($identifier, $tagName="p") { |
16
|
|
|
parent::__construct($identifier, $tagName); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* {@inheritDoc} |
21
|
|
|
* @see \Ajax\common\html\HtmlSingleElement::setSize() |
22
|
|
|
*/ |
23
|
|
|
public function setSize($size){ |
24
|
|
|
return $this->addToPropertyCtrl("class", $size, Size::getConstants()); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* show it is currently unable to be interacted with |
29
|
|
|
* @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
30
|
|
|
*/ |
31
|
|
|
public function setDisabled(){ |
32
|
|
|
return $this->addToProperty("class", "disabled"); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param string $color |
37
|
|
|
* @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
38
|
|
|
*/ |
39
|
|
|
public function setColor($color){ |
40
|
|
|
return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
44
|
|
|
if(isset($this->_popup)) |
45
|
|
|
$this->_popup->setAttributes($variation,$popupEvent); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
49
|
|
|
$this->_popup=new InternalPopup($this,$title,$content,$variation,$params); |
50
|
|
|
return $this; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function addPopupHtml($html="",$variation=NULL,$params=array()){ |
54
|
|
|
$this->_popup=new InternalPopup($this); |
55
|
|
|
$this->_popup->setHtml($html); |
56
|
|
|
$this->_popup->setAttributes($variation,$params); |
57
|
|
|
return $this; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function setFluid(){ |
61
|
|
|
$this->addToProperty("class", "fluid"); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* can be formatted to appear on dark backgrounds |
66
|
|
|
*/ |
67
|
|
|
public function setInverted(){ |
68
|
|
|
$this->addToProperty("class", "inverted"); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Adds an icon before or after |
73
|
|
|
* @param string|HtmlIcon $icon |
74
|
|
|
* @param boolean $before |
75
|
|
|
* @param boolean $labeled |
76
|
|
|
* @return \Ajax\semantic\html\elements\HtmlIcon |
77
|
|
|
*/ |
78
|
|
|
public function addIcon($icon,$before=true,$labeled=false){ |
79
|
|
|
$iconO=$icon; |
80
|
|
|
if(\is_string($icon)){ |
81
|
|
|
$iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
82
|
|
|
} |
83
|
|
|
if($labeled!==false){ |
84
|
|
|
$this->addToProperty("class", "labeled icon"); |
85
|
|
|
$this->tagName="div"; |
86
|
|
|
} |
87
|
|
|
$this->addContent($iconO,$before); |
88
|
|
|
return $iconO; |
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* show a loading indicator |
93
|
|
|
* @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
94
|
|
|
*/ |
95
|
|
|
public function asLoader(){ |
96
|
|
|
return $this->addToProperty("class", "loading"); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function compile(JsUtils $js=NULL, View $view=NULL){ |
100
|
|
|
if(isset($this->_popup)) |
101
|
|
|
$this->_popup->compile(); |
102
|
|
|
return parent::compile($js,$view); |
103
|
|
|
} |
104
|
|
|
public function run(JsUtils $js){ |
105
|
|
|
parent::run($js); |
106
|
|
|
if(isset($this->_popup)){ |
107
|
|
|
$this->_popup->run($js); |
108
|
|
|
//$this->addEventsOnRun($js); |
|
|
|
|
109
|
|
|
//return $this->_bsComponent; |
|
|
|
|
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
} |