@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getParam($key) { |
41 | 41 | $value=null; |
42 | - if (array_key_exists($key, $this->params)) |
|
43 | - $value=$this->params [$key]; |
|
42 | + if (array_key_exists($key, $this->params)) { |
|
43 | + $value=$this->params [$key]; |
|
44 | + } |
|
44 | 45 | return $value; |
45 | 46 | } |
46 | 47 | |
@@ -49,16 +50,18 @@ discard block |
||
49 | 50 | } |
50 | 51 | |
51 | 52 | public function compile(JsUtils $js=NULL) { |
52 | - if ($js==NULL) |
|
53 | - $js=$this->js; |
|
53 | + if ($js==NULL) { |
|
54 | + $js=$this->js; |
|
55 | + } |
|
54 | 56 | $script=$this->getScript(); |
55 | 57 | $js->addToCompile($script); |
56 | 58 | } |
57 | 59 | |
58 | 60 | protected function setParamCtrl($key, $value, $typeCtrl) { |
59 | 61 | if (is_array($typeCtrl)) { |
60 | - if (array_search($value, $typeCtrl)===false) |
|
61 | - throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
62 | + if (array_search($value, $typeCtrl)===false) { |
|
63 | + throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
64 | + } |
|
62 | 65 | } else { |
63 | 66 | if (!$typeCtrl($value)) { |
64 | 67 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key); |
@@ -70,9 +73,9 @@ discard block |
||
70 | 73 | public function setParams($params) { |
71 | 74 | foreach ( $params as $k => $v ) { |
72 | 75 | $method="set".ucfirst($k); |
73 | - if (method_exists($this, $method)) |
|
74 | - $this->$method($v); |
|
75 | - else { |
|
76 | + if (method_exists($this, $method)) { |
|
77 | + $this->$method($v); |
|
78 | + } else { |
|
76 | 79 | $this->setParam($k, $v); |
77 | 80 | trigger_error("`".$k."` property n'existe pas", E_USER_NOTICE); |
78 | 81 | } |
@@ -64,8 +64,9 @@ |
||
64 | 64 | |
65 | 65 | protected function setParamCtrl($key, $value, $typeCtrl) { |
66 | 66 | if (is_array($typeCtrl)) { |
67 | - if (array_search($value, $typeCtrl)===false) |
|
68 | - 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)."}"); |
|
67 | + if (array_search($value, $typeCtrl)===false) { |
|
68 | + 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)."}"); |
|
69 | + } |
|
69 | 70 | } else { |
70 | 71 | if (!$typeCtrl($value)) { |
71 | 72 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -40,9 +40,9 @@ |
||
40 | 40 | * @return HtmlDoubleElement |
41 | 41 | */ |
42 | 42 | public function getItem($index) { |
43 | - if (is_int($index)) |
|
44 | - return $this->content[$index]; |
|
45 | - else { |
|
43 | + if (is_int($index)) { |
|
44 | + return $this->content[$index]; |
|
45 | + } else { |
|
46 | 46 | $elm=$this->getElementById($index, $this->content); |
47 | 47 | return $elm; |
48 | 48 | } |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | public function addInput($name){ |
42 | - if(!isset($name)) |
|
43 | - $name="input-".$this->identifier; |
|
42 | + if(!isset($name)) { |
|
43 | + $name="input-".$this->identifier; |
|
44 | + } |
|
44 | 45 | $this->setAction("activate"); |
45 | 46 | $this->input=new HtmlInput($name,"hidden"); |
46 | 47 | } |
@@ -50,7 +51,7 @@ discard block |
||
50 | 51 | foreach ($items as $k=>$v){ |
51 | 52 | $this->addItem($v)->setData($k); |
52 | 53 | } |
53 | - }else{ |
|
54 | + } else{ |
|
54 | 55 | foreach ($items as $item){ |
55 | 56 | $this->addItem($item); |
56 | 57 | } |
@@ -62,12 +63,15 @@ discard block |
||
62 | 63 | } |
63 | 64 | |
64 | 65 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
65 | - if(isset($name)) |
|
66 | - $this->addInput($name); |
|
67 | - if($multiple) |
|
68 | - $this->addToProperty("class", "multiple"); |
|
69 | - if ($selection) |
|
70 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
66 | + if(isset($name)) { |
|
67 | + $this->addInput($name); |
|
68 | + } |
|
69 | + if($multiple) { |
|
70 | + $this->addToProperty("class", "multiple"); |
|
71 | + } |
|
72 | + if ($selection) { |
|
73 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
74 | + } |
|
71 | 75 | return $this; |
72 | 76 | } |
73 | 77 | |
@@ -77,8 +81,9 @@ discard block |
||
77 | 81 | } |
78 | 82 | |
79 | 83 | public function setSelect($name=NULL,$multiple=false){ |
80 | - if(!isset($name)) |
|
81 | - $name="select-".$this->identifier; |
|
84 | + if(!isset($name)) { |
|
85 | + $name="select-".$this->identifier; |
|
86 | + } |
|
82 | 87 | $this->input=null; |
83 | 88 | if($multiple){ |
84 | 89 | $this->setProperty("multiple", true); |
@@ -97,7 +102,7 @@ discard block |
||
97 | 102 | public function setValue($value){ |
98 | 103 | if(isset($this->input)){ |
99 | 104 | $this->input->setProperty("value", $value); |
100 | - }else{ |
|
105 | + } else{ |
|
101 | 106 | $this->setProperty("value", $value); |
102 | 107 | } |
103 | 108 | return $this; |
@@ -41,8 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
44 | - if(isset($this->_popup)) |
|
45 | - $this->_popup->setAttributes($variation,$popupEvent); |
|
44 | + if(isset($this->_popup)) { |
|
45 | + $this->_popup->setAttributes($variation,$popupEvent); |
|
46 | + } |
|
46 | 47 | } |
47 | 48 | |
48 | 49 | public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | } |
83 | 84 | |
84 | 85 | public function compile(JsUtils $js=NULL, View $view=NULL){ |
85 | - if(isset($this->_popup)) |
|
86 | - $this->_popup->compile(); |
|
86 | + if(isset($this->_popup)) { |
|
87 | + $this->_popup->compile(); |
|
88 | + } |
|
87 | 89 | return parent::compile($js,$view); |
88 | 90 | } |
89 | 91 | public function run(JsUtils $js){ |
@@ -14,10 +14,12 @@ discard block |
||
14 | 14 | parent::__construct($identifier, "div"); |
15 | 15 | $this->setClass("item"); |
16 | 16 | $this->setContent($content); |
17 | - if($value!==NULL) |
|
18 | - $this->setData($value); |
|
19 | - if($image!==NULL) |
|
20 | - $this->asMiniAvatar($image); |
|
17 | + if($value!==NULL) { |
|
18 | + $this->setData($value); |
|
19 | + } |
|
20 | + if($image!==NULL) { |
|
21 | + $this->asMiniAvatar($image); |
|
22 | + } |
|
21 | 23 | } |
22 | 24 | |
23 | 25 | public function setDescription($description){ |
@@ -33,8 +35,9 @@ discard block |
||
33 | 35 | |
34 | 36 | public function asOption(){ |
35 | 37 | $this->tagName="option"; |
36 | - if($this->getProperty("data-value")!==null) |
|
37 | - $this->setProperty("value", $this->getProperty("data-value")); |
|
38 | + if($this->getProperty("data-value")!==null) { |
|
39 | + $this->setProperty("value", $this->getProperty("data-value")); |
|
40 | + } |
|
38 | 41 | } |
39 | 42 | |
40 | 43 | /** |
@@ -52,22 +55,25 @@ discard block |
||
52 | 55 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
53 | 56 | $this->setClass("ui icon search input"); |
54 | 57 | $input=new HtmlInput("search-".$this->identifier); |
55 | - if(isset($placeholder)) |
|
56 | - $input->setProperty("placeholder", $placeholder); |
|
58 | + if(isset($placeholder)) { |
|
59 | + $input->setProperty("placeholder", $placeholder); |
|
60 | + } |
|
57 | 61 | $this->content=$input; |
58 | - if(isset($icon)) |
|
59 | - $this->addIcon($icon); |
|
62 | + if(isset($icon)) { |
|
63 | + $this->addIcon($icon); |
|
64 | + } |
|
60 | 65 | return $this; |
61 | 66 | } |
62 | 67 | |
63 | 68 | public function setContent($content){ |
64 | 69 | if($content==="-"){ |
65 | 70 | $this->asDivider(); |
66 | - }elseif($content==="-search-"){ |
|
71 | + } elseif($content==="-search-"){ |
|
67 | 72 | $values=\explode(",",$content,-1); |
68 | 73 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
69 | - }else |
|
70 | - parent::setContent($content); |
|
74 | + } else { |
|
75 | + parent::setContent($content); |
|
76 | + } |
|
71 | 77 | return $this; |
72 | 78 | } |
73 | 79 |