@@ -23,8 +23,9 @@ discard block |
||
23 | 23 | public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
24 | 24 | parent::__construct($identifier, $tagName, "ui label"); |
25 | 25 | $this->content=$caption; |
26 | - if (isset($icon)) |
|
27 | - $this->addIcon($icon); |
|
26 | + if (isset($icon)) { |
|
27 | + $this->addIcon($icon); |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | |
30 | 31 | /** |
@@ -33,10 +34,11 @@ discard block |
||
33 | 34 | * @return HtmlLabel |
34 | 35 | */ |
35 | 36 | public function setPointing($value=Direction::NONE) { |
36 | - if($value==="left" || $value==="right") |
|
37 | - return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
38 | - else |
|
39 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
37 | + if($value==="left" || $value==="right") { |
|
38 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
39 | + } else { |
|
40 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
41 | + } |
|
40 | 42 | } |
41 | 43 | |
42 | 44 | /** |
@@ -134,10 +136,11 @@ discard block |
||
134 | 136 | } |
135 | 137 | |
136 | 138 | public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
137 | - if($direction!==Direction::NONE) |
|
138 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
139 | - else |
|
140 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
139 | + if($direction!==Direction::NONE) { |
|
140 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
141 | + } else { |
|
142 | + return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
143 | + } |
|
141 | 144 | } |
142 | 145 | |
143 | 146 | /** |
@@ -29,15 +29,17 @@ discard block |
||
29 | 29 | |
30 | 30 | public function addContent($content,$before=false) { |
31 | 31 | if (!\is_array($this->content)) { |
32 | - if(isset($this->content)) |
|
33 | - $this->content=array ($this->content); |
|
34 | - else |
|
35 | - $this->content=array(); |
|
32 | + if(isset($this->content)) { |
|
33 | + $this->content=array ($this->content); |
|
34 | + } else { |
|
35 | + $this->content=array(); |
|
36 | + } |
|
37 | + } |
|
38 | + if($before) { |
|
39 | + array_unshift($this->content,$content); |
|
40 | + } else { |
|
41 | + $this->content []=$content; |
|
36 | 42 | } |
37 | - if($before) |
|
38 | - array_unshift($this->content,$content); |
|
39 | - else |
|
40 | - $this->content []=$content; |
|
41 | 43 | return $this; |
42 | 44 | } |
43 | 45 | |
@@ -75,9 +77,9 @@ discard block |
||
75 | 77 | $instances=[]; |
76 | 78 | if($content instanceof $class){ |
77 | 79 | $instances[]=$content; |
78 | - }elseif($content instanceof HtmlDoubleElement){ |
|
80 | + } elseif($content instanceof HtmlDoubleElement){ |
|
79 | 81 | $instances=\array_merge($instances,$content->getContentInstances($class)); |
80 | - }elseif (\is_array($content)){ |
|
82 | + } elseif (\is_array($content)){ |
|
81 | 83 | foreach ($content as $element){ |
82 | 84 | $instances=\array_merge($instances,$this->_getContentInstances($class, $element)); |
83 | 85 | } |
@@ -90,10 +92,12 @@ discard block |
||
90 | 92 | * @return HtmlDoubleElement |
91 | 93 | */ |
92 | 94 | public function asLink($href=NULL,$target=NULL) { |
93 | - if (isset($href)) |
|
94 | - $this->setProperty("href", $href); |
|
95 | - if(isset($target)) |
|
96 | - $this->setProperty("target", $target); |
|
95 | + if (isset($href)) { |
|
96 | + $this->setProperty("href", $href); |
|
97 | + } |
|
98 | + if(isset($target)) { |
|
99 | + $this->setProperty("target", $target); |
|
100 | + } |
|
97 | 101 | return $this->setTagName("a"); |
98 | 102 | } |
99 | 103 | } |
@@ -28,11 +28,12 @@ discard block |
||
28 | 28 | if(\is_array($value)){ |
29 | 29 | $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
30 | 30 | return $itemO; |
31 | - }elseif(\is_object($value)){ |
|
31 | + } elseif(\is_object($value)){ |
|
32 | 32 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
33 | 33 | return $itemO; |
34 | - }else |
|
35 | - return new HtmlFormInput($value); |
|
34 | + } else { |
|
35 | + return new HtmlFormInput($value); |
|
36 | + } |
|
36 | 37 | } |
37 | 38 | |
38 | 39 | protected function createCondition($value){ |
@@ -66,8 +67,7 @@ discard block |
||
66 | 67 | if(isset($c)){ |
67 | 68 | $df=$c->getDataField(); |
68 | 69 | $df->setProperty($property,$value); |
69 | - } |
|
70 | - else{ |
|
70 | + } else{ |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | } |
@@ -25,16 +25,17 @@ |
||
25 | 25 | if(isset($title)){ |
26 | 26 | $this->setTitle($title,$desc); |
27 | 27 | } |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | $this->setContent($content); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function setActive($value=true){ |
34 | - if($value) |
|
35 | - $this->setStatus(StepStatus::ACTIVE); |
|
36 | - else |
|
37 | - $this->setStatus(StepStatus::NONE); |
|
34 | + if($value) { |
|
35 | + $this->setStatus(StepStatus::ACTIVE); |
|
36 | + } else { |
|
37 | + $this->setStatus(StepStatus::NONE); |
|
38 | + } |
|
38 | 39 | return $this; |
39 | 40 | } |
40 | 41 |
@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function getProperty($name) { |
37 | - if (array_key_exists($name, $this->_self->properties)) |
|
38 | - return $this->_self->properties[$name]; |
|
37 | + if (array_key_exists($name, $this->_self->properties)) { |
|
38 | + return $this->_self->properties[$name]; |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | |
41 | 42 | public function addToProperty($name, $value, $separator=" ") { |
@@ -46,10 +47,11 @@ discard block |
||
46 | 47 | } else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) { |
47 | 48 | if(isset($this->_self->properties[$name])){ |
48 | 49 | $v=$this->_self->properties[$name]; |
49 | - if (isset($v) && $v !== "") |
|
50 | - $v=$v . $separator . $value; |
|
51 | - else |
|
52 | - $v=$value; |
|
50 | + if (isset($v) && $v !== "") { |
|
51 | + $v=$v . $separator . $value; |
|
52 | + } else { |
|
53 | + $v=$value; |
|
54 | + } |
|
53 | 55 | |
54 | 56 | return $this->_self->setProperty($name, $v); |
55 | 57 | } |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | } |
74 | 76 | |
75 | 77 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
76 | - if (is_string($typeCtrl) && @class_exists($typeCtrl, true)) |
|
77 | - $typeCtrl=$typeCtrl::getConstants(); |
|
78 | + if (is_string($typeCtrl) && @class_exists($typeCtrl, true)) { |
|
79 | + $typeCtrl=$typeCtrl::getConstants(); |
|
80 | + } |
|
78 | 81 | if (\is_array($typeCtrl)) { |
79 | 82 | $this->_self->removeOldValues($this->_self->properties[$name], $typeCtrl); |
80 | 83 | } |
@@ -93,8 +96,9 @@ discard block |
||
93 | 96 | } |
94 | 97 | |
95 | 98 | public function removeProperty($name) { |
96 | - if (\array_key_exists($name, $this->_self->properties)) |
|
97 | - unset($this->_self->properties[$name]); |
|
99 | + if (\array_key_exists($name, $this->_self->properties)) { |
|
100 | + unset($this->_self->properties[$name]); |
|
101 | + } |
|
98 | 102 | return $this; |
99 | 103 | } |
100 | 104 | |
@@ -107,8 +111,9 @@ discard block |
||
107 | 111 | } |
108 | 112 | |
109 | 113 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
110 | - if ($this->_self->ctrl($name, $value, $typeCtrl) === true) |
|
111 | - return $this->_self->setProperty($name, $value); |
|
114 | + if ($this->_self->ctrl($name, $value, $typeCtrl) === true) { |
|
115 | + return $this->_self->setProperty($name, $value); |
|
116 | + } |
|
112 | 117 | return $this; |
113 | 118 | } |
114 | 119 |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public function removeIcon(){ |
27 | - if(isset($this->content["icon"])) |
|
28 | - unset($this->content["icon"]); |
|
27 | + if(isset($this->content["icon"])) { |
|
28 | + unset($this->content["icon"]); |
|
29 | + } |
|
29 | 30 | return $this; |
30 | 31 | } |
31 | 32 | |
@@ -77,7 +78,7 @@ discard block |
||
77 | 78 | $this->setTagName("div"); |
78 | 79 | $this->removeProperty("href"); |
79 | 80 | $this->addToPropertyCtrl("class", "active", array("active")); |
80 | - }else{ |
|
81 | + } else{ |
|
81 | 82 | $this->removePropertyValue("class", "active"); |
82 | 83 | } |
83 | 84 | return $this; |
@@ -85,8 +86,9 @@ discard block |
||
85 | 86 | |
86 | 87 | public function asLink($href=NULL,$part=NULL){ |
87 | 88 | $this->setTagName("a"); |
88 | - if(isset($href)) |
|
89 | - $this->setProperty("href", $href); |
|
89 | + if(isset($href)) { |
|
90 | + $this->setProperty("href", $href); |
|
91 | + } |
|
90 | 92 | return $this; |
91 | 93 | } |
92 | 94 | |
@@ -97,8 +99,9 @@ discard block |
||
97 | 99 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
98 | 100 | */ |
99 | 101 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
100 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
101 | - $this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]); |
|
102 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
103 | + $this->content=JArray::sortAssociative($this->content, [ "right-content","icon","image","content" ]); |
|
104 | + } |
|
102 | 105 | return parent::compile($js, $view); |
103 | 106 | } |
104 | 107 | } |
@@ -47,8 +47,9 @@ |
||
47 | 47 | if(isset($this->injected)){ |
48 | 48 | $view=$this->injected->getView(); |
49 | 49 | $this->compile($view); |
50 | - if (isset($parameters)) |
|
51 | - $view->setVars($parameters); |
|
50 | + if (isset($parameters)) { |
|
51 | + $view->setVars($parameters); |
|
52 | + } |
|
52 | 53 | return $view->render($viewName, $asString); |
53 | 54 | } |
54 | 55 | throw new \Exception(get_class()." instance is not properly instancied : you omitted the second parameter \$controller!"); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | foreach ($items as $k=>$v){ |
25 | 25 | $this->addItem([$k,$v]); |
26 | 26 | } |
27 | - }else{ |
|
27 | + } else{ |
|
28 | 28 | foreach ($items as $item){ |
29 | 29 | $this->addItem($item); |
30 | 30 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return \Ajax\common\html\HtmlDoubleElement |
81 | 81 | */ |
82 | 82 | public function getItem($index) { |
83 | - if (is_int($index)) |
|
84 | - return $this->content[$index]; |
|
85 | - else { |
|
83 | + if (is_int($index)) { |
|
84 | + return $this->content[$index]; |
|
85 | + } else { |
|
86 | 86 | $elm=$this->getElementById($index, $this->content); |
87 | 87 | return $elm; |
88 | 88 | } |
@@ -144,10 +144,11 @@ discard block |
||
144 | 144 | $i=0; |
145 | 145 | foreach ($properties as $k=>$v){ |
146 | 146 | $c=$this->content[$i++]; |
147 | - if(isset($c)) |
|
148 | - $c->setProperty($k,$v); |
|
149 | - else |
|
150 | - return $this; |
|
147 | + if(isset($c)) { |
|
148 | + $c->setProperty($k,$v); |
|
149 | + } else { |
|
150 | + return $this; |
|
151 | + } |
|
151 | 152 | } |
152 | 153 | return $this; |
153 | 154 | } |
@@ -167,8 +168,7 @@ discard block |
||
167 | 168 | $c=$this->content[$i++]; |
168 | 169 | if(isset($c)){ |
169 | 170 | $c->setProperty($property,$value); |
170 | - } |
|
171 | - else{ |
|
171 | + } else{ |
|
172 | 172 | return $this; |
173 | 173 | } |
174 | 174 | } |
@@ -190,8 +190,7 @@ discard block |
||
190 | 190 | $c=$this->content[$i++]; |
191 | 191 | if(isset($c)){ |
192 | 192 | $c->addToProperty($property,$value); |
193 | - } |
|
194 | - else{ |
|
193 | + } else{ |
|
195 | 194 | return $this; |
196 | 195 | } |
197 | 196 | } |
@@ -220,8 +219,9 @@ discard block |
||
220 | 219 | foreach ( $this->content as $index=>$item ) { |
221 | 220 | if($item instanceof HtmlDoubleElement){ |
222 | 221 | $href=""; |
223 | - if(isset($hrefs[$index])) |
|
224 | - $href=$hrefs[$index]; |
|
222 | + if(isset($hrefs[$index])) { |
|
223 | + $href=$hrefs[$index]; |
|
224 | + } |
|
225 | 225 | $item->asLink($href,$target); |
226 | 226 | } |
227 | 227 | } |