@@ -87,6 +87,9 @@ |
||
87 | 87 | $this->addItem($function($object)); |
88 | 88 | } |
89 | 89 | |
90 | + /** |
|
91 | + * @param \Closure $callBack |
|
92 | + */ |
|
90 | 93 | public function apply($callBack){ |
91 | 94 | foreach ($this->content as $item){ |
92 | 95 | $callBack($item); |
@@ -13,29 +13,29 @@ discard block |
||
13 | 13 | */ |
14 | 14 | abstract class HtmlCollection extends HtmlDoubleElement { |
15 | 15 | |
16 | - public function __construct($identifier,$tagName="div"){ |
|
17 | - parent::__construct($identifier,$tagName); |
|
16 | + public function __construct($identifier, $tagName="div") { |
|
17 | + parent::__construct($identifier, $tagName); |
|
18 | 18 | $this->content=array(); |
19 | 19 | } |
20 | 20 | |
21 | - public function addItems($items){ |
|
22 | - if(JArray::isAssociative($items)){ |
|
23 | - foreach ($items as $k=>$v){ |
|
24 | - $this->addItem([$k,$v]); |
|
21 | + public function addItems($items) { |
|
22 | + if (JArray::isAssociative($items)) { |
|
23 | + foreach ($items as $k=>$v) { |
|
24 | + $this->addItem([$k, $v]); |
|
25 | 25 | } |
26 | - }else{ |
|
27 | - foreach ($items as $item){ |
|
26 | + }else { |
|
27 | + foreach ($items as $item) { |
|
28 | 28 | $this->addItem($item); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - public function setItems($items){ |
|
33 | + public function setItems($items) { |
|
34 | 34 | $this->content=$items; |
35 | 35 | return $this; |
36 | 36 | } |
37 | 37 | |
38 | - public function getItems(){ |
|
38 | + public function getItems() { |
|
39 | 39 | return $this->content; |
40 | 40 | } |
41 | 41 | |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * @param HtmlDoubleElement|string $item |
45 | 45 | * @return \Ajax\common\html\HtmlDoubleElement |
46 | 46 | */ |
47 | - public function addItem($item){ |
|
47 | + public function addItem($item) { |
|
48 | 48 | $itemO=$item; |
49 | - if($this->createCondition($item)===true){ |
|
49 | + if ($this->createCondition($item)===true) { |
|
50 | 50 | $itemO=$this->createItem($item); |
51 | 51 | } |
52 | 52 | $this->addContent($itemO); |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function removeItem($index){ |
|
75 | + public function removeItem($index) { |
|
76 | 76 | return array_splice($this->content, $index, 1); |
77 | 77 | } |
78 | 78 | |
79 | - public function count(){ |
|
79 | + public function count() { |
|
80 | 80 | return \sizeof($this->content); |
81 | 81 | } |
82 | 82 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $this->addItem($function($object)); |
88 | 88 | } |
89 | 89 | |
90 | - public function apply($callBack){ |
|
91 | - foreach ($this->content as $item){ |
|
90 | + public function apply($callBack) { |
|
91 | + foreach ($this->content as $item) { |
|
92 | 92 | $callBack($item); |
93 | 93 | } |
94 | 94 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected abstract function createItem($value); |
108 | 108 | |
109 | - protected function createCondition($value){ |
|
109 | + protected function createCondition($value) { |
|
110 | 110 | return \is_object($value)===false; |
111 | 111 | } |
112 | 112 |
@@ -21,6 +21,11 @@ discard block |
||
21 | 21 | protected $_contentSeparator=""; |
22 | 22 | |
23 | 23 | |
24 | + /** |
|
25 | + * @param string $identifier |
|
26 | + * @param string $tagName |
|
27 | + * @param string $baseClass |
|
28 | + */ |
|
24 | 29 | public function __construct($identifier,$tagName,$baseClass){ |
25 | 30 | parent::__construct($identifier,$tagName,$baseClass); |
26 | 31 | $this->root=""; |
@@ -31,8 +36,7 @@ discard block |
||
31 | 36 | * Associate an ajax get to the elements, displayed in $targetSelector |
32 | 37 | * $attr member is used to build each element url |
33 | 38 | * @param string $targetSelector the target of the get |
34 | - * @param string $attr the html attribute used to build the elements url |
|
35 | - * @return HtmlNavElement |
|
39 | + * @return HtmlSemNavElement |
|
36 | 40 | */ |
37 | 41 | public function autoGetOnClick($targetSelector){ |
38 | 42 | return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
@@ -64,7 +68,7 @@ discard block |
||
64 | 68 | /** |
65 | 69 | * Define the html attribute for each element url in ajax |
66 | 70 | * @param string $attr html attribute |
67 | - * @return HtmlNavElement |
|
71 | + * @return HtmlSemNavElement |
|
68 | 72 | */ |
69 | 73 | public function setAttr($attr) { |
70 | 74 | $this->attr = $attr; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | protected $_contentSeparator=""; |
22 | 22 | |
23 | 23 | |
24 | - public function __construct($identifier,$tagName,$baseClass){ |
|
25 | - parent::__construct($identifier,$tagName,$baseClass); |
|
24 | + public function __construct($identifier, $tagName, $baseClass) { |
|
25 | + parent::__construct($identifier, $tagName, $baseClass); |
|
26 | 26 | $this->root=""; |
27 | 27 | $this->attr="data-ajax"; |
28 | 28 | } |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * @param string $attr the html attribute used to build the elements url |
35 | 35 | * @return HtmlNavElement |
36 | 36 | */ |
37 | - public function autoGetOnClick($targetSelector){ |
|
38 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
37 | + public function autoGetOnClick($targetSelector) { |
|
38 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function contentAsString(){ |
|
41 | + public function contentAsString() { |
|
42 | 42 | return implode($this->_contentSeparator, $this->content); |
43 | 43 | } |
44 | 44 | |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | * Generate the jquery script to set the elements to the HtmlNavElement |
47 | 47 | * @param JsUtils $jsUtils |
48 | 48 | */ |
49 | - public function jsSetContent(JsUtils $jsUtils){ |
|
50 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
49 | + public function jsSetContent(JsUtils $jsUtils) { |
|
50 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function getRoot() { |
54 | 54 | return $this->root; |
55 | 55 | } |
56 | 56 | public function setRoot($root) { |
57 | - $this->root = $root; |
|
57 | + $this->root=$root; |
|
58 | 58 | return $this; |
59 | 59 | } |
60 | 60 | public function getAttr() { |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | * @return HtmlNavElement |
68 | 68 | */ |
69 | 69 | public function setAttr($attr) { |
70 | - $this->attr = $attr; |
|
70 | + $this->attr=$attr; |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function __call($method, $args) { |
75 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
75 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
76 | 76 | return call_user_func_array( |
77 | 77 | $this->$method, |
78 | 78 | $args |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - public abstract function fromDispatcher($dispatcher,$startIndex=0); |
|
83 | + public abstract function fromDispatcher($dispatcher, $startIndex=0); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | public function setContentSeparator($contentSeparator) { |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * Associate an ajax get to the breadcrumb elements, displayed in $targetSelector |
56 | 56 | * $attr member is used to build each element url |
57 | 57 | * @param string $targetSelector the target of the get |
58 | - * @param string $attr the html attribute used to build the elements url |
|
59 | - * @return HtmlBreadcrumbs |
|
58 | + * @return HtmlBreadcrumb |
|
60 | 59 | */ |
61 | 60 | public function autoGetOnClick($targetSelector){ |
62 | 61 | return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
@@ -118,7 +117,7 @@ discard block |
||
118 | 117 | /** |
119 | 118 | * sets the function who generates the href elements. default : function($element){return $element->getContent()} |
120 | 119 | * @param function $_hrefFunction |
121 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
120 | + * @return HtmlBreadcrumb |
|
122 | 121 | */ |
123 | 122 | public function setHrefFunction($_hrefFunction) { |
124 | 123 | $this->_hrefFunction = $_hrefFunction; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author jc |
14 | 14 | * @version 1.001 |
15 | 15 | */ |
16 | -class HtmlBreadcrumb extends HtmlSemNavElement{ |
|
16 | +class HtmlBreadcrumb extends HtmlSemNavElement { |
|
17 | 17 | /** |
18 | 18 | * @var integer the start index for href generation |
19 | 19 | */ |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
40 | 40 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
41 | 41 | */ |
42 | - public function __construct( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
43 | - parent::__construct( $identifier, "div", "ui breadcrumb"); |
|
42 | + public function __construct($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
43 | + parent::__construct($identifier, "div", "ui breadcrumb"); |
|
44 | 44 | $this->startIndex=$startIndex; |
45 | 45 | $this->autoActive=$autoActive; |
46 | 46 | $this->_contentSeparator="<div class='divider'> / </div>"; |
47 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
48 | - if(isset($hrefFunction)){ |
|
47 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
48 | + if (isset($hrefFunction)) { |
|
49 | 49 | $this->_hrefFunction=$hrefFunction; |
50 | 50 | } |
51 | 51 | $this->addItems($items); |
@@ -58,23 +58,23 @@ discard block |
||
58 | 58 | * @param string $attr the html attribute used to build the elements url |
59 | 59 | * @return HtmlBreadcrumbs |
60 | 60 | */ |
61 | - public function autoGetOnClick($targetSelector){ |
|
62 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
61 | + public function autoGetOnClick($targetSelector) { |
|
62 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
63 | 63 | } |
64 | 64 | |
65 | - public function contentAsString(){ |
|
66 | - if($this->autoActive){ |
|
65 | + public function contentAsString() { |
|
66 | + if ($this->autoActive) { |
|
67 | 67 | $this->setActive(); |
68 | 68 | } |
69 | 69 | return parent::contentAsString(); |
70 | 70 | } |
71 | 71 | |
72 | - public function setActive($index=null){ |
|
73 | - if(!isset($index)){ |
|
72 | + public function setActive($index=null) { |
|
73 | + if (!isset($index)) { |
|
74 | 74 | $index=sizeof($this->content)-1; |
75 | 75 | } |
76 | 76 | $activeItem=$this->content[$index]; |
77 | - $activeItem->addToProperty("class","active"); |
|
77 | + $activeItem->addToProperty("class", "active"); |
|
78 | 78 | $activeItem->setTagName("div"); |
79 | 79 | } |
80 | 80 | |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | * @param Dispatcher $dispatcher the request dispatcher |
84 | 84 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
85 | 85 | */ |
86 | - public function fromDispatcher($dispatcher,$startIndex=0){ |
|
86 | + public function fromDispatcher($dispatcher, $startIndex=0) { |
|
87 | 87 | $this->startIndex=$startIndex; |
88 | 88 | $params=$dispatcher->getParams(); |
89 | 89 | $action=$dispatcher->getActionName(); |
90 | 90 | $items=array($dispatcher->getControllerName()); |
91 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
91 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
92 | 92 | $items[]=$action; |
93 | - foreach ($params as $p){ |
|
94 | - if(\is_object($p)===false) |
|
93 | + foreach ($params as $p) { |
|
94 | + if (\is_object($p)===false) |
|
95 | 95 | $items[]=$p; |
96 | 96 | } |
97 | 97 | } |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | * @param string $separator |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public function getHref($index=null,$separator="/"){ |
|
108 | - if(!isset($index)){ |
|
107 | + public function getHref($index=null, $separator="/") { |
|
108 | + if (!isset($index)) { |
|
109 | 109 | $index=sizeof($this->content); |
110 | 110 | } |
111 | - if($this->absolutePaths===true){ |
|
111 | + if ($this->absolutePaths===true) { |
|
112 | 112 | return $this->_hrefFunction($this->content[$index]); |
113 | - }else{ |
|
114 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
113 | + }else { |
|
114 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
122 | 122 | */ |
123 | 123 | public function setHrefFunction($_hrefFunction) { |
124 | - $this->_hrefFunction = $_hrefFunction; |
|
124 | + $this->_hrefFunction=$_hrefFunction; |
|
125 | 125 | return $this; |
126 | 126 | } |
127 | 127 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | public function setAutoActive($autoActive) { |
134 | - $this->autoActive = $autoActive; |
|
134 | + $this->autoActive=$autoActive; |
|
135 | 135 | return $this; |
136 | 136 | } |
137 | 137 | |
@@ -140,11 +140,11 @@ discard block |
||
140 | 140 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
141 | 141 | */ |
142 | 142 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
143 | - if($this->autoActive){ |
|
143 | + if ($this->autoActive) { |
|
144 | 144 | $this->setActive(); |
145 | 145 | } |
146 | 146 | $count=$this->count(); |
147 | - for($i=1;$i<$count;$i++){ |
|
147 | + for ($i=1; $i<$count; $i++) { |
|
148 | 148 | $this->content[$i]->wrap($this->_contentSeparator); |
149 | 149 | } |
150 | 150 | return parent::compile($js, $view); |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
156 | 156 | */ |
157 | 157 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
158 | - foreach ($this->content as $element){ |
|
159 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
158 | + foreach ($this->content as $element) { |
|
159 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
160 | 160 | } |
161 | 161 | return $this; |
162 | 162 | } |
163 | 163 | |
164 | 164 | |
165 | 165 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
166 | - foreach ($this->content as $element){ |
|
166 | + foreach ($this->content as $element) { |
|
167 | 167 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
168 | 168 | } |
169 | 169 | return $this; |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function createItem($value) { |
177 | 177 | $count=$this->count(); |
178 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"a","section"); |
|
179 | - if(\is_array($value)) |
|
178 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
179 | + if (\is_array($value)) |
|
180 | 180 | $itemO->fromArray($value); |
181 | - else{ |
|
181 | + else { |
|
182 | 182 | $itemO->setContent($value); |
183 | 183 | $itemO->setProperty($this->attr, $this->getHref($count)); |
184 | 184 | } |
185 | 185 | return $itemO; |
186 | 186 | } |
187 | 187 | |
188 | - public function addIcon($icon,$index){ |
|
188 | + public function addIcon($icon, $index) { |
|
189 | 189 | $item=$this->getItem($index); |
190 | - if(isset($item)){ |
|
190 | + if (isset($item)) { |
|
191 | 191 | $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
192 | 192 | $item->wrapContent($icon); |
193 | 193 | } |
@@ -91,8 +91,9 @@ discard block |
||
91 | 91 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
92 | 92 | $items[]=$action; |
93 | 93 | foreach ($params as $p){ |
94 | - if(\is_object($p)===false) |
|
95 | - $items[]=$p; |
|
94 | + if(\is_object($p)===false) { |
|
95 | + $items[]=$p; |
|
96 | + } |
|
96 | 97 | } |
97 | 98 | } |
98 | 99 | return $this->addItems($items); |
@@ -110,7 +111,7 @@ discard block |
||
110 | 111 | } |
111 | 112 | if($this->absolutePaths===true){ |
112 | 113 | return $this->_hrefFunction($this->content[$index]); |
113 | - }else{ |
|
114 | + } else{ |
|
114 | 115 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
115 | 116 | } |
116 | 117 | } |
@@ -176,9 +177,9 @@ discard block |
||
176 | 177 | protected function createItem($value) { |
177 | 178 | $count=$this->count(); |
178 | 179 | $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"a","section"); |
179 | - if(\is_array($value)) |
|
180 | - $itemO->fromArray($value); |
|
181 | - else{ |
|
180 | + if(\is_array($value)) { |
|
181 | + $itemO->fromArray($value); |
|
182 | + } else{ |
|
182 | 183 | $itemO->setContent($value); |
183 | 184 | $itemO->setProperty($this->attr, $this->getHref($count)); |
184 | 185 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param string $identifier |
75 | 75 | * @param string $icon |
76 | 76 | */ |
77 | - public function htmlIcon($identifier,$icon){ |
|
77 | + public function htmlIcon($identifier, $icon) { |
|
78 | 78 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
79 | 79 | } |
80 | 80 | |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | * @param string $size |
84 | 84 | * @param array $icons |
85 | 85 | */ |
86 | - public function htmlIconGroups($identifier,$size="",$icons=array()){ |
|
87 | - $group=new HtmlIconGroups($identifier,$size); |
|
88 | - if(JArray::isAssociative($icons)){ |
|
89 | - foreach ($icons as $icon=>$size){ |
|
90 | - $group->add($icon,$size); |
|
86 | + public function htmlIconGroups($identifier, $size="", $icons=array()) { |
|
87 | + $group=new HtmlIconGroups($identifier, $size); |
|
88 | + if (JArray::isAssociative($icons)) { |
|
89 | + foreach ($icons as $icon=>$size) { |
|
90 | + $group->add($icon, $size); |
|
91 | 91 | } |
92 | - }else{ |
|
93 | - foreach ($icons as $icon){ |
|
92 | + }else { |
|
93 | + foreach ($icons as $icon) { |
|
94 | 94 | $group->add($icon); |
95 | 95 | } |
96 | 96 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param array $elements |
103 | 103 | * @param boolean $asIcons |
104 | 104 | */ |
105 | - public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
|
106 | - return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
|
105 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
106 | + return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @param string $identifier |
112 | 112 | * @param string $content |
113 | 113 | */ |
114 | - public function htmlContainer($identifier,$content=""){ |
|
114 | + public function htmlContainer($identifier, $content="") { |
|
115 | 115 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
116 | 116 | } |
117 | 117 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param string $identifier |
120 | 120 | * @param string $content |
121 | 121 | */ |
122 | - public function htmlDivider($identifier,$content="",$tagName="div"){ |
|
123 | - return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
|
122 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
123 | + return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param string $content |
129 | 129 | * @param string $tagName |
130 | 130 | */ |
131 | - public function htmlLabel($identifier,$content="",$tagName="div"){ |
|
132 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
|
131 | + public function htmlLabel($identifier, $content="", $tagName="div") { |
|
132 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | * @param array $items |
138 | 138 | * @return Ajax\semantic\html\collections\HtmlMenu |
139 | 139 | */ |
140 | - public function htmlMenu($identifier,$items=array()){ |
|
141 | - return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
|
140 | + public function htmlMenu($identifier, $items=array()) { |
|
141 | + return $this->addHtmlComponent(new HtmlMenu($identifier, $items)); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /**Adds an icon menu |
145 | 145 | * @param string $identifier |
146 | 146 | * @param array $items icons |
147 | 147 | */ |
148 | - public function htmlIconMenu($identifier,$items=array()){ |
|
149 | - return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items)); |
|
148 | + public function htmlIconMenu($identifier, $items=array()) { |
|
149 | + return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items)); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /**Adds an labeled icon menu |
153 | 153 | * @param string $identifier |
154 | 154 | * @param array $items icons |
155 | 155 | */ |
156 | - public function htmlLabeledIconMenu($identifier,$items=array()){ |
|
157 | - return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items)); |
|
156 | + public function htmlLabeledIconMenu($identifier, $items=array()) { |
|
157 | + return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * @param string $value |
163 | 163 | * @param array $items |
164 | 164 | */ |
165 | - public function htmlDropdown($identifier, $value="", $items=array()){ |
|
166 | - return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
|
165 | + public function htmlDropdown($identifier, $value="", $items=array()) { |
|
166 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items)); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @param string $identifier |
172 | 172 | * @param string $content |
173 | 173 | */ |
174 | - public function htmlMessage($identifier, $content=""){ |
|
175 | - return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
|
174 | + public function htmlMessage($identifier, $content="") { |
|
175 | + return $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | * @param string $identifier |
181 | 181 | * @param string $content |
182 | 182 | */ |
183 | - public function htmlSegment($identifier, $content=""){ |
|
184 | - return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
|
183 | + public function htmlSegment($identifier, $content="") { |
|
184 | + return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -189,16 +189,16 @@ discard block |
||
189 | 189 | * @param string $identifier |
190 | 190 | * @param array $items the segments |
191 | 191 | */ |
192 | - public function htmlSegmentGroups($identifier, $items=array()){ |
|
193 | - return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
|
192 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
193 | + return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | 197 | * @param string $identifier |
198 | 198 | * @param mixed $content |
199 | 199 | */ |
200 | - public function htmlPopup(BaseHtml $container,$identifier,$content){ |
|
201 | - return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
|
200 | + public function htmlPopup(BaseHtml $container, $identifier, $content) { |
|
201 | + return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content)); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @param boolean $createCols |
209 | 209 | * @param boolean $implicitRows |
210 | 210 | */ |
211 | - public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
212 | - return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows)); |
|
211 | + public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
212 | + return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows)); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -218,19 +218,19 @@ discard block |
||
218 | 218 | * @param mixed $content |
219 | 219 | * @param string $type |
220 | 220 | */ |
221 | - public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
|
222 | - return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
|
221 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
222 | + return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
|
223 | 223 | } |
224 | 224 | |
225 | - public function htmlInput($identifier,$type="text",$value="",$placeholder=""){ |
|
226 | - return $this->addHtmlComponent(new HtmlInput($identifier,$type,$value,$placeholder)); |
|
225 | + public function htmlInput($identifier, $type="text", $value="", $placeholder="") { |
|
226 | + return $this->addHtmlComponent(new HtmlInput($identifier, $type, $value, $placeholder)); |
|
227 | 227 | } |
228 | 228 | |
229 | - public function htmlList($identifier,$items=array()){ |
|
230 | - return $this->addHtmlComponent(new HtmlList($identifier,$items)); |
|
229 | + public function htmlList($identifier, $items=array()) { |
|
230 | + return $this->addHtmlComponent(new HtmlList($identifier, $items)); |
|
231 | 231 | } |
232 | 232 | |
233 | - public function htmlBreadcrumb( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
234 | - return $this->addHtmlComponent(new HtmlBreadcrumb($identifier,$items,$autoActive,$startIndex,$hrefFunction)); |
|
233 | + public function htmlBreadcrumb($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
234 | + return $this->addHtmlComponent(new HtmlBreadcrumb($identifier, $items, $autoActive, $startIndex, $hrefFunction)); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | \ No newline at end of file |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
18 | 18 | * @return \Ajax\semantic\components\Dropdown |
19 | 19 | */ |
20 | - public function setAction($action){ |
|
21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
20 | + public function setAction($action) { |
|
21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event) |
27 | 27 | * @return \Ajax\semantic\components\Dropdown |
28 | 28 | */ |
29 | - public function setOn($event){ |
|
29 | + public function setOn($event) { |
|
30 | 30 | return $this->setParam("on", $event); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -17,42 +17,42 @@ |
||
17 | 17 | use BaseTrait; |
18 | 18 | protected $_popup=NULL; |
19 | 19 | |
20 | - public function __construct($identifier, $tagName="p",$baseClass="ui",$content=NULL) { |
|
20 | + public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) { |
|
21 | 21 | parent::__construct($identifier, $tagName); |
22 | 22 | $this->_baseClass=$baseClass; |
23 | 23 | $this->setClass($baseClass); |
24 | - if(isset($content)){ |
|
24 | + if (isset($content)) { |
|
25 | 25 | $this->content=$content; |
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | - public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
|
30 | - if(isset($this->_popup)) |
|
31 | - $this->_popup->setAttributes($variation,$popupEvent); |
|
29 | + public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
|
30 | + if (isset($this->_popup)) |
|
31 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
|
35 | - $this->_popup=new InternalPopup($this,$title,$content,$variation,$params); |
|
34 | + public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
|
35 | + $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); |
|
36 | 36 | return $this; |
37 | 37 | } |
38 | 38 | |
39 | - public function addPopupHtml($html="",$variation=NULL,$params=array()){ |
|
39 | + public function addPopupHtml($html="", $variation=NULL, $params=array()) { |
|
40 | 40 | $this->_popup=new InternalPopup($this); |
41 | 41 | $this->_popup->setHtml($html); |
42 | - $this->_popup->setAttributes($variation,$params); |
|
42 | + $this->_popup->setAttributes($variation, $params); |
|
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
46 | - public function compile(JsUtils $js=NULL, View $view=NULL){ |
|
47 | - if(isset($this->_popup)) |
|
46 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
47 | + if (isset($this->_popup)) |
|
48 | 48 | $this->_popup->compile(); |
49 | - return parent::compile($js,$view); |
|
49 | + return parent::compile($js, $view); |
|
50 | 50 | } |
51 | - public function run(JsUtils $js){ |
|
51 | + public function run(JsUtils $js) { |
|
52 | 52 | $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
53 | 53 | parent::run($js); |
54 | 54 | $this->addEventsOnRun($js); |
55 | - if(isset($this->_popup)){ |
|
55 | + if (isset($this->_popup)) { |
|
56 | 56 | $this->_popup->run($js); |
57 | 57 | } |
58 | 58 | return $this->_bsComponent; |
@@ -7,15 +7,15 @@ |
||
7 | 7 | |
8 | 8 | class HtmlListItem extends HtmlSemDoubleElement { |
9 | 9 | protected $image; |
10 | - public function __construct($identifier,$content) { |
|
10 | + public function __construct($identifier, $content) { |
|
11 | 11 | parent::__construct($identifier, "div", "item"); |
12 | 12 | $this->_template='<%tagName% id="%identifier%" %properties%>%image%%content%</%tagName%>'; |
13 | 13 | $this->content=$content; |
14 | 14 | } |
15 | - public function addIcon($icon){ |
|
15 | + public function addIcon($icon) { |
|
16 | 16 | $content=$this->content; |
17 | - $this->content=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
17 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
18 | 18 | $this->content->setContent($content); |
19 | - $this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon),true); |
|
19 | + $this->content->addContent(new HtmlIcon("icon".$this->identifier, $icon), true); |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param string $type one of text,item |
28 | 28 | * @return \Ajax\semantic\html\collections\HtmlMenu |
29 | 29 | */ |
30 | - public function setType($type=""){ |
|
31 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
30 | + public function setType($type="") { |
|
31 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function setActiveItem($index){ |
|
34 | + public function setActiveItem($index) { |
|
35 | 35 | $item=$this->getItem($index); |
36 | - if($item!==null){ |
|
36 | + if ($item!==null) { |
|
37 | 37 | $item->addToProperty("class", "active"); |
38 | 38 | } |
39 | 39 | return $this; |
@@ -43,24 +43,24 @@ discard block |
||
43 | 43 | * {@inheritDoc} |
44 | 44 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
45 | 45 | */ |
46 | - public function addItem($item){ |
|
47 | - if($item instanceof \Ajax\semantic\html\elements\HtmlInput){ |
|
48 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier,"div"); |
|
46 | + public function addItem($item) { |
|
47 | + if ($item instanceof \Ajax\semantic\html\elements\HtmlInput) { |
|
48 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div"); |
|
49 | 49 | $itemO->setContent($item); |
50 | 50 | $item=$itemO; |
51 | 51 | } |
52 | 52 | $item=parent::addItem($item); |
53 | - if(!$item instanceof HtmlMenu) |
|
54 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
55 | - else{ |
|
53 | + if (!$item instanceof HtmlMenu) |
|
54 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
55 | + else { |
|
56 | 56 | $this->setSecondary(); |
57 | 57 | } |
58 | 58 | } |
59 | - public function generateMenuAsItem($menu,$header=null){ |
|
59 | + public function generateMenuAsItem($menu, $header=null) { |
|
60 | 60 | $count=$this->count(); |
61 | - $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"div"); |
|
62 | - if(isset($header)){ |
|
63 | - $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count,"div","header"); |
|
61 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
62 | + if (isset($header)) { |
|
63 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
64 | 64 | $headerItem->setContent($header); |
65 | 65 | $item->addContent($headerItem); |
66 | 66 | } |
@@ -68,59 +68,59 @@ discard block |
||
68 | 68 | $item->addContent($menu); |
69 | 69 | return $item; |
70 | 70 | } |
71 | - public function addMenuAsItem($menu,$header=null){ |
|
72 | - return $this->addItem($this->generateMenuAsItem($menu,$header)); |
|
71 | + public function addMenuAsItem($menu, $header=null) { |
|
72 | + return $this->addItem($this->generateMenuAsItem($menu, $header)); |
|
73 | 73 | } |
74 | 74 | /** |
75 | 75 | * {@inheritDoc} |
76 | 76 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
77 | 77 | */ |
78 | 78 | protected function createItem($value) { |
79 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
79 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
80 | 80 | return $itemO->setClass("item"); |
81 | 81 | } |
82 | 82 | |
83 | - public function setInverted(){ |
|
83 | + public function setInverted() { |
|
84 | 84 | return $this->addToProperty("class", "inverted"); |
85 | 85 | } |
86 | 86 | |
87 | - public function setSecondary(){ |
|
87 | + public function setSecondary() { |
|
88 | 88 | return $this->addToProperty("class", "secondary"); |
89 | 89 | } |
90 | 90 | |
91 | - public function setVertical(){ |
|
91 | + public function setVertical() { |
|
92 | 92 | return $this->addToProperty("class", "vertical"); |
93 | 93 | } |
94 | 94 | |
95 | - public function setPosition($value="right"){ |
|
96 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
95 | + public function setPosition($value="right") { |
|
96 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
97 | 97 | } |
98 | 98 | |
99 | - public function setPointing($value=Direction::NONE){ |
|
100 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
99 | + public function setPointing($value=Direction::NONE) { |
|
100 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
101 | 101 | } |
102 | 102 | |
103 | - public function asTab($vertical=false){ |
|
104 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
105 | - if($vertical===true) |
|
103 | + public function asTab($vertical=false) { |
|
104 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
105 | + if ($vertical===true) |
|
106 | 106 | $this->setVertical(); |
107 | 107 | return $this->addToProperty("class", "tabular"); |
108 | 108 | } |
109 | 109 | |
110 | - public function asPagination(){ |
|
111 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
110 | + public function asPagination() { |
|
111 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
112 | 112 | return $this->addToProperty("class", "pagination"); |
113 | 113 | } |
114 | 114 | |
115 | - public function setFixed(){ |
|
115 | + public function setFixed() { |
|
116 | 116 | return $this->addToProperty("class", "fixed"); |
117 | 117 | } |
118 | 118 | |
119 | - public function setFluid(){ |
|
119 | + public function setFluid() { |
|
120 | 120 | return $this->addToProperty("class", "fluid"); |
121 | 121 | } |
122 | 122 | |
123 | - public function setCompact(){ |
|
123 | + public function setCompact() { |
|
124 | 124 | return $this->addToProperty("class", "compact"); |
125 | 125 | } |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function fromDatabaseObject($object, $function) { |
131 | 131 | $return=$function($object); |
132 | - if(\is_array($return)) |
|
132 | + if (\is_array($return)) |
|
133 | 133 | $this->addItems($return); |
134 | 134 | else |
135 | 135 | $this->addItem($return); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $item=$itemO; |
51 | 51 | } |
52 | 52 | $item=parent::addItem($item); |
53 | - if(!$item instanceof HtmlMenu) |
|
54 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
55 | - else{ |
|
53 | + if(!$item instanceof HtmlMenu) { |
|
54 | + $item->addToPropertyCtrl("class", "item",array("item")); |
|
55 | + } else{ |
|
56 | 56 | $this->setSecondary(); |
57 | 57 | } |
58 | 58 | } |
@@ -102,8 +102,9 @@ discard block |
||
102 | 102 | |
103 | 103 | public function asTab($vertical=false){ |
104 | 104 | $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
105 | - if($vertical===true) |
|
106 | - $this->setVertical(); |
|
105 | + if($vertical===true) { |
|
106 | + $this->setVertical(); |
|
107 | + } |
|
107 | 108 | return $this->addToProperty("class", "tabular"); |
108 | 109 | } |
109 | 110 | |
@@ -129,9 +130,10 @@ discard block |
||
129 | 130 | */ |
130 | 131 | public function fromDatabaseObject($object, $function) { |
131 | 132 | $return=$function($object); |
132 | - if(\is_array($return)) |
|
133 | - $this->addItems($return); |
|
134 | - else |
|
135 | - $this->addItem($return); |
|
133 | + if(\is_array($return)) { |
|
134 | + $this->addItems($return); |
|
135 | + } else { |
|
136 | + $this->addItem($return); |
|
137 | + } |
|
136 | 138 | } |
137 | 139 | } |
138 | 140 | \ No newline at end of file |
@@ -6,20 +6,20 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\base\HtmlSemCollection; |
7 | 7 | use Ajax\semantic\html\base\constants\Sens; |
8 | 8 | |
9 | -class HtmlSegmentGroups extends HtmlSemCollection{ |
|
9 | +class HtmlSegmentGroups extends HtmlSemCollection { |
|
10 | 10 | |
11 | 11 | |
12 | - public function __construct( $identifier, $items=array()){ |
|
13 | - parent::__construct( $identifier, "div","ui segments"); |
|
12 | + public function __construct($identifier, $items=array()) { |
|
13 | + parent::__construct($identifier, "div", "ui segments"); |
|
14 | 14 | $this->addItems($items); |
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
19 | - return new HtmlSegment("segment-".$this->count(),$value); |
|
18 | + protected function createItem($value) { |
|
19 | + return new HtmlSegment("segment-".$this->count(), $value); |
|
20 | 20 | } |
21 | 21 | |
22 | - protected function createCondition($value){ |
|
22 | + protected function createCondition($value) { |
|
23 | 23 | return !($value instanceof HtmlSegment); |
24 | 24 | } |
25 | 25 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | * @param string $type one of "raised","stacked","piled" default : "" |
29 | 29 | * @return \Ajax\semantic\html\elements\HtmlSegmentGroups |
30 | 30 | */ |
31 | - public function setType($type){ |
|
31 | + public function setType($type) { |
|
32 | 32 | return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants()); |
33 | 33 | } |
34 | 34 | |
35 | - public function setSens($sens=Sens::VERTICAL){ |
|
35 | + public function setSens($sens=Sens::VERTICAL) { |
|
36 | 36 | return $this->addToPropertyCtrl("class", $sens, Sens::getConstants()); |
37 | 37 | } |
38 | 38 | |
39 | - public static function group($identifier,$items=array(),$type="",$sens=Sens::VERTICAL){ |
|
40 | - $group=new HtmlSegmentGroups($identifier,$items); |
|
39 | + public static function group($identifier, $items=array(), $type="", $sens=Sens::VERTICAL) { |
|
40 | + $group=new HtmlSegmentGroups($identifier, $items); |
|
41 | 41 | $group->setSens($sens); |
42 | 42 | return $group->setType($type); |
43 | 43 | } |