@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @property array $jquery_code_for_compile |
11 | 11 | */ |
12 | 12 | trait JsUtilsEventsTrait { |
13 | - protected $jquery_events = [ |
|
13 | + protected $jquery_events=[ |
|
14 | 14 | 'bind', |
15 | 15 | 'blur', |
16 | 16 | 'change', |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | 'unload' |
52 | 52 | ]; |
53 | 53 | |
54 | - abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn=false); |
|
54 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Outputs a javascript library blur event |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * code to execute |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - public function blur($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
66 | - return $this->_add_event ( $element, $js, 'blur', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
65 | + public function blur($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
66 | + return $this->_add_event($element, $js, 'blur', $preventDefault, $stopPropagation, true, $listenerOn); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function change($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
82 | - return $this->_add_event ( $element, $js, 'change', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
81 | + public function change($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
82 | + return $this->_add_event($element, $js, 'change', $preventDefault, $stopPropagation, true, $listenerOn); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -96,18 +96,18 @@ discard block |
||
96 | 96 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
100 | - if (! is_array ( $js )) { |
|
101 | - $js = array ( |
|
99 | + public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
100 | + if (!is_array($js)) { |
|
101 | + $js=array( |
|
102 | 102 | $js |
103 | 103 | ); |
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($ret_false) { |
107 | - $js [] = "return false;"; |
|
107 | + $js []="return false;"; |
|
108 | 108 | } |
109 | 109 | |
110 | - return $this->_add_event ( $element, $js, 'click', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
110 | + return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation, true, $listenerOn); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
123 | 123 | * @return string |
124 | 124 | */ |
125 | - public function contextmenu($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
126 | - return $this->_add_event ( $element, $js, 'contextmenu', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
125 | + public function contextmenu($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
126 | + return $this->_add_event($element, $js, 'contextmenu', $preventDefault, $stopPropagation, true, $listenerOn); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
139 | 139 | * @return string |
140 | 140 | */ |
141 | - public function dblclick($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
142 | - return $this->_add_event ( $element, $js, 'dblclick', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
141 | + public function dblclick($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
142 | + return $this->_add_event($element, $js, 'dblclick', $preventDefault, $stopPropagation, true, $listenerOn); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * code to execute |
152 | 152 | * @return string |
153 | 153 | */ |
154 | - public function error($element = 'this', $js = '') { |
|
155 | - return $this->_add_event ( $element, $js, 'error' ); |
|
154 | + public function error($element='this', $js='') { |
|
155 | + return $this->_add_event($element, $js, 'error'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
168 | 168 | * @return string |
169 | 169 | */ |
170 | - public function focus($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
171 | - return $this->_add_event ( $element, $js, 'focus', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
170 | + public function focus($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
171 | + return $this->_add_event($element, $js, 'focus', $preventDefault, $stopPropagation, true, $listenerOn); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * code for mouse out |
182 | 182 | * @return string |
183 | 183 | */ |
184 | - public function hover($element = 'this', $over = '', $out = '') { |
|
185 | - $event = "\n\t$(" . Javascript::prep_element ( $element ) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; |
|
186 | - $this->jquery_code_for_compile [] = $event; |
|
184 | + public function hover($element='this', $over='', $out='') { |
|
185 | + $event="\n\t$(".Javascript::prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; |
|
186 | + $this->jquery_code_for_compile []=$event; |
|
187 | 187 | return $event; |
188 | 188 | } |
189 | 189 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - public function keydown($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
203 | - return $this->_add_event ( $element, $js, 'keydown', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
202 | + public function keydown($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
203 | + return $this->_add_event($element, $js, 'keydown', $preventDefault, $stopPropagation, true, $listenerOn); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function keypress($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
219 | - return $this->_add_event ( $element, $js, 'keypress', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
218 | + public function keypress($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
219 | + return $this->_add_event($element, $js, 'keypress', $preventDefault, $stopPropagation, true, $listenerOn); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
232 | 232 | * @return string |
233 | 233 | */ |
234 | - public function keyup($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
235 | - return $this->_add_event ( $element, $js, 'keyup', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
234 | + public function keyup($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
235 | + return $this->_add_event($element, $js, 'keyup', $preventDefault, $stopPropagation, true, $listenerOn); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
248 | 248 | * @return string |
249 | 249 | */ |
250 | - public function load($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
251 | - return $this->_add_event ( $element, $js, 'load', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
250 | + public function load($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
251 | + return $this->_add_event($element, $js, 'load', $preventDefault, $stopPropagation, true, $listenerOn); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
264 | 264 | * @return string |
265 | 265 | */ |
266 | - public function mousedown($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
267 | - return $this->_add_event ( $element, $js, 'mousedown', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
266 | + public function mousedown($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
267 | + return $this->_add_event($element, $js, 'mousedown', $preventDefault, $stopPropagation, true, $listenerOn); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
280 | 280 | * @return string |
281 | 281 | */ |
282 | - public function mouseout($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
283 | - return $this->_add_event ( $element, $js, 'mouseout', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
282 | + public function mouseout($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
283 | + return $this->_add_event($element, $js, 'mouseout', $preventDefault, $stopPropagation, true, $listenerOn); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
296 | 296 | * @return string |
297 | 297 | */ |
298 | - public function mouseleave($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
299 | - return $this->_add_event ( $element, $js, 'mouseleave', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
298 | + public function mouseleave($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
299 | + return $this->_add_event($element, $js, 'mouseleave', $preventDefault, $stopPropagation, true, $listenerOn); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
312 | 312 | * @return string |
313 | 313 | */ |
314 | - public function mouseenter($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
315 | - return $this->_add_event ( $element, $js, 'mouseenter', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
314 | + public function mouseenter($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
315 | + return $this->_add_event($element, $js, 'mouseenter', $preventDefault, $stopPropagation, true, $listenerOn); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
328 | 328 | * @return string |
329 | 329 | */ |
330 | - public function mouseover($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
331 | - return $this->_add_event ( $element, $js, 'mouseover', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
330 | + public function mouseover($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
331 | + return $this->_add_event($element, $js, 'mouseover', $preventDefault, $stopPropagation, true, $listenerOn); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - public function mouseup($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
347 | - return $this->_add_event ( $element, $js, 'mouseup', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
346 | + public function mouseup($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
347 | + return $this->_add_event($element, $js, 'mouseup', $preventDefault, $stopPropagation, true, $listenerOn); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
360 | 360 | * @return string |
361 | 361 | */ |
362 | - public function unload($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
363 | - return $this->_add_event ( $element, $js, 'unload', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
362 | + public function unload($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
363 | + return $this->_add_event($element, $js, 'unload', $preventDefault, $stopPropagation, true, $listenerOn); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // -------------------------------------------------------------------- |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
377 | 377 | * @return string |
378 | 378 | */ |
379 | - public function resize($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
380 | - return $this->_add_event ( $element, $js, 'resize', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
379 | + public function resize($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
380 | + return $this->_add_event($element, $js, 'resize', $preventDefault, $stopPropagation, true, $listenerOn); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // -------------------------------------------------------------------- |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @param boolean|string $listenerOn use a selector for a delegated event handler |
394 | 394 | * @return string |
395 | 395 | */ |
396 | - public function scroll($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) { |
|
397 | - return $this->_add_event ( $element, $js, 'scroll', $preventDefault, $stopPropagation, true, $listenerOn ); |
|
396 | + public function scroll($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false) { |
|
397 | + return $this->_add_event($element, $js, 'scroll', $preventDefault, $stopPropagation, true, $listenerOn); |
|
398 | 398 | } |
399 | 399 | } |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class HtmlTab extends HtmlSemCollection { |
20 | 20 | |
21 | - protected $params = []; |
|
21 | + protected $params=[]; |
|
22 | 22 | |
23 | - protected $_activated = false; |
|
23 | + protected $_activated=false; |
|
24 | 24 | |
25 | - public function __construct($identifier, $tabs = array()) { |
|
25 | + public function __construct($identifier, $tabs=array()) { |
|
26 | 26 | parent::__construct($identifier, "div", ""); |
27 | - $menu = new HtmlMenu("menu" . $this->identifier); |
|
27 | + $menu=new HtmlMenu("menu".$this->identifier); |
|
28 | 28 | $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
29 | - $this->content["menu"] = $menu; |
|
29 | + $this->content["menu"]=$menu; |
|
30 | 30 | $this->addItems($tabs); |
31 | 31 | } |
32 | 32 | |
33 | - public function getMenu(){ |
|
33 | + public function getMenu() { |
|
34 | 34 | return $this->content['menu']; |
35 | 35 | } |
36 | 36 | |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | * @return HtmlSegment |
42 | 42 | */ |
43 | 43 | protected function createItem($value) { |
44 | - $count = $this->count(); |
|
45 | - $title = $value; |
|
46 | - $content = NULL; |
|
44 | + $count=$this->count(); |
|
45 | + $title=$value; |
|
46 | + $content=NULL; |
|
47 | 47 | if (\is_array($value)) { |
48 | - $title = @$value[0]; |
|
49 | - $content = @$value[1]; |
|
48 | + $title=@$value[0]; |
|
49 | + $content=@$value[1]; |
|
50 | 50 | } |
51 | - $menuItem = $this->content["menu"]->addItem($title); |
|
51 | + $menuItem=$this->content["menu"]->addItem($title); |
|
52 | 52 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
53 | 53 | $menuItem->removeProperty("href"); |
54 | - $result = $this->createSegment($count, $content, $menuItem->getIdentifier()); |
|
55 | - $result->menuTab = $menuItem; |
|
54 | + $result=$this->createSegment($count, $content, $menuItem->getIdentifier()); |
|
55 | + $result->menuTab=$menuItem; |
|
56 | 56 | return $result; |
57 | 57 | } |
58 | 58 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return \Ajax\semantic\html\elements\HtmlSegment |
65 | 65 | */ |
66 | 66 | private function createSegment($count, $content, $datatab) { |
67 | - $segment = new HtmlSegment("item-" . $this->identifier . "-" . $count, $content); |
|
67 | + $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
|
68 | 68 | $segment->setAttachment(NULL, Side::BOTTOM) |
69 | 69 | ->addToProperty("class", "tab") |
70 | 70 | ->addToProperty("data-tab", $datatab); |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @return \Ajax\semantic\html\modules\HtmlTab |
82 | 82 | */ |
83 | 83 | public function setTabContent($index, $content) { |
84 | - $menu = $this->content["menu"]; |
|
85 | - if ($index < $menu->count()) { |
|
86 | - if (isset($this->content[$index]) === false) { |
|
87 | - $this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index) |
|
84 | + $menu=$this->content["menu"]; |
|
85 | + if ($index<$menu->count()) { |
|
86 | + if (isset($this->content[$index])===false) { |
|
87 | + $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index) |
|
88 | 88 | ->getIdentifier()); |
89 | 89 | } else |
90 | 90 | $this->content[$index]->setContent($content); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @return \Ajax\semantic\html\modules\HtmlTab |
100 | 100 | */ |
101 | 101 | public function setTabsContent($contents) { |
102 | - $size = \sizeof($contents); |
|
103 | - for ($i = 0; $i < $size; $i ++) { |
|
102 | + $size=\sizeof($contents); |
|
103 | + for ($i=0; $i<$size; $i++) { |
|
104 | 104 | $this->setTabContent($i, $contents[$i]); |
105 | 105 | } |
106 | 106 | return $this; |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | * @return \Ajax\semantic\html\modules\HtmlTab |
114 | 114 | */ |
115 | 115 | public function activate($index) { |
116 | - $item = $this->content["menu"]->getItem($index); |
|
117 | - if ($item != null) { |
|
116 | + $item=$this->content["menu"]->getItem($index); |
|
117 | + if ($item!=null) { |
|
118 | 118 | $item->setActive(true); |
119 | 119 | $this->content[$index]->setActive(true); |
120 | - $this->_activated = true; |
|
120 | + $this->_activated=true; |
|
121 | 121 | } |
122 | 122 | return $this; |
123 | 123 | } |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | * @param array $params |
152 | 152 | * @return \Ajax\semantic\html\elements\HtmlSegment |
153 | 153 | */ |
154 | - public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params = array()) { |
|
154 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
155 | 155 | if (\array_key_exists($index, $this->content)) { |
156 | - $this->content[$index] = $js->forward($initialController, $controller, $action, $params); |
|
156 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
157 | 157 | return $this->content[$index]; |
158 | 158 | } |
159 | 159 | |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | * The parameters to pass to the view |
175 | 175 | * @return \Ajax\semantic\html\elements\HtmlSegment |
176 | 176 | */ |
177 | - public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params = array()) { |
|
177 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
178 | 178 | if (\array_key_exists($index, $this->content)) { |
179 | - $this->content[$index] = $js->renderContent($initialController, $viewName, $params); |
|
179 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
180 | 180 | return $this->content[$index]; |
181 | 181 | } |
182 | 182 | return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | * @param array $params |
197 | 197 | * @return \Ajax\semantic\html\elements\HtmlSegment |
198 | 198 | */ |
199 | - public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params = array()) { |
|
199 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
200 | 200 | \ob_start(); |
201 | 201 | $js->forward($initialController, $controller, $action, $params); |
202 | - $content = \ob_get_clean(); |
|
202 | + $content=\ob_get_clean(); |
|
203 | 203 | return $this->addTab($title, $content); |
204 | 204 | } |
205 | 205 | |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | * The parameters to pass to the view |
216 | 216 | * @return \Ajax\semantic\html\elements\HtmlSegment |
217 | 217 | */ |
218 | - public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params = array()) { |
|
218 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
219 | 219 | return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
220 | 220 | } |
221 | 221 | |
222 | - public function setPointing($value = Direction::NONE) { |
|
222 | + public function setPointing($value=Direction::NONE) { |
|
223 | 223 | return $this->content["menu"]->setPointing($value); |
224 | 224 | } |
225 | 225 | |
@@ -254,25 +254,25 @@ discard block |
||
254 | 254 | * @return \Ajax\semantic\html\modules\HtmlTab |
255 | 255 | */ |
256 | 256 | public function setMenu($menu) { |
257 | - $contentSize = \sizeof($this->content); |
|
258 | - for ($i = 0; $i < $contentSize; $i ++) { |
|
259 | - if ($menu->getItem($i) !== NULL) { |
|
257 | + $contentSize=\sizeof($this->content); |
|
258 | + for ($i=0; $i<$contentSize; $i++) { |
|
259 | + if ($menu->getItem($i)!==NULL) { |
|
260 | 260 | if (isset($this->content[$i])) { |
261 | 261 | $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
262 | 262 | } |
263 | 263 | } |
264 | 264 | } |
265 | - $menuSize = $menu->count(); |
|
266 | - for ($i = 0; $i < $menuSize; $i ++) { |
|
265 | + $menuSize=$menu->count(); |
|
266 | + for ($i=0; $i<$menuSize; $i++) { |
|
267 | 267 | $menu->getItem($i)->removeProperty("href"); |
268 | - if (isset($this->content[$i]) === false) { |
|
269 | - $this->content[$i] = $this->createSegment($i, "New content", $menu->getItem($i) |
|
268 | + if (isset($this->content[$i])===false) { |
|
269 | + $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i) |
|
270 | 270 | ->getIdentifier()); |
271 | 271 | } |
272 | 272 | $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
273 | 273 | } |
274 | 274 | |
275 | - $this->content["menu"] = $menu; |
|
275 | + $this->content["menu"]=$menu; |
|
276 | 276 | return $this; |
277 | 277 | } |
278 | 278 | |
@@ -281,19 +281,19 @@ discard block |
||
281 | 281 | * @see BaseHtml::run() |
282 | 282 | */ |
283 | 283 | public function run(JsUtils $js) { |
284 | - if (isset($this->_bsComponent) === false) |
|
285 | - $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
284 | + if (isset($this->_bsComponent)===false) |
|
285 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
286 | 286 | $this->addEventsOnRun($js); |
287 | 287 | return $this->_bsComponent; |
288 | 288 | } |
289 | 289 | |
290 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
291 | - if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) |
|
290 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
291 | + if (!$this->_activated && $this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
292 | 292 | $this->activate(0); |
293 | 293 | return parent::compile($js, $view); |
294 | 294 | } |
295 | 295 | |
296 | - public function setInverted($recursive=true){ |
|
296 | + public function setInverted($recursive=true) { |
|
297 | 297 | parent::setInverted($recursive); |
298 | 298 | $this->content['menu']->addClass('inverted'); |
299 | 299 | } |
@@ -86,8 +86,9 @@ discard block |
||
86 | 86 | if (isset($this->content[$index]) === false) { |
87 | 87 | $this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index) |
88 | 88 | ->getIdentifier()); |
89 | - } else |
|
90 | - $this->content[$index]->setContent($content); |
|
89 | + } else { |
|
90 | + $this->content[$index]->setContent($content); |
|
91 | + } |
|
91 | 92 | } |
92 | 93 | return $this; |
93 | 94 | } |
@@ -281,15 +282,17 @@ discard block |
||
281 | 282 | * @see BaseHtml::run() |
282 | 283 | */ |
283 | 284 | public function run(JsUtils $js) { |
284 | - if (isset($this->_bsComponent) === false) |
|
285 | - $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
285 | + if (isset($this->_bsComponent) === false) { |
|
286 | + $this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params); |
|
287 | + } |
|
286 | 288 | $this->addEventsOnRun($js); |
287 | 289 | return $this->_bsComponent; |
288 | 290 | } |
289 | 291 | |
290 | 292 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
291 | - if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) |
|
292 | - $this->activate(0); |
|
293 | + if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) { |
|
294 | + $this->activate(0); |
|
295 | + } |
|
293 | 296 | return parent::compile($js, $view); |
294 | 297 | } |
295 | 298 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | use Ajax\common\html\traits\BaseHooksTrait; |
21 | 21 | |
22 | 22 | abstract class Widget extends HtmlDoubleElement { |
23 | - use FieldAsTrait,FormTrait,BaseHooksTrait; |
|
23 | + use FieldAsTrait, FormTrait, BaseHooksTrait; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | |
67 | 67 | protected $_hasRules; |
68 | 68 | |
69 | - public function __construct($identifier, $model, $modelInstance = NULL) { |
|
69 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
70 | 70 | parent::__construct($identifier); |
71 | - $this->_template = "%wrapContentBefore%%content%%wrapContentAfter%"; |
|
71 | + $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
|
72 | 72 | $this->setModel($model); |
73 | 73 | if (isset($modelInstance)) { |
74 | 74 | $this->show($modelInstance); |
75 | 75 | } |
76 | - $this->_generated = false; |
|
76 | + $this->_generated=false; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function _init($instanceViewer, $contentKey, $content, $edition) { |
80 | - $this->_instanceViewer = $instanceViewer; |
|
81 | - $this->content = [ |
|
80 | + $this->_instanceViewer=$instanceViewer; |
|
81 | + $this->content=[ |
|
82 | 82 | $contentKey => $content |
83 | 83 | ]; |
84 | - $this->_self = $content; |
|
85 | - $this->_toolbarPosition = PositionInTable::BEFORETABLE; |
|
86 | - $this->_edition = $edition; |
|
84 | + $this->_self=$content; |
|
85 | + $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
|
86 | + $this->_edition=$edition; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | * @return int|string|boolean |
93 | 93 | */ |
94 | 94 | protected function _getIndex($fieldName) { |
95 | - $index = $fieldName; |
|
95 | + $index=$fieldName; |
|
96 | 96 | if (\is_string($fieldName)) { |
97 | - $fields = $this->_instanceViewer->getVisibleProperties(); |
|
98 | - $index = \array_search($fieldName, $fields); |
|
97 | + $fields=$this->_instanceViewer->getVisibleProperties(); |
|
98 | + $index=\array_search($fieldName, $fields); |
|
99 | 99 | } |
100 | 100 | return $index; |
101 | 101 | } |
102 | 102 | |
103 | - protected function _getFieldIdentifier($prefix, $name = "") { |
|
104 | - return $this->identifier . "-{$prefix}-" . $this->_instanceViewer->getIdentifier(); |
|
103 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
104 | + return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | protected function _getFieldName($index) { |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | return $this->_instanceViewer->getCaption($index); |
113 | 113 | } |
114 | 114 | |
115 | - abstract protected function _setToolbarPosition($table, $captions = NULL); |
|
115 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
116 | 116 | |
117 | 117 | public function show($modelInstance) { |
118 | 118 | if (\is_array($modelInstance)) { |
119 | - $modelInstance = \json_decode(\json_encode($modelInstance), FALSE); |
|
119 | + $modelInstance=\json_decode(\json_encode($modelInstance), FALSE); |
|
120 | 120 | } |
121 | - $this->_modelInstance = $modelInstance; |
|
121 | + $this->_modelInstance=$modelInstance; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public function getModel() { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | public function setModel($_model) { |
129 | - $this->_model = $_model; |
|
129 | + $this->_model=$_model; |
|
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | public function setInstanceViewer($_instanceViewer) { |
138 | - $this->_instanceViewer = $_instanceViewer; |
|
138 | + $this->_instanceViewer=$_instanceViewer; |
|
139 | 139 | return $this; |
140 | 140 | } |
141 | 141 | |
142 | 142 | abstract public function getHtmlComponent(); |
143 | 143 | |
144 | - public function setAttached($value = true) { |
|
144 | + public function setAttached($value=true) { |
|
145 | 145 | return $this->getHtmlComponent()->setAttached($value); |
146 | 146 | } |
147 | 147 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @return Widget |
157 | 157 | */ |
158 | 158 | public function afterCompile($index, $callback) { |
159 | - $index = $this->_getIndex($index); |
|
160 | - if ($index !== false) { |
|
159 | + $index=$this->_getIndex($index); |
|
160 | + if ($index!==false) { |
|
161 | 161 | $this->_instanceViewer->afterCompile($index, $callback); |
162 | 162 | } |
163 | 163 | return $this; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | return $this; |
183 | 183 | } |
184 | 184 | |
185 | - public function addField($field, $key = null) { |
|
185 | + public function addField($field, $key=null) { |
|
186 | 186 | $this->_instanceViewer->addField($field, $key); |
187 | 187 | return $this; |
188 | 188 | } |
@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | return $this->_instanceViewer->visiblePropertiesCount(); |
197 | 197 | } |
198 | 198 | |
199 | - public function addMessage($attributes = NULL, $fieldName = "message") { |
|
199 | + public function addMessage($attributes=NULL, $fieldName="message") { |
|
200 | 200 | $this->_instanceViewer->addField($fieldName); |
201 | - $count = $this->_instanceViewer->visiblePropertiesCount(); |
|
202 | - return $this->fieldAsMessage($count - 1, $attributes); |
|
201 | + $count=$this->_instanceViewer->visiblePropertiesCount(); |
|
202 | + return $this->fieldAsMessage($count-1, $attributes); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | public function addErrorMessage() { |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | ], "message"); |
209 | 209 | } |
210 | 210 | |
211 | - public function insertField($index, $field, $key = null) { |
|
212 | - $index = $this->_getIndex($index); |
|
211 | + public function insertField($index, $field, $key=null) { |
|
212 | + $index=$this->_getIndex($index); |
|
213 | 213 | $this->_instanceViewer->insertField($index, $field, $key); |
214 | 214 | return $this; |
215 | 215 | } |
216 | 216 | |
217 | - public function insertInField($index, $field, $key = null) { |
|
218 | - $index = $this->_getIndex($index); |
|
219 | - if ($index !== false) { |
|
217 | + public function insertInField($index, $field, $key=null) { |
|
218 | + $index=$this->_getIndex($index); |
|
219 | + if ($index!==false) { |
|
220 | 220 | $this->_instanceViewer->insertInField($index, $field, $key); |
221 | 221 | } |
222 | 222 | return $this; |
@@ -232,8 +232,8 @@ discard block |
||
232 | 232 | * @return Widget |
233 | 233 | */ |
234 | 234 | public function setValueFunction($index, $callback) { |
235 | - $index = $this->_getIndex($index); |
|
236 | - if ($index !== false) { |
|
235 | + $index=$this->_getIndex($index); |
|
236 | + if ($index!==false) { |
|
237 | 237 | $this->_instanceViewer->setValueFunction($index, $callback); |
238 | 238 | } |
239 | 239 | return $this; |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
250 | 250 | */ |
251 | 251 | public function getToolbar() { |
252 | - if (isset($this->_toolbar) === false) { |
|
253 | - $this->_toolbar = new HtmlMenu("toolbar-" . $this->identifier); |
|
252 | + if (isset($this->_toolbar)===false) { |
|
253 | + $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
|
254 | 254 | } |
255 | 255 | return $this->_toolbar; |
256 | 256 | } |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | * function to call on $element |
264 | 264 | * @return \Ajax\common\html\HtmlDoubleElement |
265 | 265 | */ |
266 | - public function addInToolbar($element, $callback = NULL) { |
|
267 | - $tb = $this->getToolbar(); |
|
266 | + public function addInToolbar($element, $callback=NULL) { |
|
267 | + $tb=$this->getToolbar(); |
|
268 | 268 | if ($element instanceof BaseWidget) { |
269 | - if ($element->getIdentifier() === "") { |
|
270 | - $element->setIdentifier("tb-item-" . $this->identifier . "-" . $tb->count()); |
|
269 | + if ($element->getIdentifier()==="") { |
|
270 | + $element->setIdentifier("tb-item-".$this->identifier."-".$tb->count()); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | if (isset($callback)) { |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | * function($element) |
287 | 287 | * @return \Ajax\common\html\HtmlDoubleElement |
288 | 288 | */ |
289 | - public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) { |
|
290 | - $result = $this->addInToolbar($caption, $callback); |
|
289 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
290 | + $result=$this->addInToolbar($caption, $callback); |
|
291 | 291 | if (isset($icon) && method_exists($result, "addIcon")) |
292 | 292 | $result->addIcon($icon); |
293 | 293 | return $result; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * function($element) |
301 | 301 | * @return \Ajax\common\Widget |
302 | 302 | */ |
303 | - public function addItemsInToolbar(array $items, $callback = NULL) { |
|
303 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
304 | 304 | if (JArray::isAssociative($items)) { |
305 | 305 | foreach ($items as $icon => $item) { |
306 | 306 | $this->addItemInToolbar($item, $icon, $callback); |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | * function($element) |
322 | 322 | * @return \Ajax\common\html\HtmlDoubleElement |
323 | 323 | */ |
324 | - public function addDropdownInToolbar($value, $items, $callback = NULL) { |
|
325 | - $dd = $value; |
|
324 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
325 | + $dd=$value; |
|
326 | 326 | if (\is_string($value)) { |
327 | - $dd = new HtmlDropdown("dropdown-" . $this->identifier . "-" . $value, $value, $items); |
|
327 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
328 | 328 | } |
329 | 329 | return $this->addInToolbar($dd, $callback); |
330 | 330 | } |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | * function($element) |
338 | 338 | * @return \Ajax\common\html\HtmlDoubleElement |
339 | 339 | */ |
340 | - public function addButtonInToolbar($caption, $cssStyle = null, $callback = NULL) { |
|
341 | - $bt = new HtmlButton("bt-" . $caption, $caption, $cssStyle); |
|
340 | + public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) { |
|
341 | + $bt=new HtmlButton("bt-".$caption, $caption, $cssStyle); |
|
342 | 342 | return $this->addInToolbar($bt, $callback); |
343 | 343 | } |
344 | 344 | |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | * function($element) |
351 | 351 | * @return \Ajax\common\html\HtmlDoubleElement |
352 | 352 | */ |
353 | - public function addButtonsInToolbar(array $captions, $asIcon = false, $callback = NULL) { |
|
354 | - $bts = new HtmlButtonGroups("", $captions, $asIcon); |
|
353 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
354 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
355 | 355 | return $this->addInToolbar($bts, $callback); |
356 | 356 | } |
357 | 357 | |
@@ -363,14 +363,14 @@ discard block |
||
363 | 363 | * @param boolean $labeled |
364 | 364 | * @return \Ajax\common\html\HtmlDoubleElement |
365 | 365 | */ |
366 | - public function addLabelledIconButtonInToolbar($caption, $icon, $before = true, $labeled = false) { |
|
367 | - $bt = new HtmlButton("", $caption); |
|
366 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
367 | + $bt=new HtmlButton("", $caption); |
|
368 | 368 | $bt->addIcon($icon, $before, $labeled); |
369 | 369 | return $this->addInToolbar($bt); |
370 | 370 | } |
371 | 371 | |
372 | - public function addSubmitInToolbar($identifier, $value, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $parameters = NULL) { |
|
373 | - $button = new HtmlButton($identifier, $value, $cssStyle); |
|
372 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
373 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
374 | 374 | $this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters); |
375 | 375 | return $this->addInToolbar($button); |
376 | 376 | } |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | * @param boolean $_edition |
394 | 394 | * @return \Ajax\common\Widget |
395 | 395 | */ |
396 | - public function setEdition($_edition = true) { |
|
397 | - $this->_edition = $_edition; |
|
396 | + public function setEdition($_edition=true) { |
|
397 | + $this->_edition=$_edition; |
|
398 | 398 | return $this; |
399 | 399 | } |
400 | 400 | |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | * @param string|boolean $disable |
424 | 424 | * @return string |
425 | 425 | */ |
426 | - public function jsDisabled($disable = true) { |
|
427 | - return "$('#" . $this->identifier . " .ui.input,#" . $this->identifier . " .ui.dropdown,#" . $this->identifier . " .ui.checkbox').toggleClass('disabled'," . $disable . ");"; |
|
426 | + public function jsDisabled($disable=true) { |
|
427 | + return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");"; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | * function($element) |
435 | 435 | * @return \Ajax\common\html\HtmlDoubleElement |
436 | 436 | */ |
437 | - public function addEditButtonInToolbar($caption, $callback = NULL) { |
|
438 | - $bt = new HtmlButton($this->identifier . "-editBtn", $caption); |
|
437 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
438 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
439 | 439 | $bt->setToggle(); |
440 | 440 | $bt->setActive($this->_edition); |
441 | 441 | $bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')"))); |
@@ -443,18 +443,18 @@ discard block |
||
443 | 443 | } |
444 | 444 | |
445 | 445 | public function setToolbar(HtmlMenu $_toolbar) { |
446 | - $this->_toolbar = $_toolbar; |
|
446 | + $this->_toolbar=$_toolbar; |
|
447 | 447 | return $this; |
448 | 448 | } |
449 | 449 | |
450 | 450 | public function setToolbarPosition($_toolbarPosition) { |
451 | - $this->_toolbarPosition = $_toolbarPosition; |
|
451 | + $this->_toolbarPosition=$_toolbarPosition; |
|
452 | 452 | return $this; |
453 | 453 | } |
454 | 454 | |
455 | 455 | public function getForm() { |
456 | - if (! isset($this->_form)) { |
|
457 | - $this->_form = new HtmlForm("frm-" . $this->identifier); |
|
456 | + if (!isset($this->_form)) { |
|
457 | + $this->_form=new HtmlForm("frm-".$this->identifier); |
|
458 | 458 | $this->setEdition(true); |
459 | 459 | } |
460 | 460 | return $this->_form; |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | } |
469 | 469 | |
470 | 470 | protected function runForm(JsUtils $js) { |
471 | - $fields = $this->getContentInstances(HtmlFormField::class); |
|
471 | + $fields=$this->getContentInstances(HtmlFormField::class); |
|
472 | 472 | foreach ($fields as $field) { |
473 | 473 | $this->_form->addField($field); |
474 | 474 | } |
@@ -477,10 +477,10 @@ discard block |
||
477 | 477 | |
478 | 478 | protected function _compileForm() { |
479 | 479 | if (isset($this->_form)) { |
480 | - $noValidate = ""; |
|
481 | - if (\sizeof($this->_form->getValidationParams()) > 0) |
|
482 | - $noValidate = "novalidate"; |
|
483 | - $this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>"); |
|
480 | + $noValidate=""; |
|
481 | + if (\sizeof($this->_form->getValidationParams())>0) |
|
482 | + $noValidate="novalidate"; |
|
483 | + $this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>"); |
|
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
@@ -502,21 +502,21 @@ discard block |
||
502 | 502 | } |
503 | 503 | |
504 | 504 | public function swapFields($index1, $index2) { |
505 | - $index1 = $this->_getIndex($index1); |
|
506 | - $index2 = $this->_getIndex($index2); |
|
505 | + $index1=$this->_getIndex($index1); |
|
506 | + $index2=$this->_getIndex($index2); |
|
507 | 507 | return $this->_instanceViewer->swapFields($index1, $index2); |
508 | 508 | } |
509 | 509 | |
510 | 510 | public function removeField($index) { |
511 | - $index = $this->_getIndex($index); |
|
512 | - if ($index !== false) { |
|
511 | + $index=$this->_getIndex($index); |
|
512 | + if ($index!==false) { |
|
513 | 513 | $this->_instanceViewer->removeField($index); |
514 | 514 | } |
515 | 515 | return $this; |
516 | 516 | } |
517 | 517 | |
518 | - public function asModal($header = null) { |
|
519 | - $modal = new HtmlModal("modal-" . $this->identifier, $header); |
|
518 | + public function asModal($header=null) { |
|
519 | + $modal=new HtmlModal("modal-".$this->identifier, $header); |
|
520 | 520 | $modal->setContent($this); |
521 | 521 | if (isset($this->_form)) { |
522 | 522 | $this->_form->onSuccess($modal->jsHide()); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | return $modal; |
525 | 525 | } |
526 | 526 | |
527 | - public function addToProperty($name, $value, $separator = " ") { |
|
527 | + public function addToProperty($name, $value, $separator=" ") { |
|
528 | 528 | return $this->getHtmlComponent()->addToProperty($name, $value, $separator); |
529 | 529 | } |
530 | 530 |
@@ -288,8 +288,9 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) { |
290 | 290 | $result = $this->addInToolbar($caption, $callback); |
291 | - if (isset($icon) && method_exists($result, "addIcon")) |
|
292 | - $result->addIcon($icon); |
|
291 | + if (isset($icon) && method_exists($result, "addIcon")) { |
|
292 | + $result->addIcon($icon); |
|
293 | + } |
|
293 | 294 | return $result; |
294 | 295 | } |
295 | 296 | |
@@ -478,8 +479,9 @@ discard block |
||
478 | 479 | protected function _compileForm() { |
479 | 480 | if (isset($this->_form)) { |
480 | 481 | $noValidate = ""; |
481 | - if (\sizeof($this->_form->getValidationParams()) > 0) |
|
482 | - $noValidate = "novalidate"; |
|
482 | + if (\sizeof($this->_form->getValidationParams()) > 0) { |
|
483 | + $noValidate = "novalidate"; |
|
484 | + } |
|
483 | 485 | $this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>"); |
484 | 486 | } |
485 | 487 | } |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | private $ajaxCall; |
18 | 18 | |
19 | - public function __construct($type, $url, $params, $jsCallback = null, $method = 'post', $parameters = [], $prompt = NULL, $value = NULL) { |
|
19 | + public function __construct($type, $url, $params, $jsCallback=null, $method='post', $parameters=[], $prompt=NULL, $value=NULL) { |
|
20 | 20 | parent::__construct($type, $prompt, $value); |
21 | - $parameters = \array_merge([ |
|
21 | + $parameters=\array_merge([ |
|
22 | 22 | 'async' => false, |
23 | 23 | 'url' => $url, |
24 | 24 | 'params' => $params, |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | 'preventDefault' => false, |
30 | 30 | 'responseElement' => null |
31 | 31 | ], $parameters); |
32 | - $this->ajaxCall = new AjaxCall($method, $parameters); |
|
32 | + $this->ajaxCall=new AjaxCall($method, $parameters); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function compile(JsUtils $js) { |
36 | - $js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;" . $this->ajaxCall->compile($js) . "return result;}"), true); |
|
36 | + $js->exec(Rule::custom($this->getType(), "function(value,ruleValue){var result=true;".$this->ajaxCall->compile($js)."return result;}"), true); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -15,9 +15,9 @@ |
||
15 | 15 | |
16 | 16 | protected $jsFunction; |
17 | 17 | |
18 | - public function __construct($type, $jsFunction, $prompt = NULL, $value = NULL) { |
|
18 | + public function __construct($type, $jsFunction, $prompt=NULL, $value=NULL) { |
|
19 | 19 | parent::__construct($type, $prompt, $value); |
20 | - $this->jsFunction = $jsFunction; |
|
20 | + $this->jsFunction=$jsFunction; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function compile(JsUtils $js) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @version 1.001 |
9 | 9 | * Generates a JSON field validator |
10 | 10 | */ |
11 | -class FieldValidation implements \JsonSerializable{ |
|
11 | +class FieldValidation implements \JsonSerializable { |
|
12 | 12 | /** |
13 | 13 | * @var string |
14 | 14 | */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | protected $optional; |
33 | 33 | |
34 | - public function __construct($identifier){ |
|
34 | + public function __construct($identifier) { |
|
35 | 35 | $this->identifier=$identifier; |
36 | 36 | $this->rules=[]; |
37 | 37 | } |
@@ -55,31 +55,31 @@ discard block |
||
55 | 55 | * @param string $value |
56 | 56 | * @return Rule |
57 | 57 | */ |
58 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
59 | - if($type instanceof Rule) { |
|
60 | - $rule = $type; |
|
61 | - if($type instanceof CustomRule){ |
|
58 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
59 | + if ($type instanceof Rule) { |
|
60 | + $rule=$type; |
|
61 | + if ($type instanceof CustomRule) { |
|
62 | 62 | $this->customRules[]=$type; |
63 | 63 | $this->hasCustomRules=true; |
64 | 64 | } |
65 | - }elseif(\is_array($type)){ |
|
65 | + }elseif (\is_array($type)) { |
|
66 | 66 | $value=JArray::getValue($type, "value", 2); |
67 | 67 | $prompt=JArray::getValue($type, "prompt", 1); |
68 | 68 | $type=JArray::getValue($type, "type", 0); |
69 | - $rule=new Rule($type,$prompt,$value); |
|
70 | - }else { |
|
71 | - $rule = new Rule($type, $prompt, $value); |
|
69 | + $rule=new Rule($type, $prompt, $value); |
|
70 | + } else { |
|
71 | + $rule=new Rule($type, $prompt, $value); |
|
72 | 72 | } |
73 | 73 | $this->rules[]=$rule; |
74 | 74 | return $rule; |
75 | 75 | } |
76 | 76 | |
77 | - public function jsonSerialize(){ |
|
78 | - $result=["identifier"=>$this->identifier,"rules"=>$this->rules]; |
|
79 | - if($this->optional){ |
|
77 | + public function jsonSerialize() { |
|
78 | + $result=["identifier"=>$this->identifier, "rules"=>$this->rules]; |
|
79 | + if ($this->optional) { |
|
80 | 80 | $result["optional"]=true; |
81 | 81 | } |
82 | - if(isset($this->depends)){ |
|
82 | + if (isset($this->depends)) { |
|
83 | 83 | $result["depends"]=$this->depends; |
84 | 84 | } |
85 | 85 | return $result; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 | |
98 | - public function compile(JsUtils $js){ |
|
99 | - if($this->hasCustomRules) { |
|
98 | + public function compile(JsUtils $js) { |
|
99 | + if ($this->hasCustomRules) { |
|
100 | 100 | foreach ($this->customRules as $rule) { |
101 | 101 | $rule->compile($js); |
102 | 102 | } |
@@ -62,12 +62,12 @@ |
||
62 | 62 | $this->customRules[]=$type; |
63 | 63 | $this->hasCustomRules=true; |
64 | 64 | } |
65 | - }elseif(\is_array($type)){ |
|
65 | + } elseif(\is_array($type)){ |
|
66 | 66 | $value=JArray::getValue($type, "value", 2); |
67 | 67 | $prompt=JArray::getValue($type, "prompt", 1); |
68 | 68 | $type=JArray::getValue($type, "type", 0); |
69 | 69 | $rule=new Rule($type,$prompt,$value); |
70 | - }else { |
|
70 | + } else { |
|
71 | 71 | $rule = new Rule($type, $prompt, $value); |
72 | 72 | } |
73 | 73 | $this->rules[]=$rule; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | class HtmlRail extends HtmlSemDoubleElement { |
12 | 12 | |
13 | - public function __construct($identifier, $content = NULL) { |
|
13 | + public function __construct($identifier, $content=NULL) { |
|
14 | 14 | parent::__construct($identifier, 'div', 'ui rail', $content); |
15 | 15 | } |
16 | 16 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $onClick |
46 | 46 | * @return HtmlButton |
47 | 47 | */ |
48 | - public function htmlButton($identifier, $value = null, $cssStyle = null, $onClick = null) { |
|
48 | + public function htmlButton($identifier, $value=null, $cssStyle=null, $onClick=null) { |
|
49 | 49 | return $this->addHtmlComponent(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
50 | 50 | } |
51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param boolean $asIcons |
60 | 60 | * @return HtmlButtonGroups |
61 | 61 | */ |
62 | - public function htmlButtonGroups($identifier, $elements = array(), $asIcons = false) { |
|
62 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
63 | 63 | return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
64 | 64 | } |
65 | 65 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param string $content |
73 | 73 | * @return HtmlContainer |
74 | 74 | */ |
75 | - public function htmlContainer($identifier, $content = "") { |
|
75 | + public function htmlContainer($identifier, $content="") { |
|
76 | 76 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
77 | 77 | } |
78 | 78 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param string $content |
86 | 86 | * @return HtmlDivider |
87 | 87 | */ |
88 | - public function htmlDivider($identifier, $content = "", $tagName = "div") { |
|
88 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
89 | 89 | return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
90 | 90 | } |
91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param string $type |
101 | 101 | * @return HtmlHeader |
102 | 102 | */ |
103 | - public function htmlHeader($identifier, $niveau = 1, $content = NULL, $type = "page") { |
|
103 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
104 | 104 | return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
105 | 105 | } |
106 | 106 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $size |
129 | 129 | * @return HtmlImage |
130 | 130 | */ |
131 | - public function htmlImage($identifier, $src = "", $alt = "", $size = NULL) { |
|
131 | + public function htmlImage($identifier, $src="", $alt="", $size=NULL) { |
|
132 | 132 | return $this->addHtmlComponent(new HtmlImage($identifier, $src, $alt, $size)); |
133 | 133 | } |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param string $size |
143 | 143 | * @return HtmlIconGroups |
144 | 144 | */ |
145 | - public function htmlIconGroups($identifier, $icons = array(), $size = "") { |
|
145 | + public function htmlIconGroups($identifier, $icons=array(), $size="") { |
|
146 | 146 | return $this->addHtmlComponent(new HtmlIconGroups($identifier, $icons, $size)); |
147 | 147 | } |
148 | 148 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string $placeholder |
158 | 158 | * @return HtmlInput |
159 | 159 | */ |
160 | - public function htmlInput($identifier, $type = "text", $value = "", $placeholder = "") { |
|
160 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
161 | 161 | return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
162 | 162 | } |
163 | 163 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param string $tagName |
172 | 172 | * @return HtmlLabel |
173 | 173 | */ |
174 | - public function htmlLabel($identifier, $content = "", $icon = NULL, $tagName = "div") { |
|
174 | + public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") { |
|
175 | 175 | return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName)); |
176 | 176 | } |
177 | 177 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param array $attributes |
183 | 183 | * @return HtmlLabelGroups |
184 | 184 | */ |
185 | - public function htmlLabelGroups($identifier, $labels = array(), $attributes = array()) { |
|
185 | + public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) { |
|
186 | 186 | return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes)); |
187 | 187 | } |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param array $items |
194 | 194 | * @return HtmlList |
195 | 195 | */ |
196 | - public function htmlList($identifier, $items = array()) { |
|
196 | + public function htmlList($identifier, $items=array()) { |
|
197 | 197 | return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
198 | 198 | } |
199 | 199 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param string $content |
205 | 205 | * @return HtmlSegment |
206 | 206 | */ |
207 | - public function htmlSegment($identifier, $content = "") { |
|
207 | + public function htmlSegment($identifier, $content="") { |
|
208 | 208 | return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
209 | 209 | } |
210 | 210 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * the segments |
217 | 217 | * @return HtmlSegmentGroups |
218 | 218 | */ |
219 | - public function htmlSegmentGroups($identifier, $items = array()) { |
|
219 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
220 | 220 | return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
221 | 221 | } |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @param Direction|string $attributeType |
231 | 231 | * @return HtmlReveal |
232 | 232 | */ |
233 | - public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type = RevealType::FADE, $attributeType = NULL) { |
|
233 | + public function htmlReveal($identifier, $visibleContent, $hiddenContent, $type=RevealType::FADE, $attributeType=NULL) { |
|
234 | 234 | return $this->addHtmlComponent(new HtmlReveal($identifier, $visibleContent, $hiddenContent, $type, $attributeType)); |
235 | 235 | } |
236 | 236 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $steps |
242 | 242 | * @return HtmlStep |
243 | 243 | */ |
244 | - public function htmlStep($identifier, $steps = array()) { |
|
244 | + public function htmlStep($identifier, $steps=array()) { |
|
245 | 245 | return $this->addHtmlComponent(new HtmlStep($identifier, $steps)); |
246 | 246 | } |
247 | 247 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @param mixed $content |
276 | 276 | * @return HtmlRail |
277 | 277 | */ |
278 | - public function htmlRail($identifier, $content = null) { |
|
278 | + public function htmlRail($identifier, $content=null) { |
|
279 | 279 | return $this->addHtmlComponent(new HtmlRail($identifier, $content)); |
280 | 280 | } |
281 | 281 | } |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | */ |
14 | 14 | protected $content; |
15 | 15 | |
16 | - protected $wrapContentBefore = ""; |
|
16 | + protected $wrapContentBefore=""; |
|
17 | 17 | |
18 | - protected $wrapContentAfter = ""; |
|
18 | + protected $wrapContentAfter=""; |
|
19 | 19 | |
20 | 20 | protected $_editableContent; |
21 | 21 | |
22 | - public function __construct($identifier, $tagName = "p") { |
|
22 | + public function __construct($identifier, $tagName="p") { |
|
23 | 23 | parent::__construct($identifier, $tagName); |
24 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
24 | + $this->_template='<%tagName% id="%identifier%" %properties%>%wrapContentBefore%%content%%wrapContentAfter%</%tagName%>'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function setContent($content) { |
28 | - $this->content = $content; |
|
28 | + $this->content=$content; |
|
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | return $this->content; |
34 | 34 | } |
35 | 35 | |
36 | - public function addContent($content, $before = false) { |
|
37 | - if (! \is_array($this->content)) { |
|
36 | + public function addContent($content, $before=false) { |
|
37 | + if (!\is_array($this->content)) { |
|
38 | 38 | if (isset($this->content)) |
39 | - $this->content = array( |
|
39 | + $this->content=array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | 42 | else |
43 | - $this->content = array(); |
|
43 | + $this->content=array(); |
|
44 | 44 | } |
45 | 45 | if ($before) |
46 | 46 | \array_unshift($this->content, $content); |
47 | 47 | else |
48 | - $this->content[] = $content; |
|
48 | + $this->content[]=$content; |
|
49 | 49 | return $this; |
50 | 50 | } |
51 | 51 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | |
69 | 69 | public function setValue($value) {} |
70 | 70 | |
71 | - public function wrapContent($before, $after = "") { |
|
72 | - $this->wrapContentBefore .= $before; |
|
73 | - $this->wrapContentAfter = $after . $this->wrapContentAfter; |
|
71 | + public function wrapContent($before, $after="") { |
|
72 | + $this->wrapContentBefore.=$before; |
|
73 | + $this->wrapContentAfter=$after.$this->wrapContentAfter; |
|
74 | 74 | return $this; |
75 | 75 | } |
76 | 76 | |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | protected function _getContentInstances($class, $content) { |
92 | - $instances = []; |
|
92 | + $instances=[]; |
|
93 | 93 | if ($content instanceof $class) { |
94 | - $instances[] = $content; |
|
94 | + $instances[]=$content; |
|
95 | 95 | } elseif ($content instanceof HtmlDoubleElement) { |
96 | - $instances = \array_merge($instances, $content->getContentInstances($class)); |
|
96 | + $instances=\array_merge($instances, $content->getContentInstances($class)); |
|
97 | 97 | } elseif (\is_array($content)) { |
98 | 98 | foreach ($content as $element) { |
99 | - $instances = \array_merge($instances, $this->_getContentInstances($class, $element)); |
|
99 | + $instances=\array_merge($instances, $this->_getContentInstances($class, $element)); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | return $instances; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return HtmlDoubleElement |
109 | 109 | */ |
110 | - public function asLink($href = NULL, $target = NULL) { |
|
110 | + public function asLink($href=NULL, $target=NULL) { |
|
111 | 111 | if (isset($href)) |
112 | 112 | $this->setProperty("href", $href); |
113 | 113 | if (isset($target)) |
@@ -122,28 +122,28 @@ discard block |
||
122 | 122 | return \strip_tags($this->content); |
123 | 123 | } |
124 | 124 | |
125 | - public function asEditable(HtmlFormField $field, $asForm = false, $setValueProperty = "val()") { |
|
126 | - $idF = $field->getIdentifier(); |
|
127 | - $idE = $idF; |
|
125 | + public function asEditable(HtmlFormField $field, $asForm=false, $setValueProperty="val()") { |
|
126 | + $idF=$field->getIdentifier(); |
|
127 | + $idE=$idF; |
|
128 | 128 | if ($asForm) { |
129 | - $frm = new HtmlForm("frm-" . $field->getIdentifier()); |
|
129 | + $frm=new HtmlForm("frm-".$field->getIdentifier()); |
|
130 | 130 | $frm->setProperty("onsubmit", "return false;"); |
131 | - $fields = $frm->addFields(); |
|
132 | - $idE = $frm->getIdentifier(); |
|
131 | + $fields=$frm->addFields(); |
|
132 | + $idE=$frm->getIdentifier(); |
|
133 | 133 | $fields->addItem($field); |
134 | - $fields->addButtonIcon("bt-okay", "check", "green mini", "\$('#" . $idE . "').trigger('validate',{value: $('#'+idF+' input').val()});"); |
|
135 | - $fields->addButtonIcon("bt-cancel", "close", "mini", "\$('#" . $idE . "').trigger('endEdit');"); |
|
136 | - $this->_editableContent = $frm; |
|
137 | - $keypress = ""; |
|
138 | - $focusOut = ""; |
|
134 | + $fields->addButtonIcon("bt-okay", "check", "green mini", "\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});"); |
|
135 | + $fields->addButtonIcon("bt-cancel", "close", "mini", "\$('#".$idE."').trigger('endEdit');"); |
|
136 | + $this->_editableContent=$frm; |
|
137 | + $keypress=""; |
|
138 | + $focusOut=""; |
|
139 | 139 | } else { |
140 | - $focusOut = "if(e.relatedTarget==null)elm.trigger('endEdit');"; |
|
141 | - $this->_editableContent = $field; |
|
142 | - $keypress = "$('#" . $idF . "').keyup(function(e){if(e.which == 13) {\$('#" . $idE . "').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#" . $idE . "').trigger('endEdit');}});"; |
|
140 | + $focusOut="if(e.relatedTarget==null)elm.trigger('endEdit');"; |
|
141 | + $this->_editableContent=$field; |
|
142 | + $keypress="$('#".$idF."').keyup(function(e){if(e.which == 13) {\$('#".$idE."').trigger('validate',{value: $('#'+idF+' input').val()});}if(e.keyCode===27) {\$('#".$idE."').trigger('endEdit');}});"; |
|
143 | 143 | } |
144 | 144 | $this->_editableContent->setProperty("style", "display:none;"); |
145 | - $this->onCreate("let idF='" . $idF . "';let idE='" . $idE . "';let elm=$('#'+idE);let self=$('#" . $this->getIdentifier() . "');" . $keypress . "elm.on('validate',function(){self.html($('#'+idE+' input')." . $setValueProperty . ");elm.trigger('endEdit');});elm.on('endEdit',function(){self.show();$(this).hide();});elm.focusout(function(e){" . $focusOut . "});"); |
|
146 | - $this->onClick("let self=$(this);self.hide();" . $field->setJsContent("self.html()") . ";$('#" . $idF . " input').trigger('change');elm.show();$('#'+idE+' input').focus();"); |
|
145 | + $this->onCreate("let idF='".$idF."';let idE='".$idE."';let elm=$('#'+idE);let self=$('#".$this->getIdentifier()."');".$keypress."elm.on('validate',function(){self.html($('#'+idE+' input').".$setValueProperty.");elm.trigger('endEdit');});elm.on('endEdit',function(){self.show();$(this).hide();});elm.focusout(function(e){".$focusOut."});"); |
|
146 | + $this->onClick("let self=$(this);self.hide();".$field->setJsContent("self.html()").";$('#".$idF." input').trigger('change');elm.show();$('#'+idE+' input').focus();"); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | * {@inheritdoc} |
152 | 152 | * @see \Ajax\common\html\BaseHtml::compile_once() |
153 | 153 | */ |
154 | - protected function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL) { |
|
155 | - if (! $this->_compiled && isset($this->_editableContent)) { |
|
154 | + protected function compile_once(\Ajax\JsUtils $js=NULL, &$view=NULL) { |
|
155 | + if (!$this->_compiled && isset($this->_editableContent)) { |
|
156 | 156 | $this->wrap("", $this->_editableContent); |
157 | 157 | } |
158 | 158 | parent::compile_once($js, $view); |
@@ -35,17 +35,19 @@ discard block |
||
35 | 35 | |
36 | 36 | public function addContent($content, $before = false) { |
37 | 37 | if (! \is_array($this->content)) { |
38 | - if (isset($this->content)) |
|
39 | - $this->content = array( |
|
38 | + if (isset($this->content)) { |
|
39 | + $this->content = array( |
|
40 | 40 | $this->content |
41 | 41 | ); |
42 | - else |
|
43 | - $this->content = array(); |
|
42 | + } else { |
|
43 | + $this->content = array(); |
|
44 | + } |
|
45 | + } |
|
46 | + if ($before) { |
|
47 | + \array_unshift($this->content, $content); |
|
48 | + } else { |
|
49 | + $this->content[] = $content; |
|
44 | 50 | } |
45 | - if ($before) |
|
46 | - \array_unshift($this->content, $content); |
|
47 | - else |
|
48 | - $this->content[] = $content; |
|
49 | 51 | return $this; |
50 | 52 | } |
51 | 53 | |
@@ -108,10 +110,12 @@ discard block |
||
108 | 110 | * @return HtmlDoubleElement |
109 | 111 | */ |
110 | 112 | public function asLink($href = NULL, $target = NULL) { |
111 | - if (isset($href)) |
|
112 | - $this->setProperty("href", $href); |
|
113 | - if (isset($target)) |
|
114 | - $this->setProperty("target", $target); |
|
113 | + if (isset($href)) { |
|
114 | + $this->setProperty("href", $href); |
|
115 | + } |
|
116 | + if (isset($target)) { |
|
117 | + $this->setProperty("target", $target); |
|
118 | + } |
|
115 | 119 | return $this->setTagName("a"); |
116 | 120 | } |
117 | 121 |