@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | if(is_array($element)){ |
66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
67 | 67 | $elm->fromArray($element); |
68 | - }else if($element instanceof HtmlLink){ |
|
68 | + } else if($element instanceof HtmlLink){ |
|
69 | 69 | $elm=$element; |
70 | - }else{ |
|
70 | + } else{ |
|
71 | 71 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
72 | 72 | if(isset($glyph)){ |
73 | 73 | $elm->wrapContentWithGlyph($glyph); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | if($this->absolutePaths===true){ |
116 | 116 | return $this->_hrefFunction($this->content[$index]); |
117 | - }else{ |
|
117 | + } else{ |
|
118 | 118 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
119 | 119 | } |
120 | 120 | } |
@@ -204,8 +204,9 @@ discard block |
||
204 | 204 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
205 | 205 | $items[]=$action; |
206 | 206 | foreach ($params as $p){ |
207 | - if(\is_object($p)===false) |
|
208 | - $items[]=$p; |
|
207 | + if(\is_object($p)===false) { |
|
208 | + $items[]=$p; |
|
209 | + } |
|
209 | 210 | } |
210 | 211 | } |
211 | 212 | return $this->addElements($items); |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
43 | 43 | */ |
44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
45 | - parent::__construct($identifier,"ol"); |
|
44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
45 | + parent::__construct($identifier, "ol"); |
|
46 | 46 | $this->startIndex=$startIndex; |
47 | 47 | $this->setProperty("class", "breadcrumb"); |
48 | 48 | $this->content=array(); |
49 | 49 | $this->autoActive=$autoActive; |
50 | 50 | $this->absolutePaths; |
51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
52 | - if(isset($hrefFunction)){ |
|
51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
52 | + if (isset($hrefFunction)) { |
|
53 | 53 | $this->_hrefFunction=$hrefFunction; |
54 | 54 | } |
55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | * @param string $href |
61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
62 | 62 | */ |
63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
64 | 64 | $size=sizeof($this->content); |
65 | - if(is_array($element)){ |
|
65 | + if (is_array($element)) { |
|
66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
67 | 67 | $elm->fromArray($element); |
68 | - }else if($element instanceof HtmlLink){ |
|
68 | + }else if ($element instanceof HtmlLink) { |
|
69 | 69 | $elm=$element; |
70 | - }else{ |
|
71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
72 | - if(isset($glyph)){ |
|
70 | + }else { |
|
71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
72 | + if (isset($glyph)) { |
|
73 | 73 | $elm->wrapContentWithGlyph($glyph); |
74 | 74 | } |
75 | 75 | } |
76 | - $elm->wrap("<li>","</li>"); |
|
76 | + $elm->wrap("<li>", "</li>"); |
|
77 | 77 | $this->content[]=$elm; |
78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
79 | 79 | return $elm; |
80 | 80 | } |
81 | 81 | |
82 | - public function setActive($index=null){ |
|
83 | - if(!isset($index)){ |
|
82 | + public function setActive($index=null) { |
|
83 | + if (!isset($index)) { |
|
84 | 84 | $index=sizeof($this->content)-1; |
85 | 85 | } |
86 | - $li=new HtmlBsDoubleElement("","li"); |
|
86 | + $li=new HtmlBsDoubleElement("", "li"); |
|
87 | 87 | $li->setClass("active"); |
88 | 88 | $li->setContent($this->content[$index]->getContent()); |
89 | 89 | $this->content[$index]=$li; |
90 | 90 | } |
91 | 91 | |
92 | - public function addElements($elements){ |
|
93 | - foreach ( $elements as $element ) { |
|
92 | + public function addElements($elements) { |
|
93 | + foreach ($elements as $element) { |
|
94 | 94 | $this->addElement($element); |
95 | 95 | } |
96 | 96 | return $this; |
97 | 97 | } |
98 | 98 | |
99 | - public function fromArray($array){ |
|
99 | + public function fromArray($array) { |
|
100 | 100 | $array=parent::fromArray($array); |
101 | 101 | $this->addElements($array); |
102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | * @param string $separator |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - public function getHref($index=null,$separator="/"){ |
|
112 | - if(!isset($index)){ |
|
111 | + public function getHref($index=null, $separator="/") { |
|
112 | + if (!isset($index)) { |
|
113 | 113 | $index=sizeof($this->content); |
114 | 114 | } |
115 | - if($this->absolutePaths===true){ |
|
115 | + if ($this->absolutePaths===true) { |
|
116 | 116 | return $this->_hrefFunction($this->content[$index]); |
117 | - }else{ |
|
118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
117 | + }else { |
|
118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
125 | 125 | */ |
126 | 126 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
127 | - if($this->autoActive){ |
|
127 | + if ($this->autoActive) { |
|
128 | 128 | $this->setActive(); |
129 | 129 | } |
130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
143 | 143 | */ |
144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
145 | - foreach ($this->content as $element){ |
|
146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
145 | + foreach ($this->content as $element) { |
|
146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
147 | 147 | } |
148 | 148 | return $this; |
149 | 149 | } |
150 | 150 | |
151 | 151 | public function setAutoActive($autoActive) { |
152 | - $this->autoActive = $autoActive; |
|
152 | + $this->autoActive=$autoActive; |
|
153 | 153 | return $this; |
154 | 154 | } |
155 | 155 | |
156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
157 | - foreach ($this->content as $element){ |
|
157 | + foreach ($this->content as $element) { |
|
158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
159 | 159 | } |
160 | 160 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
167 | 167 | * @param string $attr the html attribute used to build the elements url |
168 | 168 | * @return HtmlBreadcrumbs |
169 | 169 | */ |
170 | - public function autoGetOnClick($targetSelector){ |
|
171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
170 | + public function autoGetOnClick($targetSelector) { |
|
171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
172 | 172 | } |
173 | 173 | |
174 | - public function contentAsString(){ |
|
175 | - if($this->autoActive){ |
|
174 | + public function contentAsString() { |
|
175 | + if ($this->autoActive) { |
|
176 | 176 | $this->setActive(); |
177 | 177 | } |
178 | 178 | return parent::contentAsString(); |
179 | 179 | } |
180 | 180 | |
181 | - public function getElement($index){ |
|
181 | + public function getElement($index) { |
|
182 | 182 | return $this->content[$index]; |
183 | 183 | } |
184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param mixed $glyph |
188 | 188 | * @param int $index |
189 | 189 | */ |
190 | - public function addGlyph($glyph,$index=0){ |
|
190 | + public function addGlyph($glyph, $index=0) { |
|
191 | 191 | $elm=$this->getElement($index); |
192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
193 | 193 | } |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
199 | 199 | */ |
200 | - public function fromDispatcher($dispatcher,$startIndex=0){ |
|
200 | + public function fromDispatcher($dispatcher, $startIndex=0) { |
|
201 | 201 | $this->startIndex=$startIndex; |
202 | 202 | $params=$dispatcher->getParams(); |
203 | 203 | $action=$dispatcher->getActionName(); |
204 | 204 | $items=array($dispatcher->getControllerName()); |
205 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
205 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
206 | 206 | $items[]=$action; |
207 | - foreach ($params as $p){ |
|
208 | - if(\is_object($p)===false) |
|
207 | + foreach ($params as $p) { |
|
208 | + if (\is_object($p)===false) |
|
209 | 209 | $items[]=$p; |
210 | 210 | } |
211 | 211 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
220 | 220 | */ |
221 | 221 | public function setHrefFunction($_hrefFunction) { |
222 | - $this->_hrefFunction = $_hrefFunction; |
|
222 | + $this->_hrefFunction=$_hrefFunction; |
|
223 | 223 | return $this; |
224 | 224 | } |
225 | 225 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | class HtmlImg extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$src="",$alt="") { |
|
10 | + public function __construct($identifier, $src="", $alt="") { |
|
11 | 11 | parent::__construct($identifier, "img"); |
12 | 12 | $this->setSrc($src); |
13 | 13 | $this->setAlt($alt); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $attributes; |
18 | 18 | protected $color; |
19 | 19 | |
20 | - public function __construct($identifier,$icon) { |
|
20 | + public function __construct($identifier, $icon) { |
|
21 | 21 | parent::__construct($identifier, "i"); |
22 | 22 | $this->icon=$icon; |
23 | 23 | $this->_template='<i class="%icon% icon %size% %attributes% %color%"></i>'; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
43 | 43 | */ |
44 | 44 | public function setSize($size) { |
45 | - $this->setMemberCtrl($this->size, $size,Size::getConstants()); |
|
45 | + $this->setMemberCtrl($this->size, $size, Size::getConstants()); |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | |
49 | - public function setDisabled(){ |
|
49 | + public function setDisabled() { |
|
50 | 50 | return $this->addToMember($this->attributes, "disabled"); |
51 | 51 | } |
52 | 52 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * Icon used as a simple loader |
55 | 55 | * @return \Ajax\semantic\html\HtmlIcon |
56 | 56 | */ |
57 | - public function asLoader(){ |
|
57 | + public function asLoader() { |
|
58 | 58 | return $this->addToMember($this->attributes, "loading"); |
59 | 59 | } |
60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * An icon can be fitted, without any space to the left or right of it. |
63 | 63 | * @return \Ajax\semantic\html\HtmlIcon |
64 | 64 | */ |
65 | - public function setFitted(){ |
|
65 | + public function setFitted() { |
|
66 | 66 | return $this->addToMember($this->attributes, "fitted"); |
67 | 67 | } |
68 | 68 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $sens horizontally or vertically |
71 | 71 | * @return \Ajax\semantic\html\HtmlIcon |
72 | 72 | */ |
73 | - public function setFlipped($sens="horizontally"){ |
|
73 | + public function setFlipped($sens="horizontally") { |
|
74 | 74 | return $this->addToMember($this->attributes, "flipped ".$sens); |
75 | 75 | } |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param string $sens clockwise or counterclockwise |
79 | 79 | * @return \Ajax\semantic\html\HtmlIcon |
80 | 80 | */ |
81 | - public function setRotated($sens="clockwise"){ |
|
81 | + public function setRotated($sens="clockwise") { |
|
82 | 82 | return $this->addToMember($this->attributes, "rotated ".$sens); |
83 | 83 | } |
84 | 84 | |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * icon formatted as a link |
87 | 87 | * @return \Ajax\semantic\html\HtmlIcon |
88 | 88 | */ |
89 | - public function asLink(){ |
|
89 | + public function asLink() { |
|
90 | 90 | return $this->addToMember($this->attributes, "link"); |
91 | 91 | } |
92 | 92 | |
93 | - public function setCircular($inverted=false){ |
|
93 | + public function setCircular($inverted=false) { |
|
94 | 94 | $invertedStr=""; |
95 | - if($inverted!==false) |
|
95 | + if ($inverted!==false) |
|
96 | 96 | $invertedStr=" inverted"; |
97 | 97 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
98 | 98 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * @return \Ajax\semantic\html\HtmlIcon |
102 | 102 | */ |
103 | - public function setInverted(){ |
|
103 | + public function setInverted() { |
|
104 | 104 | return $this->addToMember($this->attributes, "inverted"); |
105 | 105 | } |
106 | 106 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * @param string $inverted |
109 | 109 | * @return \Ajax\semantic\html\HtmlIcon |
110 | 110 | */ |
111 | - public function setBordered($inverted=false){ |
|
111 | + public function setBordered($inverted=false) { |
|
112 | 112 | $invertedStr=""; |
113 | - if($inverted!==false) |
|
113 | + if ($inverted!==false) |
|
114 | 114 | $invertedStr=" inverted"; |
115 | 115 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
116 | 116 | } |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * @param string $color |
120 | 120 | * @return \Ajax\semantic\html\HtmlIcon |
121 | 121 | */ |
122 | - public function setColor($color){ |
|
122 | + public function setColor($color) { |
|
123 | 123 | return $this->setMemberCtrl($this->color, $color, Color::getConstants()); |
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @return \Ajax\semantic\html\HtmlIcon |
128 | 128 | */ |
129 | - public function toCorner(){ |
|
129 | + public function toCorner() { |
|
130 | 130 | return $this->addToMember($this->attributes, "corner"); |
131 | 131 | } |
132 | 132 | } |
133 | 133 | \ No newline at end of file |
@@ -92,8 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | public function setCircular($inverted=false){ |
94 | 94 | $invertedStr=""; |
95 | - if($inverted!==false) |
|
96 | - $invertedStr=" inverted"; |
|
95 | + if($inverted!==false) { |
|
96 | + $invertedStr=" inverted"; |
|
97 | + } |
|
97 | 98 | return $this->addToMember($this->attributes, "circular".$invertedStr); |
98 | 99 | } |
99 | 100 | |
@@ -110,8 +111,9 @@ discard block |
||
110 | 111 | */ |
111 | 112 | public function setBordered($inverted=false){ |
112 | 113 | $invertedStr=""; |
113 | - if($inverted!==false) |
|
114 | - $invertedStr=" inverted"; |
|
114 | + if($inverted!==false) { |
|
115 | + $invertedStr=" inverted"; |
|
116 | + } |
|
115 | 117 | return $this->addToMember($this->attributes, "bordered".$invertedStr); |
116 | 118 | } |
117 | 119 |
@@ -22,8 +22,9 @@ |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function setAlignement($value="justified"){ |
25 | - if($value!=="justified") |
|
26 | - $value.=" aligned"; |
|
25 | + if($value!=="justified") { |
|
26 | + $value.=" aligned"; |
|
27 | + } |
|
27 | 28 | return $this->addToProperty("class", $value); |
28 | 29 | } |
29 | 30 |
@@ -12,17 +12,17 @@ |
||
12 | 12 | class HtmlContainer extends HtmlSemDoubleElement { |
13 | 13 | |
14 | 14 | public function __construct($identifier, $content="") { |
15 | - parent::__construct($identifier, "div","ui container"); |
|
15 | + parent::__construct($identifier, "div", "ui container"); |
|
16 | 16 | $this->content=$content; |
17 | 17 | } |
18 | 18 | |
19 | - public function setAlignement($value="justified"){ |
|
20 | - if($value!=="justified") |
|
19 | + public function setAlignement($value="justified") { |
|
20 | + if ($value!=="justified") |
|
21 | 21 | $value.=" aligned"; |
22 | 22 | return $this->addToProperty("class", $value); |
23 | 23 | } |
24 | 24 | |
25 | - public function setTextContainer(){ |
|
25 | + public function setTextContainer() { |
|
26 | 26 | return $this->addToProperty("class", "text"); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | \ No newline at end of file |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | parent::__construct($identifier, "div"); |
16 | 16 | $this->setProperty("class", "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 | public function addElement($element,$asIcon=false){ |
@@ -25,8 +26,9 @@ discard block |
||
25 | 26 | if($asIcon){ |
26 | 27 | $elementO=new HtmlButton("button-".\sizeof($this->content)); |
27 | 28 | $elementO->asIcon($element); |
28 | - }else |
|
29 | - $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
29 | + } else { |
|
30 | + $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
31 | + } |
|
30 | 32 | } |
31 | 33 | $this->addContent($elementO); |
32 | 34 | } |
@@ -72,9 +74,9 @@ discard block |
||
72 | 74 | * @return HtmlButton |
73 | 75 | */ |
74 | 76 | public function getElement($index) { |
75 | - if (is_int($index)) |
|
76 | - return $this->content[$index]; |
|
77 | - else { |
|
77 | + if (is_int($index)) { |
|
78 | + return $this->content[$index]; |
|
79 | + } else { |
|
78 | 80 | $elm=$this->getElementById($index, $this->content); |
79 | 81 | return $elm; |
80 | 82 | } |
@@ -11,35 +11,35 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class HtmlButtonGroups extends HtmlSemDoubleElement { |
13 | 13 | |
14 | - public function __construct($identifier, $elements=array(),$asIcons=false) { |
|
15 | - parent::__construct($identifier, "div","ui buttons"); |
|
14 | + public function __construct($identifier, $elements=array(), $asIcons=false) { |
|
15 | + parent::__construct($identifier, "div", "ui buttons"); |
|
16 | 16 | $this->content=array(); |
17 | - if($asIcons===true) |
|
17 | + if ($asIcons===true) |
|
18 | 18 | $this->asIcons(); |
19 | - $this->addElements($elements,$asIcons); |
|
19 | + $this->addElements($elements, $asIcons); |
|
20 | 20 | } |
21 | - public function addElement($element,$asIcon=false){ |
|
21 | + public function addElement($element, $asIcon=false) { |
|
22 | 22 | $elementO=$element; |
23 | - if(\is_string($element)){ |
|
24 | - if($asIcon){ |
|
23 | + if (\is_string($element)) { |
|
24 | + if ($asIcon) { |
|
25 | 25 | $elementO=new HtmlButton("button-".\sizeof($this->content)); |
26 | 26 | $elementO->asIcon($element); |
27 | 27 | }else |
28 | - $elementO=new HtmlButton("button-".\sizeof($this->content),$element); |
|
28 | + $elementO=new HtmlButton("button-".\sizeof($this->content), $element); |
|
29 | 29 | } |
30 | 30 | $this->addContent($elementO); |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - public function addElements($elements,$asIcons=false) { |
|
35 | - foreach ( $elements as $element ) { |
|
36 | - $this->addElement($element,$asIcons); |
|
34 | + public function addElements($elements, $asIcons=false) { |
|
35 | + foreach ($elements as $element) { |
|
36 | + $this->addElement($element, $asIcons); |
|
37 | 37 | } |
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | - public function insertOr($aferIndex=0,$or="or"){ |
|
42 | - $orElement=new HtmlSemDoubleElement("or-".$this->identifier,"div","or"); |
|
41 | + public function insertOr($aferIndex=0, $or="or") { |
|
42 | + $orElement=new HtmlSemDoubleElement("or-".$this->identifier, "div", "or"); |
|
43 | 43 | $orElement->setProperty("data-text", $or); |
44 | 44 | array_splice($this->content, $aferIndex+1, 0, array($orElement)); |
45 | 45 | return $this; |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | $this->addElements($array); |
53 | 53 | } |
54 | 54 | |
55 | - public function asIcons(){ |
|
56 | - foreach ($this->content as $item){ |
|
55 | + public function asIcons() { |
|
56 | + foreach ($this->content as $item) { |
|
57 | 57 | $item->asIcon($item->getContent()); |
58 | 58 | } |
59 | 59 | return $this->addToProperty("class", "icons"); |
60 | 60 | } |
61 | 61 | |
62 | - public function setVertical(){ |
|
62 | + public function setVertical() { |
|
63 | 63 | return $this->addToProperty("class", "vertical"); |
64 | 64 | } |
65 | 65 | |
66 | - public function setLabeled(){ |
|
66 | + public function setLabeled() { |
|
67 | 67 | return $this->addToProperty("class", "labeled icon"); |
68 | 68 | } |
69 | 69 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
92 | 92 | */ |
93 | 93 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
94 | - foreach ( $this->content as $element ) { |
|
94 | + foreach ($this->content as $element) { |
|
95 | 95 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
96 | 96 | } |
97 | 97 | return $this; |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use Ajax\common\JsCode; |
7 | 7 | |
8 | 8 | class SimpleBsComponent extends SimpleComponent { |
9 | - protected $events=array (); |
|
10 | - protected $jsCodes=array (); |
|
9 | + protected $events=array(); |
|
10 | + protected $jsCodes=array(); |
|
11 | 11 | |
12 | 12 | public function addEvent($event, $jsCode) { |
13 | 13 | $this->events [$event]=$jsCode; |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | public function getScript() { |
17 | 17 | parent::getScript(); |
18 | - foreach ( $this->jsCodes as $jsCode ) { |
|
19 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
18 | + foreach ($this->jsCodes as $jsCode) { |
|
19 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
20 | 20 | "identifier" => $this->attachTo |
21 | 21 | )); |
22 | 22 | } |
@@ -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 | * |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (is_array($typeCtrl)) { |
60 | 60 | if (array_search($value, $typeCtrl)===false) |
61 | 61 | throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | if (!$typeCtrl($value)) { |
64 | 64 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key); |
65 | 65 | } |
@@ -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); |
@@ -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 | } |
@@ -9,9 +9,9 @@ |
||
9 | 9 | * @see \Ajax\bootstrap\components\SimpleBsComponent::getScript() |
10 | 10 | */ |
11 | 11 | public function getScript() { |
12 | - $this->jquery_code_for_compile=array (); |
|
13 | - foreach ( $this->jsCodes as $jsCode ) { |
|
14 | - $this->jquery_code_for_compile []=$jsCode->compile(array ( |
|
12 | + $this->jquery_code_for_compile=array(); |
|
13 | + foreach ($this->jsCodes as $jsCode) { |
|
14 | + $this->jquery_code_for_compile []=$jsCode->compile(array( |
|
15 | 15 | "identifier" => $this->attachTo |
16 | 16 | )); |
17 | 17 | } |
@@ -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){ |
@@ -17,42 +17,42 @@ |
||
17 | 17 | use BaseTrait; |
18 | 18 | protected $_popup=NULL; |
19 | 19 | |
20 | - public function __construct($identifier, $tagName="p",$baseClass="ui",$content=NULL) { |
|
20 | + public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
|
21 | 21 | parent::__construct($identifier, $tagName); |
22 | 22 | $this->_baseClass=$baseClass; |
23 | 23 | $this->setClass($baseClass); |
24 | - if(isset($content)){ |
|
24 | + if (isset($content)) { |
|
25 | 25 | $this->content=$content; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | - public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
|
30 | - if(isset($this->_popup)) |
|
31 | - $this->_popup->setAttributes($variation,$popupEvent); |
|
29 | + public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
|
30 | + if (isset($this->_popup)) |
|
31 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
|
35 | - $this->_popup=new InternalPopup($this,$title,$content,$variation,$params); |
|
34 | + public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
|
35 | + $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); |
|
36 | 36 | return $this; |
37 | 37 | } |
38 | 38 | |
39 | - public function addPopupHtml($html="",$variation=NULL,$params=array()){ |
|
39 | + public function addPopupHtml($html="", $variation=NULL, $params=array()) { |
|
40 | 40 | $this->_popup=new InternalPopup($this); |
41 | 41 | $this->_popup->setHtml($html); |
42 | - $this->_popup->setAttributes($variation,$params); |
|
42 | + $this->_popup->setAttributes($variation, $params); |
|
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
46 | - public function compile(JsUtils $js=NULL, View $view=NULL){ |
|
47 | - if(isset($this->_popup)) |
|
46 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
47 | + if (isset($this->_popup)) |
|
48 | 48 | $this->_popup->compile(); |
49 | - return parent::compile($js,$view); |
|
49 | + return parent::compile($js, $view); |
|
50 | 50 | } |
51 | - public function run(JsUtils $js){ |
|
51 | + public function run(JsUtils $js) { |
|
52 | 52 | $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
53 | 53 | parent::run($js); |
54 | 54 | $this->addEventsOnRun($js); |
55 | - if(isset($this->_popup)){ |
|
55 | + if (isset($this->_popup)) { |
|
56 | 56 | $this->_popup->run($js); |
57 | 57 | } |
58 | 58 | return $this->_bsComponent; |