@@ -12,11 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($identifier, $value=NULL, $label=NULL) { |
| 14 | 14 | parent::__construct($identifier, "div", "ui progress"); |
| 15 | - if (isset($value) === true) |
|
| 16 | - $this->setProperty("data-percent", $value); |
|
| 15 | + if (isset($value) === true) { |
|
| 16 | + $this->setProperty("data-percent", $value); |
|
| 17 | + } |
|
| 17 | 18 | $this->createBar(); |
| 18 | - if (isset($label) === true) |
|
| 19 | - $this->setLabel($label); |
|
| 19 | + if (isset($label) === true) { |
|
| 20 | + $this->setLabel($label); |
|
| 21 | + } |
|
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | public function setLabel($label) { |
@@ -93,8 +95,9 @@ discard block |
||
| 93 | 95 | * @see BaseHtml::run() |
| 94 | 96 | */ |
| 95 | 97 | public function run(JsUtils $js) { |
| 96 | - if (isset($this->_bsComponent) === false) |
|
| 97 | - $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 98 | + if (isset($this->_bsComponent) === false) { |
|
| 99 | + $this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params); |
|
| 100 | + } |
|
| 98 | 101 | $this->addEventsOnRun($js); |
| 99 | 102 | return $this->_bsComponent; |
| 100 | 103 | } |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function setVariations($variations) { |
| 36 | 36 | $this->setProperty("class", $this->_baseClass); |
| 37 | - if (\is_string($variations)) |
|
| 38 | - $variations=\explode(" ", $variations); |
|
| 37 | + if (\is_string($variations)) { |
|
| 38 | + $variations=\explode(" ", $variations); |
|
| 39 | + } |
|
| 39 | 40 | foreach ( $variations as $variation ) { |
| 40 | 41 | $this->addVariation($variation); |
| 41 | 42 | } |
@@ -48,8 +49,9 @@ discard block |
||
| 48 | 49 | } |
| 49 | 50 | |
| 50 | 51 | public function addVariations($variations=array()) { |
| 51 | - if (\is_string($variations)) |
|
| 52 | - $variations=\explode(" ", $variations); |
|
| 52 | + if (\is_string($variations)) { |
|
| 53 | + $variations=\explode(" ", $variations); |
|
| 54 | + } |
|
| 53 | 55 | foreach ( $variations as $variation ) { |
| 54 | 56 | $this->addVariation($variation); |
| 55 | 57 | } |
@@ -57,8 +59,9 @@ discard block |
||
| 57 | 59 | } |
| 58 | 60 | |
| 59 | 61 | public function addStates($states=array()) { |
| 60 | - if (\is_string($states)) |
|
| 61 | - $states=\explode(" ", $states); |
|
| 62 | + if (\is_string($states)) { |
|
| 63 | + $states=\explode(" ", $states); |
|
| 64 | + } |
|
| 62 | 65 | foreach ( $states as $state ) { |
| 63 | 66 | $this->addState($state); |
| 64 | 67 | } |
@@ -67,8 +70,9 @@ discard block |
||
| 67 | 70 | |
| 68 | 71 | public function setStates($states) { |
| 69 | 72 | $this->setProperty("class", $this->_baseClass); |
| 70 | - if (\is_string($states)) |
|
| 71 | - $states=\explode(" ", $states); |
|
| 73 | + if (\is_string($states)) { |
|
| 74 | + $states=\explode(" ", $states); |
|
| 75 | + } |
|
| 72 | 76 | foreach ( $states as $state ) { |
| 73 | 77 | $this->addState($state); |
| 74 | 78 | } |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
| 16 | 16 | parent::__construct($identifier, "div", "ui buttons"); |
| 17 | 17 | $this->content=array (); |
| 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 | |
@@ -26,8 +27,9 @@ discard block |
||
| 26 | 27 | if ($asIcon) { |
| 27 | 28 | $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content)); |
| 28 | 29 | $elementO->asIcon($element); |
| 29 | - } else |
|
| 30 | - $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 30 | + } else { |
|
| 31 | + $elementO=new HtmlButton("button-" . $this->identifier . "-" . \sizeof($this->content), $element); |
|
| 32 | + } |
|
| 31 | 33 | } |
| 32 | 34 | $this->addContent($elementO); |
| 33 | 35 | } |
@@ -75,9 +77,9 @@ discard block |
||
| 75 | 77 | * @return HtmlButton |
| 76 | 78 | */ |
| 77 | 79 | public function getElement($index) { |
| 78 | - if (is_int($index)) |
|
| 79 | - return $this->content[$index]; |
|
| 80 | - else { |
|
| 80 | + if (is_int($index)) { |
|
| 81 | + return $this->content[$index]; |
|
| 82 | + } else { |
|
| 81 | 83 | $elm=$this->getElementById($index, $this->content); |
| 82 | 84 | return $elm; |
| 83 | 85 | } |
@@ -29,8 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function addHeader($title, $niveau=1, $dividing=true) { |
| 31 | 31 | $header=new HtmlHeader("", $niveau, $title); |
| 32 | - if ($dividing) |
|
| 33 | - $header->setDividing(); |
|
| 32 | + if ($dividing) { |
|
| 33 | + $header->setDividing(); |
|
| 34 | + } |
|
| 34 | 35 | return $this->addItem($header); |
| 35 | 36 | } |
| 36 | 37 | |
@@ -43,14 +44,16 @@ discard block |
||
| 43 | 44 | if (\is_string($end)) { |
| 44 | 45 | $label=$end; |
| 45 | 46 | \array_pop($fields); |
| 46 | - } else |
|
| 47 | - $label=NULL; |
|
| 47 | + } else { |
|
| 48 | + $label=NULL; |
|
| 49 | + } |
|
| 48 | 50 | } |
| 49 | 51 | $this->_fields=\array_merge($this->_fields, $fields); |
| 50 | 52 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
| 51 | 53 | } |
| 52 | - if (isset($label)) |
|
| 53 | - $fields=new HtmlFormField("", $fields, $label); |
|
| 54 | + if (isset($label)) { |
|
| 55 | + $fields=new HtmlFormField("", $fields, $label); |
|
| 56 | + } |
|
| 54 | 57 | } else { |
| 55 | 58 | $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
| 56 | 59 | } |
@@ -103,12 +106,15 @@ discard block |
||
| 103 | 106 | */ |
| 104 | 107 | public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) { |
| 105 | 108 | $message=new HtmlMessage($identifier, $content); |
| 106 | - if (isset($header)) |
|
| 107 | - $message->addHeader($header); |
|
| 108 | - if (isset($icon)) |
|
| 109 | - $message->setIcon($icon); |
|
| 110 | - if (isset($type)) |
|
| 111 | - $message->setStyle($type); |
|
| 109 | + if (isset($header)) { |
|
| 110 | + $message->addHeader($header); |
|
| 111 | + } |
|
| 112 | + if (isset($icon)) { |
|
| 113 | + $message->setIcon($icon); |
|
| 114 | + } |
|
| 115 | + if (isset($type)) { |
|
| 116 | + $message->setStyle($type); |
|
| 117 | + } |
|
| 112 | 118 | return $this->addItem($message); |
| 113 | 119 | } |
| 114 | 120 | |
@@ -23,10 +23,11 @@ discard block |
||
| 23 | 23 | foreach ( $this->events as $event => $jsCode ) { |
| 24 | 24 | if($event=="execute"){ |
| 25 | 25 | $this->jquery_code_for_compile []=$jsCode; |
| 26 | - }else if($event=="beforeExecute"){ |
|
| 26 | + } else if($event=="beforeExecute"){ |
|
| 27 | 27 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
| 28 | - }else |
|
| 29 | - $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
|
| 28 | + } else { |
|
| 29 | + $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
|
| 30 | + } |
|
| 30 | 31 | } |
| 31 | 32 | } |
| 32 | 33 | |
@@ -69,8 +70,9 @@ discard block |
||
| 69 | 70 | |
| 70 | 71 | protected function setParamCtrl($key, $value, $typeCtrl) { |
| 71 | 72 | if (is_array($typeCtrl)) { |
| 72 | - if (array_search($value, $typeCtrl)===false) |
|
| 73 | - 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)."}"); |
|
| 73 | + if (array_search($value, $typeCtrl)===false) { |
|
| 74 | + 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)."}"); |
|
| 75 | + } |
|
| 74 | 76 | } else { |
| 75 | 77 | if (!$typeCtrl($value)) { |
| 76 | 78 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -20,8 +20,9 @@ |
||
| 20 | 20 | $result=array (); |
| 21 | 21 | foreach ( $this->categories as $category ) { |
| 22 | 22 | $r=$category->search($query, $field); |
| 23 | - if ($r !== false) |
|
| 24 | - $result[]=$r; |
|
| 23 | + if ($r !== false) { |
|
| 24 | + $result[]=$r; |
|
| 25 | + } |
|
| 25 | 26 | } |
| 26 | 27 | $this->categories=$result; |
| 27 | 28 | return $this; |
@@ -77,8 +77,9 @@ |
||
| 77 | 77 | $vars=get_object_vars($this); |
| 78 | 78 | $result=array (); |
| 79 | 79 | foreach ( $vars as $k => $v ) { |
| 80 | - if (isset($v)) |
|
| 81 | - $result[$k]=$v; |
|
| 80 | + if (isset($v)) { |
|
| 81 | + $result[$k]=$v; |
|
| 82 | + } |
|
| 82 | 83 | } |
| 83 | 84 | return $result; |
| 84 | 85 | } |
@@ -22,10 +22,12 @@ |
||
| 22 | 22 | |
| 23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
| 24 | 24 | $field=new HtmlInput($this->identifier); |
| 25 | - if (isset($placeholder) === true) |
|
| 26 | - $field->setPlaceholder($placeholder); |
|
| 27 | - if (isset($icon) === true) |
|
| 28 | - $field->addIcon($icon, Direction::RIGHT); |
|
| 25 | + if (isset($placeholder) === true) { |
|
| 26 | + $field->setPlaceholder($placeholder); |
|
| 27 | + } |
|
| 28 | + if (isset($icon) === true) { |
|
| 29 | + $field->addIcon($icon, Direction::RIGHT); |
|
| 30 | + } |
|
| 29 | 31 | $field->getField()->setClass("prompt"); |
| 30 | 32 | $this->content["field"]=$field; |
| 31 | 33 | return $field; |
@@ -38,8 +38,9 @@ discard block |
||
| 38 | 38 | foreach ( $objects as $object ) { |
| 39 | 39 | $this->addResult([ "title" => $object ]); |
| 40 | 40 | } |
| 41 | - } else |
|
| 42 | - $this->elements=\array_merge($this->elements, $objects); |
|
| 41 | + } else { |
|
| 42 | + $this->elements=\array_merge($this->elements, $objects); |
|
| 43 | + } |
|
| 43 | 44 | return $this; |
| 44 | 45 | } |
| 45 | 46 | |
@@ -47,8 +48,9 @@ discard block |
||
| 47 | 48 | $result=array (); |
| 48 | 49 | foreach ( $this->elements as $element ) { |
| 49 | 50 | if ($element instanceof SearchResult) { |
| 50 | - if ($element->search($query, $field) !== false) |
|
| 51 | - $result[]=$element->asArray(); |
|
| 51 | + if ($element->search($query, $field) !== false) { |
|
| 52 | + $result[]=$element->asArray(); |
|
| 53 | + } |
|
| 52 | 54 | } else { |
| 53 | 55 | if (\array_key_exists($field, $element)) { |
| 54 | 56 | $value=$element[$field]; |
@@ -66,8 +68,9 @@ discard block |
||
| 66 | 68 | |
| 67 | 69 | public function search($query, $field="title") { |
| 68 | 70 | $result=$this->_search($query, $field); |
| 69 | - if ($result === false) |
|
| 70 | - $result=NULL; |
|
| 71 | + if ($result === false) { |
|
| 72 | + $result=NULL; |
|
| 73 | + } |
|
| 71 | 74 | return new SearchResults($result); |
| 72 | 75 | } |
| 73 | 76 | |