@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | * @version 1.001 |
11 | 11 | */ |
12 | 12 | abstract class BaseComponent { |
13 | - public $jquery_code_for_compile=array (); |
|
14 | - protected $params=array (); |
|
13 | + public $jquery_code_for_compile=array(); |
|
14 | + protected $params=array(); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | public function setParams($params) { |
71 | - foreach ( $params as $k => $v ) { |
|
71 | + foreach ($params as $k => $v) { |
|
72 | 72 | $method="set".ucfirst($k); |
73 | 73 | if (method_exists($this, $method)) |
74 | 74 | $this->$method($v); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | return $this; |
82 | 82 | } |
83 | 83 | |
84 | - public function addParams($params){ |
|
85 | - foreach ($params as $k=>$v){ |
|
84 | + public function addParams($params) { |
|
85 | + foreach ($params as $k=>$v) { |
|
86 | 86 | $this->setParam($k, $v); |
87 | 87 | } |
88 | 88 | return $this; |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | |
91 | 91 | abstract public function getScript(); |
92 | 92 | |
93 | - public function setDebug($value){ |
|
93 | + public function setDebug($value) { |
|
94 | 94 | return $this->setParam("debug", $value); |
95 | 95 | } |
96 | 96 | |
97 | - public function setVerbose($value){ |
|
97 | + public function setVerbose($value) { |
|
98 | 98 | return $this->setParam("verbose", $value); |
99 | 99 | } |
100 | 100 |
@@ -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}` doesn't exists!", E_USER_NOTICE); |
78 | 81 | } |
@@ -18,38 +18,38 @@ |
||
18 | 18 | $this->uiName='toast'; |
19 | 19 | } |
20 | 20 | |
21 | - public function close(){ |
|
21 | + public function close() { |
|
22 | 22 | return $this->addBehavior('close'); |
23 | 23 | } |
24 | 24 | |
25 | - public function setClass($value){ |
|
25 | + public function setClass($value) { |
|
26 | 26 | $this->params['class']=$value; |
27 | 27 | } |
28 | 28 | |
29 | - public function setCloseIcon(){ |
|
29 | + public function setCloseIcon() { |
|
30 | 30 | $this->params['closeIcon']=true; |
31 | 31 | } |
32 | 32 | |
33 | - public function setShowIcon($value=false){ |
|
33 | + public function setShowIcon($value=false) { |
|
34 | 34 | $this->params['showIcon']=$value; |
35 | 35 | } |
36 | 36 | |
37 | - public function setCloseOnClick($value){ |
|
37 | + public function setCloseOnClick($value) { |
|
38 | 38 | $this->params['closeOnClick']=$value; |
39 | 39 | } |
40 | - public function setTitle($title){ |
|
40 | + public function setTitle($title) { |
|
41 | 41 | $this->params['title']=$title; |
42 | 42 | } |
43 | 43 | |
44 | - public function setMessage($message){ |
|
44 | + public function setMessage($message) { |
|
45 | 45 | $this->params['message']=$message; |
46 | 46 | } |
47 | 47 | |
48 | - public function setDisplayTime($time){ |
|
48 | + public function setDisplayTime($time) { |
|
49 | 49 | $this->params['displayTime']=$time; |
50 | 50 | } |
51 | 51 | |
52 | - public function showProgress($value='top'){ |
|
52 | + public function showProgress($value='top') { |
|
53 | 53 | $this->params['showProgress']=$value; |
54 | 54 | } |
55 | 55 |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | return $this; |
18 | 18 | } |
19 | 19 | |
20 | - protected function generateParamParts(){ |
|
20 | + protected function generateParamParts() { |
|
21 | 21 | $results=[]; |
22 | - foreach ($this->paramParts as $paramPart){ |
|
22 | + foreach ($this->paramParts as $paramPart) { |
|
23 | 23 | $results[]="{$this->uiName}(".\implode(",", $paramPart).")"; |
24 | 24 | } |
25 | 25 | return \implode(".", $results); |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | public function getScript() { |
29 | 29 | $allParams=$this->params; |
30 | - $this->jquery_code_for_compile=array (); |
|
30 | + $this->jquery_code_for_compile=array(); |
|
31 | 31 | $paramParts=""; |
32 | - if(\sizeof($this->paramParts)>0){ |
|
32 | + if (\sizeof($this->paramParts)>0) { |
|
33 | 33 | $paramParts=".".$this->generateParamParts(); |
34 | 34 | } |
35 | 35 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).")".$paramParts.";"; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | return $this; |
43 | 43 | } |
44 | 44 | |
45 | - public function addComponentEvent($event,$jsCode){ |
|
46 | - $jsCode=\str_ireplace("\"","%quote%", $jsCode); |
|
45 | + public function addComponentEvent($event, $jsCode) { |
|
46 | + $jsCode=\str_ireplace("\"", "%quote%", $jsCode); |
|
47 | 47 | return $this->setParam($event, "%function(){".$jsCode."}%"); |
48 | 48 | } |
49 | 49 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | $this->uiName='modal'; |
19 | 19 | } |
20 | 20 | |
21 | - public function showDimmer(){ |
|
21 | + public function showDimmer() { |
|
22 | 22 | return $this->addBehavior('hide dimmer'); |
23 | 23 | } |
24 | 24 | |
25 | - public function setInverted(){ |
|
25 | + public function setInverted() { |
|
26 | 26 | $this->params['inverted']=true; |
27 | 27 | } |
28 | 28 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | protected $_popup=NULL; |
26 | 26 | protected $_dimmer=NULL; |
27 | 27 | protected $_toast=NULL; |
28 | - protected $_params=array (); |
|
28 | + protected $_params=array(); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * @return HtmlDimmer |
82 | 82 | */ |
83 | 83 | public function addDimmer($params=array(), $content=NULL) { |
84 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
84 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
85 | 85 | $dimmer->setParams($params); |
86 | 86 | $dimmer->setContainer($this); |
87 | 87 | $this->addContent($dimmer); |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function addLabel($label, $before=false, $icon=NULL) { |
99 | 99 | $labelO=$label; |
100 | - if (\is_object($label) === false) { |
|
101 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
100 | + if (\is_object($label)===false) { |
|
101 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
102 | 102 | if (isset($icon)) |
103 | 103 | $labelO->addIcon($icon); |
104 | 104 | } else { |
105 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
105 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
106 | 106 | } |
107 | 107 | $this->addContent($labelO, $before); |
108 | 108 | return $labelO; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @param string $icon |
117 | 117 | * @return HtmlSemDoubleElement |
118 | 118 | */ |
119 | - public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){ |
|
120 | - $label=$this->addLabel($label,true,$icon); |
|
121 | - $label->setAttached($side,$direction); |
|
119 | + public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) { |
|
120 | + $label=$this->addLabel($label, true, $icon); |
|
121 | + $label->setAttached($side, $direction); |
|
122 | 122 | return $this; |
123 | 123 | } |
124 | 124 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * Transforms the element into a link |
127 | 127 | * @return HtmlSemDoubleElement |
128 | 128 | */ |
129 | - public function asLink($href=NULL,$target=NULL) { |
|
129 | + public function asLink($href=NULL, $target=NULL) { |
|
130 | 130 | if (isset($href)) |
131 | 131 | $this->setProperty("href", $href); |
132 | - if(isset($target)) |
|
132 | + if (isset($target)) |
|
133 | 133 | $this->setProperty("target", $target); |
134 | 134 | return $this->setTagName("a"); |
135 | 135 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function jsShowDimmer($show=true) { |
143 | 143 | $status="hide"; |
144 | - if ($show === true) |
|
144 | + if ($show===true) |
|
145 | 145 | $status="show"; |
146 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
146 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @see BaseHtml::compile() |
152 | 152 | */ |
153 | 153 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
154 | - if (isset($this->_popup)){ |
|
154 | + if (isset($this->_popup)) { |
|
155 | 155 | $this->_popup->compile($js); |
156 | 156 | } |
157 | 157 | return parent::compile($js, $view); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @see HtmlDoubleElement::run() |
163 | 163 | */ |
164 | 164 | public function run(JsUtils $js) { |
165 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
165 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
166 | 166 | parent::run($js); |
167 | 167 | $this->addEventsOnRun($js); |
168 | 168 | if (isset($this->_popup)) { |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @param boolean $ordered |
180 | 180 | * @return \Ajax\common\html\html5\HtmlList |
181 | 181 | */ |
182 | - public function addList($items,$ordered=false){ |
|
183 | - $list=new HtmlList("list-".$this->identifier,$items); |
|
182 | + public function addList($items, $ordered=false) { |
|
183 | + $list=new HtmlList("list-".$this->identifier, $items); |
|
184 | 184 | $list->setOrdered($ordered); |
185 | 185 | $list->setClass("ui list"); |
186 | 186 | $this->addContent($list); |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | * @param ?array $params |
192 | 192 | * @return \Ajax\semantic\components\Toast |
193 | 193 | */ |
194 | - public function asToast($params=NULL){ |
|
194 | + public function asToast($params=NULL) { |
|
195 | 195 | $this->_toast=new Toast(null); |
196 | - if(isset($params)){ |
|
196 | + if (isset($params)) { |
|
197 | 197 | $this->_toast->setParams($params); |
198 | 198 | } |
199 | 199 | return $this->_toast; |