@@ -60,10 +60,10 @@ |
||
60 | 60 | |
61 | 61 | protected function replaceVersionAndTheme($url, $version, $theme) { |
62 | 62 | if (isset($theme)) |
63 | - return str_ireplace(array ( |
|
63 | + return str_ireplace(array( |
|
64 | 64 | "%theme%", |
65 | 65 | "%version%" |
66 | - ), array ( |
|
66 | + ), array( |
|
67 | 67 | $theme, |
68 | 68 | $version |
69 | 69 | ), $url); |
@@ -33,11 +33,13 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | protected function getUrlOrCss($element, $key) { |
36 | - if (isset($element)) |
|
37 | - return $element; |
|
36 | + if (isset($element)) { |
|
37 | + return $element; |
|
38 | + } |
|
38 | 39 | $version=$this->version; |
39 | - if (array_search($version, $this->getVersions())===false) |
|
40 | - $version=$this->getLastVersion(); |
|
40 | + if (array_search($version, $this->getVersions())===false) { |
|
41 | + $version=$this->getLastVersion(); |
|
42 | + } |
|
41 | 43 | return $this->replaceVersion($this->data [$this->provider] [$key], $version); |
42 | 44 | } |
43 | 45 | |
@@ -59,16 +61,17 @@ discard block |
||
59 | 61 | } |
60 | 62 | |
61 | 63 | protected function replaceVersionAndTheme($url, $version, $theme) { |
62 | - if (isset($theme)) |
|
63 | - return str_ireplace(array ( |
|
64 | + if (isset($theme)) { |
|
65 | + return str_ireplace(array ( |
|
64 | 66 | "%theme%", |
65 | 67 | "%version%" |
66 | 68 | ), array ( |
67 | 69 | $theme, |
68 | 70 | $version |
69 | 71 | ), $url); |
70 | - else |
|
71 | - return $this->replaceVersion($url, $version); |
|
72 | + } else { |
|
73 | + return $this->replaceVersion($url, $version); |
|
74 | + } |
|
72 | 75 | } |
73 | 76 | |
74 | 77 | public function getProviders() { |
@@ -76,10 +79,11 @@ discard block |
||
76 | 79 | } |
77 | 80 | |
78 | 81 | public function getVersions($provider=NULL) { |
79 | - if (isset($provider)) |
|
80 | - return $this->data [$provider] ["versions"]; |
|
81 | - else |
|
82 | - return $this->data [$this->provider] ["versions"]; |
|
82 | + if (isset($provider)) { |
|
83 | + return $this->data [$provider] ["versions"]; |
|
84 | + } else { |
|
85 | + return $this->data [$this->provider] ["versions"]; |
|
86 | + } |
|
83 | 87 | } |
84 | 88 | |
85 | 89 | public function getLastVersion($provider=NULL) { |
@@ -14,10 +14,11 @@ discard block |
||
14 | 14 | $this->data=$this->data ["JQueryUI"]; |
15 | 15 | if (is_int($theme)) { |
16 | 16 | $themes=$this->getThemes(); |
17 | - if (sizeof($themes)>$theme-1) |
|
18 | - $this->theme=$themes [$theme-1]; |
|
19 | - else |
|
20 | - throw new \Exception("CDNGuiGen : Le numéro de thème demandé n'existe pas"); |
|
17 | + if (sizeof($themes)>$theme-1) { |
|
18 | + $this->theme=$themes [$theme-1]; |
|
19 | + } else { |
|
20 | + throw new \Exception("CDNGuiGen : Le numéro de thème demandé n'existe pas"); |
|
21 | + } |
|
21 | 22 | } |
22 | 23 | $this->theme=$theme; |
23 | 24 | $this->cssUrl=null; |
@@ -28,16 +29,18 @@ discard block |
||
28 | 29 | } |
29 | 30 | |
30 | 31 | public function getThemes($provider=NULL) { |
31 | - if (isset($provider)) |
|
32 | - return $this->data [$provider] ["themes"]; |
|
33 | - else |
|
34 | - return $this->data [$this->provider] ["themes"]; |
|
32 | + if (isset($provider)) { |
|
33 | + return $this->data [$provider] ["themes"]; |
|
34 | + } else { |
|
35 | + return $this->data [$this->provider] ["themes"]; |
|
36 | + } |
|
35 | 37 | } |
36 | 38 | |
37 | 39 | public function getFirstTheme($provider=NULL) { |
38 | 40 | $themes=$this->getThemes($provider); |
39 | - if (sizeof($themes)>0) |
|
40 | - return $themes [0]; |
|
41 | + if (sizeof($themes)>0) { |
|
42 | + return $themes [0]; |
|
43 | + } |
|
41 | 44 | return ""; |
42 | 45 | } |
43 | 46 | |
@@ -46,14 +49,17 @@ discard block |
||
46 | 49 | } |
47 | 50 | |
48 | 51 | public function getCss() { |
49 | - if (isset($this->cssUrl)) |
|
50 | - return $this->cssUrl; |
|
52 | + if (isset($this->cssUrl)) { |
|
53 | + return $this->cssUrl; |
|
54 | + } |
|
51 | 55 | $version=$this->version; |
52 | - if (array_search($version, $this->getVersions())===false) |
|
53 | - $version=$this->getLastVersion(); |
|
56 | + if (array_search($version, $this->getVersions())===false) { |
|
57 | + $version=$this->getLastVersion(); |
|
58 | + } |
|
54 | 59 | $theme=$this->theme; |
55 | - if (array_search($theme, $this->getThemes())===false) |
|
56 | - $theme=$this->getFirstTheme(); |
|
60 | + if (array_search($theme, $this->getThemes())===false) { |
|
61 | + $theme=$this->getFirstTheme(); |
|
62 | + } |
|
57 | 63 | return $this->replaceVersionAndTheme($this->data [$this->provider] ["css"], $version, $theme); |
58 | 64 | } |
59 | 65 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $viewVars=$view->viewVars; |
14 | 14 | if (isset($viewVars["q"]) === false) { |
15 | 15 | $controls=array (); |
16 | - }else{ |
|
16 | + } else{ |
|
17 | 17 | $controls=$viewVars["q"]; |
18 | 18 | } |
19 | 19 | $controls[$identifier]=$content; |
@@ -8,23 +8,23 @@ discard block |
||
8 | 8 | use Cake\Network\Response; |
9 | 9 | use Cake\Core\App; |
10 | 10 | |
11 | -class _JsUtils extends \Ajax\JsUtils{ |
|
12 | - public function getUrl($url){ |
|
11 | +class _JsUtils extends \Ajax\JsUtils { |
|
12 | + public function getUrl($url) { |
|
13 | 13 | return Router::url($url); |
14 | 14 | } |
15 | - public function addViewElement($identifier,$content,&$view){ |
|
15 | + public function addViewElement($identifier, $content, &$view) { |
|
16 | 16 | $viewVars=$view->viewVars; |
17 | - if (isset($viewVars["q"]) === false) { |
|
18 | - $controls=array (); |
|
19 | - }else{ |
|
17 | + if (isset($viewVars["q"])===false) { |
|
18 | + $controls=array(); |
|
19 | + } else { |
|
20 | 20 | $controls=$viewVars["q"]; |
21 | 21 | } |
22 | 22 | $controls[$identifier]=$content; |
23 | 23 | $view->set("q", $controls); |
24 | 24 | } |
25 | 25 | |
26 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
27 | - $view->set($view_var,$output); |
|
26 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
27 | + $view->set($view_var, $output); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | * @param array $params |
35 | 35 | * @see \Ajax\JsUtils::forward() |
36 | 36 | */ |
37 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){ |
|
37 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) { |
|
38 | 38 | \ob_start(); |
39 | - if(isset($params) && !\is_array($params)){ |
|
39 | + if (isset($params) && !\is_array($params)) { |
|
40 | 40 | $params=[$params]; |
41 | 41 | } |
42 | 42 | $url=h(Router::url(\array_merge([ |
43 | 43 | 'controller' => $controllerName, |
44 | - 'action' => $actionName],$params),false |
|
44 | + 'action' => $actionName], $params), false |
|
45 | 45 | )); |
46 | 46 | $base=Router::url("/"); |
47 | - if (substr($url, 0, strlen($base)) == $base) { |
|
48 | - $url = substr($url, strlen($base)); |
|
47 | + if (substr($url, 0, strlen($base))==$base) { |
|
48 | + $url=substr($url, strlen($base)); |
|
49 | 49 | } |
50 | 50 | $initialControllerInstance->requestAction($url); |
51 | 51 | $result=\ob_get_contents(); |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | return $result; |
54 | 54 | } |
55 | 55 | |
56 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
57 | - $view = new View(Router::getRequest(true), new Response()); |
|
58 | - if(\is_array($params)){ |
|
59 | - foreach ($params as $k=>$v){ |
|
56 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
57 | + $view=new View(Router::getRequest(true), new Response()); |
|
58 | + if (\is_array($params)) { |
|
59 | + foreach ($params as $k=>$v) { |
|
60 | 60 | $view->set($k, $v); |
61 | 61 | } |
62 | 62 | } |
63 | 63 | return $view->render($viewName); |
64 | 64 | } |
65 | 65 | |
66 | - public function fromDispatcher($dispatcher){ |
|
66 | + public function fromDispatcher($dispatcher) { |
|
67 | 67 | return \explode("/", Router::getRequest(true)->url); |
68 | 68 | } |
69 | 69 | } |
70 | 70 | \ No newline at end of file |
@@ -11,10 +11,10 @@ |
||
11 | 11 | * @var Ajax\php\cakephp\_JsUtils |
12 | 12 | */ |
13 | 13 | public $jquery; |
14 | - public function initialize(array $config){ |
|
14 | + public function initialize(array $config) { |
|
15 | 15 | \extract($config); |
16 | 16 | $this->jquery=new _JsUtils(); |
17 | - if(isset($semantic)){ |
|
17 | + if (isset($semantic)) { |
|
18 | 18 | $this->jquery->semantic(new Semantic()); |
19 | 19 | } |
20 | 20 | } |
@@ -4,34 +4,34 @@ |
||
4 | 4 | |
5 | 5 | use micro\controllers\Startup; |
6 | 6 | use micro\utils\RequestUtils; |
7 | -class JsUtils extends \Ajax\JsUtils{ |
|
7 | +class JsUtils extends \Ajax\JsUtils { |
|
8 | 8 | |
9 | - public function getUrl($url){ |
|
9 | + public function getUrl($url) { |
|
10 | 10 | return RequestUtils::getUrl($url); |
11 | 11 | } |
12 | 12 | |
13 | - public function addViewElement($identifier,$content,&$view){ |
|
13 | + public function addViewElement($identifier, $content, &$view) { |
|
14 | 14 | $controls=$view->getVar("q"); |
15 | - if (isset($controls) === false) { |
|
16 | - $controls=array (); |
|
15 | + if (isset($controls)===false) { |
|
16 | + $controls=array(); |
|
17 | 17 | } |
18 | 18 | $controls[$identifier]=$content; |
19 | 19 | $view->setVar("q", $controls); |
20 | 20 | } |
21 | 21 | |
22 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
23 | - $view->setVar($view_var,$output); |
|
22 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
23 | + $view->setVar($view_var, $output); |
|
24 | 24 | } |
25 | 25 | |
26 | - public function forward($initialController,$controller,$action,$params=array()){ |
|
27 | - return $initialController->forward($controller,$action,$params,true,true,true); |
|
26 | + public function forward($initialController, $controller, $action, $params=array()) { |
|
27 | + return $initialController->forward($controller, $action, $params, true, true, true); |
|
28 | 28 | } |
29 | 29 | |
30 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
31 | - return $initialControllerInstance->loadView($viewName,$params,true); |
|
30 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
31 | + return $initialControllerInstance->loadView($viewName, $params, true); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function fromDispatcher($dispatcher){ |
|
34 | + public function fromDispatcher($dispatcher) { |
|
35 | 35 | return Startup::$urlParts; |
36 | 36 | } |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -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 | } |
@@ -228,15 +229,17 @@ discard block |
||
228 | 229 | * @see BaseHtml::run() |
229 | 230 | */ |
230 | 231 | public function run(JsUtils $js) { |
231 | - if(isset($this->_bsComponent)===false) |
|
232 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
232 | + if(isset($this->_bsComponent)===false) { |
|
233 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
234 | + } |
|
233 | 235 | $this->addEventsOnRun($js); |
234 | 236 | return $this->_bsComponent; |
235 | 237 | } |
236 | 238 | |
237 | 239 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
238 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
239 | - $this->activate(0); |
|
240 | + if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) { |
|
241 | + $this->activate(0); |
|
242 | + } |
|
240 | 243 | return parent::compile($js,$view); |
241 | 244 | } |
242 | 245 | } |
243 | 246 | \ No newline at end of file |
@@ -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 | } |
246 | 246 | \ No newline at end of file |
@@ -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 |
@@ -20,8 +20,9 @@ discard block |
||
20 | 20 | public function __construct($identifier, $width=NULL) { |
21 | 21 | parent::__construct($identifier, "div"); |
22 | 22 | $this->setClass("column"); |
23 | - if (isset($width)) |
|
24 | - $this->setWidth($width); |
|
23 | + if (isset($width)) { |
|
24 | + $this->setWidth($width); |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | /** |
@@ -48,10 +49,11 @@ discard block |
||
48 | 49 | |
49 | 50 | public function addDivider($vertical=true, $content=NULL) { |
50 | 51 | $divider=new HtmlDivider("", $content); |
51 | - if ($vertical) |
|
52 | - $divider->setVertical(); |
|
53 | - else |
|
54 | - $divider->setHorizontal(); |
|
52 | + if ($vertical) { |
|
53 | + $divider->setVertical(); |
|
54 | + } else { |
|
55 | + $divider->setHorizontal(); |
|
56 | + } |
|
55 | 57 | $this->wrap($divider,""); |
56 | 58 | return $divider; |
57 | 59 | } |
@@ -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 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | if(!$item instanceof HtmlDropdownItem){ |
73 | 73 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
74 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
74 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
75 | 75 | $this->addToProperty("class", "vertical"); |
76 | 76 | } |
77 | 77 | return $itemO; |
@@ -85,8 +85,9 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | public function addInput($name){ |
88 | - if(!isset($name)) |
|
89 | - $name="input-".$this->identifier; |
|
88 | + if(!isset($name)) { |
|
89 | + $name="input-".$this->identifier; |
|
90 | + } |
|
90 | 91 | $this->setAction("activate"); |
91 | 92 | $this->input=new HtmlInput($name,"hidden"); |
92 | 93 | } |
@@ -143,7 +144,7 @@ discard block |
||
143 | 144 | foreach ($items as $k=>$v){ |
144 | 145 | $this->addItem($v)->setData($k); |
145 | 146 | } |
146 | - }else{ |
|
147 | + } else{ |
|
147 | 148 | foreach ($items as $item){ |
148 | 149 | $this->addItem($item); |
149 | 150 | } |
@@ -167,7 +168,7 @@ discard block |
||
167 | 168 | if($dropdown===false){ |
168 | 169 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
169 | 170 | $dropdown="menu"; |
170 | - }else{ |
|
171 | + } else{ |
|
171 | 172 | $dropdown="dropdown"; |
172 | 173 | $this->mClass="menu"; |
173 | 174 | } |
@@ -187,20 +188,24 @@ discard block |
||
187 | 188 | } |
188 | 189 | |
189 | 190 | public function asButton($floating=false){ |
190 | - if($floating) |
|
191 | - $this->addToProperty("class", "floating"); |
|
191 | + if($floating) { |
|
192 | + $this->addToProperty("class", "floating"); |
|
193 | + } |
|
192 | 194 | $this->removePropertyValue("class", "selection"); |
193 | 195 | return $this->addToProperty("class", "button"); |
194 | 196 | } |
195 | 197 | |
196 | 198 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
197 | - if(isset($name)) |
|
198 | - $this->addInput($name); |
|
199 | - if($multiple) |
|
200 | - $this->addToProperty("class", "multiple"); |
|
199 | + if(isset($name)) { |
|
200 | + $this->addInput($name); |
|
201 | + } |
|
202 | + if($multiple) { |
|
203 | + $this->addToProperty("class", "multiple"); |
|
204 | + } |
|
201 | 205 | if ($selection){ |
202 | - if($this->propertyContains("class", "button")===false) |
|
203 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
206 | + if($this->propertyContains("class", "button")===false) { |
|
207 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
208 | + } |
|
204 | 209 | } |
205 | 210 | return $this; |
206 | 211 | } |
@@ -211,8 +216,9 @@ discard block |
||
211 | 216 | } |
212 | 217 | |
213 | 218 | public function setSelect($name=NULL,$multiple=false){ |
214 | - if(!isset($name)) |
|
215 | - $name="select-".$this->identifier; |
|
219 | + if(!isset($name)) { |
|
220 | + $name="select-".$this->identifier; |
|
221 | + } |
|
216 | 222 | $this->input=null; |
217 | 223 | if($multiple){ |
218 | 224 | $this->setProperty("multiple", true); |
@@ -248,12 +254,13 @@ discard block |
||
248 | 254 | $value=$this->value; |
249 | 255 | if(isset($this->input) && isset($value)){ |
250 | 256 | $this->input->setProperty("value", $value); |
251 | - }else{ |
|
257 | + } else{ |
|
252 | 258 | $this->setProperty("value", $value); |
253 | 259 | } |
254 | 260 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
255 | - if(isset($textElement)) |
|
256 | - $textElement->setContent($value); |
|
261 | + if(isset($textElement)) { |
|
262 | + $textElement->setContent($value); |
|
263 | + } |
|
257 | 264 | return $this; |
258 | 265 | } |
259 | 266 | |
@@ -263,8 +270,9 @@ discard block |
||
263 | 270 | */ |
264 | 271 | public function run(JsUtils $js) { |
265 | 272 | if($this->propertyContains("class", "simple")===false){ |
266 | - if(isset($this->_bsComponent)===false) |
|
267 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
273 | + if(isset($this->_bsComponent)===false) { |
|
274 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
275 | + } |
|
268 | 276 | $this->addEventsOnRun($js); |
269 | 277 | return $this->_bsComponent; |
270 | 278 | } |
@@ -13,53 +13,53 @@ discard block |
||
13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
14 | 14 | |
15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
16 | - use FieldTrait,LabeledIconTrait { |
|
16 | + use FieldTrait, LabeledIconTrait { |
|
17 | 17 | addIcon as addIconP; |
18 | 18 | } |
19 | 19 | protected $mClass="menu"; |
20 | 20 | protected $mTagName="div"; |
21 | - protected $items=array (); |
|
22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
21 | + protected $items=array(); |
|
22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
23 | 23 | protected $input; |
24 | 24 | protected $value; |
25 | 25 | protected $_associative; |
26 | 26 | |
27 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
27 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
28 | 28 | parent::__construct($identifier, "div"); |
29 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
30 | 30 | $this->setProperty("class", "ui dropdown"); |
31 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
31 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
32 | 32 | $content->setClass("text"); |
33 | 33 | $this->setValue($value); |
34 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
34 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
35 | 35 | $this->content=array($content); |
36 | 36 | $this->tagName="div"; |
37 | 37 | $this->_associative=$associative; |
38 | 38 | $this->addItems($items); |
39 | 39 | } |
40 | 40 | |
41 | - public function getField(){ |
|
41 | + public function getField() { |
|
42 | 42 | return $this->input; |
43 | 43 | } |
44 | 44 | |
45 | - public function getDataField(){ |
|
45 | + public function getDataField() { |
|
46 | 46 | return $this->input; |
47 | 47 | } |
48 | 48 | |
49 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
50 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
49 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
50 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
51 | 51 | $this->items[]=$itemO; |
52 | 52 | return $itemO; |
53 | 53 | } |
54 | 54 | |
55 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
56 | - $this->addIconP($icon,$before,$labeled); |
|
55 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
56 | + $this->addIconP($icon, $before, $labeled); |
|
57 | 57 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
58 | 58 | } |
59 | 59 | |
60 | - public function addIcons($icons){ |
|
60 | + public function addIcons($icons) { |
|
61 | 61 | $count=$this->count(); |
62 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
62 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
63 | 63 | $this->getItem($i)->addIcon($icons[$i]); |
64 | 64 | } |
65 | 65 | } |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | * @param number $position |
71 | 71 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
72 | 72 | */ |
73 | - public function insertItem($item,$position=0){ |
|
73 | + public function insertItem($item, $position=0) { |
|
74 | 74 | $itemO=$this->beforeAddItem($item); |
75 | - $start = array_slice($this->items, 0, $position); |
|
76 | - $end = array_slice($this->items, $position); |
|
77 | - $start[] = $item; |
|
75 | + $start=array_slice($this->items, 0, $position); |
|
76 | + $end=array_slice($this->items, $position); |
|
77 | + $start[]=$item; |
|
78 | 78 | $this->items=array_merge($start, $end); |
79 | 79 | return $itemO; |
80 | 80 | } |
81 | 81 | |
82 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
82 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
83 | 83 | $itemO=$item; |
84 | - if(\is_array($item)){ |
|
84 | + if (\is_array($item)) { |
|
85 | 85 | $description=JArray::getValue($item, "description", 3); |
86 | 86 | $value=JArray::getValue($item, "value", 1); |
87 | 87 | $image=JArray::getValue($item, "image", 2); |
88 | 88 | $item=JArray::getValue($item, "item", 0); |
89 | 89 | } |
90 | - if(!$item instanceof HtmlDropdownItem){ |
|
91 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
92 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
90 | + if (!$item instanceof HtmlDropdownItem) { |
|
91 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
92 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
93 | 93 | $this->addToProperty("class", "vertical"); |
94 | 94 | } |
95 | 95 | return $itemO; |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $this->addItem($function($object)); |
103 | 103 | } |
104 | 104 | |
105 | - public function addInput($name){ |
|
106 | - if(!isset($name)) |
|
105 | + public function addInput($name) { |
|
106 | + if (!isset($name)) |
|
107 | 107 | $name="input-".$this->identifier; |
108 | 108 | $this->setAction("activate"); |
109 | - $this->input=new HtmlInput($name,"hidden"); |
|
109 | + $this->input=new HtmlInput($name, "hidden"); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * @param string $icon |
116 | 116 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
117 | 117 | */ |
118 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
119 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
118 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
119 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Adds a divider item |
124 | 124 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
125 | 125 | */ |
126 | - public function addDividerItem(){ |
|
126 | + public function addDividerItem() { |
|
127 | 127 | return $this->addItem(HtmlDropdownItem::divider()); |
128 | 128 | } |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param string $icon |
134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
135 | 135 | */ |
136 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
137 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
136 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
137 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $color |
144 | 144 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
145 | 145 | */ |
146 | - public function addCircularLabelItem($caption,$color){ |
|
146 | + public function addCircularLabelItem($caption, $color) { |
|
147 | 147 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
148 | 148 | } |
149 | 149 | |
@@ -152,87 +152,87 @@ discard block |
||
152 | 152 | * @param string $image |
153 | 153 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
154 | 154 | */ |
155 | - public function addMiniAvatarImageItem($caption,$image){ |
|
155 | + public function addMiniAvatarImageItem($caption, $image) { |
|
156 | 156 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
157 | 157 | } |
158 | 158 | |
159 | - public function addItems($items){ |
|
160 | - if(\is_array($items) && $this->_associative){ |
|
161 | - foreach ($items as $k=>$v){ |
|
159 | + public function addItems($items) { |
|
160 | + if (\is_array($items) && $this->_associative) { |
|
161 | + foreach ($items as $k=>$v) { |
|
162 | 162 | $this->addItem($v)->setData($k); |
163 | 163 | } |
164 | - }else{ |
|
165 | - foreach ($items as $item){ |
|
164 | + } else { |
|
165 | + foreach ($items as $item) { |
|
166 | 166 | $this->addItem($item); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - public function getItem($index){ |
|
171 | + public function getItem($index) { |
|
172 | 172 | return $this->items[$index]; |
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | 176 | * @return int |
177 | 177 | */ |
178 | - public function count(){ |
|
178 | + public function count() { |
|
179 | 179 | return \sizeof($this->items); |
180 | 180 | } |
181 | 181 | /** |
182 | 182 | * @param boolean $dropdown |
183 | 183 | */ |
184 | - public function asDropdown($dropdown){ |
|
185 | - if($dropdown===false){ |
|
184 | + public function asDropdown($dropdown) { |
|
185 | + if ($dropdown===false) { |
|
186 | 186 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
187 | 187 | $dropdown="menu"; |
188 | - }else{ |
|
188 | + } else { |
|
189 | 189 | $dropdown="dropdown"; |
190 | 190 | $this->mClass="menu"; |
191 | 191 | } |
192 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
192 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
193 | 193 | } |
194 | 194 | |
195 | - public function setVertical(){ |
|
196 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
195 | + public function setVertical() { |
|
196 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
197 | 197 | } |
198 | 198 | |
199 | - public function setInline(){ |
|
200 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
199 | + public function setInline() { |
|
200 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
201 | 201 | } |
202 | 202 | |
203 | - public function setSimple(){ |
|
204 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
203 | + public function setSimple() { |
|
204 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
205 | 205 | } |
206 | 206 | |
207 | - public function asButton($floating=false){ |
|
208 | - if($floating) |
|
207 | + public function asButton($floating=false) { |
|
208 | + if ($floating) |
|
209 | 209 | $this->addToProperty("class", "floating"); |
210 | 210 | $this->removePropertyValue("class", "selection"); |
211 | 211 | return $this->addToProperty("class", "button"); |
212 | 212 | } |
213 | 213 | |
214 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
215 | - if(isset($name)) |
|
214 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
215 | + if (isset($name)) |
|
216 | 216 | $this->addInput($name); |
217 | - if($multiple) |
|
217 | + if ($multiple) |
|
218 | 218 | $this->addToProperty("class", "multiple"); |
219 | - if ($selection){ |
|
220 | - if($this->propertyContains("class", "button")===false) |
|
221 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
219 | + if ($selection) { |
|
220 | + if ($this->propertyContains("class", "button")===false) |
|
221 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
222 | 222 | } |
223 | 223 | return $this; |
224 | 224 | } |
225 | 225 | |
226 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
227 | - $this->asSelect($name,$multiple,$selection); |
|
226 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
227 | + $this->asSelect($name, $multiple, $selection); |
|
228 | 228 | return $this->addToProperty("class", "search"); |
229 | 229 | } |
230 | 230 | |
231 | - public function setSelect($name=NULL,$multiple=false){ |
|
232 | - if(!isset($name)) |
|
231 | + public function setSelect($name=NULL, $multiple=false) { |
|
232 | + if (!isset($name)) |
|
233 | 233 | $name="select-".$this->identifier; |
234 | 234 | $this->input=null; |
235 | - if($multiple){ |
|
235 | + if ($multiple) { |
|
236 | 236 | $this->setProperty("multiple", true); |
237 | 237 | $this->addToProperty("class", "multiple"); |
238 | 238 | } |
@@ -240,37 +240,37 @@ discard block |
||
240 | 240 | $this->tagName="select"; |
241 | 241 | $this->setProperty("name", $name); |
242 | 242 | $this->content=null; |
243 | - foreach ($this->items as $item){ |
|
243 | + foreach ($this->items as $item) { |
|
244 | 244 | $item->asOption(); |
245 | 245 | } |
246 | 246 | return $this; |
247 | 247 | } |
248 | 248 | |
249 | - public function asSubmenu($pointing=NULL){ |
|
249 | + public function asSubmenu($pointing=NULL) { |
|
250 | 250 | $this->setClass("ui dropdown link item"); |
251 | - if(isset($pointing)){ |
|
251 | + if (isset($pointing)) { |
|
252 | 252 | $this->setPointing($pointing); |
253 | 253 | } |
254 | 254 | return $this; |
255 | 255 | } |
256 | 256 | |
257 | - public function setPointing($value=Direction::NONE){ |
|
258 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
257 | + public function setPointing($value=Direction::NONE) { |
|
258 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
259 | 259 | } |
260 | 260 | |
261 | - public function setValue($value){ |
|
261 | + public function setValue($value) { |
|
262 | 262 | $this->value=$value; |
263 | 263 | return $this; |
264 | 264 | } |
265 | - private function applyValue(){ |
|
265 | + private function applyValue() { |
|
266 | 266 | $value=$this->value; |
267 | - if(isset($this->input) && isset($value)){ |
|
267 | + if (isset($this->input) && isset($value)) { |
|
268 | 268 | $this->input->setProperty("value", $value); |
269 | - }else{ |
|
269 | + } else { |
|
270 | 270 | $this->setProperty("value", $value); |
271 | 271 | } |
272 | 272 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
273 | - if(isset($textElement)) |
|
273 | + if (isset($textElement)) |
|
274 | 274 | $textElement->setContent($value); |
275 | 275 | return $this; |
276 | 276 | } |
@@ -280,29 +280,29 @@ discard block |
||
280 | 280 | * @see BaseHtml::run() |
281 | 281 | */ |
282 | 282 | public function run(JsUtils $js) { |
283 | - if($this->propertyContains("class", "simple")===false){ |
|
284 | - if(isset($this->_bsComponent)===false) |
|
285 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
283 | + if ($this->propertyContains("class", "simple")===false) { |
|
284 | + if (isset($this->_bsComponent)===false) |
|
285 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
286 | 286 | $this->addEventsOnRun($js); |
287 | 287 | return $this->_bsComponent; |
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
291 | - public function setCompact(){ |
|
291 | + public function setCompact() { |
|
292 | 292 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
293 | 293 | } |
294 | 294 | |
295 | - public function setAction($action){ |
|
295 | + public function setAction($action) { |
|
296 | 296 | $this->_params["action"]=$action; |
297 | 297 | } |
298 | 298 | |
299 | - public function setFullTextSearch($value){ |
|
299 | + public function setFullTextSearch($value) { |
|
300 | 300 | $this->_params["fullTextSearch"]=$value; |
301 | 301 | } |
302 | 302 | |
303 | 303 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
304 | 304 | $this->applyValue(); |
305 | - return parent::compile($js,$view); |
|
305 | + return parent::compile($js, $view); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | public function getInput() { |
@@ -24,6 +24,9 @@ discard block |
||
24 | 24 | protected $value; |
25 | 25 | protected $_associative; |
26 | 26 | |
27 | + /** |
|
28 | + * @param string $identifier |
|
29 | + */ |
|
27 | 30 | public function __construct($identifier, $value="", $items=array(),$associative=true) { |
28 | 31 | parent::__construct($identifier, "div"); |
29 | 32 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
@@ -67,7 +70,7 @@ discard block |
||
67 | 70 | /** |
68 | 71 | * Insert an item at a position |
69 | 72 | * @param mixed $item |
70 | - * @param number $position |
|
73 | + * @param integer $position |
|
71 | 74 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
72 | 75 | */ |
73 | 76 | public function insertItem($item,$position=0){ |
@@ -168,6 +171,9 @@ discard block |
||
168 | 171 | } |
169 | 172 | } |
170 | 173 | |
174 | + /** |
|
175 | + * @param integer $index |
|
176 | + */ |
|
171 | 177 | public function getItem($index){ |
172 | 178 | return $this->items[$index]; |
173 | 179 | } |
@@ -258,6 +264,9 @@ discard block |
||
258 | 264 | return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
259 | 265 | } |
260 | 266 | |
267 | + /** |
|
268 | + * @param string $value |
|
269 | + */ |
|
261 | 270 | public function setValue($value){ |
262 | 271 | $this->value=$value; |
263 | 272 | return $this; |
@@ -292,6 +301,9 @@ discard block |
||
292 | 301 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
293 | 302 | } |
294 | 303 | |
304 | + /** |
|
305 | + * @param string $action |
|
306 | + */ |
|
295 | 307 | public function setAction($action){ |
296 | 308 | $this->_params["action"]=$action; |
297 | 309 | } |