@@ -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 | } |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | public function __construct($identifier,$context=NULL,$content=NULL) { |
11 | 11 | parent::__construct($identifier, "div", "ui sticky", $content); |
12 | - if(isset($content)) |
|
13 | - $this->setContext($context); |
|
12 | + if(isset($content)) { |
|
13 | + $this->setContext($context); |
|
14 | + } |
|
14 | 15 | } |
15 | 16 | |
16 | 17 | public function setContext($context){ |
@@ -20,15 +21,17 @@ discard block |
||
20 | 21 | |
21 | 22 | public function setFixed($value=NULL){ |
22 | 23 | $fixed="fixed"; |
23 | - if(isset($value)) |
|
24 | - $fixed.=" ".$value; |
|
24 | + if(isset($value)) { |
|
25 | + $fixed.=" ".$value; |
|
26 | + } |
|
25 | 27 | return $this->addToProperty("class",$fixed); |
26 | 28 | } |
27 | 29 | |
28 | 30 | public function setBound($value=NULL){ |
29 | 31 | $bound="bound"; |
30 | - if(isset($value)) |
|
31 | - $bound.=" ".$value; |
|
32 | + if(isset($value)) { |
|
33 | + $bound.=" ".$value; |
|
34 | + } |
|
32 | 35 | return $this->addToProperty("class",$bound); |
33 | 36 | } |
34 | 37 | |
@@ -50,8 +53,9 @@ discard block |
||
50 | 53 | |
51 | 54 | public function setDebug($verbose=NULL){ |
52 | 55 | $this->_params["debug"]=true; |
53 | - if(isset($verbose)) |
|
54 | - $this->_params["verbose"]=true; |
|
56 | + if(isset($verbose)) { |
|
57 | + $this->_params["verbose"]=true; |
|
58 | + } |
|
55 | 59 | return $this; |
56 | 60 | } |
57 | 61 | } |
@@ -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=array("debug"=>true); |
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()); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @param string $datatab |
51 | 51 | * @return \Ajax\semantic\html\elements\HtmlSegment |
52 | 52 | */ |
53 | - private function createSegment($count,$content,$datatab){ |
|
53 | + private function createSegment($count, $content, $datatab) { |
|
54 | 54 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
55 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab); |
|
55 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab); |
|
56 | 56 | return $segment; |
57 | 57 | } |
58 | 58 | |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | * @param String $content new content |
63 | 63 | * @return \Ajax\semantic\html\modules\HtmlTab |
64 | 64 | */ |
65 | - public function setTabContent($index,$content){ |
|
65 | + public function setTabContent($index, $content) { |
|
66 | 66 | $menu=$this->content["menu"]; |
67 | - if($index<$menu->count()){ |
|
68 | - if(isset($this->content[$index])===false){ |
|
67 | + if ($index<$menu->count()) { |
|
68 | + if (isset($this->content[$index])===false) { |
|
69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
70 | - }else |
|
70 | + } else |
|
71 | 71 | $this->content[$index]->setContent($content); |
72 | 72 | } |
73 | 73 | return $this; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @param array $contents |
79 | 79 | * @return \Ajax\semantic\html\modules\HtmlTab |
80 | 80 | */ |
81 | - public function setTabsContent($contents){ |
|
81 | + public function setTabsContent($contents) { |
|
82 | 82 | $size=\sizeof($contents); |
83 | - for($i=0;$i<$size;$i++){ |
|
83 | + for ($i=0; $i<$size; $i++) { |
|
84 | 84 | $this->setTabContent($i, $contents[$i]); |
85 | 85 | } |
86 | 86 | return $this; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param int $index |
92 | 92 | * @return \Ajax\semantic\html\modules\HtmlTab |
93 | 93 | */ |
94 | - public function activate($index){ |
|
94 | + public function activate($index) { |
|
95 | 95 | $this->content["menu"]->getItem($index)->setActive(true); |
96 | 96 | $this->content[$index]->setActive(true); |
97 | 97 | return $this; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @param string $content |
104 | 104 | * @return \Ajax\semantic\html\elements\HtmlSegment |
105 | 105 | */ |
106 | - public function addTab($title,$content){ |
|
107 | - return $this->addItem([$title,$content]); |
|
106 | + public function addTab($title, $content) { |
|
107 | + return $this->addItem([$title, $content]); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | * @param array $params |
119 | 119 | * @return \Ajax\semantic\html\elements\HtmlSegment |
120 | 120 | */ |
121 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
122 | - if(\array_key_exists($index, $this->content)){ |
|
123 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
121 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
122 | + if (\array_key_exists($index, $this->content)) { |
|
123 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
124 | 124 | return $this->content[$index]; |
125 | 125 | } |
126 | 126 | |
127 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
127 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | * @param $params The parameters to pass to the view |
138 | 138 | * @return \Ajax\semantic\html\elements\HtmlSegment |
139 | 139 | */ |
140 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
141 | - if(\array_key_exists($index, $this->content)){ |
|
142 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
140 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
141 | + if (\array_key_exists($index, $this->content)) { |
|
142 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
143 | 143 | return $this->content[$index]; |
144 | 144 | } |
145 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
145 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @param array $params |
157 | 157 | * @return \Ajax\semantic\html\elements\HtmlSegment |
158 | 158 | */ |
159 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
160 | - return $this->addTab($title, $js->forward($initialController, $controller, $action,$params)); |
|
159 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
160 | + return $this->addTab($title, $js->forward($initialController, $controller, $action, $params)); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @param $params The parameters to pass to the view |
170 | 170 | * @return \Ajax\semantic\html\elements\HtmlSegment |
171 | 171 | */ |
172 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
173 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
172 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
173 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | public function setPointing($value=Direction::NONE) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param int $index |
187 | 187 | * @return Ajax\semantic\html\content\HtmlMenuItem |
188 | 188 | */ |
189 | - public function getMenuTab($index){ |
|
189 | + public function getMenuTab($index) { |
|
190 | 190 | return $this->content["menu"]->getItem($index); |
191 | 191 | } |
192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param int $index |
196 | 196 | * @return HtmlSegment |
197 | 197 | */ |
198 | - public function getTab($index){ |
|
198 | + public function getTab($index) { |
|
199 | 199 | return $this->content[$index]; |
200 | 200 | } |
201 | 201 | |
@@ -204,22 +204,22 @@ discard block |
||
204 | 204 | * @param HtmlMenu $menu |
205 | 205 | * @return \Ajax\semantic\html\modules\HtmlTab |
206 | 206 | */ |
207 | - public function setMenu($menu){ |
|
207 | + public function setMenu($menu) { |
|
208 | 208 | $contentSize=\sizeof($this->content); |
209 | - for($i=0;$i<$contentSize;$i++){ |
|
210 | - if($menu->getItem($i)!==NULL){ |
|
211 | - if(isset($this->content[$i])){ |
|
212 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
209 | + for ($i=0; $i<$contentSize; $i++) { |
|
210 | + if ($menu->getItem($i)!==NULL) { |
|
211 | + if (isset($this->content[$i])) { |
|
212 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | 216 | $menuSize=$menu->count(); |
217 | - for($i=0;$i<$menuSize;$i++){ |
|
217 | + for ($i=0; $i<$menuSize; $i++) { |
|
218 | 218 | $menu->getItem($i)->removeProperty("href"); |
219 | - if(isset($this->content[$i])===false){ |
|
219 | + if (isset($this->content[$i])===false) { |
|
220 | 220 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
221 | 221 | } |
222 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
222 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | $this->content["menu"]=$menu; |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | * @see BaseHtml::run() |
232 | 232 | */ |
233 | 233 | public function run(JsUtils $js) { |
234 | - if(isset($this->_bsComponent)===false) |
|
235 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
234 | + if (isset($this->_bsComponent)===false) |
|
235 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
236 | 236 | $this->addEventsOnRun($js); |
237 | 237 | return $this->_bsComponent; |
238 | 238 | } |
239 | 239 | |
240 | 240 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
241 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
241 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
242 | 242 | $this->activate(0); |
243 | - return parent::compile($js,$view); |
|
243 | + return parent::compile($js, $view); |
|
244 | 244 | } |
245 | 245 | } |
@@ -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 | } |
@@ -6,31 +6,31 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
9 | +class HtmlAccordion extends HtmlSemCollection { |
|
10 | 10 | |
11 | 11 | protected $params=array(); |
12 | 12 | |
13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
18 | + protected function createItem($value) { |
|
19 | 19 | $count=$this->count(); |
20 | 20 | $title=$value; |
21 | 21 | $content=NULL; |
22 | - if(\is_array($value)){ |
|
23 | - $title=@$value[0];$content=@$value[1]; |
|
22 | + if (\is_array($value)) { |
|
23 | + $title=@$value[0]; $content=@$value[1]; |
|
24 | 24 | } |
25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
26 | 26 | } |
27 | 27 | |
28 | - protected function createCondition($value){ |
|
28 | + protected function createCondition($value) { |
|
29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
30 | 30 | } |
31 | 31 | |
32 | - public function addPanel($title,$content){ |
|
33 | - return $this->addItem([$title,$content]); |
|
32 | + public function addPanel($title, $content) { |
|
33 | + return $this->addItem([$title, $content]); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $action a Phalcon action |
43 | 43 | * @param array $params |
44 | 44 | */ |
45 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
46 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
45 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
46 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -54,30 +54,30 @@ discard block |
||
54 | 54 | * @param string $viewName |
55 | 55 | * @param $params The parameters to pass to the view |
56 | 56 | */ |
57 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
58 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
57 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
58 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
59 | 59 | } |
60 | 60 | /* |
61 | 61 | * (non-PHPdoc) |
62 | 62 | * @see BaseHtml::run() |
63 | 63 | */ |
64 | 64 | public function run(JsUtils $js) { |
65 | - if(isset($this->_bsComponent)===false) |
|
66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
65 | + if (isset($this->_bsComponent)===false) |
|
66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
67 | 67 | $this->addEventsOnRun($js); |
68 | 68 | return $this->_bsComponent; |
69 | 69 | } |
70 | 70 | |
71 | - public function setStyled(){ |
|
71 | + public function setStyled() { |
|
72 | 72 | return $this->addToProperty("class", "styled"); |
73 | 73 | } |
74 | 74 | |
75 | - public function activate($index){ |
|
75 | + public function activate($index) { |
|
76 | 76 | $this->getItem($index)->setActive(true); |
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | - public function setExclusive($value){ |
|
80 | + public function setExclusive($value) { |
|
81 | 81 | $this->params["exclusive"]=$value; |
82 | 82 | } |
83 | 83 | } |