@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | foreach ($items as $k=>$v){ |
| 23 | 23 | $this->addItem([$k,$v]); |
| 24 | 24 | } |
| 25 | - }else{ |
|
| 25 | + } else{ |
|
| 26 | 26 | foreach ($items as $item){ |
| 27 | 27 | $this->addItem($item); |
| 28 | 28 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | * @return \Ajax\common\html\HtmlDoubleElement |
| 71 | 71 | */ |
| 72 | 72 | public function getItem($index) { |
| 73 | - if (is_int($index)) |
|
| 74 | - return $this->content[$index]; |
|
| 75 | - else { |
|
| 73 | + if (is_int($index)) { |
|
| 74 | + return $this->content[$index]; |
|
| 75 | + } else { |
|
| 76 | 76 | $elm=$this->getElementById($index, $this->content); |
| 77 | 77 | return $elm; |
| 78 | 78 | } |
@@ -134,10 +134,11 @@ discard block |
||
| 134 | 134 | $i=0; |
| 135 | 135 | foreach ($properties as $k=>$v){ |
| 136 | 136 | $c=$this->content[$i++]; |
| 137 | - if(isset($c)) |
|
| 138 | - $c->setProperty($k,$v); |
|
| 139 | - else |
|
| 140 | - return $this; |
|
| 137 | + if(isset($c)) { |
|
| 138 | + $c->setProperty($k,$v); |
|
| 139 | + } else { |
|
| 140 | + return $this; |
|
| 141 | + } |
|
| 141 | 142 | } |
| 142 | 143 | return $this; |
| 143 | 144 | } |
@@ -151,8 +152,7 @@ discard block |
||
| 151 | 152 | $c=$this->content[$i++]; |
| 152 | 153 | if(isset($c)){ |
| 153 | 154 | $c->setProperty($property,$value); |
| 154 | - } |
|
| 155 | - else{ |
|
| 155 | + } else{ |
|
| 156 | 156 | return $this; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -12,18 +12,21 @@ |
||
| 12 | 12 | $this->setProperty("name", $identifier); |
| 13 | 13 | $this->setValue($value); |
| 14 | 14 | $this->setPlaceholder($placeholder); |
| 15 | - if(isset($rows)) |
|
| 16 | - $this->setRows($rows); |
|
| 15 | + if(isset($rows)) { |
|
| 16 | + $this->setRows($rows); |
|
| 17 | + } |
|
| 17 | 18 | } |
| 18 | 19 | public function setValue($value) { |
| 19 | - if(isset($value)) |
|
| 20 | - $this->setContent($value); |
|
| 20 | + if(isset($value)) { |
|
| 21 | + $this->setContent($value); |
|
| 22 | + } |
|
| 21 | 23 | return $this; |
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | public function setPlaceholder($value){ |
| 25 | - if(JString::isNotNull($value)) |
|
| 26 | - $this->setProperty("placeholder", $value); |
|
| 27 | + if(JString::isNotNull($value)) { |
|
| 28 | + $this->setProperty("placeholder", $value); |
|
| 29 | + } |
|
| 27 | 30 | return $this; |
| 28 | 31 | } |
| 29 | 32 | |
@@ -46,8 +46,9 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
| 48 | 48 | $retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$jsCallback)."});\n"; |
| 49 | - if ($immediatly) |
|
| 50 | - $this->jquery_code_for_compile[]=$retour; |
|
| 49 | + if ($immediatly) { |
|
| 50 | + $this->jquery_code_for_compile[]=$retour; |
|
| 51 | + } |
|
| 51 | 52 | return $retour; |
| 52 | 53 | } |
| 53 | 54 | |
@@ -55,15 +56,17 @@ discard block |
||
| 55 | 56 | $url=$this->_correctAjaxUrl($url); |
| 56 | 57 | $retour="url='".$url."';\n"; |
| 57 | 58 | $slash="/"; |
| 58 | - if(JString::endswith($url, "/")===true) |
|
| 59 | - $slash=""; |
|
| 59 | + if(JString::endswith($url, "/")===true) { |
|
| 60 | + $slash=""; |
|
| 61 | + } |
|
| 60 | 62 | if(JString::isNotNull($attr)){ |
| 61 | - if ($attr==="value") |
|
| 62 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 63 | - elseif ($attr==="html") |
|
| 64 | - $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
| 65 | - elseif($attr!=null && $attr!=="") |
|
| 66 | - $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 63 | + if ($attr==="value") { |
|
| 64 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
| 65 | + } elseif ($attr==="html") { |
|
| 66 | + $retour.="url=url+'".$slash."'+$(this).html();\n"; |
|
| 67 | + } elseif($attr!=null && $attr!=="") { |
|
| 68 | + $retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n"; |
|
| 69 | + } |
|
| 67 | 70 | } |
| 68 | 71 | return $retour; |
| 69 | 72 | } |
@@ -85,8 +88,9 @@ discard block |
||
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | protected function _correctAjaxUrl($url) { |
| 88 | - if ($url!=="/" && JString::endsWith($url, "/")===true) |
|
| 89 | - $url=substr($url, 0, strlen($url)-1); |
|
| 91 | + if ($url!=="/" && JString::endsWith($url, "/")===true) { |
|
| 92 | + $url=substr($url, 0, strlen($url)-1); |
|
| 93 | + } |
|
| 90 | 94 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
| 91 | 95 | $url=$this->jsUtils->getUrl($url); |
| 92 | 96 | } |
@@ -110,8 +114,9 @@ discard block |
||
| 110 | 114 | $retour.="\t".$jsCallback."\n". |
| 111 | 115 | "\t$(document).trigger('jsonReady',[data]);\n". |
| 112 | 116 | "});\n"; |
| 113 | - if ($immediatly) |
|
| 114 | - $this->jquery_code_for_compile[]=$retour; |
|
| 117 | + if ($immediatly) { |
|
| 118 | + $this->jquery_code_for_compile[]=$retour; |
|
| 119 | + } |
|
| 115 | 120 | return $retour; |
| 116 | 121 | } |
| 117 | 122 | |
@@ -150,7 +155,7 @@ discard block |
||
| 150 | 155 | if($context===null){ |
| 151 | 156 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 152 | 157 | $newElm = "$('#'+newId)"; |
| 153 | - }else{ |
|
| 158 | + } else{ |
|
| 154 | 159 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 155 | 160 | $newElm = $context.".find('#'+newId)"; |
| 156 | 161 | } |
@@ -160,8 +165,9 @@ discard block |
||
| 160 | 165 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
| 161 | 166 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
| 162 | 167 | $retour.="\t".$jsCallback."\n"."});\n"; |
| 163 | - if ($immediatly) |
|
| 164 | - $this->jquery_code_for_compile[]=$retour; |
|
| 168 | + if ($immediatly) { |
|
| 169 | + $this->jquery_code_for_compile[]=$retour; |
|
| 170 | + } |
|
| 165 | 171 | return $retour; |
| 166 | 172 | } |
| 167 | 173 | /** |
@@ -202,8 +208,9 @@ discard block |
||
| 202 | 208 | }});\n"; |
| 203 | 209 | $retour.="$('#".$form."').submit();\n"; |
| 204 | 210 | } |
| 205 | - if ($immediatly) |
|
| 206 | - $this->jquery_code_for_compile[]=$retour; |
|
| 211 | + if ($immediatly) { |
|
| 212 | + $this->jquery_code_for_compile[]=$retour; |
|
| 213 | + } |
|
| 207 | 214 | return $retour; |
| 208 | 215 | } |
| 209 | 216 | |
@@ -33,8 +33,9 @@ |
||
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | public function addSeparatorAfter($fieldNum){ |
| 36 | - if(\array_search($fieldNum, $this->separators)===false) |
|
| 37 | - $this->separators[]=$fieldNum; |
|
| 36 | + if(\array_search($fieldNum, $this->separators)===false) { |
|
| 37 | + $this->separators[]=$fieldNum; |
|
| 38 | + } |
|
| 38 | 39 | return $this; |
| 39 | 40 | } |
| 40 | 41 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else{ |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function asLink($href=NULL,$part=NULL){ |
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 69 | - $this->setProperty("href", $href); |
|
| 68 | + if(isset($href)) { |
|
| 69 | + $this->setProperty("href", $href); |
|
| 70 | + } |
|
| 70 | 71 | return $this; |
| 71 | 72 | } |
| 72 | 73 | |
@@ -77,8 +78,9 @@ discard block |
||
| 77 | 78 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 79 | */ |
| 79 | 80 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content) && JArray::isAssociative($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 81 | + if(\is_array($this->content) && JArray::isAssociative($this->content)) { |
|
| 82 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 83 | + } |
|
| 82 | 84 | return parent::compile($js, $view); |
| 83 | 85 | } |
| 84 | 86 | } |
| 85 | 87 | \ No newline at end of file |
@@ -32,8 +32,9 @@ discard block |
||
| 32 | 32 | // } |
| 33 | 33 | $this->setWide($numCols); |
| 34 | 34 | } |
| 35 | - if($createCols) |
|
| 36 | - $this->setRowsCount($numRows, $numCols); |
|
| 35 | + if($createCols) { |
|
| 36 | + $this->setRowsCount($numRows, $numCols); |
|
| 37 | + } |
|
| 37 | 38 | } |
| 38 | 39 | |
| 39 | 40 | public function asSegment() { |
@@ -85,8 +86,9 @@ discard block |
||
| 85 | 86 | public function addCol($width=NULL) { |
| 86 | 87 | $colCount=$this->colCount() + 1; |
| 87 | 88 | $this->setColsCount($colCount, true, $width); |
| 88 | - if ($this->hasOnlyCols($this->count())) |
|
| 89 | - return $this->content[$colCount - 1]; |
|
| 89 | + if ($this->hasOnlyCols($this->count())) { |
|
| 90 | + return $this->content[$colCount - 1]; |
|
| 91 | + } |
|
| 90 | 92 | return $this; |
| 91 | 93 | } |
| 92 | 94 | |
@@ -174,8 +176,9 @@ discard block |
||
| 174 | 176 | */ |
| 175 | 177 | public function rowCount() { |
| 176 | 178 | $count=$this->count(); |
| 177 | - if ($this->hasOnlyCols($count)) |
|
| 178 | - return 0; |
|
| 179 | + if ($this->hasOnlyCols($count)) { |
|
| 180 | + return 0; |
|
| 181 | + } |
|
| 179 | 182 | return $count; |
| 180 | 183 | } |
| 181 | 184 | |
@@ -185,10 +188,12 @@ discard block |
||
| 185 | 188 | */ |
| 186 | 189 | public function colCount() { |
| 187 | 190 | $count=$this->count(); |
| 188 | - if ($this->hasOnlyCols($count)) |
|
| 189 | - return $count; |
|
| 190 | - if ($count > 0) |
|
| 191 | - return $this->getItem(0)->count(); |
|
| 191 | + if ($this->hasOnlyCols($count)) { |
|
| 192 | + return $count; |
|
| 193 | + } |
|
| 194 | + if ($count > 0) { |
|
| 195 | + return $this->getItem(0)->count(); |
|
| 196 | + } |
|
| 192 | 197 | return 0; |
| 193 | 198 | } |
| 194 | 199 | |
@@ -199,8 +204,9 @@ discard block |
||
| 199 | 204 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 200 | 205 | */ |
| 201 | 206 | public function getCell($row, $col) { |
| 202 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 203 | - return $this->getItem($col); |
|
| 207 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
| 208 | + return $this->getItem($col); |
|
| 209 | + } |
|
| 204 | 210 | $row=$this->getItem($row); |
| 205 | 211 | if (isset($row)) { |
| 206 | 212 | $col=$row->getItem($col); |
@@ -249,8 +255,9 @@ discard block |
||
| 249 | 255 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 250 | 256 | */ |
| 251 | 257 | public function setPadded($value=NULL) { |
| 252 | - if (isset($value)) |
|
| 253 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 258 | + if (isset($value)) { |
|
| 259 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 260 | + } |
|
| 254 | 261 | return $this->addToProperty("class", "padded"); |
| 255 | 262 | } |
| 256 | 263 | |
@@ -275,8 +282,9 @@ discard block |
||
| 275 | 282 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 276 | 283 | */ |
| 277 | 284 | protected function createItem($value) { |
| 278 | - if ($this->_createCols === false) |
|
| 279 | - $value=null; |
|
| 285 | + if ($this->_createCols === false) { |
|
| 286 | + $value=null; |
|
| 287 | + } |
|
| 280 | 288 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
| 281 | 289 | return $item; |
| 282 | 290 | } |
@@ -55,14 +55,14 @@ |
||
| 55 | 55 | foreach ($values as $v){ |
| 56 | 56 | $form->addField($v); |
| 57 | 57 | } |
| 58 | - }else{ |
|
| 58 | + } else{ |
|
| 59 | 59 | $separators[]=$count; |
| 60 | 60 | for($i=0;$i<$size;$i++){ |
| 61 | 61 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
| 62 | 62 | //TODO check why $fields is empty |
| 63 | 63 | if(\sizeof($fields)===1){ |
| 64 | 64 | $form->addField($fields[0]); |
| 65 | - }elseif(\sizeof($fields)>1){ |
|
| 65 | + } elseif(\sizeof($fields)>1){ |
|
| 66 | 66 | $form->addFields($fields); |
| 67 | 67 | $i+=\sizeof($fields)-1; |
| 68 | 68 | } |
@@ -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 | } |
@@ -17,8 +17,9 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function setValue($value) { |
| 20 | - if(isset($value)) |
|
| 21 | - $this->setProperty("value", $value); |
|
| 20 | + if(isset($value)) { |
|
| 21 | + $this->setProperty("value", $value); |
|
| 22 | + } |
|
| 22 | 23 | return $this; |
| 23 | 24 | } |
| 24 | 25 | |
@@ -27,16 +28,18 @@ discard block |
||
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | public function setPlaceholder($value){ |
| 30 | - if(JString::isNotNull($value)) |
|
| 31 | - $this->_placeholder=$value; |
|
| 31 | + if(JString::isNotNull($value)) { |
|
| 32 | + $this->_placeholder=$value; |
|
| 33 | + } |
|
| 32 | 34 | return $this; |
| 33 | 35 | } |
| 34 | 36 | |
| 35 | 37 | public function compile(JsUtils $js=NULL,&$view=NULL){ |
| 36 | 38 | $value=$this->_placeholder; |
| 37 | 39 | if(JString::isNull($value)){ |
| 38 | - if(JString::isNotNull($this->getProperty("name"))) |
|
| 39 | - $value=\ucfirst($this->getProperty("name")); |
|
| 40 | + if(JString::isNotNull($this->getProperty("name"))) { |
|
| 41 | + $value=\ucfirst($this->getProperty("name")); |
|
| 42 | + } |
|
| 40 | 43 | } |
| 41 | 44 | $this->setProperty("placeholder", $value); |
| 42 | 45 | return parent::compile($js,$view); |