@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class State extends BaseEnum { |
8 | - const ACTIVE="active",DISABLED="disabled",ERROR="error",FOCUS="focus",LOADING="loading"; |
|
8 | + const ACTIVE="active", DISABLED="disabled", ERROR="error", FOCUS="focus", LOADING="loading"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -13,17 +13,17 @@ |
||
13 | 13 | * @param boolean $labeled |
14 | 14 | * @return \Ajax\semantic\html\elements\HtmlIcon |
15 | 15 | */ |
16 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
16 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
17 | 17 | $iconO=$icon; |
18 | - if(\is_string($icon)){ |
|
18 | + if (\is_string($icon)) { |
|
19 | 19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
20 | 20 | } |
21 | - if($labeled!==false){ |
|
22 | - $direction=($before===true)?Direction::RIGHT:Direction::LEFT; |
|
21 | + if ($labeled!==false) { |
|
22 | + $direction=($before===true) ? Direction::RIGHT : Direction::LEFT; |
|
23 | 23 | $this->addToProperty("class", $direction." labeled icon"); |
24 | 24 | $this->tagName="div"; |
25 | 25 | } |
26 | - $this->addContent($iconO,$before); |
|
26 | + $this->addContent($iconO, $before); |
|
27 | 27 | return $iconO; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -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 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Variation extends BaseEnum { |
8 | - const ANIMATED="animated",AVATAR="avatar",COMPACT="compact",FLUID="fluid",INVERTED="inverted",PADDED="padded",TRANSPARENT="transparent"; |
|
8 | + const ANIMATED="animated", AVATAR="avatar", COMPACT="compact", FLUID="fluid", INVERTED="inverted", PADDED="padded", TRANSPARENT="transparent"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,22 +5,22 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
6 | 6 | use Ajax\semantic\html\content\HtmlListItem; |
7 | 7 | |
8 | -class HtmlList extends HtmlSemCollection{ |
|
8 | +class HtmlList extends HtmlSemCollection { |
|
9 | 9 | |
10 | 10 | |
11 | - public function __construct( $identifier, $items=array()){ |
|
12 | - parent::__construct( $identifier, "div", "ui list"); |
|
11 | + public function __construct($identifier, $items=array()) { |
|
12 | + parent::__construct($identifier, "div", "ui list"); |
|
13 | 13 | $this->addItems($items); |
14 | 14 | } |
15 | 15 | |
16 | 16 | |
17 | - protected function createItem($value){ |
|
17 | + protected function createItem($value) { |
|
18 | 18 | $count=$this->count(); |
19 | - if(\is_array($value)){ |
|
19 | + if (\is_array($value)) { |
|
20 | 20 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
21 | 21 | $item->addIcon($value[1]); |
22 | 22 | }else |
23 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
23 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
24 | 24 | return $item; |
25 | 25 | } |
26 | 26 |
@@ -19,8 +19,9 @@ |
||
19 | 19 | if(\is_array($value)){ |
20 | 20 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
21 | 21 | $item->addIcon($value[1]); |
22 | - }else |
|
23 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
22 | + } else { |
|
23 | + $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
24 | + } |
|
24 | 25 | return $item; |
25 | 26 | } |
26 | 27 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $itemO=$item; |
35 | 35 | if(\is_object($item)===false){ |
36 | 36 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
37 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
38 | 38 | $this->addToProperty("class", "vertical"); |
39 | 39 | } |
40 | 40 | $this->items[]=$itemO; |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | public function addInput($name){ |
45 | - if(!isset($name)) |
|
46 | - $name="input-".$this->identifier; |
|
45 | + if(!isset($name)) { |
|
46 | + $name="input-".$this->identifier; |
|
47 | + } |
|
47 | 48 | $this->setAction("activate"); |
48 | 49 | $this->input=new HtmlInput($name,"hidden"); |
49 | 50 | } |
@@ -53,7 +54,7 @@ discard block |
||
53 | 54 | foreach ($items as $k=>$v){ |
54 | 55 | $this->addItem($v)->setData($k); |
55 | 56 | } |
56 | - }else{ |
|
57 | + } else{ |
|
57 | 58 | foreach ($items as $item){ |
58 | 59 | $this->addItem($item); |
59 | 60 | } |
@@ -67,7 +68,7 @@ discard block |
||
67 | 68 | if($dropdown===false){ |
68 | 69 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
69 | 70 | $dropdown="menu"; |
70 | - }else{ |
|
71 | + } else{ |
|
71 | 72 | $dropdown="dropdown"; |
72 | 73 | $this->mClass="menu"; |
73 | 74 | } |
@@ -83,18 +84,22 @@ discard block |
||
83 | 84 | } |
84 | 85 | |
85 | 86 | public function asButton($floating=false){ |
86 | - if($floating) |
|
87 | - $this->addToProperty("class", "floating"); |
|
87 | + if($floating) { |
|
88 | + $this->addToProperty("class", "floating"); |
|
89 | + } |
|
88 | 90 | return $this->addToProperty("class", "button"); |
89 | 91 | } |
90 | 92 | |
91 | 93 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
92 | - if(isset($name)) |
|
93 | - $this->addInput($name); |
|
94 | - if($multiple) |
|
95 | - $this->addToProperty("class", "multiple"); |
|
96 | - if ($selection) |
|
97 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
94 | + if(isset($name)) { |
|
95 | + $this->addInput($name); |
|
96 | + } |
|
97 | + if($multiple) { |
|
98 | + $this->addToProperty("class", "multiple"); |
|
99 | + } |
|
100 | + if ($selection) { |
|
101 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
102 | + } |
|
98 | 103 | return $this; |
99 | 104 | } |
100 | 105 | |
@@ -104,8 +109,9 @@ discard block |
||
104 | 109 | } |
105 | 110 | |
106 | 111 | public function setSelect($name=NULL,$multiple=false){ |
107 | - if(!isset($name)) |
|
108 | - $name="select-".$this->identifier; |
|
112 | + if(!isset($name)) { |
|
113 | + $name="select-".$this->identifier; |
|
114 | + } |
|
109 | 115 | $this->input=null; |
110 | 116 | if($multiple){ |
111 | 117 | $this->setProperty("multiple", true); |
@@ -136,12 +142,13 @@ discard block |
||
136 | 142 | public function setValue($value){ |
137 | 143 | if(isset($this->input)){ |
138 | 144 | $this->input->setProperty("value", $value); |
139 | - }else{ |
|
145 | + } else{ |
|
140 | 146 | $this->setProperty("value", $value); |
141 | 147 | } |
142 | 148 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
143 | - if(isset($textElement)) |
|
144 | - $textElement->setContent($value); |
|
149 | + if(isset($textElement)) { |
|
150 | + $textElement->setContent($value); |
|
151 | + } |
|
145 | 152 | return $this; |
146 | 153 | } |
147 | 154 | |
@@ -151,8 +158,9 @@ discard block |
||
151 | 158 | */ |
152 | 159 | public function run(JsUtils $js) { |
153 | 160 | if($this->propertyContains("class", "simple")===false){ |
154 | - if(isset($this->_bsComponent)===false) |
|
155 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
161 | + if(isset($this->_bsComponent)===false) { |
|
162 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
163 | + } |
|
156 | 164 | $this->addEventsOnRun($js); |
157 | 165 | return $this->_bsComponent; |
158 | 166 | } |
@@ -13,28 +13,28 @@ discard block |
||
13 | 13 | class HtmlDropdown extends HtmlSemDoubleElement { |
14 | 14 | protected $mClass="menu"; |
15 | 15 | protected $mTagName="div"; |
16 | - protected $items=array (); |
|
17 | - protected $params=array("action"=>"auto","on"=>"hover"); |
|
16 | + protected $items=array(); |
|
17 | + protected $params=array("action"=>"auto", "on"=>"hover"); |
|
18 | 18 | protected $input; |
19 | 19 | |
20 | 20 | public function __construct($identifier, $value="", $items=array()) { |
21 | 21 | parent::__construct($identifier, "div"); |
22 | 22 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
23 | 23 | $this->setProperty("class", "ui dropdown"); |
24 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
24 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
25 | 25 | $content->setClass("text"); |
26 | 26 | $content->setContent($value); |
27 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
27 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
28 | 28 | $this->content=array($content); |
29 | 29 | $this->tagName="div"; |
30 | 30 | $this->addItems($items); |
31 | 31 | } |
32 | 32 | |
33 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
33 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
34 | 34 | $itemO=$item; |
35 | - if(\is_object($item)===false){ |
|
36 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
35 | + if (\is_object($item)===false) { |
|
36 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
37 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
38 | 38 | $this->addToProperty("class", "vertical"); |
39 | 39 | } |
40 | 40 | $this->items[]=$itemO; |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | $this->addItem($function($object)); |
49 | 49 | } |
50 | 50 | |
51 | - public function addInput($name){ |
|
52 | - if(!isset($name)) |
|
51 | + public function addInput($name) { |
|
52 | + if (!isset($name)) |
|
53 | 53 | $name="input-".$this->identifier; |
54 | 54 | $this->setAction("activate"); |
55 | - $this->input=new HtmlInput($name,"hidden"); |
|
55 | + $this->input=new HtmlInput($name, "hidden"); |
|
56 | 56 | } |
57 | 57 | |
58 | - public function addItems($items){ |
|
59 | - if(JArray::isAssociative($items)){ |
|
60 | - foreach ($items as $k=>$v){ |
|
58 | + public function addItems($items) { |
|
59 | + if (JArray::isAssociative($items)) { |
|
60 | + foreach ($items as $k=>$v) { |
|
61 | 61 | $this->addItem($v)->setData($k); |
62 | 62 | } |
63 | - }else{ |
|
64 | - foreach ($items as $item){ |
|
63 | + }else { |
|
64 | + foreach ($items as $item) { |
|
65 | 65 | $this->addItem($item); |
66 | 66 | } |
67 | 67 | } |
@@ -70,51 +70,51 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @param boolean $dropdown |
72 | 72 | */ |
73 | - public function asDropdown($dropdown){ |
|
74 | - if($dropdown===false){ |
|
73 | + public function asDropdown($dropdown) { |
|
74 | + if ($dropdown===false) { |
|
75 | 75 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
76 | 76 | $dropdown="menu"; |
77 | - }else{ |
|
77 | + }else { |
|
78 | 78 | $dropdown="dropdown"; |
79 | 79 | $this->mClass="menu"; |
80 | 80 | } |
81 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
81 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
82 | 82 | } |
83 | 83 | |
84 | - public function setVertical(){ |
|
85 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
84 | + public function setVertical() { |
|
85 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function setSimple(){ |
|
89 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
88 | + public function setSimple() { |
|
89 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
90 | 90 | } |
91 | 91 | |
92 | - public function asButton($floating=false){ |
|
93 | - if($floating) |
|
92 | + public function asButton($floating=false) { |
|
93 | + if ($floating) |
|
94 | 94 | $this->addToProperty("class", "floating"); |
95 | 95 | return $this->addToProperty("class", "button"); |
96 | 96 | } |
97 | 97 | |
98 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
99 | - if(isset($name)) |
|
98 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
99 | + if (isset($name)) |
|
100 | 100 | $this->addInput($name); |
101 | - if($multiple) |
|
101 | + if ($multiple) |
|
102 | 102 | $this->addToProperty("class", "multiple"); |
103 | 103 | if ($selection) |
104 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
104 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
105 | 105 | return $this; |
106 | 106 | } |
107 | 107 | |
108 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
109 | - $this->asSelect($name,$multiple,$selection); |
|
108 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
109 | + $this->asSelect($name, $multiple, $selection); |
|
110 | 110 | return $this->addToProperty("class", "search"); |
111 | 111 | } |
112 | 112 | |
113 | - public function setSelect($name=NULL,$multiple=false){ |
|
114 | - if(!isset($name)) |
|
113 | + public function setSelect($name=NULL, $multiple=false) { |
|
114 | + if (!isset($name)) |
|
115 | 115 | $name="select-".$this->identifier; |
116 | 116 | $this->input=null; |
117 | - if($multiple){ |
|
117 | + if ($multiple) { |
|
118 | 118 | $this->setProperty("multiple", true); |
119 | 119 | $this->addToProperty("class", "multiple"); |
120 | 120 | } |
@@ -122,32 +122,32 @@ discard block |
||
122 | 122 | $this->tagName="select"; |
123 | 123 | $this->setProperty("name", $name); |
124 | 124 | $this->content=null; |
125 | - foreach ($this->items as $item){ |
|
125 | + foreach ($this->items as $item) { |
|
126 | 126 | $item->asOption(); |
127 | 127 | } |
128 | 128 | return $this; |
129 | 129 | } |
130 | 130 | |
131 | - public function asSubmenu($pointing=NULL){ |
|
131 | + public function asSubmenu($pointing=NULL) { |
|
132 | 132 | $this->setClass("ui dropdown link item"); |
133 | - if(isset($pointing)){ |
|
133 | + if (isset($pointing)) { |
|
134 | 134 | $this->setPointing($pointing); |
135 | 135 | } |
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
139 | - public function setPointing($value=Direction::NONE){ |
|
140 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
139 | + public function setPointing($value=Direction::NONE) { |
|
140 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
141 | 141 | } |
142 | 142 | |
143 | - public function setValue($value){ |
|
144 | - if(isset($this->input)){ |
|
143 | + public function setValue($value) { |
|
144 | + if (isset($this->input)) { |
|
145 | 145 | $this->input->setProperty("value", $value); |
146 | - }else{ |
|
146 | + }else { |
|
147 | 147 | $this->setProperty("value", $value); |
148 | 148 | } |
149 | 149 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
150 | - if(isset($textElement)) |
|
150 | + if (isset($textElement)) |
|
151 | 151 | $textElement->setContent($value); |
152 | 152 | return $this; |
153 | 153 | } |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | * @see BaseHtml::run() |
158 | 158 | */ |
159 | 159 | public function run(JsUtils $js) { |
160 | - if($this->propertyContains("class", "simple")===false){ |
|
161 | - if(isset($this->_bsComponent)===false) |
|
162 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
160 | + if ($this->propertyContains("class", "simple")===false) { |
|
161 | + if (isset($this->_bsComponent)===false) |
|
162 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->params); |
|
163 | 163 | $this->addEventsOnRun($js); |
164 | 164 | return $this->_bsComponent; |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - public function setAction($action){ |
|
168 | + public function setAction($action) { |
|
169 | 169 | $this->params["action"]=$action; |
170 | 170 | } |
171 | 171 | } |
172 | 172 | \ No newline at end of file |
@@ -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; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @author jc |
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | -class HtmlBreadcrumb extends HtmlSemNavElement{ |
|
17 | +class HtmlBreadcrumb extends HtmlSemNavElement { |
|
18 | 18 | /** |
19 | 19 | * @var integer the start index for href generation |
20 | 20 | */ |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
41 | 41 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
42 | 42 | */ |
43 | - public function __construct( $identifier,$items=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
44 | - parent::__construct( $identifier, "div", "ui breadcrumb"); |
|
43 | + public function __construct($identifier, $items=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
44 | + parent::__construct($identifier, "div", "ui breadcrumb"); |
|
45 | 45 | $this->startIndex=$startIndex; |
46 | 46 | $this->autoActive=$autoActive; |
47 | 47 | $this->_contentSeparator="<div class='divider'> / </div>"; |
48 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
49 | - if(isset($hrefFunction)){ |
|
48 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
49 | + if (isset($hrefFunction)) { |
|
50 | 50 | $this->_hrefFunction=$hrefFunction; |
51 | 51 | } |
52 | 52 | $this->addItems($items); |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * @param string $attr the html attribute used to build the elements url |
60 | 60 | * @return HtmlBreadcrumbs |
61 | 61 | */ |
62 | - public function autoGetOnClick($targetSelector){ |
|
63 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
62 | + public function autoGetOnClick($targetSelector) { |
|
63 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
64 | 64 | } |
65 | 65 | |
66 | - public function contentAsString(){ |
|
67 | - if($this->autoActive){ |
|
66 | + public function contentAsString() { |
|
67 | + if ($this->autoActive) { |
|
68 | 68 | $this->setActive(); |
69 | 69 | } |
70 | 70 | return parent::contentAsString(); |
71 | 71 | } |
72 | 72 | |
73 | - public function setActive($index=null){ |
|
74 | - if(!isset($index)){ |
|
73 | + public function setActive($index=null) { |
|
74 | + if (!isset($index)) { |
|
75 | 75 | $index=sizeof($this->content)-1; |
76 | 76 | } |
77 | 77 | $activeItem=$this->content[$index]; |
78 | - $activeItem->addToProperty("class","active"); |
|
78 | + $activeItem->addToProperty("class", "active"); |
|
79 | 79 | $activeItem->setTagName("div"); |
80 | 80 | } |
81 | 81 | |
@@ -84,15 +84,15 @@ discard block |
||
84 | 84 | * @param Dispatcher $dispatcher the request dispatcher |
85 | 85 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
86 | 86 | */ |
87 | - public function fromDispatcher($dispatcher,$startIndex=0){ |
|
87 | + public function fromDispatcher($dispatcher, $startIndex=0) { |
|
88 | 88 | $this->startIndex=$startIndex; |
89 | 89 | $params=$dispatcher->getParams(); |
90 | 90 | $action=$dispatcher->getActionName(); |
91 | 91 | $items=array($dispatcher->getControllerName()); |
92 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
92 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
93 | 93 | $items[]=$action; |
94 | - foreach ($params as $p){ |
|
95 | - if(\is_object($p)===false) |
|
94 | + foreach ($params as $p) { |
|
95 | + if (\is_object($p)===false) |
|
96 | 96 | $items[]=$p; |
97 | 97 | } |
98 | 98 | } |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param string $separator |
106 | 106 | * @return string |
107 | 107 | */ |
108 | - public function getHref($index=null,$separator="/"){ |
|
109 | - if(!isset($index)){ |
|
108 | + public function getHref($index=null, $separator="/") { |
|
109 | + if (!isset($index)) { |
|
110 | 110 | $index=sizeof($this->content); |
111 | 111 | } |
112 | - if($this->absolutePaths===true){ |
|
112 | + if ($this->absolutePaths===true) { |
|
113 | 113 | return $this->_hrefFunction($this->content[$index]); |
114 | - }else{ |
|
115 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
114 | + }else { |
|
115 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
123 | 123 | */ |
124 | 124 | public function setHrefFunction($_hrefFunction) { |
125 | - $this->_hrefFunction = $_hrefFunction; |
|
125 | + $this->_hrefFunction=$_hrefFunction; |
|
126 | 126 | return $this; |
127 | 127 | } |
128 | 128 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | public function setAutoActive($autoActive) { |
135 | - $this->autoActive = $autoActive; |
|
135 | + $this->autoActive=$autoActive; |
|
136 | 136 | return $this; |
137 | 137 | } |
138 | 138 | |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
142 | 142 | */ |
143 | 143 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
144 | - if($this->autoActive){ |
|
144 | + if ($this->autoActive) { |
|
145 | 145 | $this->setActive(); |
146 | 146 | } |
147 | 147 | $count=$this->count(); |
148 | - for($i=1;$i<$count;$i++){ |
|
148 | + for ($i=1; $i<$count; $i++) { |
|
149 | 149 | $this->content[$i]->wrap($this->getContentDivider($i-1)); |
150 | 150 | } |
151 | 151 | return parent::compile($js, $view); |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
157 | 157 | */ |
158 | 158 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
159 | - foreach ($this->content as $element){ |
|
160 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
159 | + foreach ($this->content as $element) { |
|
160 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
161 | 161 | } |
162 | 162 | return $this; |
163 | 163 | } |
164 | 164 | |
165 | 165 | |
166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | - foreach ($this->content as $element){ |
|
168 | - if($element->getProperty($this->attr)!=NULL) |
|
167 | + foreach ($this->content as $element) { |
|
168 | + if ($element->getProperty($this->attr)!=NULL) |
|
169 | 169 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
170 | 170 | } |
171 | 171 | return $this; |
@@ -177,35 +177,35 @@ discard block |
||
177 | 177 | */ |
178 | 178 | protected function createItem($value) { |
179 | 179 | $count=$this->count(); |
180 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"a","section"); |
|
181 | - if(\is_array($value)) |
|
180 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
181 | + if (\is_array($value)) |
|
182 | 182 | $itemO->fromArray($value); |
183 | - else{ |
|
183 | + else { |
|
184 | 184 | $itemO->setContent($value); |
185 | 185 | $itemO->setProperty($this->attr, $this->getHref($count)); |
186 | 186 | } |
187 | 187 | return $itemO; |
188 | 188 | } |
189 | 189 | |
190 | - public function addIcon($icon,$index){ |
|
190 | + public function addIcon($icon, $index) { |
|
191 | 191 | $item=$this->getItem($index); |
192 | - if(isset($item)){ |
|
192 | + if (isset($item)) { |
|
193 | 193 | $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
194 | 194 | $item->wrapContent($icon); |
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
198 | - public function addItem($item){ |
|
198 | + public function addItem($item) { |
|
199 | 199 | $itemO=parent::addItem($item); |
200 | 200 | $this->addToPropertyCtrl("class", "section", array("section")); |
201 | 201 | return $itemO; |
202 | 202 | } |
203 | 203 | |
204 | - public function asLinks(){ |
|
204 | + public function asLinks() { |
|
205 | 205 | $this->contentAs("a"); |
206 | 206 | } |
207 | 207 | |
208 | - public function asTexts(){ |
|
208 | + public function asTexts() { |
|
209 | 209 | $this->contentAs("div"); |
210 | 210 | } |
211 | 211 |
@@ -92,8 +92,9 @@ discard block |
||
92 | 92 | if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
93 | 93 | $items[]=$action; |
94 | 94 | foreach ($params as $p){ |
95 | - if(\is_object($p)===false) |
|
96 | - $items[]=$p; |
|
95 | + if(\is_object($p)===false) { |
|
96 | + $items[]=$p; |
|
97 | + } |
|
97 | 98 | } |
98 | 99 | } |
99 | 100 | return $this->addItems($items); |
@@ -111,7 +112,7 @@ discard block |
||
111 | 112 | } |
112 | 113 | if($this->absolutePaths===true){ |
113 | 114 | return $this->_hrefFunction($this->content[$index]); |
114 | - }else{ |
|
115 | + } else{ |
|
115 | 116 | return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
116 | 117 | } |
117 | 118 | } |
@@ -165,8 +166,9 @@ discard block |
||
165 | 166 | |
166 | 167 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
167 | 168 | foreach ($this->content as $element){ |
168 | - if($element->getProperty($this->attr)!=NULL) |
|
169 | - $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
169 | + if($element->getProperty($this->attr)!=NULL) { |
|
170 | + $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
|
171 | + } |
|
170 | 172 | } |
171 | 173 | return $this; |
172 | 174 | } |
@@ -178,9 +180,9 @@ discard block |
||
178 | 180 | protected function createItem($value) { |
179 | 181 | $count=$this->count(); |
180 | 182 | $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"a","section"); |
181 | - if(\is_array($value)) |
|
182 | - $itemO->fromArray($value); |
|
183 | - else{ |
|
183 | + if(\is_array($value)) { |
|
184 | + $itemO->fromArray($value); |
|
185 | + } else{ |
|
184 | 186 | $itemO->setContent($value); |
185 | 187 | $itemO->setProperty($this->attr, $this->getHref($count)); |
186 | 188 | } |
@@ -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 |
@@ -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 |