@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
59 | + if ($value===true) |
|
60 | 60 | $this->setProperty("tabindex", "0"); |
61 | 61 | else { |
62 | 62 | $this->removeProperty("tabindex"); |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | |
67 | 67 | public function setAnimated($content, $animation="") { |
68 | 68 | $this->setTagName("div"); |
69 | - $this->addToProperty("class", "animated " . $animation); |
|
70 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
69 | + $this->addToProperty("class", "animated ".$animation); |
|
70 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
71 | 71 | $visible->setClass("visible content"); |
72 | 72 | $visible->setContent($this->content); |
73 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
73 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
74 | 74 | $hidden->setClass("hidden content"); |
75 | 75 | $hidden->setContent($content); |
76 | - $this->content=array ($visible,$hidden ); |
|
76 | + $this->content=array($visible, $hidden); |
|
77 | 77 | return $hidden; |
78 | 78 | } |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function asIcon($icon) { |
86 | 86 | $iconO=$icon; |
87 | 87 | if (\is_string($icon)) { |
88 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
88 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
89 | 89 | } |
90 | 90 | $this->addToProperty("class", "icon"); |
91 | 91 | $this->content=$iconO; |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | * @return HtmlLabel |
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | - $this->tagName="div";$prefix=""; |
|
109 | - if($before) |
|
108 | + $this->tagName="div"; $prefix=""; |
|
109 | + if ($before) |
|
110 | 110 | $prefix="left "; |
111 | 111 | $this->addToProperty("class", $prefix."labeled"); |
112 | 112 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
113 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
114 | - if($isIcon){ |
|
113 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
114 | + if ($isIcon) { |
|
115 | 115 | $this->content->addClass("icon"); |
116 | 116 | } |
117 | 117 | $this->content->setTagName("div"); |
118 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
118 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
119 | 119 | $label->setBasic(); |
120 | 120 | $this->addContent($label, $before); |
121 | 121 | return $label; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function fromArray($array) { |
129 | 129 | $array=parent::fromArray($array); |
130 | - foreach ( $array as $key => $value ) { |
|
130 | + foreach ($array as $key => $value) { |
|
131 | 131 | $this->setProperty($key, $value); |
132 | 132 | } |
133 | 133 | return $array; |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | return $this->addToProperty("class", "positive"); |
142 | 142 | } |
143 | 143 | |
144 | - public function setColor($color){ |
|
145 | - if(\is_array($this->content)){ |
|
146 | - foreach ($this->content as $content){ |
|
147 | - if($content instanceof HtmlButton) |
|
144 | + public function setColor($color) { |
|
145 | + if (\is_array($this->content)) { |
|
146 | + foreach ($this->content as $content) { |
|
147 | + if ($content instanceof HtmlButton) |
|
148 | 148 | $content->setColor($color); |
149 | 149 | } |
150 | 150 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return HtmlButton |
203 | 203 | */ |
204 | 204 | public static function social($identifier, $social, $value=NULL) { |
205 | - if ($value === NULL) |
|
205 | + if ($value===NULL) |
|
206 | 206 | $value=\ucfirst($social); |
207 | 207 | $return=new HtmlButton($identifier, $value); |
208 | 208 | $return->addIcon($social); |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | * {@inheritDoc} |
240 | 240 | * @see HtmlSemDoubleElement::asLink() |
241 | 241 | */ |
242 | - public function asLink($href=NULL,$target=NULL) { |
|
243 | - parent::asLink($href,$target); |
|
242 | + public function asLink($href=NULL, $target=NULL) { |
|
243 | + parent::asLink($href, $target); |
|
244 | 244 | /*$lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content,$target); |
245 | 245 | $this->content=$lnk;*/ |
246 | 246 | return $this; |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
60 | - $this->setProperty("tabindex", "0"); |
|
61 | - else { |
|
59 | + if ($value === true) { |
|
60 | + $this->setProperty("tabindex", "0"); |
|
61 | + } else { |
|
62 | 62 | $this->removeProperty("tabindex"); |
63 | 63 | } |
64 | 64 | return $this; |
@@ -106,8 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | 108 | $this->tagName="div";$prefix=""; |
109 | - if($before) |
|
110 | - $prefix="left "; |
|
109 | + if($before) { |
|
110 | + $prefix="left "; |
|
111 | + } |
|
111 | 112 | $this->addToProperty("class", $prefix."labeled"); |
112 | 113 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
113 | 114 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
@@ -144,12 +145,13 @@ discard block |
||
144 | 145 | public function setColor($color){ |
145 | 146 | if(\is_array($this->content)){ |
146 | 147 | foreach ($this->content as $content){ |
147 | - if($content instanceof HtmlButton) |
|
148 | - $content->setColor($color); |
|
148 | + if($content instanceof HtmlButton) { |
|
149 | + $content->setColor($color); |
|
150 | + } |
|
149 | 151 | } |
152 | + } else { |
|
153 | + parent::setColor($color); |
|
150 | 154 | } |
151 | - else |
|
152 | - parent::setColor($color); |
|
153 | 155 | return $this; |
154 | 156 | } |
155 | 157 | |
@@ -202,8 +204,9 @@ discard block |
||
202 | 204 | * @return HtmlButton |
203 | 205 | */ |
204 | 206 | public static function social($identifier, $social, $value=NULL) { |
205 | - if ($value === NULL) |
|
206 | - $value=\ucfirst($social); |
|
207 | + if ($value === NULL) { |
|
208 | + $value=\ucfirst($social); |
|
209 | + } |
|
207 | 210 | $return=new HtmlButton($identifier, $value); |
208 | 211 | $return->addIcon($social); |
209 | 212 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -2,5 +2,5 @@ |
||
2 | 2 | namespace Ajax\semantic\html\base\constants; |
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | abstract class Social extends BaseEnum { |
5 | - const FACEBOOK="facebook", TWITTER="twitter",GOOGLEPLUS="google plus",VK="vk",LINKEDIN="linkedin",INSTAGRAM="instagram",YOUTUBE="youtube",GITHUB="github"; |
|
5 | + const FACEBOOK="facebook", TWITTER="twitter", GOOGLEPLUS="google plus", VK="vk", LINKEDIN="linkedin", INSTAGRAM="instagram", YOUTUBE="youtube", GITHUB="github"; |
|
6 | 6 | } |
@@ -13,27 +13,27 @@ discard block |
||
13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
14 | 14 | |
15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
16 | - use FieldTrait,LabeledIconTrait { |
|
16 | + use FieldTrait, LabeledIconTrait { |
|
17 | 17 | addIcon as addIconP; |
18 | 18 | } |
19 | 19 | protected $mClass="menu"; |
20 | 20 | protected $mTagName="div"; |
21 | - protected $items=array (); |
|
22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
21 | + protected $items=array(); |
|
22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
23 | 23 | protected $input; |
24 | 24 | protected $value; |
25 | 25 | protected $_associative; |
26 | 26 | |
27 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
27 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
28 | 28 | parent::__construct($identifier, "div"); |
29 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
30 | 30 | $this->setProperty("class", "ui dropdown"); |
31 | 31 | $content=[]; |
32 | - if(isset($value)){ |
|
33 | - if($value instanceof HtmlSemDoubleElement){ |
|
32 | + if (isset($value)) { |
|
33 | + if ($value instanceof HtmlSemDoubleElement) { |
|
34 | 34 | $text=$value; |
35 | - }else{ |
|
36 | - $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
35 | + } else { |
|
36 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
37 | 37 | $text->setClass("text"); |
38 | 38 | $this->setValue($value); |
39 | 39 | } |
@@ -46,29 +46,29 @@ discard block |
||
46 | 46 | $this->addItems($items); |
47 | 47 | } |
48 | 48 | |
49 | - public function getField(){ |
|
49 | + public function getField() { |
|
50 | 50 | return $this->input; |
51 | 51 | } |
52 | 52 | |
53 | - public function getDataField(){ |
|
53 | + public function getDataField() { |
|
54 | 54 | return $this->input; |
55 | 55 | } |
56 | 56 | |
57 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
58 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
57 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
58 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
59 | 59 | $this->items[]=$itemO; |
60 | 60 | return $itemO; |
61 | 61 | } |
62 | 62 | |
63 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
63 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
64 | 64 | $this->removeArrow(); |
65 | - $this->addIconP($icon,$before,$labeled); |
|
65 | + $this->addIconP($icon, $before, $labeled); |
|
66 | 66 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
67 | 67 | } |
68 | 68 | |
69 | - public function addIcons($icons){ |
|
69 | + public function addIcons($icons) { |
|
70 | 70 | $count=$this->count(); |
71 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
71 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
72 | 72 | $this->getItem($i)->addIcon($icons[$i]); |
73 | 73 | } |
74 | 74 | } |
@@ -79,33 +79,33 @@ discard block |
||
79 | 79 | * @param number $position |
80 | 80 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
81 | 81 | */ |
82 | - public function insertItem($item,$position=0){ |
|
82 | + public function insertItem($item, $position=0) { |
|
83 | 83 | $itemO=$this->beforeAddItem($item); |
84 | - $start = array_slice($this->items, 0, $position); |
|
85 | - $end = array_slice($this->items, $position); |
|
86 | - $start[] = $item; |
|
84 | + $start=array_slice($this->items, 0, $position); |
|
85 | + $end=array_slice($this->items, $position); |
|
86 | + $start[]=$item; |
|
87 | 87 | $this->items=array_merge($start, $end); |
88 | 88 | return $itemO; |
89 | 89 | } |
90 | 90 | |
91 | - protected function removeArrow(){ |
|
92 | - if(\sizeof($this->content)>1){ |
|
91 | + protected function removeArrow() { |
|
92 | + if (\sizeof($this->content)>1) { |
|
93 | 93 | unset($this->content["arrow"]); |
94 | 94 | $this->content=\array_values($this->content); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
98 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
99 | 99 | $itemO=$item; |
100 | - if(\is_array($item)){ |
|
100 | + if (\is_array($item)) { |
|
101 | 101 | $description=JArray::getValue($item, "description", 3); |
102 | 102 | $value=JArray::getValue($item, "value", 1); |
103 | 103 | $image=JArray::getValue($item, "image", 2); |
104 | 104 | $item=JArray::getValue($item, "item", 0); |
105 | 105 | } |
106 | - if(!$item instanceof HtmlDropdownItem){ |
|
107 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
108 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
106 | + if (!$item instanceof HtmlDropdownItem) { |
|
107 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
108 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
109 | 109 | $this->addToProperty("class", "vertical"); |
110 | 110 | } |
111 | 111 | return $itemO; |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | $this->addItem($function($object)); |
119 | 119 | } |
120 | 120 | |
121 | - public function addInput($name){ |
|
122 | - if(!isset($name)) |
|
121 | + public function addInput($name) { |
|
122 | + if (!isset($name)) |
|
123 | 123 | $name="input-".$this->identifier; |
124 | 124 | $this->setAction("activate"); |
125 | - $this->input=new HtmlInput($name,"hidden"); |
|
125 | + $this->input=new HtmlInput($name, "hidden"); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | * @param string $icon |
132 | 132 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
133 | 133 | */ |
134 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
135 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
134 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
135 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Adds a divider item |
140 | 140 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
141 | 141 | */ |
142 | - public function addDividerItem(){ |
|
142 | + public function addDividerItem() { |
|
143 | 143 | return $this->addItem(HtmlDropdownItem::divider()); |
144 | 144 | } |
145 | 145 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * @param string $icon |
150 | 150 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
151 | 151 | */ |
152 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
153 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
152 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
153 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param string $color |
160 | 160 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
161 | 161 | */ |
162 | - public function addCircularLabelItem($caption,$color){ |
|
162 | + public function addCircularLabelItem($caption, $color) { |
|
163 | 163 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
164 | 164 | } |
165 | 165 | |
@@ -168,88 +168,88 @@ discard block |
||
168 | 168 | * @param string $image |
169 | 169 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
170 | 170 | */ |
171 | - public function addMiniAvatarImageItem($caption,$image){ |
|
171 | + public function addMiniAvatarImageItem($caption, $image) { |
|
172 | 172 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
173 | 173 | } |
174 | 174 | |
175 | - public function addItems($items){ |
|
176 | - if(\is_array($items) && $this->_associative){ |
|
177 | - foreach ($items as $k=>$v){ |
|
175 | + public function addItems($items) { |
|
176 | + if (\is_array($items) && $this->_associative) { |
|
177 | + foreach ($items as $k=>$v) { |
|
178 | 178 | $this->addItem($v)->setData($k); |
179 | 179 | } |
180 | - }else{ |
|
181 | - foreach ($items as $item){ |
|
180 | + } else { |
|
181 | + foreach ($items as $item) { |
|
182 | 182 | $this->addItem($item); |
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - public function getItem($index){ |
|
187 | + public function getItem($index) { |
|
188 | 188 | return $this->items[$index]; |
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | 192 | * @return int |
193 | 193 | */ |
194 | - public function count(){ |
|
194 | + public function count() { |
|
195 | 195 | return \sizeof($this->items); |
196 | 196 | } |
197 | 197 | /** |
198 | 198 | * @param boolean $dropdown |
199 | 199 | */ |
200 | - public function asDropdown($dropdown){ |
|
201 | - if($dropdown===false){ |
|
200 | + public function asDropdown($dropdown) { |
|
201 | + if ($dropdown===false) { |
|
202 | 202 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
203 | 203 | $dropdown="menu"; |
204 | - }else{ |
|
204 | + } else { |
|
205 | 205 | $dropdown="dropdown"; |
206 | 206 | $this->mClass="menu"; |
207 | 207 | } |
208 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
208 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
209 | 209 | } |
210 | 210 | |
211 | - public function setVertical(){ |
|
212 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
211 | + public function setVertical() { |
|
212 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
213 | 213 | } |
214 | 214 | |
215 | - public function setInline(){ |
|
216 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
215 | + public function setInline() { |
|
216 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
217 | 217 | } |
218 | 218 | |
219 | - public function setSimple(){ |
|
220 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
219 | + public function setSimple() { |
|
220 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
221 | 221 | } |
222 | 222 | |
223 | - public function asButton($floating=false){ |
|
223 | + public function asButton($floating=false) { |
|
224 | 224 | $this->removeArrow(); |
225 | - if($floating) |
|
225 | + if ($floating) |
|
226 | 226 | $this->addToProperty("class", "floating"); |
227 | 227 | $this->removePropertyValue("class", "selection"); |
228 | 228 | return $this->addToProperty("class", "button"); |
229 | 229 | } |
230 | 230 | |
231 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
232 | - if(isset($name)) |
|
231 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
232 | + if (isset($name)) |
|
233 | 233 | $this->addInput($name); |
234 | - if($multiple) |
|
234 | + if ($multiple) |
|
235 | 235 | $this->addToProperty("class", "multiple"); |
236 | - if ($selection){ |
|
237 | - if($this->propertyContains("class", "button")===false) |
|
238 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
236 | + if ($selection) { |
|
237 | + if ($this->propertyContains("class", "button")===false) |
|
238 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
239 | 239 | } |
240 | 240 | return $this; |
241 | 241 | } |
242 | 242 | |
243 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
244 | - $this->asSelect($name,$multiple,$selection); |
|
243 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
244 | + $this->asSelect($name, $multiple, $selection); |
|
245 | 245 | return $this->addToProperty("class", "search"); |
246 | 246 | } |
247 | 247 | |
248 | - public function setSelect($name=NULL,$multiple=false){ |
|
249 | - if(!isset($name)) |
|
248 | + public function setSelect($name=NULL, $multiple=false) { |
|
249 | + if (!isset($name)) |
|
250 | 250 | $name="select-".$this->identifier; |
251 | 251 | $this->input=null; |
252 | - if($multiple){ |
|
252 | + if ($multiple) { |
|
253 | 253 | $this->setProperty("multiple", true); |
254 | 254 | $this->addToProperty("class", "multiple"); |
255 | 255 | } |
@@ -257,37 +257,37 @@ discard block |
||
257 | 257 | $this->tagName="select"; |
258 | 258 | $this->setProperty("name", $name); |
259 | 259 | $this->content=null; |
260 | - foreach ($this->items as $item){ |
|
260 | + foreach ($this->items as $item) { |
|
261 | 261 | $item->asOption(); |
262 | 262 | } |
263 | 263 | return $this; |
264 | 264 | } |
265 | 265 | |
266 | - public function asSubmenu($pointing=NULL){ |
|
266 | + public function asSubmenu($pointing=NULL) { |
|
267 | 267 | $this->setClass("ui dropdown link item"); |
268 | - if(isset($pointing)){ |
|
268 | + if (isset($pointing)) { |
|
269 | 269 | $this->setPointing($pointing); |
270 | 270 | } |
271 | 271 | return $this; |
272 | 272 | } |
273 | 273 | |
274 | - public function setPointing($value=Direction::NONE){ |
|
275 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
274 | + public function setPointing($value=Direction::NONE) { |
|
275 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
276 | 276 | } |
277 | 277 | |
278 | - public function setValue($value){ |
|
278 | + public function setValue($value) { |
|
279 | 279 | $this->value=$value; |
280 | 280 | return $this; |
281 | 281 | } |
282 | - private function applyValue(){ |
|
282 | + private function applyValue() { |
|
283 | 283 | $value=$this->value; |
284 | - if(isset($this->input) && isset($value)){ |
|
284 | + if (isset($this->input) && isset($value)) { |
|
285 | 285 | $this->input->setProperty("value", $value); |
286 | - }else{ |
|
286 | + } else { |
|
287 | 287 | $this->setProperty("value", $value); |
288 | 288 | } |
289 | 289 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
290 | - if(isset($textElement)) |
|
290 | + if (isset($textElement)) |
|
291 | 291 | $textElement->setContent($value); |
292 | 292 | return $this; |
293 | 293 | } |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | * @see BaseHtml::run() |
298 | 298 | */ |
299 | 299 | public function run(JsUtils $js) { |
300 | - if($this->propertyContains("class", "simple")===false){ |
|
301 | - if(isset($this->_bsComponent)===false){ |
|
302 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
300 | + if ($this->propertyContains("class", "simple")===false) { |
|
301 | + if (isset($this->_bsComponent)===false) { |
|
302 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
303 | 303 | $this->_bsComponent->setItemSelector(".item"); |
304 | 304 | } |
305 | 305 | $this->addEventsOnRun($js); |
@@ -307,31 +307,31 @@ discard block |
||
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | - public function setCompact(){ |
|
310 | + public function setCompact() { |
|
311 | 311 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
312 | 312 | } |
313 | 313 | |
314 | - public function setAction($action){ |
|
314 | + public function setAction($action) { |
|
315 | 315 | $this->_params["action"]=$action; |
316 | 316 | } |
317 | 317 | |
318 | - public function setFullTextSearch($value){ |
|
318 | + public function setFullTextSearch($value) { |
|
319 | 319 | $this->_params["fullTextSearch"]=$value; |
320 | 320 | } |
321 | 321 | |
322 | 322 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
323 | 323 | $this->applyValue(); |
324 | - return parent::compile($js,$view); |
|
324 | + return parent::compile($js, $view); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | public function getInput() { |
328 | 328 | return $this->input; |
329 | 329 | } |
330 | 330 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
331 | - return $this->_addAction($this, $action,$direction,$icon,$labeled); |
|
331 | + return $this->_addAction($this, $action, $direction, $icon, $labeled); |
|
332 | 332 | } |
333 | 333 | |
334 | - public function jsAddItem($caption){ |
|
334 | + public function jsAddItem($caption) { |
|
335 | 335 | $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')"; |
336 | 336 | return $js; |
337 | 337 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | if(isset($value)){ |
33 | 33 | if($value instanceof HtmlSemDoubleElement){ |
34 | 34 | $text=$value; |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | $text=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
37 | 37 | $text->setClass("text"); |
38 | 38 | $this->setValue($value); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | if(!$item instanceof HtmlDropdownItem){ |
107 | 107 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
108 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
108 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
109 | 109 | $this->addToProperty("class", "vertical"); |
110 | 110 | } |
111 | 111 | return $itemO; |
@@ -119,8 +119,9 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | public function addInput($name){ |
122 | - if(!isset($name)) |
|
123 | - $name="input-".$this->identifier; |
|
122 | + if(!isset($name)) { |
|
123 | + $name="input-".$this->identifier; |
|
124 | + } |
|
124 | 125 | $this->setAction("activate"); |
125 | 126 | $this->input=new HtmlInput($name,"hidden"); |
126 | 127 | } |
@@ -177,7 +178,7 @@ discard block |
||
177 | 178 | foreach ($items as $k=>$v){ |
178 | 179 | $this->addItem($v)->setData($k); |
179 | 180 | } |
180 | - }else{ |
|
181 | + } else{ |
|
181 | 182 | foreach ($items as $item){ |
182 | 183 | $this->addItem($item); |
183 | 184 | } |
@@ -201,7 +202,7 @@ discard block |
||
201 | 202 | if($dropdown===false){ |
202 | 203 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
203 | 204 | $dropdown="menu"; |
204 | - }else{ |
|
205 | + } else{ |
|
205 | 206 | $dropdown="dropdown"; |
206 | 207 | $this->mClass="menu"; |
207 | 208 | } |
@@ -222,20 +223,24 @@ discard block |
||
222 | 223 | |
223 | 224 | public function asButton($floating=false){ |
224 | 225 | $this->removeArrow(); |
225 | - if($floating) |
|
226 | - $this->addToProperty("class", "floating"); |
|
226 | + if($floating) { |
|
227 | + $this->addToProperty("class", "floating"); |
|
228 | + } |
|
227 | 229 | $this->removePropertyValue("class", "selection"); |
228 | 230 | return $this->addToProperty("class", "button"); |
229 | 231 | } |
230 | 232 | |
231 | 233 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
232 | - if(isset($name)) |
|
233 | - $this->addInput($name); |
|
234 | - if($multiple) |
|
235 | - $this->addToProperty("class", "multiple"); |
|
234 | + if(isset($name)) { |
|
235 | + $this->addInput($name); |
|
236 | + } |
|
237 | + if($multiple) { |
|
238 | + $this->addToProperty("class", "multiple"); |
|
239 | + } |
|
236 | 240 | if ($selection){ |
237 | - if($this->propertyContains("class", "button")===false) |
|
238 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
241 | + if($this->propertyContains("class", "button")===false) { |
|
242 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
243 | + } |
|
239 | 244 | } |
240 | 245 | return $this; |
241 | 246 | } |
@@ -246,8 +251,9 @@ discard block |
||
246 | 251 | } |
247 | 252 | |
248 | 253 | public function setSelect($name=NULL,$multiple=false){ |
249 | - if(!isset($name)) |
|
250 | - $name="select-".$this->identifier; |
|
254 | + if(!isset($name)) { |
|
255 | + $name="select-".$this->identifier; |
|
256 | + } |
|
251 | 257 | $this->input=null; |
252 | 258 | if($multiple){ |
253 | 259 | $this->setProperty("multiple", true); |
@@ -283,12 +289,13 @@ discard block |
||
283 | 289 | $value=$this->value; |
284 | 290 | if(isset($this->input) && isset($value)){ |
285 | 291 | $this->input->setProperty("value", $value); |
286 | - }else{ |
|
292 | + } else{ |
|
287 | 293 | $this->setProperty("value", $value); |
288 | 294 | } |
289 | 295 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
290 | - if(isset($textElement)) |
|
291 | - $textElement->setContent($value); |
|
296 | + if(isset($textElement)) { |
|
297 | + $textElement->setContent($value); |
|
298 | + } |
|
292 | 299 | return $this; |
293 | 300 | } |
294 | 301 |
@@ -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,19 +40,19 @@ 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 | |
55 | - public function setSetFluidWidth($value){ |
|
55 | + public function setSetFluidWidth($value) { |
|
56 | 56 | return $this->setParam("setFluidWidth", $value); |
57 | 57 | } |
58 | 58 | } |
@@ -10,56 +10,56 @@ |
||
10 | 10 | * @param string $identifier |
11 | 11 | * @param object $modelInstance |
12 | 12 | */ |
13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
15 | 15 | } |
16 | 16 | |
17 | - protected function getDefaultModelInstance(){ |
|
17 | + protected function getDefaultModelInstance() { |
|
18 | 18 | return new UserModel(); |
19 | 19 | } |
20 | 20 | |
21 | - public static function regular($identifier,$modelInstance=null){ |
|
22 | - return new FormAccount($identifier,$modelInstance, |
|
23 | - ["message","login","password","passwordConf","email","submit","error"], |
|
21 | + public static function regular($identifier, $modelInstance=null) { |
|
22 | + return new FormAccount($identifier, $modelInstance, |
|
23 | + ["message", "login", "password", "passwordConf", "email", "submit", "error"], |
|
24 | 24 | ["message"=>[["icon"=>"sign in"]], |
25 | 25 | "input0"=>[["rules"=>"empty"]], |
26 | - "input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]], |
|
27 | - "input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
26 | + "input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]], |
|
27 | + "input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]], |
|
28 | 28 | "input3"=>[["rules"=>"email"]], |
29 | 29 | "submit"=>["green fluid"], |
30 | 30 | "message2"=>[["error"=>true]]], |
31 | - ["Account","login","password","passwordConf","email","submit","error"], |
|
32 | - ["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"], |
|
33 | - [0,1,3,4,5,6]); |
|
31 | + ["Account", "login", "password", "passwordConf", "email", "submit", "error"], |
|
32 | + ["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"], |
|
33 | + [0, 1, 3, 4, 5, 6]); |
|
34 | 34 | } |
35 | 35 | |
36 | - public static function smallInline($identifier,$modelInstance=null){ |
|
37 | - $result=new FormAccount($identifier,$modelInstance, |
|
38 | - ["login","password","submit"], |
|
39 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
40 | - ["login","password","submit"], |
|
41 | - ["","","Connection"], |
|
36 | + public static function smallInline($identifier, $modelInstance=null) { |
|
37 | + $result=new FormAccount($identifier, $modelInstance, |
|
38 | + ["login", "password", "submit"], |
|
39 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
40 | + ["login", "password", "submit"], |
|
41 | + ["", "", "Connection"], |
|
42 | 42 | [2]); |
43 | 43 | $result->addDividerBefore(0, "Connection"); |
44 | 44 | return $result; |
45 | 45 | } |
46 | 46 | |
47 | - public static function small($identifier,$modelInstance=null){ |
|
48 | - $result=new FormAccount($identifier,$modelInstance, |
|
49 | - ["login","password","submit"], |
|
50 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
51 | - ["login","password","submit"], |
|
52 | - ["Login","Password","Connection"], |
|
53 | - [1,2]); |
|
47 | + public static function small($identifier, $modelInstance=null) { |
|
48 | + $result=new FormAccount($identifier, $modelInstance, |
|
49 | + ["login", "password", "submit"], |
|
50 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
51 | + ["login", "password", "submit"], |
|
52 | + ["Login", "Password", "Connection"], |
|
53 | + [1, 2]); |
|
54 | 54 | $result->addDividerBefore(0, "Connection"); |
55 | 55 | return $result; |
56 | 56 | } |
57 | 57 | |
58 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
59 | - $result=self::regular($identifier,$modelInstance); |
|
60 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
61 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
62 | - $result->addWrapper("error", null,"</div>"); |
|
58 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
59 | + $result=self::regular($identifier, $modelInstance); |
|
60 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
61 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
62 | + $result->addWrapper("error", null, "</div>"); |
|
63 | 63 | return $result; |
64 | 64 | } |
65 | 65 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | private $pages_visibles; |
10 | 10 | private $row_count; |
11 | 11 | |
12 | - public function __construct($items_per_page=10,$pages_visibles=null,$page=1,$row_count=null){ |
|
12 | + public function __construct($items_per_page=10, $pages_visibles=null, $page=1, $row_count=null) { |
|
13 | 13 | $this->items_per_page=$items_per_page; |
14 | 14 | $this->row_count=$row_count; |
15 | 15 | $this->page=$page; |
@@ -17,30 +17,30 @@ discard block |
||
17 | 17 | $this->visible=true; |
18 | 18 | } |
19 | 19 | |
20 | - public function getObjects($objects){ |
|
20 | + public function getObjects($objects) { |
|
21 | 21 | $auto=(!isset($this->row_count)); |
22 | 22 | $os=$objects; |
23 | - if(!\is_array($os)){ |
|
23 | + if (!\is_array($os)) { |
|
24 | 24 | $os=[]; |
25 | - foreach ($objects as $o){ |
|
25 | + foreach ($objects as $o) { |
|
26 | 26 | $os[]=$o; |
27 | 27 | } |
28 | 28 | } |
29 | - $this->page_count = 0; |
|
30 | - $row_count=($auto)?\sizeof($os):$this->row_count; |
|
31 | - if (0 === $row_count) { |
|
29 | + $this->page_count=0; |
|
30 | + $row_count=($auto) ? \sizeof($os) : $this->row_count; |
|
31 | + if (0===$row_count) { |
|
32 | 32 | $this->visible=false; |
33 | 33 | } else { |
34 | 34 | |
35 | - $this->page_count = (int)ceil($row_count / $this->items_per_page); |
|
35 | + $this->page_count=(int)ceil($row_count/$this->items_per_page); |
|
36 | 36 | $this->visible=$this->page_count>1; |
37 | - if($this->page > $this->page_count+1) { |
|
38 | - $this->page = 1; |
|
37 | + if ($this->page>$this->page_count+1) { |
|
38 | + $this->page=1; |
|
39 | 39 | } |
40 | 40 | } |
41 | - if($auto){ |
|
42 | - $offset = ($this->page - 1) * $this->items_per_page; |
|
43 | - return array_slice($os, $offset,$this->items_per_page); |
|
41 | + if ($auto) { |
|
42 | + $offset=($this->page-1)*$this->items_per_page; |
|
43 | + return array_slice($os, $offset, $this->items_per_page); |
|
44 | 44 | } |
45 | 45 | return $os; |
46 | 46 | } |
@@ -76,22 +76,22 @@ discard block |
||
76 | 76 | return $this->page_count; |
77 | 77 | } |
78 | 78 | |
79 | - public function getPagesNumbers(){ |
|
80 | - $middle= (int)ceil(($this->pages_visibles-1)/ 2); |
|
79 | + public function getPagesNumbers() { |
|
80 | + $middle=(int)ceil(($this->pages_visibles-1)/2); |
|
81 | 81 | $first=$this->page-$middle; |
82 | - if($first<1){ |
|
82 | + if ($first<1) { |
|
83 | 83 | $first=1; |
84 | 84 | } |
85 | 85 | $last=$first+$this->pages_visibles-1; |
86 | - if($last>$this->page_count){ |
|
86 | + if ($last>$this->page_count) { |
|
87 | 87 | $last=$this->page_count; |
88 | 88 | } |
89 | 89 | return \range($first, $last); |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function setPagesVisibles($pages_visibles) { |
93 | - if(!isset($pages_visibles)) |
|
94 | - $pages_visibles=(int)ceil($this->row_count / $this->items_per_page)+1; |
|
93 | + if (!isset($pages_visibles)) |
|
94 | + $pages_visibles=(int)ceil($this->row_count/$this->items_per_page)+1; |
|
95 | 95 | $this->pages_visibles=$pages_visibles; |
96 | 96 | return $this; |
97 | 97 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | */ |
26 | 26 | class DataTable extends Widget { |
27 | - use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait; |
|
27 | + use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait; |
|
28 | 28 | protected $_searchField; |
29 | 29 | protected $_urls; |
30 | 30 | protected $_pagination; |
@@ -42,35 +42,35 @@ discard block |
||
42 | 42 | protected $_colWidths; |
43 | 43 | |
44 | 44 | |
45 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
46 | - parent::__construct($identifier, $model,$modelInstance); |
|
47 | - $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
|
45 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
46 | + parent::__construct($identifier, $model, $modelInstance); |
|
47 | + $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false); |
|
48 | 48 | $this->_urls=[]; |
49 | - $this->_emptyMessage=new HtmlMessage("","nothing to display"); |
|
49 | + $this->_emptyMessage=new HtmlMessage("", "nothing to display"); |
|
50 | 50 | $this->_emptyMessage->setIcon("info circle"); |
51 | 51 | } |
52 | 52 | |
53 | - public function run(JsUtils $js){ |
|
54 | - if($this->_hasCheckboxes && isset($js)){ |
|
53 | + public function run(JsUtils $js) { |
|
54 | + if ($this->_hasCheckboxes && isset($js)) { |
|
55 | 55 | $this->_runCheckboxes($js); |
56 | 56 | } |
57 | - if($this->_visibleHover){ |
|
58 | - $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
|
59 | - $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
|
57 | + if ($this->_visibleHover) { |
|
58 | + $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]); |
|
59 | + $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]); |
|
60 | 60 | } |
61 | - if(\is_array($this->_deleteBehavior)) |
|
62 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
63 | - if(\is_array($this->_editBehavior)) |
|
64 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
61 | + if (\is_array($this->_deleteBehavior)) |
|
62 | + $this->_generateBehavior("delete", $this->_deleteBehavior, $js); |
|
63 | + if (\is_array($this->_editBehavior)) |
|
64 | + $this->_generateBehavior("edit", $this->_editBehavior, $js); |
|
65 | 65 | return parent::run($js); |
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | - protected function _generateBehavior($op,$params,JsUtils $js){ |
|
71 | - if(isset($this->_urls[$op])){ |
|
72 | - $params=\array_merge($params,["attr"=>"data-ajax"]); |
|
73 | - $js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector($op),$params); |
|
70 | + protected function _generateBehavior($op, $params, JsUtils $js) { |
|
71 | + if (isset($this->_urls[$op])) { |
|
72 | + $params=\array_merge($params, ["attr"=>"data-ajax"]); |
|
73 | + $js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -83,156 +83,156 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | |
86 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
87 | - if(!$this->_generated){ |
|
86 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
87 | + if (!$this->_generated) { |
|
88 | 88 | $this->_instanceViewer->setInstance($this->_model); |
89 | 89 | $captions=$this->_instanceViewer->getCaptions(); |
90 | 90 | $table=$this->content["table"]; |
91 | - if($this->_hasCheckboxes){ |
|
91 | + if ($this->_hasCheckboxes) { |
|
92 | 92 | $this->_generateMainCheckbox($captions); |
93 | 93 | } |
94 | 94 | $table->setRowCount(0, \sizeof($captions)); |
95 | - $this->_generateHeader($table,$captions); |
|
95 | + $this->_generateHeader($table, $captions); |
|
96 | 96 | |
97 | - if(isset($this->_compileParts)) |
|
97 | + if (isset($this->_compileParts)) |
|
98 | 98 | $table->setCompileParts($this->_compileParts); |
99 | 99 | |
100 | 100 | $this->_generateContent($table); |
101 | 101 | |
102 | - $this->compileExtraElements($table, $captions,$js); |
|
102 | + $this->compileExtraElements($table, $captions, $js); |
|
103 | 103 | |
104 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
104 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
105 | 105 | $this->_compileForm(); |
106 | 106 | $this->_applyStyleAttributes($table); |
107 | 107 | $this->_generated=true; |
108 | 108 | } |
109 | - return parent::compile($js,$view); |
|
109 | + return parent::compile($js, $view); |
|
110 | 110 | } |
111 | 111 | |
112 | - protected function compileExtraElements($table,$captions,JsUtils $js=NULL){ |
|
113 | - if(isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])){ |
|
114 | - $this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]); |
|
112 | + protected function compileExtraElements($table, $captions, JsUtils $js=NULL) { |
|
113 | + if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) { |
|
114 | + $this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]); |
|
115 | 115 | } |
116 | - if($this->_hasCheckboxes && $table->hasPart("thead")){ |
|
116 | + if ($this->_hasCheckboxes && $table->hasPart("thead")) { |
|
117 | 117 | $table->getHeader()->getCell(0, 0)->addClass("no-sort"); |
118 | 118 | } |
119 | 119 | |
120 | - if(isset($this->_toolbar)){ |
|
120 | + if (isset($this->_toolbar)) { |
|
121 | 121 | $this->_setToolbarPosition($table, $captions); |
122 | 122 | } |
123 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
124 | - $this->_generatePagination($table,$js); |
|
123 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
124 | + $this->_generatePagination($table, $js); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | - protected function _applyStyleAttributes($table){ |
|
129 | - if(isset($this->_hiddenColumns)) |
|
128 | + protected function _applyStyleAttributes($table) { |
|
129 | + if (isset($this->_hiddenColumns)) |
|
130 | 130 | $this->_hideColumns(); |
131 | - if(isset($this->_colWidths)){ |
|
132 | - foreach ($this->_colWidths as $colIndex=>$width){ |
|
133 | - $table->setColWidth($colIndex,$width); |
|
131 | + if (isset($this->_colWidths)) { |
|
132 | + foreach ($this->_colWidths as $colIndex=>$width) { |
|
133 | + $table->setColWidth($colIndex, $width); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - protected function _hideColumns(){ |
|
139 | - foreach ($this->_hiddenColumns as $colIndex){ |
|
138 | + protected function _hideColumns() { |
|
139 | + foreach ($this->_hiddenColumns as $colIndex) { |
|
140 | 140 | $this->_self->hideColumn($colIndex); |
141 | 141 | } |
142 | 142 | return $this; |
143 | 143 | } |
144 | 144 | |
145 | - protected function _generateHeader(HtmlTable $table,$captions){ |
|
145 | + protected function _generateHeader(HtmlTable $table, $captions) { |
|
146 | 146 | $table->setHeaderValues($captions); |
147 | - if(isset($this->_sortable)){ |
|
147 | + if (isset($this->_sortable)) { |
|
148 | 148 | $table->setSortable($this->_sortable); |
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | 152 | |
153 | 153 | |
154 | - protected function _generateContent($table){ |
|
154 | + protected function _generateContent($table) { |
|
155 | 155 | $objects=$this->_modelInstance; |
156 | - if(isset($this->_pagination)){ |
|
156 | + if (isset($this->_pagination)) { |
|
157 | 157 | $objects=$this->_pagination->getObjects($this->_modelInstance); |
158 | 158 | } |
159 | 159 | InstanceViewer::setIndex(0); |
160 | 160 | $table->fromDatabaseObjects($objects, function($instance) use($table){ |
161 | 161 | return $this->_generateRow($instance, $table); |
162 | 162 | }); |
163 | - if($table->getRowCount()==0){ |
|
163 | + if ($table->getRowCount()==0) { |
|
164 | 164 | $result=$table->addRow(); |
165 | 165 | $result->mergeRow(); |
166 | 166 | $result->setValues([$this->_emptyMessage]); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - protected function _generateRow($instance,&$table,$checkedClass=null){ |
|
170 | + protected function _generateRow($instance, &$table, $checkedClass=null) { |
|
171 | 171 | $this->_instanceViewer->setInstance($instance); |
172 | 172 | InstanceViewer::$index++; |
173 | - $values= $this->_instanceViewer->getValues(); |
|
173 | + $values=$this->_instanceViewer->getValues(); |
|
174 | 174 | $id=$this->_instanceViewer->getIdentifier(); |
175 | - if($this->_hasCheckboxes){ |
|
176 | - $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id,""); |
|
175 | + if ($this->_hasCheckboxes) { |
|
176 | + $ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, ""); |
|
177 | 177 | $ck->setOnChange("event.stopPropagation();"); |
178 | 178 | $field=$ck->getField(); |
179 | - $field->setProperty("value",$id); |
|
179 | + $field->setProperty("value", $id); |
|
180 | 180 | $field->setProperty("name", "selection[]"); |
181 | - if(isset($checkedClass)) |
|
181 | + if (isset($checkedClass)) |
|
182 | 182 | $field->setClass($checkedClass); |
183 | 183 | \array_unshift($values, $ck); |
184 | 184 | } |
185 | 185 | $result=$table->newRow(); |
186 | 186 | $result->setIdentifier($this->identifier."-tr-".$id); |
187 | - $result->setProperty("data-ajax",$id); |
|
187 | + $result->setProperty("data-ajax", $id); |
|
188 | 188 | $result->setValues($values); |
189 | - $result->addToProperty("class",$this->_rowClass); |
|
189 | + $result->addToProperty("class", $this->_rowClass); |
|
190 | 190 | return $result; |
191 | 191 | } |
192 | 192 | |
193 | - protected function _generatePagination($table,$js=NULL){ |
|
194 | - if(isset($this->_toolbar)){ |
|
195 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
193 | + protected function _generatePagination($table, $js=NULL) { |
|
194 | + if (isset($this->_toolbar)) { |
|
195 | + if ($this->_toolbarPosition==PositionInTable::FOOTER) |
|
196 | 196 | $this->_toolbar->setFloated("left"); |
197 | 197 | } |
198 | 198 | $footer=$table->getFooter(); |
199 | 199 | $footer->mergeCol(); |
200 | - $menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers()); |
|
200 | + $menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers()); |
|
201 | 201 | $menu->floatRight(); |
202 | 202 | $menu->setActiveItem($this->_pagination->getPage()-1); |
203 | 203 | $footer->addValues($menu); |
204 | - $this->_associatePaginationBehavior($menu,$js); |
|
204 | + $this->_associatePaginationBehavior($menu, $js); |
|
205 | 205 | } |
206 | 206 | |
207 | - protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){ |
|
208 | - if(isset($this->_urls["refresh"])){ |
|
209 | - $menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>false]); |
|
207 | + protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) { |
|
208 | + if (isset($this->_urls["refresh"])) { |
|
209 | + $menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", $this->getRefreshSelector(), ["preventDefault"=>false, "jqueryDone"=>"replaceWith", "hasLoader"=>false]); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | - protected function _getFieldName($index){ |
|
213 | + protected function _getFieldName($index) { |
|
214 | 214 | $fieldName=parent::_getFieldName($index); |
215 | - if(\is_object($fieldName)) |
|
215 | + if (\is_object($fieldName)) |
|
216 | 216 | $fieldName="field-".$index; |
217 | 217 | return $fieldName."[]"; |
218 | 218 | } |
219 | 219 | |
220 | - protected function _getFieldCaption($index){ |
|
220 | + protected function _getFieldCaption($index) { |
|
221 | 221 | return null; |
222 | 222 | } |
223 | 223 | |
224 | - protected function _setToolbarPosition($table,$captions=NULL){ |
|
225 | - switch ($this->_toolbarPosition){ |
|
224 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
225 | + switch ($this->_toolbarPosition) { |
|
226 | 226 | case PositionInTable::BEFORETABLE: |
227 | 227 | case PositionInTable::AFTERTABLE: |
228 | - if(isset($this->_compileParts)===false){ |
|
228 | + if (isset($this->_compileParts)===false) { |
|
229 | 229 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
230 | 230 | } |
231 | 231 | break; |
232 | 232 | case PositionInTable::HEADER: |
233 | 233 | case PositionInTable::FOOTER: |
234 | 234 | case PositionInTable::BODY: |
235 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
235 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
236 | 236 | break; |
237 | 237 | } |
238 | 238 | } |
@@ -244,16 +244,16 @@ discard block |
||
244 | 244 | * @param callable $callback function called after the field compilation |
245 | 245 | * @return DataTable |
246 | 246 | */ |
247 | - public function afterCompile($index,$callback){ |
|
248 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
247 | + public function afterCompile($index, $callback) { |
|
248 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
249 | 249 | return $this; |
250 | 250 | } |
251 | 251 | |
252 | - private function addToolbarRow($part,$table,$captions){ |
|
252 | + private function addToolbarRow($part, $table, $captions) { |
|
253 | 253 | $hasPart=$table->hasPart($part); |
254 | - if($hasPart){ |
|
254 | + if ($hasPart) { |
|
255 | 255 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
256 | - }else{ |
|
256 | + } else { |
|
257 | 257 | $row=$table->getPart($part)->getRow(0); |
258 | 258 | } |
259 | 259 | $row->mergeCol(); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @see Widget::getHtmlComponent() |
266 | 266 | * @return HtmlTable |
267 | 267 | */ |
268 | - public function getHtmlComponent(){ |
|
268 | + public function getHtmlComponent() { |
|
269 | 269 | return $this->content["table"]; |
270 | 270 | } |
271 | 271 | |
@@ -279,12 +279,12 @@ discard block |
||
279 | 279 | * @return DataTable |
280 | 280 | */ |
281 | 281 | public function setUrls($urls) { |
282 | - if(\is_array($urls)){ |
|
283 | - $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
|
284 | - $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
|
285 | - $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
|
286 | - }else{ |
|
287 | - $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
|
282 | + if (\is_array($urls)) { |
|
283 | + $this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0); |
|
284 | + $this->_urls["edit"]=JArray::getValue($urls, "edit", 1); |
|
285 | + $this->_urls["delete"]=JArray::getValue($urls, "delete", 2); |
|
286 | + } else { |
|
287 | + $this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls]; |
|
288 | 288 | } |
289 | 289 | return $this; |
290 | 290 | } |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param number $pages_visibles The number of visible pages in the Pagination component |
298 | 298 | * @return DataTable |
299 | 299 | */ |
300 | - public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){ |
|
301 | - $this->_pagination=new Pagination($items_per_page,$pages_visibles,$page,$total_rowcount); |
|
300 | + public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) { |
|
301 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount); |
|
302 | 302 | return $this; |
303 | 303 | } |
304 | 304 | |
@@ -309,8 +309,8 @@ discard block |
||
309 | 309 | * @param number $pages_visibles The number of visible pages in the Pagination component |
310 | 310 | * @return DataTable |
311 | 311 | */ |
312 | - public function autoPaginate($page=1,$items_per_page=10,$pages_visibles=4){ |
|
313 | - $this->_pagination=new Pagination($items_per_page,$pages_visibles,$page); |
|
312 | + public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) { |
|
313 | + $this->_pagination=new Pagination($items_per_page, $pages_visibles, $page); |
|
314 | 314 | return $this; |
315 | 315 | } |
316 | 316 | |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @param array $compileParts |
321 | 321 | * @return DataTable |
322 | 322 | */ |
323 | - public function refresh($compileParts=["tbody"]){ |
|
323 | + public function refresh($compileParts=["tbody"]) { |
|
324 | 324 | $this->_compileParts=$compileParts; |
325 | 325 | return $this; |
326 | 326 | } |
327 | 327 | |
328 | 328 | |
329 | - public function addSearchInToolbar($position=Direction::RIGHT){ |
|
329 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
330 | 330 | return $this->addInToolbar($this->getSearchField())->setPosition($position); |
331 | 331 | } |
332 | 332 | |
333 | - public function getSearchField(){ |
|
334 | - if(isset($this->_searchField)===false){ |
|
335 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
336 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
333 | + public function getSearchField() { |
|
334 | + if (isset($this->_searchField)===false) { |
|
335 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
336 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
337 | 337 | } |
338 | 338 | return $this->_searchField; |
339 | 339 | } |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | return $this; |
350 | 350 | } |
351 | 351 | |
352 | - public function asForm(){ |
|
352 | + public function asForm() { |
|
353 | 353 | return $this->getForm(); |
354 | 354 | } |
355 | 355 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | protected function getTargetSelector($op) { |
359 | 359 | $result=$this->_targetSelector; |
360 | - if(!isset($result[$op])) |
|
360 | + if (!isset($result[$op])) |
|
361 | 361 | $result="#".$this->identifier; |
362 | 362 | return $result[$op]; |
363 | 363 | } |
@@ -368,15 +368,15 @@ discard block |
||
368 | 368 | * @return \Ajax\semantic\widgets\datatable\DataTable |
369 | 369 | */ |
370 | 370 | public function setTargetSelector($_targetSelector) { |
371 | - if(!\is_array($_targetSelector)){ |
|
372 | - $_targetSelector=["edit"=>$_targetSelector,"delete"=>$_targetSelector]; |
|
371 | + if (!\is_array($_targetSelector)) { |
|
372 | + $_targetSelector=["edit"=>$_targetSelector, "delete"=>$_targetSelector]; |
|
373 | 373 | } |
374 | 374 | $this->_targetSelector=$_targetSelector; |
375 | 375 | return $this; |
376 | 376 | } |
377 | 377 | |
378 | 378 | public function getRefreshSelector() { |
379 | - if(isset($this->_refreshSelector)) |
|
379 | + if (isset($this->_refreshSelector)) |
|
380 | 380 | return $this->_refreshSelector; |
381 | 381 | return "#".$this->identifier." tbody"; |
382 | 382 | } |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | * {@inheritDoc} |
395 | 395 | * @see \Ajax\common\Widget::show() |
396 | 396 | */ |
397 | - public function show($modelInstance){ |
|
398 | - if(\is_array($modelInstance)){ |
|
399 | - if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
397 | + public function show($modelInstance) { |
|
398 | + if (\is_array($modelInstance)) { |
|
399 | + if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
400 | 400 | $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
401 | 401 | } |
402 | 402 | $this->_modelInstance=$modelInstance; |
@@ -431,24 +431,24 @@ discard block |
||
431 | 431 | return $this; |
432 | 432 | } |
433 | 433 | |
434 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
435 | - $this->_self->setActiveRowSelector($class,$event,$multiple); |
|
434 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
435 | + $this->_self->setActiveRowSelector($class, $event, $multiple); |
|
436 | 436 | return $this; |
437 | 437 | } |
438 | 438 | |
439 | - public function hideColumn($colIndex){ |
|
440 | - if(!\is_array($this->_hiddenColumns)) |
|
439 | + public function hideColumn($colIndex) { |
|
440 | + if (!\is_array($this->_hiddenColumns)) |
|
441 | 441 | $this->_hiddenColumns=[]; |
442 | 442 | $this->_hiddenColumns[]=$colIndex; |
443 | 443 | return $this; |
444 | 444 | } |
445 | 445 | |
446 | - public function setColWidth($colIndex,$width){ |
|
446 | + public function setColWidth($colIndex, $width) { |
|
447 | 447 | $this->_colWidths[$colIndex]=$width; |
448 | 448 | return $this; |
449 | 449 | } |
450 | 450 | public function setColWidths($_colWidths) { |
451 | - $this->_colWidths = $_colWidths; |
|
451 | + $this->_colWidths=$_colWidths; |
|
452 | 452 | return $this; |
453 | 453 | } |
454 | 454 | } |
@@ -58,10 +58,12 @@ discard block |
||
58 | 58 | $js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]); |
59 | 59 | $js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]); |
60 | 60 | } |
61 | - if(\is_array($this->_deleteBehavior)) |
|
62 | - $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
63 | - if(\is_array($this->_editBehavior)) |
|
64 | - $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
61 | + if(\is_array($this->_deleteBehavior)) { |
|
62 | + $this->_generateBehavior("delete",$this->_deleteBehavior, $js); |
|
63 | + } |
|
64 | + if(\is_array($this->_editBehavior)) { |
|
65 | + $this->_generateBehavior("edit",$this->_editBehavior,$js); |
|
66 | + } |
|
65 | 67 | return parent::run($js); |
66 | 68 | } |
67 | 69 | |
@@ -94,8 +96,9 @@ discard block |
||
94 | 96 | $table->setRowCount(0, \sizeof($captions)); |
95 | 97 | $this->_generateHeader($table,$captions); |
96 | 98 | |
97 | - if(isset($this->_compileParts)) |
|
98 | - $table->setCompileParts($this->_compileParts); |
|
99 | + if(isset($this->_compileParts)) { |
|
100 | + $table->setCompileParts($this->_compileParts); |
|
101 | + } |
|
99 | 102 | |
100 | 103 | $this->_generateContent($table); |
101 | 104 | |
@@ -126,8 +129,9 @@ discard block |
||
126 | 129 | } |
127 | 130 | |
128 | 131 | protected function _applyStyleAttributes($table){ |
129 | - if(isset($this->_hiddenColumns)) |
|
130 | - $this->_hideColumns(); |
|
132 | + if(isset($this->_hiddenColumns)) { |
|
133 | + $this->_hideColumns(); |
|
134 | + } |
|
131 | 135 | if(isset($this->_colWidths)){ |
132 | 136 | foreach ($this->_colWidths as $colIndex=>$width){ |
133 | 137 | $table->setColWidth($colIndex,$width); |
@@ -178,8 +182,9 @@ discard block |
||
178 | 182 | $field=$ck->getField(); |
179 | 183 | $field->setProperty("value",$id); |
180 | 184 | $field->setProperty("name", "selection[]"); |
181 | - if(isset($checkedClass)) |
|
182 | - $field->setClass($checkedClass); |
|
185 | + if(isset($checkedClass)) { |
|
186 | + $field->setClass($checkedClass); |
|
187 | + } |
|
183 | 188 | \array_unshift($values, $ck); |
184 | 189 | } |
185 | 190 | $result=$table->newRow(); |
@@ -192,8 +197,9 @@ discard block |
||
192 | 197 | |
193 | 198 | protected function _generatePagination($table,$js=NULL){ |
194 | 199 | if(isset($this->_toolbar)){ |
195 | - if($this->_toolbarPosition==PositionInTable::FOOTER) |
|
196 | - $this->_toolbar->setFloated("left"); |
|
200 | + if($this->_toolbarPosition==PositionInTable::FOOTER) { |
|
201 | + $this->_toolbar->setFloated("left"); |
|
202 | + } |
|
197 | 203 | } |
198 | 204 | $footer=$table->getFooter(); |
199 | 205 | $footer->mergeCol(); |
@@ -212,8 +218,9 @@ discard block |
||
212 | 218 | |
213 | 219 | protected function _getFieldName($index){ |
214 | 220 | $fieldName=parent::_getFieldName($index); |
215 | - if(\is_object($fieldName)) |
|
216 | - $fieldName="field-".$index; |
|
221 | + if(\is_object($fieldName)) { |
|
222 | + $fieldName="field-".$index; |
|
223 | + } |
|
217 | 224 | return $fieldName."[]"; |
218 | 225 | } |
219 | 226 | |
@@ -253,7 +260,7 @@ discard block |
||
253 | 260 | $hasPart=$table->hasPart($part); |
254 | 261 | if($hasPart){ |
255 | 262 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
256 | - }else{ |
|
263 | + } else{ |
|
257 | 264 | $row=$table->getPart($part)->getRow(0); |
258 | 265 | } |
259 | 266 | $row->mergeCol(); |
@@ -283,7 +290,7 @@ discard block |
||
283 | 290 | $this->_urls["refresh"]=JArray::getValue($urls, "refresh",0); |
284 | 291 | $this->_urls["edit"]=JArray::getValue($urls, "edit",1); |
285 | 292 | $this->_urls["delete"]=JArray::getValue($urls, "delete",2); |
286 | - }else{ |
|
293 | + } else{ |
|
287 | 294 | $this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls]; |
288 | 295 | } |
289 | 296 | return $this; |
@@ -357,8 +364,9 @@ discard block |
||
357 | 364 | |
358 | 365 | protected function getTargetSelector($op) { |
359 | 366 | $result=$this->_targetSelector; |
360 | - if(!isset($result[$op])) |
|
361 | - $result="#".$this->identifier; |
|
367 | + if(!isset($result[$op])) { |
|
368 | + $result="#".$this->identifier; |
|
369 | + } |
|
362 | 370 | return $result[$op]; |
363 | 371 | } |
364 | 372 | |
@@ -376,8 +384,9 @@ discard block |
||
376 | 384 | } |
377 | 385 | |
378 | 386 | public function getRefreshSelector() { |
379 | - if(isset($this->_refreshSelector)) |
|
380 | - return $this->_refreshSelector; |
|
387 | + if(isset($this->_refreshSelector)) { |
|
388 | + return $this->_refreshSelector; |
|
389 | + } |
|
381 | 390 | return "#".$this->identifier." tbody"; |
382 | 391 | } |
383 | 392 | |
@@ -396,8 +405,9 @@ discard block |
||
396 | 405 | */ |
397 | 406 | public function show($modelInstance){ |
398 | 407 | if(\is_array($modelInstance)){ |
399 | - if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) |
|
400 | - $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
408 | + if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) { |
|
409 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
410 | + } |
|
401 | 411 | } |
402 | 412 | $this->_modelInstance=$modelInstance; |
403 | 413 | } |
@@ -437,8 +447,9 @@ discard block |
||
437 | 447 | } |
438 | 448 | |
439 | 449 | public function hideColumn($colIndex){ |
440 | - if(!\is_array($this->_hiddenColumns)) |
|
441 | - $this->_hiddenColumns=[]; |
|
450 | + if(!\is_array($this->_hiddenColumns)) { |
|
451 | + $this->_hiddenColumns=[]; |
|
452 | + } |
|
442 | 453 | $this->_hiddenColumns[]=$colIndex; |
443 | 454 | return $this; |
444 | 455 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @param array $instances |
19 | 19 | * @return DataTable |
20 | 20 | */ |
21 | - public function dataTable($identifier,$model, $instances){ |
|
22 | - return $this->addHtmlComponent(new DataTable($identifier,$model,$instances)); |
|
21 | + public function dataTable($identifier, $model, $instances) { |
|
22 | + return $this->addHtmlComponent(new DataTable($identifier, $model, $instances)); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | * @param array $instances |
29 | 29 | * @return JsonDataTable |
30 | 30 | */ |
31 | - public function jsonDataTable($identifier,$model, $instances){ |
|
32 | - return $this->addHtmlComponent(new JsonDataTable($identifier,$model,$instances)); |
|
31 | + public function jsonDataTable($identifier, $model, $instances) { |
|
32 | + return $this->addHtmlComponent(new JsonDataTable($identifier, $model, $instances)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | * @param object $instance |
38 | 38 | * @return DataElement |
39 | 39 | */ |
40 | - public function dataElement($identifier, $instance){ |
|
41 | - return $this->addHtmlComponent(new DataElement($identifier,$instance)); |
|
40 | + public function dataElement($identifier, $instance) { |
|
41 | + return $this->addHtmlComponent(new DataElement($identifier, $instance)); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * @param object $instance |
47 | 47 | * @return DataForm |
48 | 48 | */ |
49 | - public function dataForm($identifier, $instance){ |
|
50 | - return $this->addHtmlComponent(new DataForm($identifier,$instance)); |
|
49 | + public function dataForm($identifier, $instance) { |
|
50 | + return $this->addHtmlComponent(new DataForm($identifier, $instance)); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param object $instance |
56 | 56 | * @return FormLogin |
57 | 57 | */ |
58 | - public function defaultLogin($identifier,$instance=null){ |
|
59 | - return $this->addHtmlComponent(FormLogin::regular($identifier,$instance)); |
|
58 | + public function defaultLogin($identifier, $instance=null) { |
|
59 | + return $this->addHtmlComponent(FormLogin::regular($identifier, $instance)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param object $instance |
65 | 65 | * @return FormLogin |
66 | 66 | */ |
67 | - public function smallLogin($identifier,$instance=null){ |
|
68 | - return $this->addHtmlComponent(FormLogin::small($identifier,$instance)); |
|
67 | + public function smallLogin($identifier, $instance=null) { |
|
68 | + return $this->addHtmlComponent(FormLogin::small($identifier, $instance)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param object $instance |
74 | 74 | * @return FormLogin |
75 | 75 | */ |
76 | - public function segmentedLogin($identifier,$instance=null){ |
|
77 | - return $this->addHtmlComponent(FormLogin::attachedSegment($identifier,$instance)); |
|
76 | + public function segmentedLogin($identifier, $instance=null) { |
|
77 | + return $this->addHtmlComponent(FormLogin::attachedSegment($identifier, $instance)); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param object $instance |
83 | 83 | * @return FormAccount |
84 | 84 | */ |
85 | - public function defaultAccount($identifier,$instance=null){ |
|
86 | - return $this->addHtmlComponent(FormAccount::regular($identifier,$instance)); |
|
85 | + public function defaultAccount($identifier, $instance=null) { |
|
86 | + return $this->addHtmlComponent(FormAccount::regular($identifier, $instance)); |
|
87 | 87 | } |
88 | 88 | } |