@@ -17,12 +17,15 @@ discard block |
||
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 21 | - $this->setData($value); |
|
| 22 | - if($image!==NULL) |
|
| 23 | - $this->asMiniAvatar($image); |
|
| 24 | - if($description!==NULL) |
|
| 25 | - $this->setDescription($description); |
|
| 20 | + if($value!==NULL) { |
|
| 21 | + $this->setData($value); |
|
| 22 | + } |
|
| 23 | + if($image!==NULL) { |
|
| 24 | + $this->asMiniAvatar($image); |
|
| 25 | + } |
|
| 26 | + if($description!==NULL) { |
|
| 27 | + $this->setDescription($description); |
|
| 28 | + } |
|
| 26 | 29 | } |
| 27 | 30 | |
| 28 | 31 | public function setDescription($description){ |
@@ -39,8 +42,9 @@ discard block |
||
| 39 | 42 | |
| 40 | 43 | public function asOption(){ |
| 41 | 44 | $this->tagName="option"; |
| 42 | - if($this->getProperty("data-value")!==null) |
|
| 43 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
| 45 | + if($this->getProperty("data-value")!==null) { |
|
| 46 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
| 47 | + } |
|
| 44 | 48 | } |
| 45 | 49 | |
| 46 | 50 | /** |
@@ -47,8 +47,9 @@ |
||
| 47 | 47 | if($item instanceof HtmlSemDoubleElement){ |
| 48 | 48 | $comp=$item->compile($js); |
| 49 | 49 | $bs=$item->run($js); |
| 50 | - if(isset($bs)) |
|
| 51 | - $this->params['onShow']=$bs->getScript(); |
|
| 50 | + if(isset($bs)) { |
|
| 51 | + $this->params['onShow']=$bs->getScript(); |
|
| 52 | + } |
|
| 52 | 53 | $item=$comp; |
| 53 | 54 | } |
| 54 | 55 | }); |
@@ -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)===true){ |
| 153 | 154 | $c->setProperty($property,$value); |
| 154 | - } |
|
| 155 | - else{ |
|
| 155 | + } else{ |
|
| 156 | 156 | return $this; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -51,8 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getSideContent($index){ |
| 53 | 53 | $item= $this->getItem($index); |
| 54 | - if(isset($item)) |
|
| 55 | - return $item->getContent(); |
|
| 54 | + if(isset($item)) { |
|
| 55 | + return $item->getContent(); |
|
| 56 | + } |
|
| 56 | 57 | return null; |
| 57 | 58 | } |
| 58 | 59 | |
@@ -85,15 +86,17 @@ discard block |
||
| 85 | 86 | * @see BaseHtml::run() |
| 86 | 87 | */ |
| 87 | 88 | public function run(JsUtils $js) { |
| 88 | - if (isset($this->_bsComponent) === false) |
|
| 89 | - $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
| 89 | + if (isset($this->_bsComponent) === false) { |
|
| 90 | + $this->_bsComponent=$js->semantic()->shape("#" . $this->identifier, $this->_params); |
|
| 91 | + } |
|
| 90 | 92 | $this->addEventsOnRun($js); |
| 91 | 93 | return $this->_bsComponent; |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 95 | - if($this->_autoActive) |
|
| 96 | - $this->setActiveSide(0); |
|
| 97 | + if($this->_autoActive) { |
|
| 98 | + $this->setActiveSide(0); |
|
| 99 | + } |
|
| 97 | 100 | return parent::compile($js,$view); |
| 98 | 101 | } |
| 99 | 102 | } |
| 100 | 103 | \ No newline at end of file |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 17 | 17 | parent::__construct($identifier, "div", "ui buttons"); |
| 18 | - if ($asIcons === true) |
|
| 19 | - $this->asIcons(); |
|
| 18 | + if ($asIcons === true) { |
|
| 19 | + $this->asIcons(); |
|
| 20 | + } |
|
| 20 | 21 | $this->addElements($elements, $asIcons); |
| 21 | 22 | } |
| 22 | 23 | protected function createItem($value){ |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | |
| 27 | 28 | public function addElement($element, $asIcon=false) { |
| 28 | 29 | $item=$this->addItem($element); |
| 29 | - if($asIcon) |
|
| 30 | - $item->asIcon($element); |
|
| 30 | + if($asIcon) { |
|
| 31 | + $item->asIcon($element); |
|
| 32 | + } |
|
| 31 | 33 | return $item; |
| 32 | 34 | } |
| 33 | 35 | |
@@ -55,8 +57,9 @@ discard block |
||
| 55 | 57 | |
| 56 | 58 | public function asIcons() { |
| 57 | 59 | foreach ( $this->content as $item ) { |
| 58 | - if($item instanceof HtmlButton) |
|
| 59 | - $item->asIcon($item->getContent()); |
|
| 60 | + if($item instanceof HtmlButton) { |
|
| 61 | + $item->asIcon($item->getContent()); |
|
| 62 | + } |
|
| 60 | 63 | } |
| 61 | 64 | return $this->addToProperty("class", "icons"); |
| 62 | 65 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $viewVars=$view->viewVars; |
| 14 | 14 | if (isset($viewVars["q"]) === false) { |
| 15 | 15 | $controls=array (); |
| 16 | - }else{ |
|
| 16 | + } else{ |
|
| 17 | 17 | $controls=$viewVars["q"]; |
| 18 | 18 | } |
| 19 | 19 | $controls[$identifier]=$content; |
@@ -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)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 81 | + if(\is_array($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 |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getProperty($name) { |
| 53 | - if (array_key_exists($name, $this->properties)) |
|
| 54 | - return $this->properties[$name]; |
|
| 53 | + if (array_key_exists($name, $this->properties)) { |
|
| 54 | + return $this->properties[$name]; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
@@ -61,10 +62,11 @@ discard block |
||
| 61 | 62 | } |
| 62 | 63 | } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
| 63 | 64 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 66 | - else |
|
| 67 | - $v=$value; |
|
| 65 | + if (isset($v) && $v !== "") { |
|
| 66 | + $v=$v . $separator . $value; |
|
| 67 | + } else { |
|
| 68 | + $v=$value; |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | return $this->setProperty($name, $v); |
| 70 | 72 | } |
@@ -119,8 +121,9 @@ discard block |
||
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 123 | - return $this->setProperty($name, $value); |
|
| 124 | + if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 125 | + return $this->setProperty($name, $value); |
|
| 126 | + } |
|
| 124 | 127 | return $this; |
| 125 | 128 | } |
| 126 | 129 | |
@@ -150,8 +153,9 @@ discard block |
||
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | public function removeProperty($name) { |
| 153 | - if (\array_key_exists($name, $this->properties)) |
|
| 154 | - unset($this->properties[$name]); |
|
| 156 | + if (\array_key_exists($name, $this->properties)) { |
|
| 157 | + unset($this->properties[$name]); |
|
| 158 | + } |
|
| 155 | 159 | return $this; |
| 156 | 160 | } |
| 157 | 161 | |
@@ -171,8 +175,9 @@ discard block |
||
| 171 | 175 | } |
| 172 | 176 | |
| 173 | 177 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 174 | - if (@class_exists($typeCtrl, true)) |
|
| 175 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 178 | + if (@class_exists($typeCtrl, true)) { |
|
| 179 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 180 | + } |
|
| 176 | 181 | if (is_array($typeCtrl)) { |
| 177 | 182 | $this->removeOldValues($this->properties[$name], $typeCtrl); |
| 178 | 183 | } |
@@ -301,7 +306,7 @@ discard block |
||
| 301 | 306 | public function onCreate($jsCode){ |
| 302 | 307 | if(isset($this->_events["_create"])){ |
| 303 | 308 | $this->_events["_create"][]=$jsCode; |
| 304 | - }else{ |
|
| 309 | + } else{ |
|
| 305 | 310 | $this->_events["_create"]=[$jsCode]; |
| 306 | 311 | } |
| 307 | 312 | return $this; |
@@ -313,8 +318,9 @@ discard block |
||
| 313 | 318 | if(\is_array($create)){ |
| 314 | 319 | $create=\implode("", $create); |
| 315 | 320 | } |
| 316 | - if($create!=="") |
|
| 317 | - $js->exec($create,true); |
|
| 321 | + if($create!=="") { |
|
| 322 | + $js->exec($create,true); |
|
| 323 | + } |
|
| 318 | 324 | unset($this->_events["_create"]); |
| 319 | 325 | } |
| 320 | 326 | if (isset($this->_bsComponent)) { |
@@ -376,15 +382,18 @@ discard block |
||
| 376 | 382 | $flag=false; |
| 377 | 383 | $index=0; |
| 378 | 384 | while ( !$flag && $index < sizeof($elements) ) { |
| 379 | - if ($elements[$index] instanceof BaseHtml) |
|
| 380 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 385 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 386 | + $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 387 | + } |
|
| 381 | 388 | $index++; |
| 382 | 389 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 390 | + if ($flag === true) { |
|
| 391 | + return $elements[$index - 1]; |
|
| 392 | + } |
|
| 385 | 393 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->getIdentifier() === $identifier) |
|
| 387 | - return $elements; |
|
| 394 | + if ($elements->getIdentifier() === $identifier) { |
|
| 395 | + return $elements; |
|
| 396 | + } |
|
| 388 | 397 | } |
| 389 | 398 | return null; |
| 390 | 399 | } |
@@ -394,15 +403,18 @@ discard block |
||
| 394 | 403 | $flag=false; |
| 395 | 404 | $index=0; |
| 396 | 405 | while ( !$flag && $index < sizeof($elements) ) { |
| 397 | - if ($elements[$index] instanceof BaseHtml) |
|
| 398 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 406 | + if ($elements[$index] instanceof BaseHtml) { |
|
| 407 | + $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 408 | + } |
|
| 399 | 409 | $index++; |
| 400 | 410 | } |
| 401 | - if ($flag === true) |
|
| 402 | - return $elements[$index - 1]; |
|
| 411 | + if ($flag === true) { |
|
| 412 | + return $elements[$index - 1]; |
|
| 413 | + } |
|
| 403 | 414 | } elseif ($elements instanceof BaseHtml) { |
| 404 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 405 | - return $elements; |
|
| 415 | + if ($elements->propertyContains($propertyName, $value) === true) { |
|
| 416 | + return $elements; |
|
| 417 | + } |
|
| 406 | 418 | } |
| 407 | 419 | return null; |
| 408 | 420 | } |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function htmlMessage($identifier, $content="",$styles=NULL) { |
| 33 | 33 | $msg= $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
| 34 | - if(isset($msg)) |
|
| 35 | - $msg->setStyle($styles); |
|
| 34 | + if(isset($msg)) { |
|
| 35 | + $msg->setStyle($styles); |
|
| 36 | + } |
|
| 36 | 37 | return $msg; |
| 37 | 38 | } |
| 38 | 39 | |