@@ -21,7 +21,7 @@ |
||
21 | 21 | if($class->getProperty($property)!==null){ |
22 | 22 | \call_user_func_array([$object,$name],[$value]); |
23 | 23 | } |
24 | - }catch(\Exception $e){ |
|
24 | + } catch(\Exception $e){ |
|
25 | 25 | //Nothing to do |
26 | 26 | } |
27 | 27 | } |
@@ -13,8 +13,9 @@ |
||
13 | 13 | public function __construct($identifier, $href="#", $content="Link",$target=NULL) { |
14 | 14 | parent::__construct($identifier, "a", ""); |
15 | 15 | $this->setHref($href); |
16 | - if(isset($target)) |
|
17 | - $this->setTarget($target); |
|
16 | + if(isset($target)) { |
|
17 | + $this->setTarget($target); |
|
18 | + } |
|
18 | 19 | $this->content=$content; |
19 | 20 | } |
20 | 21 |
@@ -89,8 +89,9 @@ discard block |
||
89 | 89 | public function asLink($href=NULL,$target=NULL) { |
90 | 90 | if (isset($href)) { |
91 | 91 | $_target=""; |
92 | - if(isset($target)) |
|
93 | - $_target="target='{$target}'"; |
|
92 | + if(isset($target)) { |
|
93 | + $_target="target='{$target}'"; |
|
94 | + } |
|
94 | 95 | $this->wrap("<a href='" . $href . "' {$_target}>", "</a>"); |
95 | 96 | } |
96 | 97 | return $this->addToProperty("class", "link"); |
@@ -107,8 +108,9 @@ discard block |
||
107 | 108 | */ |
108 | 109 | public function setBordered($inverted=false) { |
109 | 110 | $invertedStr=""; |
110 | - if ($inverted !== false) |
|
111 | - $invertedStr=" inverted"; |
|
111 | + if ($inverted !== false) { |
|
112 | + $invertedStr=" inverted"; |
|
113 | + } |
|
112 | 114 | return $this->addToProperty("class", "bordered" . $invertedStr); |
113 | 115 | } |
114 | 116 | |
@@ -121,12 +123,14 @@ discard block |
||
121 | 123 | } |
122 | 124 | |
123 | 125 | public function addLabel($label, $before=false, $icon=NULL) { |
124 | - if($before) |
|
125 | - $this->wrap($label); |
|
126 | - else |
|
127 | - $this->wrap("", $label); |
|
128 | - if(isset($icon)) |
|
129 | - $this->addToIcon($icon); |
|
126 | + if($before) { |
|
127 | + $this->wrap($label); |
|
128 | + } else { |
|
129 | + $this->wrap("", $label); |
|
130 | + } |
|
131 | + if(isset($icon)) { |
|
132 | + $this->addToIcon($icon); |
|
133 | + } |
|
130 | 134 | return $this; |
131 | 135 | } |
132 | 136 |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | * @param string $popupEvent |
41 | 41 | */ |
42 | 42 | public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
43 | - if (isset($this->_popup)) |
|
44 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
43 | + if (isset($this->_popup)) { |
|
44 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | /** |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | $labelO=$label; |
97 | 98 | if (\is_object($label) === false) { |
98 | 99 | $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
99 | - if (isset($icon)) |
|
100 | - $labelO->addIcon($icon); |
|
100 | + if (isset($icon)) { |
|
101 | + $labelO->addIcon($icon); |
|
102 | + } |
|
101 | 103 | } else { |
102 | 104 | $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
103 | 105 | } |
@@ -124,10 +126,12 @@ discard block |
||
124 | 126 | * @return HtmlSemDoubleElement |
125 | 127 | */ |
126 | 128 | public function asLink($href=NULL,$target=NULL) { |
127 | - if (isset($href)) |
|
128 | - $this->setProperty("href", $href); |
|
129 | - if(isset($target)) |
|
130 | - $this->setProperty("target", $target); |
|
129 | + if (isset($href)) { |
|
130 | + $this->setProperty("href", $href); |
|
131 | + } |
|
132 | + if(isset($target)) { |
|
133 | + $this->setProperty("target", $target); |
|
134 | + } |
|
131 | 135 | return $this->setTagName("a"); |
132 | 136 | } |
133 | 137 | |
@@ -138,8 +142,9 @@ discard block |
||
138 | 142 | */ |
139 | 143 | public function jsShowDimmer($show=true) { |
140 | 144 | $status="hide"; |
141 | - if ($show === true) |
|
142 | - $status="show"; |
|
145 | + if ($show === true) { |
|
146 | + $status="show"; |
|
147 | + } |
|
143 | 148 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
144 | 149 | } |
145 | 150 | |
@@ -148,8 +153,9 @@ discard block |
||
148 | 153 | * @see BaseHtml::compile() |
149 | 154 | */ |
150 | 155 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
151 | - if (isset($this->_popup)) |
|
152 | - $this->_popup->compile($js); |
|
156 | + if (isset($this->_popup)) { |
|
157 | + $this->_popup->compile($js); |
|
158 | + } |
|
153 | 159 | return parent::compile($js, $view); |
154 | 160 | } |
155 | 161 |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | //echo $itemSelector.":::".$jsCode."<br>"; |
29 | 29 | if($event=="execute"){ |
30 | 30 | $this->jquery_code_for_compile []=$jsCode; |
31 | - }else if($event=="beforeExecute"){ |
|
31 | + } else if($event=="beforeExecute"){ |
|
32 | 32 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
33 | - }else{ |
|
33 | + } else{ |
|
34 | 34 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
35 | 35 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
36 | 36 | } |
@@ -38,10 +38,12 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | protected function _createSelector($itemSelector,$selector){ |
41 | - if(!isset($itemSelector)) |
|
42 | - $itemSelector=$this->itemSelector; |
|
43 | - if(isset($itemSelector) && $itemSelector!=="") |
|
44 | - $selector.=" ".$itemSelector; |
|
41 | + if(!isset($itemSelector)) { |
|
42 | + $itemSelector=$this->itemSelector; |
|
43 | + } |
|
44 | + if(isset($itemSelector) && $itemSelector!=="") { |
|
45 | + $selector.=" ".$itemSelector; |
|
46 | + } |
|
45 | 47 | return $selector; |
46 | 48 | } |
47 | 49 | |
@@ -84,8 +86,9 @@ discard block |
||
84 | 86 | |
85 | 87 | protected function setParamCtrl($key, $value, $typeCtrl) { |
86 | 88 | if (\is_array($typeCtrl)) { |
87 | - if (array_search($value, $typeCtrl)===false) |
|
88 | - throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
89 | + if (array_search($value, $typeCtrl)===false) { |
|
90 | + throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
91 | + } |
|
89 | 92 | } else { |
90 | 93 | if (!$typeCtrl($value)) { |
91 | 94 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | public function __construct($identifier,$context=NULL,$content=NULL) { |
11 | 11 | parent::__construct($identifier, "div", "ui sticky", $content); |
12 | - if(isset($content)) |
|
13 | - $this->setContext($context); |
|
12 | + if(isset($content)) { |
|
13 | + $this->setContext($context); |
|
14 | + } |
|
14 | 15 | } |
15 | 16 | |
16 | 17 | public function setContext($context){ |
@@ -20,15 +21,17 @@ discard block |
||
20 | 21 | |
21 | 22 | public function setFixed($value=NULL){ |
22 | 23 | $fixed="fixed"; |
23 | - if(isset($value)) |
|
24 | - $fixed.=" ".$value; |
|
24 | + if(isset($value)) { |
|
25 | + $fixed.=" ".$value; |
|
26 | + } |
|
25 | 27 | return $this->addToProperty("class",$fixed); |
26 | 28 | } |
27 | 29 | |
28 | 30 | public function setBound($value=NULL){ |
29 | 31 | $bound="bound"; |
30 | - if(isset($value)) |
|
31 | - $bound.=" ".$value; |
|
32 | + if(isset($value)) { |
|
33 | + $bound.=" ".$value; |
|
34 | + } |
|
32 | 35 | return $this->addToProperty("class",$bound); |
33 | 36 | } |
34 | 37 | |
@@ -50,8 +53,9 @@ discard block |
||
50 | 53 | |
51 | 54 | public function setDebug($verbose=NULL){ |
52 | 55 | $this->_params["debug"]=true; |
53 | - if(isset($verbose)) |
|
54 | - $this->_params["verbose"]=true; |
|
56 | + if(isset($verbose)) { |
|
57 | + $this->_params["verbose"]=true; |
|
58 | + } |
|
55 | 59 | return $this; |
56 | 60 | } |
57 | 61 | } |
58 | 62 | \ No newline at end of file |
@@ -15,14 +15,15 @@ discard block |
||
15 | 15 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
16 | 16 | $field->setProperty("name", $name); |
17 | 17 | $this->setField($field); |
18 | - if (isset($label)) |
|
19 | - $this->setLabel($label); |
|
18 | + if (isset($label)) { |
|
19 | + $this->setLabel($label); |
|
20 | + } |
|
20 | 21 | } |
21 | 22 | |
22 | 23 | public function setChecked($value=true){ |
23 | 24 | if($value===true){ |
24 | 25 | $this->getField()->setProperty("checked", "checked"); |
25 | - }else{ |
|
26 | + } else{ |
|
26 | 27 | $this->getField()->removeProperty("checked"); |
27 | 28 | } |
28 | 29 | return $this; |
@@ -51,8 +52,9 @@ discard block |
||
51 | 52 | * @return mixed |
52 | 53 | */ |
53 | 54 | public function getLabel() { |
54 | - if (\array_key_exists("label", $this->content)) |
|
55 | - return $this->content["label"]; |
|
55 | + if (\array_key_exists("label", $this->content)) { |
|
56 | + return $this->content["label"]; |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | /** |
@@ -127,8 +129,9 @@ discard block |
||
127 | 129 | } |
128 | 130 | |
129 | 131 | public function run(JsUtils $js) { |
130 | - if(!isset($this->_bsComponent)) |
|
131 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
132 | + if(!isset($this->_bsComponent)) { |
|
133 | + $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
134 | + } |
|
132 | 135 | return parent::run($js); |
133 | 136 | } |
134 | 137 | } |
135 | 138 | \ No newline at end of file |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | private function afterInsert($item) { |
63 | - if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
|
64 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
65 | - else { |
|
63 | + if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) { |
|
64 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
65 | + } else { |
|
66 | 66 | $this->setSecondary(); |
67 | 67 | } |
68 | 68 | return $item; |
@@ -77,8 +77,9 @@ discard block |
||
77 | 77 | public function addItem($item) { |
78 | 78 | $number=$item; |
79 | 79 | $item=parent::addItem($this->getItemToInsert($item)); |
80 | - if(\is_int($number)) |
|
81 | - $item->setProperty("data-page", $number); |
|
80 | + if(\is_int($number)) { |
|
81 | + $item->setProperty("data-page", $number); |
|
82 | + } |
|
82 | 83 | return $this->afterInsert($item); |
83 | 84 | } |
84 | 85 | |
@@ -151,10 +152,11 @@ discard block |
||
151 | 152 | } |
152 | 153 | |
153 | 154 | public function setSecondary($value=true) { |
154 | - if($value) |
|
155 | - $this->addToProperty("class", "secondary"); |
|
156 | - else |
|
157 | - $this->removePropertyValue("class", "secondary"); |
|
155 | + if($value) { |
|
156 | + $this->addToProperty("class", "secondary"); |
|
157 | + } else { |
|
158 | + $this->removePropertyValue("class", "secondary"); |
|
159 | + } |
|
158 | 160 | return $this; |
159 | 161 | } |
160 | 162 | |
@@ -174,8 +176,9 @@ discard block |
||
174 | 176 | $this->apply(function (HtmlDoubleElement &$item) { |
175 | 177 | $item->setTagName("a"); |
176 | 178 | }); |
177 | - if ($vertical === true) |
|
178 | - $this->setVertical(); |
|
179 | + if ($vertical === true) { |
|
180 | + $this->setVertical(); |
|
181 | + } |
|
179 | 182 | return $this->addToProperty("class", "tabular"); |
180 | 183 | } |
181 | 184 | |
@@ -204,10 +207,11 @@ discard block |
||
204 | 207 | */ |
205 | 208 | public function fromDatabaseObject($object, $function) { |
206 | 209 | $return=$function($object); |
207 | - if (\is_array($return)) |
|
208 | - $this->addItems($return); |
|
209 | - else |
|
210 | - $this->addItem($return); |
|
210 | + if (\is_array($return)) { |
|
211 | + $this->addItems($return); |
|
212 | + } else { |
|
213 | + $this->addItem($return); |
|
214 | + } |
|
211 | 215 | } |
212 | 216 | |
213 | 217 | /** |
@@ -240,8 +244,9 @@ discard block |
||
240 | 244 | } |
241 | 245 | |
242 | 246 | public function run(JsUtils $js){ |
243 | - if($this->identifier!=="" && !isset($this->_bsComponent)) |
|
244 | - $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false); |
|
247 | + if($this->identifier!=="" && !isset($this->_bsComponent)) { |
|
248 | + $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false); |
|
249 | + } |
|
245 | 250 | $result= parent::run($js); |
246 | 251 | return $result->setItemSelector(".item"); |
247 | 252 | } |
@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | $this->widgetIdentifier=$identifier; |
24 | 24 | $this->values=[]; |
25 | 25 | $this->afterCompile=[]; |
26 | - if(isset($instance)) |
|
27 | - $this->setInstance($instance); |
|
26 | + if(isset($instance)) { |
|
27 | + $this->setInstance($instance); |
|
28 | + } |
|
28 | 29 | $this->setCaptions($captions); |
29 | 30 | $this->captionCallback=NULL; |
30 | 31 | $this->defaultValueFunction=function($name,$value){return $value;}; |
@@ -62,14 +63,16 @@ discard block |
||
62 | 63 | } |
63 | 64 | |
64 | 65 | public function getIdentifier($index=NULL){ |
65 | - if(!isset($index)) |
|
66 | - $index=self::$index; |
|
66 | + if(!isset($index)) { |
|
67 | + $index=self::$index; |
|
68 | + } |
|
67 | 69 | $value=$index; |
68 | 70 | if(isset($this->values["identifier"])){ |
69 | - if(\is_string($this->values["identifier"])) |
|
70 | - $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
71 | - else |
|
72 | - $value=$this->values["identifier"]($index,$this->instance); |
|
71 | + if(\is_string($this->values["identifier"])) { |
|
72 | + $value=JReflection::callMethod($this->instance, $this->values["identifier"], []); |
|
73 | + } else { |
|
74 | + $value=$this->values["identifier"]($index,$this->instance); |
|
75 | + } |
|
73 | 76 | } |
74 | 77 | return $value; |
75 | 78 | } |
@@ -99,16 +102,16 @@ discard block |
||
99 | 102 | if($property instanceof \ReflectionProperty){ |
100 | 103 | $value=$this->_getPropertyValue($property, $index); |
101 | 104 | $propertyName=$property->getName(); |
102 | - }elseif(\is_callable($property)) |
|
103 | - $value=$property($this->instance); |
|
104 | - elseif(\is_array($property)){ |
|
105 | + } elseif(\is_callable($property)) { |
|
106 | + $value=$property($this->instance); |
|
107 | + } elseif(\is_array($property)){ |
|
105 | 108 | $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
106 | 109 | $value=\implode("", $values); |
107 | - }elseif(\is_string($property)){ |
|
110 | + } elseif(\is_string($property)){ |
|
108 | 111 | $value=$property; |
109 | 112 | if(isset($this->instance->{$property})){ |
110 | 113 | $value=$this->instance->{$property}; |
111 | - }elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
114 | + } elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){ |
|
112 | 115 | $value=JReflection::callMethod($this->instance, $getter, []); |
113 | 116 | } |
114 | 117 | } |
@@ -118,7 +121,7 @@ discard block |
||
118 | 121 | protected function _postGetValue($index,$propertyName,$value){ |
119 | 122 | if(isset($this->values[$index])){ |
120 | 123 | $value= $this->values[$index]($value,$this->instance,$index); |
121 | - }else{ |
|
124 | + } else{ |
|
122 | 125 | $value=$this->_getDefaultValue($propertyName,$value, $index); |
123 | 126 | } |
124 | 127 | if(isset($this->afterCompile[$index])){ |
@@ -139,10 +142,10 @@ discard block |
||
139 | 142 | if(isset($vb[$index])){ |
140 | 143 | if(\is_array($vb[$index])){ |
141 | 144 | $this->visibleProperties[$index][]=$field; |
142 | - }else{ |
|
145 | + } else{ |
|
143 | 146 | $this->visibleProperties[$index]=[$vb[$index],$field]; |
144 | 147 | } |
145 | - }else{ |
|
148 | + } else{ |
|
146 | 149 | return $this->insertField($index, $field); |
147 | 150 | } |
148 | 151 | return $this; |
@@ -169,9 +172,9 @@ discard block |
||
169 | 172 | $property=$this->getProperty($index); |
170 | 173 | if($property instanceof \ReflectionProperty){ |
171 | 174 | $result=$property->getName(); |
172 | - }elseif(\is_callable($property)){ |
|
175 | + } elseif(\is_callable($property)){ |
|
173 | 176 | $result=$this->visibleProperties[$index]; |
174 | - }else{ |
|
177 | + } else{ |
|
175 | 178 | $result=$property; |
176 | 179 | } |
177 | 180 | return $result; |
@@ -191,7 +194,7 @@ discard block |
||
191 | 194 | $this->reflect=new \ReflectionClass($instance); |
192 | 195 | if(\sizeof($this->visibleProperties)===0){ |
193 | 196 | $this->properties=$this->getDefaultProperties(); |
194 | - }else{ |
|
197 | + } else{ |
|
195 | 198 | foreach ($this->visibleProperties as $property){ |
196 | 199 | $this->setInstanceProperty($property); |
197 | 200 | } |
@@ -202,22 +205,23 @@ discard block |
||
202 | 205 | private function setInstanceProperty($property){ |
203 | 206 | if(\is_callable($property)){ |
204 | 207 | $this->properties[]=$property; |
205 | - }elseif(\is_string($property)){ |
|
208 | + } elseif(\is_string($property)){ |
|
206 | 209 | try{ |
207 | 210 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
208 | 211 | $rProperty=$this->reflect->getProperty($property); |
209 | 212 | $this->properties[]=$rProperty; |
210 | - }catch(\Exception $e){ |
|
213 | + } catch(\Exception $e){ |
|
211 | 214 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
212 | 215 | $this->properties[]=$property; |
213 | 216 | } |
214 | - }elseif(\is_int($property)){ |
|
217 | + } elseif(\is_int($property)){ |
|
215 | 218 | $props=$this->getDefaultProperties(); |
216 | - if(isset($props[$property])) |
|
217 | - $this->properties[]=$props[$property]; |
|
218 | - else |
|
219 | - $this->properties[]=$property; |
|
220 | - }else{ |
|
219 | + if(isset($props[$property])) { |
|
220 | + $this->properties[]=$props[$property]; |
|
221 | + } else { |
|
222 | + $this->properties[]=$property; |
|
223 | + } |
|
224 | + } else{ |
|
221 | 225 | $this->properties[]=$property; |
222 | 226 | } |
223 | 227 | } |
@@ -261,12 +265,13 @@ discard block |
||
261 | 265 | if(isset($this->captions[$index])){ |
262 | 266 | return $this->captions[$index]; |
263 | 267 | } |
264 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
265 | - return $this->properties[$index]->getName(); |
|
266 | - elseif(\is_callable($this->properties[$index])) |
|
267 | - return ""; |
|
268 | - else |
|
269 | - return $this->properties[$index]; |
|
268 | + if($this->properties[$index] instanceof \ReflectionProperty) { |
|
269 | + return $this->properties[$index]->getName(); |
|
270 | + } elseif(\is_callable($this->properties[$index])) { |
|
271 | + return ""; |
|
272 | + } else { |
|
273 | + return $this->properties[$index]; |
|
274 | + } |
|
270 | 275 | } |
271 | 276 | |
272 | 277 | public function getCaptions(){ |
@@ -275,7 +280,7 @@ discard block |
||
275 | 280 | for($i=\sizeof($captions);$i<$this->count();$i++){ |
276 | 281 | $captions[]=""; |
277 | 282 | } |
278 | - }else{ |
|
283 | + } else{ |
|
279 | 284 | $captions=[]; |
280 | 285 | $index=0; |
281 | 286 | $count=$this->count(); |
@@ -291,8 +296,9 @@ discard block |
||
291 | 296 | } |
292 | 297 | |
293 | 298 | public function setCaption($index,$caption){ |
294 | - if(isset($this->captions)===false) |
|
295 | - $this->captions=[]; |
|
299 | + if(isset($this->captions)===false) { |
|
300 | + $this->captions=[]; |
|
301 | + } |
|
296 | 302 | $this->captions[$index]=$caption; |
297 | 303 | return $this; |
298 | 304 | } |