@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | public function __construct($identifier) { |
16 | 16 | parent::__construct($identifier, "form"); |
17 | 17 | $this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>'; |
18 | - $this->futureElements=array (); |
|
19 | - $this->formGroups=array (); |
|
18 | + $this->futureElements=array(); |
|
19 | + $this->formGroups=array(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /* |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
27 | 27 | if (isset($js)) { |
28 | 28 | $this->formElementsPrefix=$js->config()->getVar("formElementsPrefix"); |
29 | - foreach ( $this->futureElements as $futureElement ) { |
|
29 | + foreach ($this->futureElements as $futureElement) { |
|
30 | 30 | $futureElementValue=$this->getPrefix($futureElement); |
31 | 31 | $futureElementValues=explode("_", $futureElementValue); |
32 | - switch($futureElementValues [0]) { |
|
32 | + switch ($futureElementValues [0]) { |
|
33 | 33 | case "input": |
34 | 34 | $control=new HtmlInput($futureElement); |
35 | 35 | $control->setClass("form-control"); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $control->setLabel($label, false); |
48 | 48 | break; |
49 | 49 | case "select": |
50 | - $control=new HtmlSelect($futureElement,""); |
|
50 | + $control=new HtmlSelect($futureElement, ""); |
|
51 | 51 | $control->setProperty("size", $futureElementValues [1]); |
52 | 52 | $control->setClass("form-control"); |
53 | 53 | //$control->setLabel($this->getPart($futureElement)); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->addElement($control); |
63 | 63 | } |
64 | 64 | } |
65 | - foreach ( $this->formGroups as $group ) { |
|
65 | + foreach ($this->formGroups as $group) { |
|
66 | 66 | $this->addContent($group); |
67 | 67 | } |
68 | 68 | return parent::compile($js, $view); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | private function getPrefix($element) { |
92 | 92 | $result="input_text"; |
93 | - foreach ( $this->formElementsPrefix as $k => $v ) { |
|
93 | + foreach ($this->formElementsPrefix as $k => $v) { |
|
94 | 94 | if (Text::startsWith($element, $k)) { |
95 | 95 | $result=$v; |
96 | 96 | break; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | public function getElement($name) { |
122 | 122 | $element=null; |
123 | - foreach ( $this->formGroups as $group ) { |
|
123 | + foreach ($this->formGroups as $group) { |
|
124 | 124 | } |
125 | 125 | return $element; |
126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray() |
131 | 131 | */ |
132 | 132 | public function fromArray($array) { |
133 | - foreach ( $array as $value ) { |
|
133 | + foreach ($array as $value) { |
|
134 | 134 | if (is_string($value)) { |
135 | 135 | $this->futureElements []=$value; |
136 | 136 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | private $default; |
14 | 14 | private $options; |
15 | 15 | |
16 | - public function __construct($identifier, $caption="",$default=NULL) { |
|
16 | + public function __construct($identifier, $caption="", $default=NULL) { |
|
17 | 17 | parent::__construct($identifier, "select"); |
18 | 18 | $this->setProperty("name", $identifier); |
19 | 19 | $this->setProperty("class", "form-control"); |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | $this->options=array(); |
23 | 23 | } |
24 | 24 | |
25 | - public function addOption($element,$value="",$selected=false){ |
|
26 | - if($element instanceof HtmlOption){ |
|
25 | + public function addOption($element, $value="", $selected=false) { |
|
26 | + if ($element instanceof HtmlOption) { |
|
27 | 27 | $option=$element; |
28 | - }else{ |
|
29 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
28 | + } else { |
|
29 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
30 | 30 | } |
31 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
31 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
32 | 32 | $option->select(); |
33 | 33 | } |
34 | 34 | $this->options[]=$option; |
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setValue($value) { |
38 | - foreach ( $this->options as $option ) { |
|
39 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
38 | + foreach ($this->options as $option) { |
|
39 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
40 | 40 | $option->setProperty("selected", ""); |
41 | 41 | } |
42 | 42 | } |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
51 | 51 | $this->content=array(); |
52 | - if(isset($this->default)){ |
|
52 | + if (isset($this->default)) { |
|
53 | 53 | $default=new HtmlOption("", $this->default); |
54 | 54 | $this->content[]=$default; |
55 | 55 | } |
56 | - foreach ($this->options as $option){ |
|
56 | + foreach ($this->options as $option) { |
|
57 | 57 | $this->content[]=$option; |
58 | 58 | } |
59 | 59 | return parent::compile($js, $view); |
60 | 60 | } |
61 | 61 | |
62 | - public function fromArray($array){ |
|
63 | - if(JArray::isAssociative($array)){ |
|
64 | - foreach ($array as $k=>$v){ |
|
62 | + public function fromArray($array) { |
|
63 | + if (JArray::isAssociative($array)) { |
|
64 | + foreach ($array as $k=>$v) { |
|
65 | 65 | $this->addOption($v, $k); |
66 | 66 | } |
67 | - }else{ |
|
68 | - foreach ($array as $v){ |
|
67 | + } else { |
|
68 | + foreach ($array as $v) { |
|
69 | 69 | $this->addOption($v, $v); |
70 | 70 | } |
71 | 71 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->addOption($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function setSize($size){ |
|
101 | + public function setSize($size) { |
|
102 | 102 | return $this->setProperty("size", $size); |
103 | 103 | } |
104 | 104 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function setWidth($width) { |
33 | 33 | if (\is_int($width)) { |
34 | - $width=Wide::getConstants()["W" . $width]; |
|
34 | + $width=Wide::getConstants()["W".$width]; |
|
35 | 35 | } |
36 | 36 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
37 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
37 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setValue($value) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $divider->setVertical(); |
53 | 53 | else |
54 | 54 | $divider->setHorizontal(); |
55 | - $this->wrap($divider,""); |
|
55 | + $this->wrap($divider, ""); |
|
56 | 56 | return $divider; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | \ No newline at end of file |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @return $this |
28 | 28 | */ |
29 | 29 | public function setOnShow($jsCode) { |
30 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
30 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
31 | 31 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
32 | 32 | } |
33 | 33 | |
34 | - public function setExclusive($value){ |
|
34 | + public function setExclusive($value) { |
|
35 | 35 | return $this->setParam("exclusive", $value); |
36 | 36 | } |
37 | 37 | |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * @param string $popup the css selector of the popup |
41 | 41 | * @return \Ajax\semantic\components\Popup |
42 | 42 | */ |
43 | - public function setPopup($popup){ |
|
43 | + public function setPopup($popup) { |
|
44 | 44 | return $this->setParam("popup", $popup); |
45 | 45 | } |
46 | 46 | |
47 | - public function setInline($value){ |
|
47 | + public function setInline($value) { |
|
48 | 48 | return $this->setParam("inline", $value); |
49 | 49 | } |
50 | 50 | |
51 | - public function setPosition($value){ |
|
51 | + public function setPosition($value) { |
|
52 | 52 | return $this->setParam("position", $value); |
53 | 53 | } |
54 | 54 | //TODO other events implementation |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | private $_hasIcon=false; |
16 | 16 | |
17 | 17 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
18 | - public abstract function addContent($content,$before=false); |
|
18 | + public abstract function addContent($content, $before=false); |
|
19 | 19 | |
20 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
21 | - if($this->_hasIcon===false){ |
|
20 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
21 | + if ($this->_hasIcon===false) { |
|
22 | 22 | $iconO=$icon; |
23 | - if(\is_string($icon)){ |
|
23 | + if (\is_string($icon)) { |
|
24 | 24 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
25 | 25 | } |
26 | 26 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
27 | - $this->addContent($iconO,$direction===Direction::LEFT); |
|
27 | + $this->addContent($iconO, $direction===Direction::LEFT); |
|
28 | 28 | $this->_hasIcon=true; |
29 | - }else{ |
|
29 | + } else { |
|
30 | 30 | $iconO=$this->getIcon(); |
31 | 31 | $iconO->setIcon($icon); |
32 | 32 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | return $iconO; |
35 | 35 | } |
36 | 36 | |
37 | - public function getIcon(){ |
|
38 | - if(\is_array($this->content)){ |
|
39 | - foreach ($this->content as $item){ |
|
40 | - if($item instanceof HtmlIcon) |
|
37 | + public function getIcon() { |
|
38 | + if (\is_array($this->content)) { |
|
39 | + foreach ($this->content as $item) { |
|
40 | + if ($item instanceof HtmlIcon) |
|
41 | 41 | return $item; |
42 | 42 | } |
43 | 43 | } |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | } |
18 | 18 | protected $mClass="menu"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
20 | + protected $items=array(); |
|
21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
22 | 22 | protected $input; |
23 | 23 | protected $value; |
24 | 24 | |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | parent::__construct($identifier, "div"); |
27 | 27 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
28 | 28 | $this->setProperty("class", "ui dropdown"); |
29 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
29 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
30 | 30 | $content->setClass("text"); |
31 | 31 | $this->setValue($value); |
32 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
32 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
33 | 33 | $this->content=array($content); |
34 | 34 | $this->tagName="div"; |
35 | 35 | $this->addItems($items); |
36 | 36 | } |
37 | 37 | |
38 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
39 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
38 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
39 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
40 | 40 | $this->items[]=$itemO; |
41 | 41 | return $itemO; |
42 | 42 | } |
43 | 43 | |
44 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
45 | - $this->addIconP($icon,$before,$labeled); |
|
44 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
45 | + $this->addIconP($icon, $before, $labeled); |
|
46 | 46 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
47 | 47 | } |
48 | 48 | |
@@ -52,26 +52,26 @@ discard block |
||
52 | 52 | * @param number $position |
53 | 53 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
54 | 54 | */ |
55 | - public function insertItem($item,$position=0){ |
|
55 | + public function insertItem($item, $position=0) { |
|
56 | 56 | $itemO=$this->beforeAddItem($item); |
57 | - $start = array_slice($this->items, 0, $position); |
|
58 | - $end = array_slice($this->items, $position); |
|
59 | - $start[] = $item; |
|
57 | + $start=array_slice($this->items, 0, $position); |
|
58 | + $end=array_slice($this->items, $position); |
|
59 | + $start[]=$item; |
|
60 | 60 | $this->items=array_merge($start, $end); |
61 | 61 | return $itemO; |
62 | 62 | } |
63 | 63 | |
64 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
64 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
65 | 65 | $itemO=$item; |
66 | - if(\is_array($item)){ |
|
66 | + if (\is_array($item)) { |
|
67 | 67 | $description=JArray::getValue($item, "description", 3); |
68 | 68 | $value=JArray::getValue($item, "value", 1); |
69 | 69 | $image=JArray::getValue($item, "image", 2); |
70 | 70 | $item=JArray::getValue($item, "item", 0); |
71 | 71 | } |
72 | - if(!$item instanceof HtmlDropdownItem){ |
|
73 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
74 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
72 | + if (!$item instanceof HtmlDropdownItem) { |
|
73 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
74 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
75 | 75 | $this->addToProperty("class", "vertical"); |
76 | 76 | } |
77 | 77 | return $itemO; |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | $this->addItem($function($object)); |
85 | 85 | } |
86 | 86 | |
87 | - public function addInput($name){ |
|
88 | - if(!isset($name)) |
|
87 | + public function addInput($name) { |
|
88 | + if (!isset($name)) |
|
89 | 89 | $name="input-".$this->identifier; |
90 | 90 | $this->setAction("activate"); |
91 | - $this->input=new HtmlInput($name,"hidden"); |
|
91 | + $this->input=new HtmlInput($name, "hidden"); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | * @param string $icon |
98 | 98 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
99 | 99 | */ |
100 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
101 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
100 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
101 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Adds a divider item |
106 | 106 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
107 | 107 | */ |
108 | - public function addDividerItem(){ |
|
108 | + public function addDividerItem() { |
|
109 | 109 | return $this->addItem(HtmlDropdownItem::divider()); |
110 | 110 | } |
111 | 111 | |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * @param string $icon |
116 | 116 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
117 | 117 | */ |
118 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
119 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
118 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
119 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param string $color |
126 | 126 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
127 | 127 | */ |
128 | - public function addCircularLabelItem($caption,$color){ |
|
128 | + public function addCircularLabelItem($caption, $color) { |
|
129 | 129 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
130 | 130 | } |
131 | 131 | |
@@ -134,87 +134,87 @@ discard block |
||
134 | 134 | * @param string $image |
135 | 135 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
136 | 136 | */ |
137 | - public function addMiniAvatarImageItem($caption,$image){ |
|
137 | + public function addMiniAvatarImageItem($caption, $image) { |
|
138 | 138 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
139 | 139 | } |
140 | 140 | |
141 | - public function addItems($items){ |
|
142 | - if(JArray::isAssociative($items)){ |
|
143 | - foreach ($items as $k=>$v){ |
|
141 | + public function addItems($items) { |
|
142 | + if (JArray::isAssociative($items)) { |
|
143 | + foreach ($items as $k=>$v) { |
|
144 | 144 | $this->addItem($v)->setData($k); |
145 | 145 | } |
146 | - }else{ |
|
147 | - foreach ($items as $item){ |
|
146 | + } else { |
|
147 | + foreach ($items as $item) { |
|
148 | 148 | $this->addItem($item); |
149 | 149 | } |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - public function getItem($index){ |
|
153 | + public function getItem($index) { |
|
154 | 154 | return $this->items[$index]; |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | 158 | * @return int |
159 | 159 | */ |
160 | - public function count(){ |
|
160 | + public function count() { |
|
161 | 161 | return \sizeof($this->items); |
162 | 162 | } |
163 | 163 | /** |
164 | 164 | * @param boolean $dropdown |
165 | 165 | */ |
166 | - public function asDropdown($dropdown){ |
|
167 | - if($dropdown===false){ |
|
166 | + public function asDropdown($dropdown) { |
|
167 | + if ($dropdown===false) { |
|
168 | 168 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
169 | 169 | $dropdown="menu"; |
170 | - }else{ |
|
170 | + } else { |
|
171 | 171 | $dropdown="dropdown"; |
172 | 172 | $this->mClass="menu"; |
173 | 173 | } |
174 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
174 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
175 | 175 | } |
176 | 176 | |
177 | - public function setVertical(){ |
|
178 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
177 | + public function setVertical() { |
|
178 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
179 | 179 | } |
180 | 180 | |
181 | - public function setInline(){ |
|
182 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
181 | + public function setInline() { |
|
182 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
183 | 183 | } |
184 | 184 | |
185 | - public function setSimple(){ |
|
186 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
185 | + public function setSimple() { |
|
186 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
187 | 187 | } |
188 | 188 | |
189 | - public function asButton($floating=false){ |
|
190 | - if($floating) |
|
189 | + public function asButton($floating=false) { |
|
190 | + if ($floating) |
|
191 | 191 | $this->addToProperty("class", "floating"); |
192 | 192 | $this->removePropertyValue("class", "selection"); |
193 | 193 | return $this->addToProperty("class", "button"); |
194 | 194 | } |
195 | 195 | |
196 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
197 | - if(isset($name)) |
|
196 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
197 | + if (isset($name)) |
|
198 | 198 | $this->addInput($name); |
199 | - if($multiple) |
|
199 | + if ($multiple) |
|
200 | 200 | $this->addToProperty("class", "multiple"); |
201 | - if ($selection){ |
|
202 | - if($this->propertyContains("class", "button")===false) |
|
203 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
201 | + if ($selection) { |
|
202 | + if ($this->propertyContains("class", "button")===false) |
|
203 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
204 | 204 | } |
205 | 205 | return $this; |
206 | 206 | } |
207 | 207 | |
208 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
209 | - $this->asSelect($name,$multiple,$selection); |
|
208 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
209 | + $this->asSelect($name, $multiple, $selection); |
|
210 | 210 | return $this->addToProperty("class", "search"); |
211 | 211 | } |
212 | 212 | |
213 | - public function setSelect($name=NULL,$multiple=false){ |
|
214 | - if(!isset($name)) |
|
213 | + public function setSelect($name=NULL, $multiple=false) { |
|
214 | + if (!isset($name)) |
|
215 | 215 | $name="select-".$this->identifier; |
216 | 216 | $this->input=null; |
217 | - if($multiple){ |
|
217 | + if ($multiple) { |
|
218 | 218 | $this->setProperty("multiple", true); |
219 | 219 | $this->addToProperty("class", "multiple"); |
220 | 220 | } |
@@ -222,37 +222,37 @@ discard block |
||
222 | 222 | $this->tagName="select"; |
223 | 223 | $this->setProperty("name", $name); |
224 | 224 | $this->content=null; |
225 | - foreach ($this->items as $item){ |
|
225 | + foreach ($this->items as $item) { |
|
226 | 226 | $item->asOption(); |
227 | 227 | } |
228 | 228 | return $this; |
229 | 229 | } |
230 | 230 | |
231 | - public function asSubmenu($pointing=NULL){ |
|
231 | + public function asSubmenu($pointing=NULL) { |
|
232 | 232 | $this->setClass("ui dropdown link item"); |
233 | - if(isset($pointing)){ |
|
233 | + if (isset($pointing)) { |
|
234 | 234 | $this->setPointing($pointing); |
235 | 235 | } |
236 | 236 | return $this; |
237 | 237 | } |
238 | 238 | |
239 | - public function setPointing($value=Direction::NONE){ |
|
240 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
239 | + public function setPointing($value=Direction::NONE) { |
|
240 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
241 | 241 | } |
242 | 242 | |
243 | - public function setValue($value){ |
|
243 | + public function setValue($value) { |
|
244 | 244 | $this->value=$value; |
245 | 245 | return $this; |
246 | 246 | } |
247 | - private function applyValue(){ |
|
247 | + private function applyValue() { |
|
248 | 248 | $value=$this->value; |
249 | - if(isset($this->input) && isset($value)){ |
|
249 | + if (isset($this->input) && isset($value)) { |
|
250 | 250 | $this->input->setProperty("value", $value); |
251 | - }else{ |
|
251 | + } else { |
|
252 | 252 | $this->setProperty("value", $value); |
253 | 253 | } |
254 | 254 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
255 | - if(isset($textElement)) |
|
255 | + if (isset($textElement)) |
|
256 | 256 | $textElement->setContent($value); |
257 | 257 | return $this; |
258 | 258 | } |
@@ -262,28 +262,28 @@ discard block |
||
262 | 262 | * @see BaseHtml::run() |
263 | 263 | */ |
264 | 264 | public function run(JsUtils $js) { |
265 | - if($this->propertyContains("class", "simple")===false){ |
|
266 | - if(isset($this->_bsComponent)===false) |
|
267 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
265 | + if ($this->propertyContains("class", "simple")===false) { |
|
266 | + if (isset($this->_bsComponent)===false) |
|
267 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
268 | 268 | $this->addEventsOnRun($js); |
269 | 269 | return $this->_bsComponent; |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - public function setCompact(){ |
|
273 | + public function setCompact() { |
|
274 | 274 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
275 | 275 | } |
276 | 276 | |
277 | - public function setAction($action){ |
|
277 | + public function setAction($action) { |
|
278 | 278 | $this->_params["action"]=$action; |
279 | 279 | } |
280 | 280 | |
281 | - public function setFullTextSearch($value){ |
|
281 | + public function setFullTextSearch($value) { |
|
282 | 282 | $this->_params["fullTextSearch"]=$value; |
283 | 283 | } |
284 | 284 | |
285 | 285 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
286 | 286 | $this->applyValue(); |
287 | - return parent::compile($js,$view); |
|
287 | + return parent::compile($js, $view); |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | \ No newline at end of file |
@@ -12,34 +12,34 @@ discard block |
||
12 | 12 | use Ajax\semantic\html\base\traits\MenuItemTrait; |
13 | 13 | |
14 | 14 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
15 | - use IconTrait,MenuItemTrait; |
|
16 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) { |
|
15 | + use IconTrait, MenuItemTrait; |
|
16 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) { |
|
17 | 17 | parent::__construct($identifier, "a"); |
18 | 18 | $this->setClass("item"); |
19 | 19 | $this->setContent($content); |
20 | - if($value!==NULL) |
|
20 | + if ($value!==NULL) |
|
21 | 21 | $this->setData($value); |
22 | - if($image!==NULL) |
|
22 | + if ($image!==NULL) |
|
23 | 23 | $this->asMiniAvatar($image); |
24 | - if($description!==NULL) |
|
24 | + if ($description!==NULL) |
|
25 | 25 | $this->setDescription($description); |
26 | 26 | } |
27 | 27 | |
28 | - public function setDescription($description){ |
|
29 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
28 | + public function setDescription($description) { |
|
29 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
30 | 30 | $descO->setClass("description"); |
31 | 31 | $descO->setContent($description); |
32 | - return $this->addContent($descO,true); |
|
32 | + return $this->addContent($descO, true); |
|
33 | 33 | } |
34 | 34 | |
35 | - public function setData($value){ |
|
35 | + public function setData($value) { |
|
36 | 36 | $this->setProperty("data-value", $value); |
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | - public function asOption(){ |
|
40 | + public function asOption() { |
|
41 | 41 | $this->tagName="option"; |
42 | - if($this->getProperty("data-value")!==null) |
|
42 | + if ($this->getProperty("data-value")!==null) |
|
43 | 43 | $this->setProperty("value", $this->getProperty("data-value")); |
44 | 44 | } |
45 | 45 | |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @param string $image the image src |
48 | 48 | * @return \Ajax\common\html\html5\HtmlImg |
49 | 49 | */ |
50 | - public function asMiniAvatar($image){ |
|
50 | + public function asMiniAvatar($image) { |
|
51 | 51 | $this->tagName="div"; |
52 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
52 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
53 | 53 | $img->setClass("ui mini avatar image"); |
54 | - $this->addContent($img,true); |
|
54 | + $this->addContent($img, true); |
|
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @param string $icon |
61 | 61 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
62 | 62 | */ |
63 | - public function asIcon($caption,$icon){ |
|
63 | + public function asIcon($caption, $icon) { |
|
64 | 64 | $this->setContent($caption); |
65 | - $this->addContent(new HtmlIcon("", $icon),true); |
|
65 | + $this->addContent(new HtmlIcon("", $icon), true); |
|
66 | 66 | return $this; |
67 | 67 | } |
68 | 68 | |
@@ -71,23 +71,23 @@ discard block |
||
71 | 71 | * @param string $color |
72 | 72 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
73 | 73 | */ |
74 | - public function asCircularLabel($caption,$color){ |
|
74 | + public function asCircularLabel($caption, $color) { |
|
75 | 75 | $this->setContent($caption); |
76 | 76 | $lbl=new HtmlLabel(""); |
77 | 77 | $lbl->setCircular()->setColor($color)->setEmpty(); |
78 | - $this->addContent($lbl,true); |
|
78 | + $this->addContent($lbl, true); |
|
79 | 79 | return $this; |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | |
84 | 84 | public function addMenuItem($items) { |
85 | - $menu=new HtmlMenu("menu-" . $this->identifier, $items); |
|
85 | + $menu=new HtmlMenu("menu-".$this->identifier, $items); |
|
86 | 86 | $content=$this->content; |
87 | 87 | $this->setTagName("div"); |
88 | 88 | $this->setProperty("class", "item"); |
89 | 89 | $icon=new HtmlIcon("", "dropdown"); |
90 | - $this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu]; |
|
90 | + $this->content=[$icon, new HtmlSemDoubleElement("", "span", "text", $content), $menu]; |
|
91 | 91 | return $menu; |
92 | 92 | } |
93 | 93 | |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | * @param string $icon |
97 | 97 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
98 | 98 | */ |
99 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
100 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
99 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
100 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | 104 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
105 | 105 | */ |
106 | - public static function divider(){ |
|
106 | + public static function divider() { |
|
107 | 107 | return (new HtmlDropdownItem(""))->asDivider(); |
108 | 108 | } |
109 | 109 | |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | * @param string $icon |
113 | 113 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
114 | 114 | */ |
115 | - public static function header($caption=NULL,$icon=NULL){ |
|
116 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
115 | + public static function header($caption=NULL, $icon=NULL) { |
|
116 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @param string $color |
122 | 122 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
123 | 123 | */ |
124 | - public static function circular($caption,$color){ |
|
125 | - return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color); |
|
124 | + public static function circular($caption, $color) { |
|
125 | + return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | * @param string $icon |
131 | 131 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
132 | 132 | */ |
133 | - public static function icon($caption,$icon){ |
|
134 | - return (new HtmlDropdownItem(""))->asIcon($caption,$icon); |
|
133 | + public static function icon($caption, $icon) { |
|
134 | + return (new HtmlDropdownItem(""))->asIcon($caption, $icon); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param unknown $image |
140 | 140 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
141 | 141 | */ |
142 | - public static function avatar($caption,$image){ |
|
143 | - return (new HtmlDropdownItem("",$caption))->asMiniAvatar($image); |
|
142 | + public static function avatar($caption, $image) { |
|
143 | + return (new HtmlDropdownItem("", $caption))->asMiniAvatar($image); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | \ No newline at end of file |
@@ -12,58 +12,58 @@ |
||
12 | 12 | protected $variation; |
13 | 13 | protected $params; |
14 | 14 | protected $semElement; |
15 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
15 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
16 | 16 | $this->semElement=$semElement; |
17 | 17 | $this->title=$title; |
18 | 18 | $this->content=$content; |
19 | - $this->setAttributes($variation,$params); |
|
19 | + $this->setAttributes($variation, $params); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function setHtml($html) { |
23 | - $this->html= $html; |
|
23 | + $this->html=$html; |
|
24 | 24 | return $this; |
25 | 25 | } |
26 | 26 | |
27 | - public function setAttributes($variation=NULL,$params=array()){ |
|
27 | + public function setAttributes($variation=NULL, $params=array()) { |
|
28 | 28 | $this->variation=$variation; |
29 | 29 | $this->params=$params; |
30 | 30 | } |
31 | 31 | |
32 | - public function onShow($jsCode){ |
|
32 | + public function onShow($jsCode) { |
|
33 | 33 | $this->params["onShow"]=$jsCode; |
34 | 34 | } |
35 | 35 | |
36 | - public function compile(JsUtils $js=NULL){ |
|
37 | - if(JString::isNotNull($this->title)){ |
|
36 | + public function compile(JsUtils $js=NULL) { |
|
37 | + if (JString::isNotNull($this->title)) { |
|
38 | 38 | $this->semElement->addToProperty("data-title", $this->title); |
39 | 39 | } |
40 | - if(JString::isNotNull($this->content)){ |
|
40 | + if (JString::isNotNull($this->content)) { |
|
41 | 41 | $this->semElement->addToProperty("data-content", $this->content); |
42 | 42 | } |
43 | - if(JString::isNotNull($this->html)){ |
|
43 | + if (JString::isNotNull($this->html)) { |
|
44 | 44 | $html=$this->html; |
45 | - if(\is_array($html)){ |
|
45 | + if (\is_array($html)) { |
|
46 | 46 | \array_walk($html, function(&$item) use($js){ |
47 | - if($item instanceof HtmlSemDoubleElement){ |
|
47 | + if ($item instanceof HtmlSemDoubleElement) { |
|
48 | 48 | $comp=$item->compile($js); |
49 | 49 | $bs=$item->run($js); |
50 | - if(isset($bs)) |
|
50 | + if (isset($bs)) |
|
51 | 51 | $this->params['onShow']=$bs->getScript(); |
52 | 52 | $item=$comp; |
53 | 53 | } |
54 | 54 | }); |
55 | - $html=\implode("",$html); |
|
55 | + $html=\implode("", $html); |
|
56 | 56 | } |
57 | 57 | $html=\str_replace("\"", "'", $html); |
58 | 58 | $this->semElement->addToProperty("data-html", $html); |
59 | 59 | } |
60 | - if(JString::isNotNull($this->variation)){ |
|
60 | + if (JString::isNotNull($this->variation)) { |
|
61 | 61 | $this->semElement->addToProperty("data-variation", $this->variation); |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - public function run(JsUtils $js){ |
|
66 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
65 | + public function run(JsUtils $js) { |
|
66 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
10 | 10 | use MenuItemTrait; |
11 | 11 | public function __construct($identifier, $content) { |
12 | - parent::__construct($identifier,"div","item",$content); |
|
12 | + parent::__construct($identifier, "div", "item", $content); |
|
13 | 13 | } |
14 | 14 | |
15 | - protected function initContent($content){ |
|
16 | - if(\is_array($content)){ |
|
17 | - if(JArray::isAssociative($content)===false){ |
|
15 | + protected function initContent($content) { |
|
16 | + if (\is_array($content)) { |
|
17 | + if (JArray::isAssociative($content)===false) { |
|
18 | 18 | $icon=@$content[0]; |
19 | 19 | $title=@$content[1]; |
20 | 20 | $desc=@$content[2]; |
21 | - }else{ |
|
21 | + } else { |
|
22 | 22 | $icon=@$content["icon"]; |
23 | 23 | $title=@$content["title"]; |
24 | 24 | $desc=@$content["description"]; |
25 | 25 | } |
26 | - if(isset($icon)===true){ |
|
26 | + if (isset($icon)===true) { |
|
27 | 27 | $this->setIcon($icon); |
28 | 28 | } |
29 | - if(isset($title)===true){ |
|
30 | - $this->setTitle($title,$desc); |
|
29 | + if (isset($title)===true) { |
|
30 | + $this->setTitle($title, $desc); |
|
31 | 31 | } |
32 | - }else{ |
|
32 | + } else { |
|
33 | 33 | $this->setContent($content); |
34 | 34 | } |
35 | 35 | } |