@@ -99,12 +99,12 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
102 | - * Adds an image |
|
103 | - * @param string $src |
|
104 | - * @param string $alt |
|
105 | - * @param boolean $before |
|
106 | - * @return HtmlImg |
|
107 | - */ |
|
102 | + * Adds an image |
|
103 | + * @param string $src |
|
104 | + * @param string $alt |
|
105 | + * @param boolean $before |
|
106 | + * @return HtmlImg |
|
107 | + */ |
|
108 | 108 | public function addImage($src, $alt="", $before=true) { |
109 | 109 | $img=new HtmlImg("image-" . $this->identifier, $src, $alt); |
110 | 110 | $img->setClass(""); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | 19 | class HtmlLabel extends HtmlSemDoubleElement { |
20 | - use LabeledIconTrait,HasTimeoutTrait; |
|
20 | + use LabeledIconTrait, HasTimeoutTrait; |
|
21 | 21 | |
22 | 22 | public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
23 | 23 | parent::__construct($identifier, $tagName, "ui label"); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * @return HtmlLabel |
33 | 33 | */ |
34 | 34 | public function setPointing($value=Direction::NONE) { |
35 | - if($value==="left" || $value==="right") |
|
35 | + if ($value==="left" || $value==="right") |
|
36 | 36 | return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
37 | 37 | else |
38 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
38 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing", true)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * @return HtmlLabel |
45 | 45 | */ |
46 | 46 | public function toCorner($side="left") { |
47 | - return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" )); |
|
47 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
48 | 48 | } |
49 | 49 | |
50 | - public function setHorizontal(){ |
|
51 | - return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal")); |
|
50 | + public function setHorizontal() { |
|
51 | + return $this->addToPropertyCtrl("class", "hozizontal", array("horizontal")); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function setFloating(){ |
|
55 | - return $this->addToPropertyCtrl("class", "floating",array("floating")); |
|
54 | + public function setFloating() { |
|
55 | + return $this->addToPropertyCtrl("class", "floating", array("floating")); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | return $this->addToProperty("class", "tag"); |
64 | 64 | } |
65 | 65 | |
66 | - public function setEmpty(){ |
|
66 | + public function setEmpty() { |
|
67 | 67 | $this->content=NULL; |
68 | - return $this->addToPropertyCtrl("class", "empty",array("empty")); |
|
68 | + return $this->addToPropertyCtrl("class", "empty", array("empty")); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function setBasic() { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function addEmphasisImage($src, $alt="", $before=true) { |
83 | 83 | $this->addToProperty("class", "image"); |
84 | - return $this->addImage($src,$alt,$before); |
|
84 | + return $this->addImage($src, $alt, $before); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return HtmlImg |
93 | 93 | */ |
94 | 94 | public function addAvatarImage($src, $alt="", $before=true) { |
95 | - $img=$this->addImage($src,$alt,$before); |
|
95 | + $img=$this->addImage($src, $alt, $before); |
|
96 | 96 | $img->setClass("ui image"); |
97 | 97 | $img->asAvatar(); |
98 | 98 | return $img; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @return HtmlImg |
107 | 107 | */ |
108 | 108 | public function addImage($src, $alt="", $before=true) { |
109 | - $img=new HtmlImg("image-" . $this->identifier, $src, $alt); |
|
109 | + $img=new HtmlImg("image-".$this->identifier, $src, $alt); |
|
110 | 110 | $img->setClass(""); |
111 | 111 | $this->addContent($img, $before); |
112 | 112 | return $img; |
@@ -118,21 +118,21 @@ discard block |
||
118 | 118 | * @return HtmlDoubleElement |
119 | 119 | */ |
120 | 120 | public function addDetail($detail) { |
121 | - $div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail"); |
|
121 | + $div=new HtmlSemDoubleElement("detail-".$this->identifier, $this->tagName, "detail"); |
|
122 | 122 | $div->setContent($detail); |
123 | 123 | $this->addContent($div); |
124 | 124 | return $div; |
125 | 125 | } |
126 | 126 | |
127 | 127 | public function asRibbon($direction=Direction::NONE) { |
128 | - return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" )); |
|
128 | + return $this->addToPropertyCtrl("class", $direction." ribbon", array("ribbon", "right ribbon", "left ribbon")); |
|
129 | 129 | } |
130 | 130 | |
131 | - public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
|
132 | - if($direction!==Direction::NONE) |
|
133 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
131 | + public function setAttached($side=Side::TOP, $direction=Direction::NONE) { |
|
132 | + if ($direction!==Direction::NONE) |
|
133 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached", Side::getConstantValues($direction." attached")); |
|
134 | 134 | else |
135 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
135 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public static function ribbon($identifier, $caption) { |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") { |
23 | 23 | parent::__construct($identifier, $tagName, "ui label"); |
24 | 24 | $this->content=$caption; |
25 | - if (isset($icon)) |
|
26 | - $this->addIcon($icon); |
|
25 | + if (isset($icon)) { |
|
26 | + $this->addIcon($icon); |
|
27 | + } |
|
27 | 28 | } |
28 | 29 | |
29 | 30 | /** |
@@ -32,10 +33,11 @@ discard block |
||
32 | 33 | * @return HtmlLabel |
33 | 34 | */ |
34 | 35 | public function setPointing($value=Direction::NONE) { |
35 | - if($value==="left" || $value==="right") |
|
36 | - return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
37 | - else |
|
38 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
36 | + if($value==="left" || $value==="right") { |
|
37 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
38 | + } else { |
|
39 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
40 | + } |
|
39 | 41 | } |
40 | 42 | |
41 | 43 | /** |
@@ -129,10 +131,11 @@ discard block |
||
129 | 131 | } |
130 | 132 | |
131 | 133 | public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
132 | - if($direction!==Direction::NONE) |
|
133 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
134 | - else |
|
135 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
134 | + if($direction!==Direction::NONE) { |
|
135 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
136 | + } else { |
|
137 | + return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
138 | + } |
|
136 | 139 | } |
137 | 140 | |
138 | 141 | public static function ribbon($identifier, $caption) { |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * @param string $tagName container tagName |
177 | 177 | * @return HtmlListgroup |
178 | 178 | */ |
179 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
180 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
179 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
180 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
181 | 181 | $listGroup->addItems($items); |
182 | 182 | return $this->addHtmlComponent($listGroup); |
183 | 183 | } |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | * @param string $onClick |
203 | 203 | * @return HtmlSplitbutton |
204 | 204 | */ |
205 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
206 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
205 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
206 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @param string $identifier |
212 | 212 | * @return HtmlInputgroup |
213 | 213 | */ |
214 | - public function htmlInputgroup($identifier){ |
|
214 | + public function htmlInputgroup($identifier) { |
|
215 | 215 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
216 | 216 | } |
217 | 217 | |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
224 | 224 | * @return HtmlBreadcrumbs |
225 | 225 | */ |
226 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
227 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$startIndex,$hrefFunction)); |
|
226 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
227 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $startIndex, $hrefFunction)); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @param int $active The active page |
237 | 237 | * @return HtmlPagination |
238 | 238 | */ |
239 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
240 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
239 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
240 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param int $numCols |
249 | 249 | * @return HtmlGridSystem |
250 | 250 | */ |
251 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
252 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
251 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
252 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
253 | 253 | } |
254 | 254 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class HtmlLabelGroups extends HtmlSemCollection { |
17 | 17 | |
18 | - public function __construct($identifier,$labels=array(), $attributes=array()) { |
|
18 | + public function __construct($identifier, $labels=array(), $attributes=array()) { |
|
19 | 19 | parent::__construct($identifier, "div", "ui labels"); |
20 | - $this->_states=\array_merge(Size::getConstants(),Color::getConstants(),["tag","circular"]); |
|
20 | + $this->_states=\array_merge(Size::getConstants(), Color::getConstants(), ["tag", "circular"]); |
|
21 | 21 | $this->addItems($labels); |
22 | 22 | $this->setStates($attributes); |
23 | 23 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | $icon=JArray::getValue($value, "icon", 1); |
32 | 32 | $tagName=JArray::getValue($value, "tagName", 2); |
33 | 33 | } |
34 | - $labelO=new HtmlLabel("label-" . $this->identifier, $caption,$icon,$tagName); |
|
34 | + $labelO=new HtmlLabel("label-".$this->identifier, $caption, $icon, $tagName); |
|
35 | 35 | return $labelO; |
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function createCondition($value) { |
39 | - return ($value instanceof HtmlLabel) === false; |
|
39 | + return ($value instanceof HtmlLabel)===false; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | } |
@@ -14,11 +14,11 @@ |
||
14 | 14 | class HtmlContainer extends HtmlSemDoubleElement { |
15 | 15 | use TextAlignmentTrait; |
16 | 16 | public function __construct($identifier, $content="") { |
17 | - parent::__construct($identifier, "div","ui container"); |
|
17 | + parent::__construct($identifier, "div", "ui container"); |
|
18 | 18 | $this->content=$content; |
19 | 19 | } |
20 | 20 | |
21 | - public function asText(){ |
|
21 | + public function asText() { |
|
22 | 22 | return $this->addToProperty("class", "text"); |
23 | 23 | } |
24 | 24 | } |
@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | use Ajax\JsUtils; |
11 | 11 | |
12 | 12 | class HtmlInput extends HtmlSemDoubleElement { |
13 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
13 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
14 | 14 | |
15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
17 | 17 | $this->_identifier=$identifier; |
18 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
19 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
20 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
18 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
19 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
20 | + $this->_variations=[Variation::TRANSPARENT]; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function getField() { |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | |
38 | 38 | public function run(JsUtils $js) { |
39 | 39 | $result=parent::run($js); |
40 | - $result->attach("#" . $this->getDataField()->getIdentifier()); |
|
40 | + $result->attach("#".$this->getDataField()->getIdentifier()); |
|
41 | 41 | return $result; |
42 | 42 | } |
43 | 43 | |
44 | - public function setTransparent(){ |
|
44 | + public function setTransparent() { |
|
45 | 45 | return $this->addToProperty("class", "transparent"); |
46 | 46 | } |
47 | 47 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return HtmlDivider |
24 | 24 | */ |
25 | 25 | public function setVertical() { |
26 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical","horizontal" )); |
|
26 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical", "horizontal")); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return HtmlDivider |
32 | 32 | */ |
33 | 33 | public function setHorizontal() { |
34 | - return $this->addToPropertyCtrl("class", "horizontal", array ("vertical","horizontal" )); |
|
34 | + return $this->addToPropertyCtrl("class", "horizontal", array("vertical", "horizontal")); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * @return HtmlDivider |
63 | 63 | */ |
64 | - public function setIgnored(){ |
|
64 | + public function setIgnored() { |
|
65 | 65 | return $this->addToProperty("class", "ignored"); |
66 | 66 | } |
67 | 67 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | $this->setLabel($label); |
20 | 20 | } |
21 | 21 | |
22 | - public function setChecked($value=true){ |
|
23 | - if($value===true){ |
|
22 | + public function setChecked($value=true) { |
|
23 | + if ($value===true) { |
|
24 | 24 | $this->getField()->setProperty("checked", "checked"); |
25 | - }else{ |
|
25 | + } else { |
|
26 | 26 | $this->getField()->removeProperty("checked"); |
27 | 27 | } |
28 | 28 | return $this; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
85 | 85 | */ |
86 | 86 | public function attachEvent($selector, $action=NULL) { |
87 | - if (isset($action)||\is_numeric($action)===true) { |
|
87 | + if (isset($action) || \is_numeric($action)===true) { |
|
88 | 88 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
89 | 89 | } else { |
90 | 90 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function attachEvents($events=array()) { |
102 | 102 | if (\is_array($events)) { |
103 | - foreach ( $events as $action => $selector ) { |
|
103 | + foreach ($events as $action => $selector) { |
|
104 | 104 | $this->attachEvent($selector, $action); |
105 | 105 | } |
106 | 106 | } |
@@ -111,24 +111,24 @@ discard block |
||
111 | 111 | return $this->addToProperty("class", "fitted"); |
112 | 112 | } |
113 | 113 | |
114 | - public function setOnChecked($jsCode){ |
|
114 | + public function setOnChecked($jsCode) { |
|
115 | 115 | $this->_params["onChecked"]=$jsCode; |
116 | 116 | return $this; |
117 | 117 | } |
118 | 118 | |
119 | - public function setOnUnchecked($jsCode){ |
|
119 | + public function setOnUnchecked($jsCode) { |
|
120 | 120 | $this->_params["onUnchecked"]=$jsCode; |
121 | 121 | return $this; |
122 | 122 | } |
123 | 123 | |
124 | - public function setOnChange($jsCode){ |
|
124 | + public function setOnChange($jsCode) { |
|
125 | 125 | $this->_params["onChange"]=$jsCode; |
126 | 126 | return $this; |
127 | 127 | } |
128 | 128 | |
129 | 129 | public function run(JsUtils $js) { |
130 | - if(!isset($this->_bsComponent)) |
|
131 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
130 | + if (!isset($this->_bsComponent)) |
|
131 | + $this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params); |
|
132 | 132 | return parent::run($js); |
133 | 133 | } |
134 | 134 | } |
@@ -15,14 +15,15 @@ discard block |
||
15 | 15 | $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
16 | 16 | $field->setProperty("name", $name); |
17 | 17 | $this->setField($field); |
18 | - if (isset($label)) |
|
19 | - $this->setLabel($label); |
|
18 | + if (isset($label)) { |
|
19 | + $this->setLabel($label); |
|
20 | + } |
|
20 | 21 | } |
21 | 22 | |
22 | 23 | public function setChecked($value=true){ |
23 | 24 | if($value===true){ |
24 | 25 | $this->getField()->setProperty("checked", "checked"); |
25 | - }else{ |
|
26 | + } else{ |
|
26 | 27 | $this->getField()->removeProperty("checked"); |
27 | 28 | } |
28 | 29 | return $this; |
@@ -51,8 +52,9 @@ discard block |
||
51 | 52 | * @return mixed |
52 | 53 | */ |
53 | 54 | public function getLabel() { |
54 | - if (\array_key_exists("label", $this->content)) |
|
55 | - return $this->content["label"]; |
|
55 | + if (\array_key_exists("label", $this->content)) { |
|
56 | + return $this->content["label"]; |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | /** |
@@ -127,8 +129,9 @@ discard block |
||
127 | 129 | } |
128 | 130 | |
129 | 131 | public function run(JsUtils $js) { |
130 | - if(!isset($this->_bsComponent)) |
|
131 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
132 | + if(!isset($this->_bsComponent)) { |
|
133 | + $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
134 | + } |
|
132 | 135 | return parent::run($js); |
133 | 136 | } |
134 | 137 | } |
@@ -67,8 +67,9 @@ discard block |
||
67 | 67 | if($index<$menu->count()){ |
68 | 68 | if(isset($this->content[$index])===false){ |
69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
70 | - }else |
|
71 | - $this->content[$index]->setContent($content); |
|
70 | + } else { |
|
71 | + $this->content[$index]->setContent($content); |
|
72 | + } |
|
72 | 73 | } |
73 | 74 | return $this; |
74 | 75 | } |
@@ -231,15 +232,17 @@ discard block |
||
231 | 232 | * @see BaseHtml::run() |
232 | 233 | */ |
233 | 234 | public function run(JsUtils $js) { |
234 | - if(isset($this->_bsComponent)===false) |
|
235 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
235 | + if(isset($this->_bsComponent)===false) { |
|
236 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
237 | + } |
|
236 | 238 | $this->addEventsOnRun($js); |
237 | 239 | return $this->_bsComponent; |
238 | 240 | } |
239 | 241 | |
240 | 242 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
241 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
242 | - $this->activate(0); |
|
243 | + if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) { |
|
244 | + $this->activate(0); |
|
245 | + } |
|
243 | 246 | return parent::compile($js,$view); |
244 | 247 | } |
245 | 248 | } |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * @author jc |
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | -class HtmlTab extends HtmlSemCollection{ |
|
17 | +class HtmlTab extends HtmlSemCollection { |
|
18 | 18 | |
19 | 19 | protected $params=[]; |
20 | 20 | |
21 | - public function __construct( $identifier, $tabs=array()){ |
|
22 | - parent::__construct( $identifier, "div", ""); |
|
21 | + public function __construct($identifier, $tabs=array()) { |
|
22 | + parent::__construct($identifier, "div", ""); |
|
23 | 23 | $menu=new HtmlMenu("menu".$this->identifier); |
24 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
24 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
25 | 25 | $this->content["menu"]=$menu; |
26 | 26 | $this->addItems($tabs); |
27 | 27 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * @see \Ajax\common\html\HtmlCollection::createItem() |
32 | 32 | * @return HtmlSegment |
33 | 33 | */ |
34 | - protected function createItem($value){ |
|
34 | + protected function createItem($value) { |
|
35 | 35 | $count=$this->count(); |
36 | 36 | $title=$value; |
37 | 37 | $content=NULL; |
38 | - if(\is_array($value)){ |
|
39 | - $title=@$value[0];$content=@$value[1]; |
|
38 | + if (\is_array($value)) { |
|
39 | + $title=@$value[0]; $content=@$value[1]; |
|
40 | 40 | } |
41 | 41 | $menuItem=$this->content["menu"]->addItem($title); |
42 | 42 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @param string $datatab |
53 | 53 | * @return \Ajax\semantic\html\elements\HtmlSegment |
54 | 54 | */ |
55 | - private function createSegment($count,$content,$datatab){ |
|
55 | + private function createSegment($count, $content, $datatab) { |
|
56 | 56 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
57 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab); |
|
57 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab); |
|
58 | 58 | return $segment; |
59 | 59 | } |
60 | 60 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | * @param String $content new content |
65 | 65 | * @return \Ajax\semantic\html\modules\HtmlTab |
66 | 66 | */ |
67 | - public function setTabContent($index,$content){ |
|
67 | + public function setTabContent($index, $content) { |
|
68 | 68 | $menu=$this->content["menu"]; |
69 | - if($index<$menu->count()){ |
|
70 | - if(isset($this->content[$index])===false){ |
|
69 | + if ($index<$menu->count()) { |
|
70 | + if (isset($this->content[$index])===false) { |
|
71 | 71 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
72 | - }else |
|
72 | + } else |
|
73 | 73 | $this->content[$index]->setContent($content); |
74 | 74 | } |
75 | 75 | return $this; |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @param array $contents |
81 | 81 | * @return \Ajax\semantic\html\modules\HtmlTab |
82 | 82 | */ |
83 | - public function setTabsContent($contents){ |
|
83 | + public function setTabsContent($contents) { |
|
84 | 84 | $size=\sizeof($contents); |
85 | - for($i=0;$i<$size;$i++){ |
|
85 | + for ($i=0; $i<$size; $i++) { |
|
86 | 86 | $this->setTabContent($i, $contents[$i]); |
87 | 87 | } |
88 | 88 | return $this; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param int $index |
94 | 94 | * @return \Ajax\semantic\html\modules\HtmlTab |
95 | 95 | */ |
96 | - public function activate($index){ |
|
96 | + public function activate($index) { |
|
97 | 97 | $this->content["menu"]->getItem($index)->setActive(true); |
98 | 98 | $this->content[$index]->setActive(true); |
99 | 99 | return $this; |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | * @param string $content |
106 | 106 | * @return \Ajax\semantic\html\elements\HtmlSegment |
107 | 107 | */ |
108 | - public function addTab($title,$content){ |
|
109 | - return $this->addItem([$title,$content]); |
|
108 | + public function addTab($title, $content) { |
|
109 | + return $this->addItem([$title, $content]); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | * @param array $params |
121 | 121 | * @return \Ajax\semantic\html\elements\HtmlSegment |
122 | 122 | */ |
123 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
124 | - if(\array_key_exists($index, $this->content)){ |
|
125 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
123 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
124 | + if (\array_key_exists($index, $this->content)) { |
|
125 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
126 | 126 | return $this->content[$index]; |
127 | 127 | } |
128 | 128 | |
129 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
129 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | * @param $params The parameters to pass to the view |
140 | 140 | * @return \Ajax\semantic\html\elements\HtmlSegment |
141 | 141 | */ |
142 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
143 | - if(\array_key_exists($index, $this->content)){ |
|
144 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
142 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
143 | + if (\array_key_exists($index, $this->content)) { |
|
144 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
145 | 145 | return $this->content[$index]; |
146 | 146 | } |
147 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
147 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -158,11 +158,11 @@ discard block |
||
158 | 158 | * @param array $params |
159 | 159 | * @return \Ajax\semantic\html\elements\HtmlSegment |
160 | 160 | */ |
161 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
161 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
162 | 162 | \ob_start(); |
163 | - $js->forward($initialController, $controller, $action,$params); |
|
163 | + $js->forward($initialController, $controller, $action, $params); |
|
164 | 164 | $content=\ob_get_clean(); |
165 | - return $this->addTab($title,$content); |
|
165 | + return $this->addTab($title, $content); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @param $params The parameters to pass to the view |
175 | 175 | * @return \Ajax\semantic\html\elements\HtmlSegment |
176 | 176 | */ |
177 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
178 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
177 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
178 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | public function setPointing($value=Direction::NONE) { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param int $index |
192 | 192 | * @return Ajax\semantic\html\content\HtmlMenuItem |
193 | 193 | */ |
194 | - public function getMenuTab($index){ |
|
194 | + public function getMenuTab($index) { |
|
195 | 195 | return $this->content["menu"]->getItem($index); |
196 | 196 | } |
197 | 197 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param int $index |
201 | 201 | * @return HtmlSegment |
202 | 202 | */ |
203 | - public function getTab($index){ |
|
203 | + public function getTab($index) { |
|
204 | 204 | return $this->content[$index]; |
205 | 205 | } |
206 | 206 | |
@@ -209,22 +209,22 @@ discard block |
||
209 | 209 | * @param HtmlMenu $menu |
210 | 210 | * @return \Ajax\semantic\html\modules\HtmlTab |
211 | 211 | */ |
212 | - public function setMenu($menu){ |
|
212 | + public function setMenu($menu) { |
|
213 | 213 | $contentSize=\sizeof($this->content); |
214 | - for($i=0;$i<$contentSize;$i++){ |
|
215 | - if($menu->getItem($i)!==NULL){ |
|
216 | - if(isset($this->content[$i])){ |
|
217 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
214 | + for ($i=0; $i<$contentSize; $i++) { |
|
215 | + if ($menu->getItem($i)!==NULL) { |
|
216 | + if (isset($this->content[$i])) { |
|
217 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | } |
221 | 221 | $menuSize=$menu->count(); |
222 | - for($i=0;$i<$menuSize;$i++){ |
|
222 | + for ($i=0; $i<$menuSize; $i++) { |
|
223 | 223 | $menu->getItem($i)->removeProperty("href"); |
224 | - if(isset($this->content[$i])===false){ |
|
224 | + if (isset($this->content[$i])===false) { |
|
225 | 225 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
226 | 226 | } |
227 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
227 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | $this->content["menu"]=$menu; |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | * @see BaseHtml::run() |
237 | 237 | */ |
238 | 238 | public function run(JsUtils $js) { |
239 | - if(isset($this->_bsComponent)===false) |
|
240 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
239 | + if (isset($this->_bsComponent)===false) |
|
240 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
241 | 241 | $this->addEventsOnRun($js); |
242 | 242 | return $this->_bsComponent; |
243 | 243 | } |
244 | 244 | |
245 | 245 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
246 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
246 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
247 | 247 | $this->activate(0); |
248 | - return parent::compile($js,$view); |
|
248 | + return parent::compile($js, $view); |
|
249 | 249 | } |
250 | 250 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @param int $max |
14 | 14 | * @param string $icon star or heart |
15 | 15 | */ |
16 | - public function __construct($identifier, $value,$max=5,$icon="") { |
|
16 | + public function __construct($identifier, $value, $max=5, $icon="") { |
|
17 | 17 | parent::__construct($identifier, "div", "ui {$icon} rating"); |
18 | 18 | $this->setValue($value); |
19 | 19 | $this->setMax($max); |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * {@inheritDoc} |
24 | 24 | * @see \Ajax\common\html\HtmlDoubleElement::setValue() |
25 | 25 | */ |
26 | - public function setValue($value){ |
|
26 | + public function setValue($value) { |
|
27 | 27 | $this->setProperty("data-rating", $value); |
28 | 28 | } |
29 | 29 | |
30 | - public function setMax($max){ |
|
30 | + public function setMax($max) { |
|
31 | 31 | $this->setProperty("data-max-rating", $max); |
32 | 32 | } |
33 | 33 | |
@@ -35,21 +35,21 @@ discard block |
||
35 | 35 | * {@inheritDoc} |
36 | 36 | * @see HtmlSemDoubleElement::run() |
37 | 37 | */ |
38 | - public function run(JsUtils $js){ |
|
38 | + public function run(JsUtils $js) { |
|
39 | 39 | parent::run($js); |
40 | - return $js->semantic()->rating("#".$this->identifier,$this->_params); |
|
40 | + return $js->semantic()->rating("#".$this->identifier, $this->_params); |
|
41 | 41 | } |
42 | 42 | |
43 | - public function asStar(){ |
|
43 | + public function asStar() { |
|
44 | 44 | return $this->setIcon(); |
45 | 45 | } |
46 | 46 | |
47 | - public function asHeart(){ |
|
47 | + public function asHeart() { |
|
48 | 48 | return $this->setIcon("heart"); |
49 | 49 | } |
50 | 50 | |
51 | - public function setIcon($icon="star"){ |
|
52 | - return $this->addToPropertyCtrl("class", $icon, ["star","heart",""]); |
|
51 | + public function setIcon($icon="star") { |
|
52 | + return $this->addToPropertyCtrl("class", $icon, ["star", "heart", ""]); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |