@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | use Ajax\semantic\html\base\constants\Side; |
8 | 8 | use Ajax\JsUtils; |
9 | 9 | |
10 | -class HtmlTab extends HtmlSemCollection{ |
|
10 | +class HtmlTab extends HtmlSemCollection { |
|
11 | 11 | protected $params=array("debug"=>true); |
12 | 12 | |
13 | - public function __construct( $identifier, $tabs=array()){ |
|
14 | - parent::__construct( $identifier, "div", ""); |
|
13 | + public function __construct($identifier, $tabs=array()) { |
|
14 | + parent::__construct($identifier, "div", ""); |
|
15 | 15 | $menu=new HtmlMenu("menu".$this->identifier); |
16 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
16 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
17 | 17 | $this->content["menu"]=$menu; |
18 | 18 | $this->addItems($tabs); |
19 | 19 | } |
20 | 20 | |
21 | - protected function createItem($value){ |
|
21 | + protected function createItem($value) { |
|
22 | 22 | $count=$this->count(); |
23 | 23 | $title=$value; |
24 | 24 | $content=NULL; |
25 | - if(\is_array($value)){ |
|
26 | - $title=@$value[0];$content=@$value[1]; |
|
25 | + if (\is_array($value)) { |
|
26 | + $title=@$value[0]; $content=@$value[1]; |
|
27 | 27 | } |
28 | 28 | $menuItem=$this->content["menu"]->addItem($title); |
29 | 29 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
30 | 30 | $menuItem->removeProperty("href"); |
31 | 31 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
32 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$menuItem->getIdentifier()); |
|
32 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $menuItem->getIdentifier()); |
|
33 | 33 | return $segment; |
34 | 34 | } |
35 | 35 | |
36 | - public function activate($index){ |
|
36 | + public function activate($index) { |
|
37 | 37 | $this->content["menu"]->getItem($index)->setActive(true); |
38 | 38 | $this->content[$index]->setActive(true); |
39 | 39 | return $this; |
40 | 40 | } |
41 | 41 | |
42 | - public function addPanel($title,$content){ |
|
43 | - return $this->addItem([$title,$content]); |
|
42 | + public function addPanel($title, $content) { |
|
43 | + return $this->addItem([$title, $content]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param string $action a Phalcon action |
53 | 53 | * @param array $params |
54 | 54 | */ |
55 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
56 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
55 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
56 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param string $viewName |
65 | 65 | * @param $params The parameters to pass to the view |
66 | 66 | */ |
67 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
68 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
67 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
68 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /* |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * @see BaseHtml::run() |
74 | 74 | */ |
75 | 75 | public function run(JsUtils $js) { |
76 | - if(isset($this->_bsComponent)===false) |
|
77 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
76 | + if (isset($this->_bsComponent)===false) |
|
77 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
78 | 78 | $this->addEventsOnRun($js); |
79 | 79 | return $this->_bsComponent; |
80 | 80 | } |
81 | 81 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
82 | - if($this->content["menu"]->count()>0) |
|
82 | + if ($this->content["menu"]->count()>0) |
|
83 | 83 | $this->activate(0); |
84 | - return parent::compile($js,$view); |
|
84 | + return parent::compile($js, $view); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | \ No newline at end of file |
@@ -73,14 +73,16 @@ |
||
73 | 73 | * @see BaseHtml::run() |
74 | 74 | */ |
75 | 75 | public function run(JsUtils $js) { |
76 | - if(isset($this->_bsComponent)===false) |
|
77 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
76 | + if(isset($this->_bsComponent)===false) { |
|
77 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
78 | + } |
|
78 | 79 | $this->addEventsOnRun($js); |
79 | 80 | return $this->_bsComponent; |
80 | 81 | } |
81 | 82 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
82 | - if($this->content["menu"]->count()>0) |
|
83 | - $this->activate(0); |
|
83 | + if($this->content["menu"]->count()>0) { |
|
84 | + $this->activate(0); |
|
85 | + } |
|
84 | 86 | return parent::compile($js,$view); |
85 | 87 | } |
86 | 88 | } |
87 | 89 | \ No newline at end of file |