@@ -17,31 +17,31 @@ discard block |
||
17 | 17 | } |
18 | 18 | protected $mClass="menu"; |
19 | 19 | protected $mTagName="div"; |
20 | - protected $items=array (); |
|
21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
20 | + protected $items=array(); |
|
21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
22 | 22 | protected $input; |
23 | 23 | |
24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
25 | 25 | parent::__construct($identifier, "div"); |
26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
27 | 27 | $this->setProperty("class", "ui dropdown"); |
28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
29 | 29 | $content->setClass("text"); |
30 | 30 | $content->setContent($value); |
31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
32 | 32 | $this->content=array($content); |
33 | 33 | $this->tagName="div"; |
34 | 34 | $this->addItems($items); |
35 | 35 | } |
36 | 36 | |
37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
39 | 39 | $this->items[]=$itemO; |
40 | 40 | return $itemO; |
41 | 41 | } |
42 | 42 | |
43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
44 | - $this->addIconP($icon,$before,$labeled); |
|
43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
44 | + $this->addIconP($icon, $before, $labeled); |
|
45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
46 | 46 | } |
47 | 47 | /** |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | * @param number $position |
51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
52 | 52 | */ |
53 | - public function insertItem($item,$position=0){ |
|
53 | + public function insertItem($item, $position=0) { |
|
54 | 54 | $itemO=$this->beforeAddItem($item); |
55 | - $start = array_slice($this->items, 0, $position); |
|
56 | - $end = array_slice($this->items, $position); |
|
57 | - $start[] = $item; |
|
55 | + $start=array_slice($this->items, 0, $position); |
|
56 | + $end=array_slice($this->items, $position); |
|
57 | + $start[]=$item; |
|
58 | 58 | $this->items=array_merge($start, $end); |
59 | 59 | return $itemO; |
60 | 60 | } |
61 | 61 | |
62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
63 | 63 | $itemO=$item; |
64 | - if(\is_array($item)){ |
|
64 | + if (\is_array($item)) { |
|
65 | 65 | $value=JArray::getValue($item, "value", 1); |
66 | 66 | $image=JArray::getValue($item, "image", 2); |
67 | 67 | $item=JArray::getValue($item, "item", 0); |
68 | 68 | } |
69 | - if(!$item instanceof HtmlDropdownItem){ |
|
70 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
71 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
69 | + if (!$item instanceof HtmlDropdownItem) { |
|
70 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
71 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
72 | 72 | $this->addToProperty("class", "vertical"); |
73 | 73 | } |
74 | 74 | return $itemO; |
@@ -81,76 +81,76 @@ discard block |
||
81 | 81 | $this->addItem($function($object)); |
82 | 82 | } |
83 | 83 | |
84 | - public function addInput($name){ |
|
85 | - if(!isset($name)) |
|
84 | + public function addInput($name) { |
|
85 | + if (!isset($name)) |
|
86 | 86 | $name="input-".$this->identifier; |
87 | 87 | $this->setAction("activate"); |
88 | - $this->input=new HtmlInput($name,"hidden"); |
|
88 | + $this->input=new HtmlInput($name, "hidden"); |
|
89 | 89 | } |
90 | 90 | |
91 | - public function addItems($items){ |
|
92 | - if(JArray::isAssociative($items)){ |
|
93 | - foreach ($items as $k=>$v){ |
|
91 | + public function addItems($items) { |
|
92 | + if (JArray::isAssociative($items)) { |
|
93 | + foreach ($items as $k=>$v) { |
|
94 | 94 | $this->addItem($v)->setData($k); |
95 | 95 | } |
96 | - }else{ |
|
97 | - foreach ($items as $item){ |
|
96 | + }else { |
|
97 | + foreach ($items as $item) { |
|
98 | 98 | $this->addItem($item); |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - public function count(){ |
|
103 | + public function count() { |
|
104 | 104 | return \sizeof($this->items); |
105 | 105 | } |
106 | 106 | /** |
107 | 107 | * @param boolean $dropdown |
108 | 108 | */ |
109 | - public function asDropdown($dropdown){ |
|
110 | - if($dropdown===false){ |
|
109 | + public function asDropdown($dropdown) { |
|
110 | + if ($dropdown===false) { |
|
111 | 111 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
112 | 112 | $dropdown="menu"; |
113 | - }else{ |
|
113 | + }else { |
|
114 | 114 | $dropdown="dropdown"; |
115 | 115 | $this->mClass="menu"; |
116 | 116 | } |
117 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
117 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
118 | 118 | } |
119 | 119 | |
120 | - public function setVertical(){ |
|
121 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
120 | + public function setVertical() { |
|
121 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
122 | 122 | } |
123 | 123 | |
124 | - public function setSimple(){ |
|
125 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
124 | + public function setSimple() { |
|
125 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
126 | 126 | } |
127 | 127 | |
128 | - public function asButton($floating=false){ |
|
129 | - if($floating) |
|
128 | + public function asButton($floating=false) { |
|
129 | + if ($floating) |
|
130 | 130 | $this->addToProperty("class", "floating"); |
131 | 131 | return $this->addToProperty("class", "button"); |
132 | 132 | } |
133 | 133 | |
134 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
135 | - if(isset($name)) |
|
134 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
135 | + if (isset($name)) |
|
136 | 136 | $this->addInput($name); |
137 | - if($multiple) |
|
137 | + if ($multiple) |
|
138 | 138 | $this->addToProperty("class", "multiple"); |
139 | 139 | if ($selection) |
140 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
140 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
141 | 141 | return $this; |
142 | 142 | } |
143 | 143 | |
144 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
145 | - $this->asSelect($name,$multiple,$selection); |
|
144 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
145 | + $this->asSelect($name, $multiple, $selection); |
|
146 | 146 | return $this->addToProperty("class", "search"); |
147 | 147 | } |
148 | 148 | |
149 | - public function setSelect($name=NULL,$multiple=false){ |
|
150 | - if(!isset($name)) |
|
149 | + public function setSelect($name=NULL, $multiple=false) { |
|
150 | + if (!isset($name)) |
|
151 | 151 | $name="select-".$this->identifier; |
152 | 152 | $this->input=null; |
153 | - if($multiple){ |
|
153 | + if ($multiple) { |
|
154 | 154 | $this->setProperty("multiple", true); |
155 | 155 | $this->addToProperty("class", "multiple"); |
156 | 156 | } |
@@ -158,32 +158,32 @@ discard block |
||
158 | 158 | $this->tagName="select"; |
159 | 159 | $this->setProperty("name", $name); |
160 | 160 | $this->content=null; |
161 | - foreach ($this->items as $item){ |
|
161 | + foreach ($this->items as $item) { |
|
162 | 162 | $item->asOption(); |
163 | 163 | } |
164 | 164 | return $this; |
165 | 165 | } |
166 | 166 | |
167 | - public function asSubmenu($pointing=NULL){ |
|
167 | + public function asSubmenu($pointing=NULL) { |
|
168 | 168 | $this->setClass("ui dropdown link item"); |
169 | - if(isset($pointing)){ |
|
169 | + if (isset($pointing)) { |
|
170 | 170 | $this->setPointing($pointing); |
171 | 171 | } |
172 | 172 | return $this; |
173 | 173 | } |
174 | 174 | |
175 | - public function setPointing($value=Direction::NONE){ |
|
176 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
175 | + public function setPointing($value=Direction::NONE) { |
|
176 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
177 | 177 | } |
178 | 178 | |
179 | - public function setValue($value){ |
|
180 | - if(isset($this->input)){ |
|
179 | + public function setValue($value) { |
|
180 | + if (isset($this->input)) { |
|
181 | 181 | $this->input->setProperty("value", $value); |
182 | - }else{ |
|
182 | + }else { |
|
183 | 183 | $this->setProperty("value", $value); |
184 | 184 | } |
185 | 185 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
186 | - if(isset($textElement)) |
|
186 | + if (isset($textElement)) |
|
187 | 187 | $textElement->setContent($value); |
188 | 188 | return $this; |
189 | 189 | } |
@@ -193,23 +193,23 @@ discard block |
||
193 | 193 | * @see BaseHtml::run() |
194 | 194 | */ |
195 | 195 | public function run(JsUtils $js) { |
196 | - if($this->propertyContains("class", "simple")===false){ |
|
197 | - if(isset($this->_bsComponent)===false) |
|
198 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
196 | + if ($this->propertyContains("class", "simple")===false) { |
|
197 | + if (isset($this->_bsComponent)===false) |
|
198 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
199 | 199 | $this->addEventsOnRun($js); |
200 | 200 | return $this->_bsComponent; |
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - public function setCompact(){ |
|
204 | + public function setCompact() { |
|
205 | 205 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
206 | 206 | } |
207 | 207 | |
208 | - public function setAction($action){ |
|
208 | + public function setAction($action) { |
|
209 | 209 | $this->_params["action"]=$action; |
210 | 210 | } |
211 | 211 | |
212 | - public function setFullTextSearch($value){ |
|
212 | + public function setFullTextSearch($value) { |
|
213 | 213 | $this->_params["fullTextSearch"]=$value; |
214 | 214 | } |
215 | 215 | } |
216 | 216 | \ No newline at end of file |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
19 | +class HtmlGridRow extends HtmlSemCollection { |
|
20 | 20 | use TextAlignmentTrait; |
21 | 21 | |
22 | 22 | private $_colSize; |
23 | 23 | private $_implicite=false; |
24 | 24 | |
25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
26 | - parent::__construct( $identifier,"div","row"); |
|
25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
26 | + parent::__construct($identifier, "div", "row"); |
|
27 | 27 | $this->_implicite=$implicite; |
28 | 28 | $width=null; |
29 | - if(isset($numCols)){ |
|
30 | - $numCols=min(16,$numCols); |
|
31 | - $numCols=max(1,$numCols); |
|
32 | - if($colSizing) |
|
33 | - $width=(int)(16/$numCols); |
|
29 | + if (isset($numCols)) { |
|
30 | + $numCols=min(16, $numCols); |
|
31 | + $numCols=max(1, $numCols); |
|
32 | + if ($colSizing) |
|
33 | + $width=(int) (16 / $numCols); |
|
34 | 34 | else |
35 | - $this->_colSize=16/$numCols; |
|
36 | - for ($i=0;$i<$numCols;$i++){ |
|
35 | + $this->_colSize=16 / $numCols; |
|
36 | + for ($i=0; $i<$numCols; $i++) { |
|
37 | 37 | $this->addItem($width); |
38 | 38 | } |
39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @param int $width |
45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
46 | 46 | */ |
47 | - public function setWidth($width){ |
|
48 | - if(\is_int($width)){ |
|
47 | + public function setWidth($width) { |
|
48 | + if (\is_int($width)) { |
|
49 | 49 | $width=Wide::getConstants()["W".$width]; |
50 | 50 | } |
51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param int $index |
58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
59 | 59 | */ |
60 | - public function getCol($index){ |
|
60 | + public function getCol($index) { |
|
61 | 61 | return $this->getItem($index); |
62 | 62 | } |
63 | 63 | |
64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
65 | 65 | $this->setWidth($colsCount); |
66 | - if($toCreate===true){ |
|
66 | + if ($toCreate===true) { |
|
67 | 67 | $count=$this->count(); |
68 | - for($i=$count;$i<$colsCount;$i++){ |
|
68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
69 | 69 | $this->addItem(null); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function addCols($colCount){ |
|
76 | - for($i=0;$i<$colCount;$i++){ |
|
75 | + public function addCols($colCount) { |
|
76 | + for ($i=0; $i<$colCount; $i++) { |
|
77 | 77 | $this->addItem(null); |
78 | 78 | } |
79 | 79 | return $this; |
80 | 80 | } |
81 | 81 | |
82 | - public function addCol($width=NULL){ |
|
82 | + public function addCol($width=NULL) { |
|
83 | 83 | return $this->addItem($width); |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * stretch the row contents to take up the entire column height |
88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
89 | 89 | */ |
90 | - public function setStretched(){ |
|
90 | + public function setStretched() { |
|
91 | 91 | return $this->addToProperty("class", "stretched"); |
92 | 92 | } |
93 | 93 | |
@@ -95,19 +95,19 @@ discard block |
||
95 | 95 | * @param string $color |
96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
97 | 97 | */ |
98 | - public function setColor($color){ |
|
99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
98 | + public function setColor($color) { |
|
99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
100 | 100 | } |
101 | 101 | |
102 | - public function setValues($values,$force=false){ |
|
102 | + public function setValues($values, $force=false) { |
|
103 | 103 | $count=$this->count(); |
104 | - if($force===true){ |
|
105 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
106 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
104 | + if ($force===true) { |
|
105 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
106 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
107 | 107 | } |
108 | 108 | } |
109 | - $count=\min(array($this->count(),\sizeof($values))); |
|
110 | - for($i=0;$i<$count;$i++){ |
|
109 | + $count=\min(array($this->count(), \sizeof($values))); |
|
110 | + for ($i=0; $i<$count; $i++) { |
|
111 | 111 | $this->content[$i]->setValue($values[$i]); |
112 | 112 | } |
113 | 113 | return $this; |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | * {@inheritDoc} |
118 | 118 | * @see \Ajax\common\html\HtmlCollection::createItem() |
119 | 119 | */ |
120 | - protected function createItem($value){ |
|
121 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
120 | + protected function createItem($value) { |
|
121 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
122 | 122 | return $col; |
123 | 123 | } |
124 | 124 | |
125 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
126 | - if($this->_implicite===true){ |
|
125 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
126 | + if ($this->_implicite===true) { |
|
127 | 127 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
128 | 128 | } |
129 | - return parent::compile($js,$view); |
|
129 | + return parent::compile($js, $view); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | \ No newline at end of file |
@@ -7,19 +7,19 @@ |
||
7 | 7 | |
8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 9 | |
10 | -class HtmlPaginationMenu extends HtmlMenu{ |
|
10 | +class HtmlPaginationMenu extends HtmlMenu { |
|
11 | 11 | |
12 | - public function __construct( $identifier, $items=array() ){ |
|
13 | - parent::__construct( $identifier,$items); |
|
12 | + public function __construct($identifier, $items=array()) { |
|
13 | + parent::__construct($identifier, $items); |
|
14 | 14 | } |
15 | 15 | /** |
16 | 16 | * {@inheritDoc} |
17 | 17 | * @see \Ajax\common\html\BaseHtml::compile() |
18 | 18 | */ |
19 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
19 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
20 | 20 | $this->insertItem(new HtmlIcon("", "left chevron")); |
21 | 21 | $this->addItem(new HtmlIcon("", "right chevron")); |
22 | 22 | $this->asPagination(); |
23 | - return parent::compile($js,$view); |
|
23 | + return parent::compile($js, $view); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | \ No newline at end of file |