@@ -15,117 +15,117 @@ discard block |
||
15 | 15 | protected $_paramParts=array(); |
16 | 16 | |
17 | 17 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
18 | - parent::__construct($identifier, "div","ui modal"); |
|
19 | - if(isset($header)){ |
|
18 | + parent::__construct($identifier, "div", "ui modal"); |
|
19 | + if (isset($header)) { |
|
20 | 20 | $this->setHeader($header); |
21 | 21 | } |
22 | - if(isset($content)){ |
|
22 | + if (isset($content)) { |
|
23 | 23 | $this->setContent($content); |
24 | 24 | } |
25 | - if(isset($actions)){ |
|
25 | + if (isset($actions)) { |
|
26 | 26 | $this->setActions($actions); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setHeader($value) { |
31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContent($value) { |
36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActions($actions) { |
41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
42 | - if(\is_array($actions)){ |
|
43 | - foreach ($actions as $action){ |
|
41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
42 | + if (\is_array($actions)) { |
|
43 | + foreach ($actions as $action) { |
|
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | 46 | } |
47 | - else{ |
|
47 | + else { |
|
48 | 48 | $this->addAction($actions); |
49 | 49 | } |
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function addAction($action){ |
|
54 | - if(!$action instanceof BaseHtml){ |
|
53 | + public function addAction($action) { |
|
54 | + if (!$action instanceof BaseHtml) { |
|
55 | 55 | $class=""; |
56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
57 | 57 | $class="approve"; |
58 | 58 | } |
59 | - if(\array_search($action, ["Cancel","No"])!==false){ |
|
59 | + if (\array_search($action, ["Cancel", "No"])!==false) { |
|
60 | 60 | $class="cancel"; |
61 | 61 | } |
62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
63 | - if($class!=="") |
|
62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
63 | + if ($class!=="") |
|
64 | 64 | $action->addToProperty("class", $class); |
65 | 65 | } |
66 | 66 | return $this->addElementInPart($action, "actions"); |
67 | 67 | } |
68 | 68 | |
69 | - public function addContent($content,$before=false){ |
|
70 | - $this->content["content"]->addContent($content,$before); |
|
69 | + public function addContent($content, $before=false) { |
|
70 | + $this->content["content"]->addContent($content, $before); |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function addImageContent($image,$description=NULL){ |
|
74 | + public function addImageContent($image, $description=NULL) { |
|
75 | 75 | $content=$this->content["content"]; |
76 | - if(isset($description)){ |
|
77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
78 | - $content->addContent($description,true); |
|
76 | + if (isset($description)) { |
|
77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
78 | + $content->addContent($description, true); |
|
79 | 79 | } |
80 | - if($image!==""){ |
|
81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
82 | - $content->addContent($img,true); |
|
83 | - $content->addToProperty("class","image"); |
|
80 | + if ($image!=="") { |
|
81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
82 | + $content->addContent($img, true); |
|
83 | + $content->addToProperty("class", "image"); |
|
84 | 84 | } |
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - public function addIconContent($icon,$description=NULL){ |
|
88 | + public function addIconContent($icon, $description=NULL) { |
|
89 | 89 | $content=$this->content["content"]; |
90 | - if(isset($description)){ |
|
91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
92 | - $content->addContent($description,true); |
|
90 | + if (isset($description)) { |
|
91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
92 | + $content->addContent($description, true); |
|
93 | 93 | } |
94 | - if($icon!==""){ |
|
95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
96 | - $content->addContent($img,true); |
|
97 | - $content->addToProperty("class","image"); |
|
94 | + if ($icon!=="") { |
|
95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
96 | + $content->addContent($img, true); |
|
97 | + $content->addToProperty("class", "image"); |
|
98 | 98 | } |
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - private function addContentInPart($content,$uiClass,$part) { |
|
103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
102 | + private function addContentInPart($content, $uiClass, $part) { |
|
103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
104 | 104 | } |
105 | 105 | |
106 | - private function addElementInPart($element,$part) { |
|
106 | + private function addElementInPart($element, $part) { |
|
107 | 107 | $this->content[$part]->addContent($element); |
108 | 108 | return $element; |
109 | 109 | } |
110 | 110 | |
111 | - public function showDimmer($value){ |
|
112 | - $value=$value?"show":"hide"; |
|
111 | + public function showDimmer($value) { |
|
112 | + $value=$value ? "show" : "hide"; |
|
113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function setInverted(){ |
|
117 | + public function setInverted() { |
|
118 | 118 | $this->_params["inverted"]=true; |
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | - public function setBasic(){ |
|
122 | + public function setBasic() { |
|
123 | 123 | return $this->addToProperty("class", "basic"); |
124 | 124 | } |
125 | 125 | |
126 | 126 | |
127 | - public function setTransition($value){ |
|
128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
127 | + public function setTransition($value) { |
|
128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @param string $viewName |
136 | 136 | * @param $params The parameters to pass to the view |
137 | 137 | */ |
138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $controllerName the controller name |
148 | 148 | * @param string $actionName the action name |
149 | 149 | */ |
150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
159 | 159 | */ |
160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
162 | 162 | return parent::compile($js, $view); |
163 | 163 | } |
164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * @see BaseHtml::run() |
167 | 167 | */ |
168 | 168 | public function run(JsUtils $js) { |
169 | - if(isset($this->_bsComponent)===false) |
|
170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
169 | + if (isset($this->_bsComponent)===false) |
|
170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
171 | 171 | $this->addEventsOnRun($js); |
172 | 172 | return $this->_bsComponent; |
173 | 173 | } |
@@ -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 | } |
84 | 84 | \ No newline at end of file |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * @return HtmlModal |
80 | 80 | */ |
81 | 81 | public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
82 | - return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
|
82 | + return $this->addHtmlComponent(new HtmlModal($identifier, $header, $content, $actions)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -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,8 +78,8 @@ discard block |
||
78 | 78 | * @param array $contents |
79 | 79 | * @return \Ajax\semantic\html\modules\HtmlTab |
80 | 80 | */ |
81 | - public function setTabsContent($contents){ |
|
82 | - for($i=0;$i<\sizeof($contents);$i++){ |
|
81 | + public function setTabsContent($contents) { |
|
82 | + for ($i=0; $i<\sizeof($contents); $i++) { |
|
83 | 83 | $this->setTabContent($i, $contents[$i]); |
84 | 84 | } |
85 | 85 | return $this; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param int $index |
91 | 91 | * @return \Ajax\semantic\html\modules\HtmlTab |
92 | 92 | */ |
93 | - public function activate($index){ |
|
93 | + public function activate($index) { |
|
94 | 94 | $this->content["menu"]->getItem($index)->setActive(true); |
95 | 95 | $this->content[$index]->setActive(true); |
96 | 96 | return $this; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param string $content |
103 | 103 | * @return \Ajax\semantic\html\elements\HtmlSegment |
104 | 104 | */ |
105 | - public function addTab($title,$content){ |
|
106 | - return $this->addItem([$title,$content]); |
|
105 | + public function addTab($title, $content) { |
|
106 | + return $this->addItem([$title, $content]); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | * @param array $params |
118 | 118 | * @return \Ajax\semantic\html\elements\HtmlSegment |
119 | 119 | */ |
120 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
121 | - if(\array_key_exists($index, $this->content)){ |
|
122 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
120 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
121 | + if (\array_key_exists($index, $this->content)) { |
|
122 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
123 | 123 | return $this->content[$index]; |
124 | 124 | } |
125 | 125 | |
126 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
126 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | * @param $params The parameters to pass to the view |
137 | 137 | * @return \Ajax\semantic\html\elements\HtmlSegment |
138 | 138 | */ |
139 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
140 | - if(\array_key_exists($index, $this->content)){ |
|
141 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
139 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
140 | + if (\array_key_exists($index, $this->content)) { |
|
141 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
142 | 142 | return $this->content[$index]; |
143 | 143 | } |
144 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
144 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @param array $params |
156 | 156 | * @return \Ajax\semantic\html\elements\HtmlSegment |
157 | 157 | */ |
158 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
159 | - return $this->addTab($title, $js->forward($initialController, $controller, $action,$params)); |
|
158 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
159 | + return $this->addTab($title, $js->forward($initialController, $controller, $action, $params)); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @param $params The parameters to pass to the view |
169 | 169 | * @return \Ajax\semantic\html\elements\HtmlSegment |
170 | 170 | */ |
171 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
172 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
171 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
172 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | public function setPointing($value=Direction::NONE) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param int $index |
186 | 186 | * @return Ajax\semantic\html\content\HtmlMenuItem |
187 | 187 | */ |
188 | - public function getMenuTab($index){ |
|
188 | + public function getMenuTab($index) { |
|
189 | 189 | return $this->content["menu"]->getItem($index); |
190 | 190 | } |
191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param int $index |
195 | 195 | * @return HtmlSegment |
196 | 196 | */ |
197 | - public function getTab($index){ |
|
197 | + public function getTab($index) { |
|
198 | 198 | return $this->content[$index]; |
199 | 199 | } |
200 | 200 | |
@@ -203,20 +203,20 @@ discard block |
||
203 | 203 | * @param HtmlMenu $menu |
204 | 204 | * @return \Ajax\semantic\html\modules\HtmlTab |
205 | 205 | */ |
206 | - public function setMenu($menu){ |
|
207 | - for($i=0;$i<\sizeof($this->content);$i++){ |
|
208 | - if($menu->getItem($i)!==NULL){ |
|
209 | - if(isset($this->content[$i])===true){ |
|
210 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
206 | + public function setMenu($menu) { |
|
207 | + for ($i=0; $i<\sizeof($this->content); $i++) { |
|
208 | + if ($menu->getItem($i)!==NULL) { |
|
209 | + if (isset($this->content[$i])===true) { |
|
210 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | } |
214 | - for($i=0;$i<$menu->count();$i++){ |
|
214 | + for ($i=0; $i<$menu->count(); $i++) { |
|
215 | 215 | $menu->getItem($i)->removeProperty("href"); |
216 | - if(isset($this->content[$i])===false){ |
|
216 | + if (isset($this->content[$i])===false) { |
|
217 | 217 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
218 | 218 | } |
219 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
219 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $this->content["menu"]=$menu; |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | * @see BaseHtml::run() |
229 | 229 | */ |
230 | 230 | public function run(JsUtils $js) { |
231 | - if(isset($this->_bsComponent)===false) |
|
232 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
231 | + if (isset($this->_bsComponent)===false) |
|
232 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
233 | 233 | $this->addEventsOnRun($js); |
234 | 234 | return $this->_bsComponent; |
235 | 235 | } |
236 | 236 | |
237 | 237 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
238 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
238 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
239 | 239 | $this->activate(0); |
240 | - return parent::compile($js,$view); |
|
240 | + return parent::compile($js, $view); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | \ No newline at end of file |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | public function __construct($identifier) { |
16 | 16 | parent::__construct($identifier, "form"); |
17 | 17 | $this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>'; |
18 | - $this->futureElements=array (); |
|
19 | - $this->formGroups=array (); |
|
18 | + $this->futureElements=array(); |
|
19 | + $this->formGroups=array(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /* |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
27 | 27 | if (isset($js)) { |
28 | 28 | $this->formElementsPrefix=$js->config()->getVar("formElementsPrefix"); |
29 | - foreach ( $this->futureElements as $futureElement ) { |
|
29 | + foreach ($this->futureElements as $futureElement) { |
|
30 | 30 | $futureElementValue=$this->getPrefix($futureElement); |
31 | 31 | $futureElementValues=explode("_", $futureElementValue); |
32 | - switch($futureElementValues [0]) { |
|
32 | + switch ($futureElementValues [0]) { |
|
33 | 33 | case "input": |
34 | 34 | $control=new HtmlInput($futureElement); |
35 | 35 | $control->setClass("form-control"); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $control->setLabel($label, false); |
48 | 48 | break; |
49 | 49 | case "select": |
50 | - $control=new HtmlSelect($futureElement,""); |
|
50 | + $control=new HtmlSelect($futureElement, ""); |
|
51 | 51 | $control->setProperty("size", $futureElementValues [1]); |
52 | 52 | $control->setClass("form-control"); |
53 | 53 | //$control->setLabel($this->getPart($futureElement)); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->addElement($control); |
63 | 63 | } |
64 | 64 | } |
65 | - foreach ( $this->formGroups as $group ) { |
|
65 | + foreach ($this->formGroups as $group) { |
|
66 | 66 | $this->addContent($group); |
67 | 67 | } |
68 | 68 | return parent::compile($js, $view); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | private function getPrefix($element) { |
92 | 92 | $result="input_text"; |
93 | - foreach ( $this->formElementsPrefix as $k => $v ) { |
|
93 | + foreach ($this->formElementsPrefix as $k => $v) { |
|
94 | 94 | if (Text::startsWith($element, $k)) { |
95 | 95 | $result=$v; |
96 | 96 | break; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | public function getElement($name) { |
122 | 122 | $element=null; |
123 | - foreach ( $this->formGroups as $group ) { |
|
123 | + foreach ($this->formGroups as $group) { |
|
124 | 124 | } |
125 | 125 | return $element; |
126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray() |
131 | 131 | */ |
132 | 132 | public function fromArray($array) { |
133 | - foreach ( $array as $value ) { |
|
133 | + foreach ($array as $value) { |
|
134 | 134 | if (is_string($value)) { |
135 | 135 | $this->futureElements []=$value; |
136 | 136 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | private $default; |
14 | 14 | private $options; |
15 | 15 | |
16 | - public function __construct($identifier, $caption="",$default=NULL) { |
|
16 | + public function __construct($identifier, $caption="", $default=NULL) { |
|
17 | 17 | parent::__construct($identifier, "select"); |
18 | 18 | $this->setProperty("name", $identifier); |
19 | 19 | $this->setProperty("class", "form-control"); |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | $this->options=array(); |
23 | 23 | } |
24 | 24 | |
25 | - public function addOption($element,$value="",$selected=false){ |
|
26 | - if($element instanceof HtmlOption){ |
|
25 | + public function addOption($element, $value="", $selected=false) { |
|
26 | + if ($element instanceof HtmlOption) { |
|
27 | 27 | $option=$element; |
28 | - }else{ |
|
29 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
28 | + } else { |
|
29 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
30 | 30 | } |
31 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
31 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
32 | 32 | $option->select(); |
33 | 33 | } |
34 | 34 | $this->options[]=$option; |
35 | 35 | } |
36 | 36 | |
37 | 37 | public function setValue($value) { |
38 | - foreach ( $this->options as $option ) { |
|
39 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
38 | + foreach ($this->options as $option) { |
|
39 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
40 | 40 | $option->setProperty("selected", ""); |
41 | 41 | } |
42 | 42 | } |
@@ -49,23 +49,23 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
51 | 51 | $this->content=array(); |
52 | - if(isset($this->default)){ |
|
52 | + if (isset($this->default)) { |
|
53 | 53 | $default=new HtmlOption("", $this->default); |
54 | 54 | $this->content[]=$default; |
55 | 55 | } |
56 | - foreach ($this->options as $option){ |
|
56 | + foreach ($this->options as $option) { |
|
57 | 57 | $this->content[]=$option; |
58 | 58 | } |
59 | 59 | return parent::compile($js, $view); |
60 | 60 | } |
61 | 61 | |
62 | - public function fromArray($array){ |
|
63 | - if(JArray::isAssociative($array)){ |
|
64 | - foreach ($array as $k=>$v){ |
|
62 | + public function fromArray($array) { |
|
63 | + if (JArray::isAssociative($array)) { |
|
64 | + foreach ($array as $k=>$v) { |
|
65 | 65 | $this->addOption($v, $k); |
66 | 66 | } |
67 | - }else{ |
|
68 | - foreach ($array as $v){ |
|
67 | + } else { |
|
68 | + foreach ($array as $v) { |
|
69 | 69 | $this->addOption($v, $v); |
70 | 70 | } |
71 | 71 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->addOption($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function setSize($size){ |
|
101 | + public function setSize($size) { |
|
102 | 102 | return $this->setProperty("size", $size); |
103 | 103 | } |
104 | 104 | } |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function setWidth($width) { |
33 | 33 | if (\is_int($width)) { |
34 | - $width=Wide::getConstants()["W" . $width]; |
|
34 | + $width=Wide::getConstants()["W".$width]; |
|
35 | 35 | } |
36 | 36 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
37 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
37 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setValue($value) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $divider->setVertical(); |
53 | 53 | else |
54 | 54 | $divider->setHorizontal(); |
55 | - $this->wrap($divider,""); |
|
55 | + $this->wrap($divider, ""); |
|
56 | 56 | return $divider; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | \ No newline at end of file |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @return $this |
28 | 28 | */ |
29 | 29 | public function setOnShow($jsCode) { |
30 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
30 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
31 | 31 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
32 | 32 | } |
33 | 33 | |
34 | - public function setExclusive($value){ |
|
34 | + public function setExclusive($value) { |
|
35 | 35 | return $this->setParam("exclusive", $value); |
36 | 36 | } |
37 | 37 | |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | * @param string $popup the css selector of the popup |
41 | 41 | * @return \Ajax\semantic\components\Popup |
42 | 42 | */ |
43 | - public function setPopup($popup){ |
|
43 | + public function setPopup($popup) { |
|
44 | 44 | return $this->setParam("popup", $popup); |
45 | 45 | } |
46 | 46 | |
47 | - public function setInline($value){ |
|
47 | + public function setInline($value) { |
|
48 | 48 | return $this->setParam("inline", $value); |
49 | 49 | } |
50 | 50 | |
51 | - public function setPosition($value){ |
|
51 | + public function setPosition($value) { |
|
52 | 52 | return $this->setParam("position", $value); |
53 | 53 | } |
54 | 54 | //TODO other events implementation |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | |
9 | 9 | trait MenuItemTrait { |
10 | 10 | |
11 | - public function setContent($content){ |
|
12 | - if($content==="-"){ |
|
11 | + public function setContent($content) { |
|
12 | + if ($content==="-") { |
|
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
15 | - $values=\explode(",",$content,-1); |
|
16 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
17 | - }elseif(JString::startswith($content, "-")){ |
|
18 | - $content=\ltrim($content,"-"); |
|
14 | + }elseif ($content==="-search-") { |
|
15 | + $values=\explode(",", $content, -1); |
|
16 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
17 | + }elseif (JString::startswith($content, "-")) { |
|
18 | + $content=\ltrim($content, "-"); |
|
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
20 | + } else |
|
21 | 21 | parent::setContent($content); |
22 | 22 | return $this; |
23 | 23 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param string $icon |
28 | 28 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
29 | 29 | */ |
30 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
30 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
31 | 31 | $this->setClass("ui icon search input"); |
32 | 32 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
33 | + if (isset($placeholder)) |
|
34 | 34 | $input->setProperty("placeholder", $placeholder); |
35 | 35 | $this->content=$input; |
36 | - if(isset($icon)) |
|
36 | + if (isset($icon)) |
|
37 | 37 | $this->addIcon($icon); |
38 | 38 | return $this; |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
43 | 43 | */ |
44 | - public function asDivider(){ |
|
44 | + public function asDivider() { |
|
45 | 45 | $this->content=NULL; |
46 | 46 | $this->tagName="div"; |
47 | 47 | $this->setClass("divider"); |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @param string $icon |
54 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
55 | 55 | */ |
56 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
56 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
57 | 57 | $this->setClass("header"); |
58 | 58 | $this->tagName="div"; |
59 | 59 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
60 | + if (isset($icon)) |
|
61 | + $this->addIcon($icon, Direction::LEFT); |
|
62 | 62 | return $this; |
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of file |