@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\common\html\HtmlDoubleElement; |
6 | 6 | use Ajax\service\JArray; |
7 | -use Ajax\JsUtils; |
|
8 | 7 | |
9 | 8 | /** |
10 | 9 | * Base class for Html collections |
@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | protected $params=array(); |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $identifier |
|
15 | + */ |
|
13 | 16 | public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
14 | 17 | parent::__construct( $identifier, "div", "ui accordion"); |
15 | 18 | } |
@@ -29,6 +32,9 @@ discard block |
||
29 | 32 | return ($value instanceof HtmlAccordionItem)===false; |
30 | 33 | } |
31 | 34 | |
35 | + /** |
|
36 | + * @param string $title |
|
37 | + */ |
|
32 | 38 | public function addPanel($title,$content){ |
33 | 39 | return $this->addItem([$title,$content]); |
34 | 40 | } |
@@ -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 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * @param string $controller a Phalcon controller |
42 | 42 | * @param string $action a Phalcon action |
43 | 43 | */ |
44 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action){ |
|
44 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action) { |
|
45 | 45 | return $this->addPanel($title, $js->forward($initialController, $controller, $action)); |
46 | 46 | } |
47 | 47 | |
@@ -50,22 +50,22 @@ discard block |
||
50 | 50 | * @see BaseHtml::run() |
51 | 51 | */ |
52 | 52 | public function run(JsUtils $js) { |
53 | - if(isset($this->_bsComponent)===false) |
|
54 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
53 | + if (isset($this->_bsComponent)===false) |
|
54 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
55 | 55 | $this->addEventsOnRun($js); |
56 | 56 | return $this->_bsComponent; |
57 | 57 | } |
58 | 58 | |
59 | - public function setStyled(){ |
|
59 | + public function setStyled() { |
|
60 | 60 | return $this->addToProperty("class", "styled"); |
61 | 61 | } |
62 | 62 | |
63 | - public function setActive($index){ |
|
63 | + public function setActive($index) { |
|
64 | 64 | $this->getItem($index)->setActive(true); |
65 | 65 | return $this; |
66 | 66 | } |
67 | 67 | |
68 | - public function setExclusive($value){ |
|
68 | + public function setExclusive($value) { |
|
69 | 69 | $this->params["exclusive"]=$value; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->startIndex=$startIndex; |
52 | 52 | $this->autoActive=$autoActive; |
53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
54 | - $this->_hrefFunction=function ($e) { |
|
54 | + $this->_hrefFunction=function($e) { |
|
55 | 55 | return $e->getContent(); |
56 | 56 | }; |
57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return HtmlBreadcrumbs |
69 | 69 | */ |
70 | 70 | public function autoGetOnClick($targetSelector) { |
71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function setActive($index=null) { |
82 | 82 | if (!isset($index)) { |
83 | - $index=sizeof($this->content) - 1; |
|
83 | + $index=sizeof($this->content)-1; |
|
84 | 84 | } |
85 | 85 | $activeItem=$this->content[$index]; |
86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param Dispatcher $dispatcher the request dispatcher |
94 | 94 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
95 | 95 | */ |
96 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
96 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
97 | 97 | return $this->addItems($js->fromDispatcher($dispatcher)); |
98 | 98 | } |
99 | 99 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | if (!isset($index)) { |
108 | 108 | $index=sizeof($this->content); |
109 | 109 | } |
110 | - if ($this->absolutePaths === true) { |
|
110 | + if ($this->absolutePaths===true) { |
|
111 | 111 | return $this->_hrefFunction($this->content[$index]); |
112 | - } else { |
|
113 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
112 | + }else { |
|
113 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
114 | 114 | return $this->_hrefFunction($e); |
115 | - }, $this->content), $this->startIndex, $index + 1)); |
|
115 | + }, $this->content), $this->startIndex, $index+1)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $this->setActive(); |
147 | 147 | } |
148 | 148 | $count=$this->count(); |
149 | - for($i=1; $i < $count; $i++) { |
|
150 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
149 | + for ($i=1; $i<$count; $i++) { |
|
150 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
151 | 151 | } |
152 | 152 | return parent::compile($js, $view); |
153 | 153 | } |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
158 | 158 | */ |
159 | 159 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
160 | - foreach ( $this->content as $element ) { |
|
160 | + foreach ($this->content as $element) { |
|
161 | 161 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
162 | 162 | } |
163 | 163 | return $this; |
164 | 164 | } |
165 | 165 | |
166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | - foreach ( $this->content as $element ) { |
|
168 | - if ($element->getProperty($this->attr) != NULL) |
|
167 | + foreach ($this->content as $element) { |
|
168 | + if ($element->getProperty($this->attr)!=NULL) |
|
169 | 169 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
170 | 170 | } |
171 | 171 | return $this; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | protected function createItem($value) { |
181 | 181 | $count=$this->count(); |
182 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
182 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
183 | 183 | if (\is_array($value)) |
184 | 184 | $itemO->fromArray($value); |
185 | 185 | else { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | public function addIconAt($icon, $index) { |
192 | 192 | $item=$this->getItem($index); |
193 | 193 | if (isset($item)) { |
194 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
194 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
195 | 195 | $item->wrapContent($icon); |
196 | 196 | } |
197 | 197 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | public function addItem($item) { |
200 | 200 | $count=$this->count(); |
201 | 201 | $itemO=parent::addItem($item); |
202 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
202 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
203 | 203 | $itemO->setProperty($this->attr, $this->getHref($count)); |
204 | 204 | return $itemO; |
205 | 205 | } |
@@ -165,8 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | 167 | foreach ( $this->content as $element ) { |
168 | - if ($element->getProperty($this->attr) != NULL) |
|
169 | - $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
168 | + if ($element->getProperty($this->attr) != NULL) { |
|
169 | + $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
170 | + } |
|
170 | 171 | } |
171 | 172 | return $this; |
172 | 173 | } |
@@ -180,9 +181,9 @@ discard block |
||
180 | 181 | protected function createItem($value) { |
181 | 182 | $count=$this->count(); |
182 | 183 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
183 | - if (\is_array($value)) |
|
184 | - $itemO->fromArray($value); |
|
185 | - else { |
|
184 | + if (\is_array($value)) { |
|
185 | + $itemO->fromArray($value); |
|
186 | + } else { |
|
186 | 187 | $itemO->setContent($value); |
187 | 188 | } |
188 | 189 | return $itemO; |
@@ -5,27 +5,27 @@ discard block |
||
5 | 5 | use Illuminate\Support\Facades\Request; |
6 | 6 | use Illuminate\Support\Facades\App; |
7 | 7 | use Illuminate\Support\Facades\Route; |
8 | -class JsUtils extends \Ajax\JsUtils{ |
|
9 | - public function getUrl($url){ |
|
8 | +class JsUtils extends \Ajax\JsUtils { |
|
9 | + public function getUrl($url) { |
|
10 | 10 | return \url($url); |
11 | 11 | } |
12 | - public function addViewElement($identifier,$content,$view){ |
|
12 | + public function addViewElement($identifier, $content, $view) { |
|
13 | 13 | $controls=$view->__get("q"); |
14 | - if (isset($controls) === false) { |
|
15 | - $controls=array (); |
|
14 | + if (isset($controls)===false) { |
|
15 | + $controls=array(); |
|
16 | 16 | } |
17 | 17 | $controls[$identifier]=$content; |
18 | 18 | $view->__set("q", $controls); |
19 | 19 | } |
20 | 20 | |
21 | - public function createScriptVariable($view,$view_var, $output){ |
|
22 | - $view->__set($view_var,$output); |
|
21 | + public function createScriptVariable($view, $view_var, $output) { |
|
22 | + $view->__set($view_var, $output); |
|
23 | 23 | } |
24 | 24 | |
25 | - public function forward($initialController,$controller,$action){ |
|
25 | + public function forward($initialController, $controller, $action) { |
|
26 | 26 | //\request()->attributes->all() |
27 | - $url=\action($controller.'@'.$action, [],false); |
|
28 | - $request = Request::create($url, 'GET'); |
|
27 | + $url=\action($controller.'@'.$action, [], false); |
|
28 | + $request=Request::create($url, 'GET'); |
|
29 | 29 | // handle the response |
30 | 30 | return Route::dispatch($request)->getContent(); |
31 | 31 | //return App::make($controller)->{$action}(\request()->attributes->all()); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | public function renderContent($view, $controller, $action, $params=NULL) { |
37 | - $template=$view->getRender($controller, $action, $params, function ($view) { |
|
37 | + $template=$view->getRender($controller, $action, $params, function($view) { |
|
38 | 38 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
39 | 39 | }); |
40 | 40 | return $template; |
41 | 41 | } |
42 | 42 | |
43 | - public function fromDispatcher($dispatcher){ |
|
43 | + public function fromDispatcher($dispatcher) { |
|
44 | 44 | return $dispatcher->segments(); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |