@@ -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); |
@@ -16,23 +16,23 @@ 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 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
25 | - parent::__construct( $identifier,"div","row"); |
|
24 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
25 | + parent::__construct($identifier, "div", "row"); |
|
26 | 26 | $this->_implicite=$implicite; |
27 | 27 | $width=null; |
28 | - if(isset($numCols)){ |
|
29 | - $numCols=min(16,$numCols); |
|
30 | - $numCols=max(1,$numCols); |
|
31 | - if($colSizing) |
|
32 | - $width=(int)(16/$numCols); |
|
28 | + if (isset($numCols)) { |
|
29 | + $numCols=min(16, $numCols); |
|
30 | + $numCols=max(1, $numCols); |
|
31 | + if ($colSizing) |
|
32 | + $width=(int) (16 / $numCols); |
|
33 | 33 | else |
34 | - $this->_colSize=16/$numCols; |
|
35 | - for ($i=0;$i<$numCols;$i++){ |
|
34 | + $this->_colSize=16 / $numCols; |
|
35 | + for ($i=0; $i<$numCols; $i++) { |
|
36 | 36 | $this->addItem($width); |
37 | 37 | } |
38 | 38 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | * @param int $width |
44 | 44 | * @return \Ajax\semantic\html\content\HtmlGridRow |
45 | 45 | */ |
46 | - public function setWidth($width){ |
|
47 | - if(\is_int($width)){ |
|
46 | + public function setWidth($width) { |
|
47 | + if (\is_int($width)) { |
|
48 | 48 | $width=Wide::getConstants()["W".$width]; |
49 | 49 | } |
50 | 50 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
51 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
51 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param int $index |
57 | 57 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
58 | 58 | */ |
59 | - public function getCol($index){ |
|
59 | + public function getCol($index) { |
|
60 | 60 | return $this->getItem($index); |
61 | 61 | } |
62 | 62 | |
63 | - public function setNumCols($numCols){ |
|
63 | + public function setNumCols($numCols) { |
|
64 | 64 | $count=$this->count(); |
65 | - for($i=$count;$i<$numCols;$i++){ |
|
65 | + for ($i=$count; $i<$numCols; $i++) { |
|
66 | 66 | $this->addItem(null); |
67 | 67 | } |
68 | 68 | return $this; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * stretch the row contents to take up the entire column height |
73 | 73 | * @return \Ajax\semantic\html\content\HtmlGridRow |
74 | 74 | */ |
75 | - public function setStretched(){ |
|
75 | + public function setStretched() { |
|
76 | 76 | return $this->addToProperty("class", "stretched"); |
77 | 77 | } |
78 | 78 | |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | * @param string $color |
81 | 81 | * @return \Ajax\semantic\html\content\HtmlGridRow |
82 | 82 | */ |
83 | - public function setColor($color){ |
|
84 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
83 | + public function setColor($color) { |
|
84 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
85 | 85 | } |
86 | 86 | |
87 | - public function setValues($values,$force=false){ |
|
87 | + public function setValues($values, $force=false) { |
|
88 | 88 | $count=$this->count(); |
89 | - if($force===true){ |
|
90 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
91 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
89 | + if ($force===true) { |
|
90 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
91 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
92 | 92 | } |
93 | 93 | } |
94 | - $count=\min(array($this->count(),\sizeof($values))); |
|
95 | - for($i=0;$i<$count;$i++){ |
|
94 | + $count=\min(array($this->count(), \sizeof($values))); |
|
95 | + for ($i=0; $i<$count; $i++) { |
|
96 | 96 | $this->content[$i]->setValue($values[$i]); |
97 | 97 | } |
98 | 98 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | * {@inheritDoc} |
102 | 102 | * @see \Ajax\common\html\HtmlCollection::createItem() |
103 | 103 | */ |
104 | - protected function createItem($value){ |
|
105 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
104 | + protected function createItem($value) { |
|
105 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
106 | 106 | return $col; |
107 | 107 | } |
108 | 108 | |
109 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
110 | - if($this->_implicite===true){ |
|
109 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
110 | + if ($this->_implicite===true) { |
|
111 | 111 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
112 | 112 | } |
113 | - return parent::compile($js,$view); |
|
113 | + return parent::compile($js, $view); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
13 | 13 | private $params; |
14 | 14 | private $_container; |
15 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
15 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
16 | 16 | parent::__construct($identifier, "div"); |
17 | 17 | $this->_container=$container; |
18 | 18 | $this->setClass("ui popup"); |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | $this->params=array("on"=>"hover"); |
21 | 21 | } |
22 | 22 | |
23 | - public function addList($items=array(),$header=NULL){ |
|
24 | - if(!$this->content instanceof HtmlGrid){ |
|
25 | - $this->content=new HtmlGrid("grid-".$this->identifier,1); |
|
23 | + public function addList($items=array(), $header=NULL) { |
|
24 | + if (!$this->content instanceof HtmlGrid) { |
|
25 | + $this->content=new HtmlGrid("grid-".$this->identifier, 1); |
|
26 | 26 | } |
27 | 27 | $grid=$this->content; |
28 | 28 | |
29 | 29 | $colCount=$grid->colCount(); |
30 | 30 | $grid->setNumCols(++$colCount); |
31 | 31 | |
32 | - $list=new HtmlList("",$items); |
|
32 | + $list=new HtmlList("", $items); |
|
33 | 33 | $list->asLink(); |
34 | - if(isset($header)){ |
|
35 | - $list->addHeader(4,$header); |
|
34 | + if (isset($header)) { |
|
35 | + $list->addHeader(4, $header); |
|
36 | 36 | } |
37 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
37 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
38 | 38 | $grid->setDivided(); |
39 | 39 | return $list; |
40 | 40 | } |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * A popup can have no maximum width and continue to flow to fit its content |
44 | 44 | */ |
45 | - public function setFlowing(){ |
|
45 | + public function setFlowing() { |
|
46 | 46 | return $this->addToProperty("class", "flowing"); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * A popup can provide more basic formatting |
51 | 51 | */ |
52 | - public function setBasic(){ |
|
52 | + public function setBasic() { |
|
53 | 53 | return $this->addToProperty("class", "basic"); |
54 | 54 | } |
55 | 55 | |
@@ -57,22 +57,22 @@ discard block |
||
57 | 57 | * {@inheritDoc} |
58 | 58 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
59 | 59 | */ |
60 | - public function run(JsUtils $js){ |
|
60 | + public function run(JsUtils $js) { |
|
61 | 61 | $this->params["popup"]="#".$this->identifier; |
62 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->params); |
|
62 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->params); |
|
63 | 63 | } |
64 | 64 | |
65 | - public function setOn($event="click"){ |
|
65 | + public function setOn($event="click") { |
|
66 | 66 | $this->params["on"]=$event; |
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
70 | - public function setInline($value=true){ |
|
70 | + public function setInline($value=true) { |
|
71 | 71 | $this->params["inline"]=$value; |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function setPosition($position){ |
|
75 | + public function setPosition($position) { |
|
76 | 76 | $this->params["position"]=$position; |
77 | 77 | return $this; |
78 | 78 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @param string $type one of text,item |
35 | 35 | * @return \Ajax\semantic\html\collections\HtmlMenu |
36 | 36 | */ |
37 | - public function setType($type=""){ |
|
38 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
37 | + public function setType($type="") { |
|
38 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function setActiveItem($index){ |
|
41 | + public function setActiveItem($index) { |
|
42 | 42 | $item=$this->getItem($index); |
43 | - if($item!==null){ |
|
43 | + if ($item!==null) { |
|
44 | 44 | $item->addToProperty("class", "active"); |
45 | 45 | } |
46 | 46 | return $this; |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | * {@inheritDoc} |
51 | 51 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
52 | 52 | */ |
53 | - public function addItem($item){ |
|
54 | - if($item instanceof HtmlInput || $item instanceof HtmlImg){ |
|
55 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier,"div",""); |
|
53 | + public function addItem($item) { |
|
54 | + if ($item instanceof HtmlInput || $item instanceof HtmlImg) { |
|
55 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
56 | 56 | $itemO->setContent($item); |
57 | 57 | $item=$itemO; |
58 | 58 | } |
59 | 59 | $item=parent::addItem($item); |
60 | - if(!$item instanceof HtmlMenu) |
|
61 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
62 | - else{ |
|
60 | + if (!$item instanceof HtmlMenu) |
|
61 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
62 | + else { |
|
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
65 | 65 | return $item; |
66 | 66 | } |
67 | 67 | |
68 | - public function generateMenuAsItem($menu,$header=null){ |
|
68 | + public function generateMenuAsItem($menu, $header=null) { |
|
69 | 69 | $count=$this->count(); |
70 | - $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"div"); |
|
71 | - if(isset($header)){ |
|
72 | - $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count,"div","header"); |
|
70 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
71 | + if (isset($header)) { |
|
72 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
73 | 73 | $headerItem->setContent($header); |
74 | 74 | $item->addContent($headerItem); |
75 | 75 | } |
@@ -77,24 +77,24 @@ discard block |
||
77 | 77 | $item->addContent($menu); |
78 | 78 | return $item; |
79 | 79 | } |
80 | - public function addMenuAsItem($menu,$header=null){ |
|
81 | - return $this->addItem($this->generateMenuAsItem($menu,$header)); |
|
80 | + public function addMenuAsItem($menu, $header=null) { |
|
81 | + return $this->addItem($this->generateMenuAsItem($menu, $header)); |
|
82 | 82 | } |
83 | 83 | |
84 | - public function addPopupAsItem($value,$identifier, $content=""){ |
|
85 | - $value=new HtmlSemDoubleElement($identifier,"a","browse item",$value); |
|
84 | + public function addPopupAsItem($value, $identifier, $content="") { |
|
85 | + $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
|
86 | 86 | $value->addContent(new HtmlIcon("", "dropdown")); |
87 | 87 | $value=$this->addItem($value); |
88 | - $popup=new HtmlPopup($value,"popup-".$this->identifier."-".$this->count(),$content); |
|
88 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
89 | 89 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
90 | 90 | $this->addContent($popup); |
91 | 91 | return $popup; |
92 | 92 | } |
93 | 93 | |
94 | - public function addDropdownAsItem($value,$items=NULL){ |
|
94 | + public function addDropdownAsItem($value, $items=NULL) { |
|
95 | 95 | $dd=$value; |
96 | - if(\is_string($value)){ |
|
97 | - $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(),$value,$items); |
|
96 | + if (\is_string($value)) { |
|
97 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
98 | 98 | } |
99 | 99 | return $this->addItem($dd); |
100 | 100 | } |
@@ -103,51 +103,51 @@ discard block |
||
103 | 103 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
104 | 104 | */ |
105 | 105 | protected function createItem($value) { |
106 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
106 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
107 | 107 | return $itemO->setClass("item"); |
108 | 108 | } |
109 | 109 | |
110 | - public function setInverted(){ |
|
110 | + public function setInverted() { |
|
111 | 111 | return $this->addToProperty("class", "inverted"); |
112 | 112 | } |
113 | 113 | |
114 | - public function setSecondary(){ |
|
114 | + public function setSecondary() { |
|
115 | 115 | return $this->addToProperty("class", "secondary"); |
116 | 116 | } |
117 | 117 | |
118 | - public function setVertical(){ |
|
119 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
118 | + public function setVertical() { |
|
119 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
120 | 120 | } |
121 | 121 | |
122 | - public function setPosition($value="right"){ |
|
123 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
122 | + public function setPosition($value="right") { |
|
123 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
124 | 124 | } |
125 | 125 | |
126 | - public function setPointing($value=Direction::NONE){ |
|
127 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
126 | + public function setPointing($value=Direction::NONE) { |
|
127 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
128 | 128 | } |
129 | 129 | |
130 | - public function asTab($vertical=false){ |
|
131 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
132 | - if($vertical===true) |
|
130 | + public function asTab($vertical=false) { |
|
131 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
132 | + if ($vertical===true) |
|
133 | 133 | $this->setVertical(); |
134 | 134 | return $this->addToProperty("class", "tabular"); |
135 | 135 | } |
136 | 136 | |
137 | - public function asPagination(){ |
|
138 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
137 | + public function asPagination() { |
|
138 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
139 | 139 | return $this->addToProperty("class", "pagination"); |
140 | 140 | } |
141 | 141 | |
142 | - public function setFixed(){ |
|
142 | + public function setFixed() { |
|
143 | 143 | return $this->addToProperty("class", "fixed"); |
144 | 144 | } |
145 | 145 | |
146 | - public function setFluid(){ |
|
146 | + public function setFluid() { |
|
147 | 147 | return $this->addToProperty("class", "fluid"); |
148 | 148 | } |
149 | 149 | |
150 | - public function setCompact(){ |
|
150 | + public function setCompact() { |
|
151 | 151 | return $this->addToProperty("class", "compact"); |
152 | 152 | } |
153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function fromDatabaseObject($object, $function) { |
158 | 158 | $return=$function($object); |
159 | - if(\is_array($return)) |
|
159 | + if (\is_array($return)) |
|
160 | 160 | $this->addItems($return); |
161 | 161 | else |
162 | 162 | $this->addItem($return); |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * @param int $width |
168 | 168 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
169 | 169 | */ |
170 | - public function setWidth($width){ |
|
171 | - if(\is_int($width)){ |
|
170 | + public function setWidth($width) { |
|
171 | + if (\is_int($width)) { |
|
172 | 172 | $width=Wide::getConstants()["W".$width]; |
173 | 173 | } |
174 | 174 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
175 | - return $this->addToPropertyCtrl("class", "item",array("item")); |
|
175 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
176 | 176 | } |
177 | 177 | |
178 | - public function addImage($identifier, $src="", $alt=""){ |
|
179 | - return $this->addItem(new HtmlImg($identifier,$src,$alt)); |
|
178 | + public function addImage($identifier, $src="", $alt="") { |
|
179 | + return $this->addItem(new HtmlImg($identifier, $src, $alt)); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | \ No newline at end of file |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | $item=$itemO; |
58 | 58 | } |
59 | 59 | $item=parent::addItem($item); |
60 | - if(!$item instanceof HtmlMenu) |
|
61 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
62 | - else{ |
|
60 | + if(!$item instanceof HtmlMenu) { |
|
61 | + $item->addToPropertyCtrl("class", "item",array("item")); |
|
62 | + } else{ |
|
63 | 63 | $this->setSecondary(); |
64 | 64 | } |
65 | 65 | return $item; |
@@ -129,8 +129,9 @@ discard block |
||
129 | 129 | |
130 | 130 | public function asTab($vertical=false){ |
131 | 131 | $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
132 | - if($vertical===true) |
|
133 | - $this->setVertical(); |
|
132 | + if($vertical===true) { |
|
133 | + $this->setVertical(); |
|
134 | + } |
|
134 | 135 | return $this->addToProperty("class", "tabular"); |
135 | 136 | } |
136 | 137 | |
@@ -156,10 +157,11 @@ discard block |
||
156 | 157 | */ |
157 | 158 | public function fromDatabaseObject($object, $function) { |
158 | 159 | $return=$function($object); |
159 | - if(\is_array($return)) |
|
160 | - $this->addItems($return); |
|
161 | - else |
|
162 | - $this->addItem($return); |
|
160 | + if(\is_array($return)) { |
|
161 | + $this->addItems($return); |
|
162 | + } else { |
|
163 | + $this->addItem($return); |
|
164 | + } |
|
163 | 165 | } |
164 | 166 | |
165 | 167 | /** |
@@ -15,28 +15,28 @@ discard block |
||
15 | 15 | * @author jc |
16 | 16 | * @version 1.001 |
17 | 17 | */ |
18 | -class HtmlGrid extends HtmlSemCollection{ |
|
18 | +class HtmlGrid extends HtmlSemCollection { |
|
19 | 19 | use TextAlignmentTrait; |
20 | 20 | private $_createCols; |
21 | 21 | private $_colSizing=true; |
22 | 22 | private $_implicitRows=false; |
23 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
24 | - parent::__construct( $identifier, "div","ui grid"); |
|
23 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
24 | + parent::__construct($identifier, "div", "ui grid"); |
|
25 | 25 | $this->_implicitRows=$implicitRows; |
26 | 26 | $this->_createCols=$createCols; |
27 | - if(isset($numCols)){ |
|
27 | + if (isset($numCols)) { |
|
28 | 28 | //if($this->_createCols){ |
29 | 29 | $this->_colSizing=false; |
30 | 30 | //} |
31 | 31 | $this->setWide($numCols); |
32 | 32 | } |
33 | - $this->setNumRows($numRows,$numCols); |
|
33 | + $this->setNumRows($numRows, $numCols); |
|
34 | 34 | } |
35 | 35 | |
36 | - public function setWide($wide){ |
|
36 | + public function setWide($wide) { |
|
37 | 37 | $wide=Wide::getConstants()["W".$wide]; |
38 | 38 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
39 | - return $this->addToPropertyCtrl("class","column",array("column")); |
|
39 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | * @param int $numCols |
46 | 46 | * @return \Ajax\semantic\html\collections\HtmlGrid |
47 | 47 | */ |
48 | - public function setNumRows($numRows,$numCols=NULL){ |
|
48 | + public function setNumRows($numRows, $numCols=NULL) { |
|
49 | 49 | $count=$this->count(); |
50 | - for($i=$count;$i<$numRows;$i++){ |
|
50 | + for ($i=$count; $i<$numRows; $i++) { |
|
51 | 51 | $this->addItem($numCols); |
52 | 52 | } |
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
56 | - public function setNumCols($numCols){ |
|
56 | + public function setNumCols($numCols) { |
|
57 | 57 | $count=$this->count(); |
58 | - for($i=0;$i<$count;$i++){ |
|
58 | + for ($i=0; $i<$count; $i++) { |
|
59 | 59 | $this->getItem($i)->setNumCols($numCols); |
60 | 60 | } |
61 | 61 | //if($this->_colSizing===false) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param int $index |
69 | 69 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
70 | 70 | */ |
71 | - public function getRow($index){ |
|
71 | + public function getRow($index) { |
|
72 | 72 | return $this->getItem($index); |
73 | 73 | } |
74 | 74 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @param int $col |
78 | 78 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
79 | 79 | */ |
80 | - public function getCell($row,$col){ |
|
80 | + public function getCell($row, $col) { |
|
81 | 81 | $row=$this->getItem($row); |
82 | - if(isset($row)){ |
|
82 | + if (isset($row)) { |
|
83 | 83 | $col=$row->getItem($col); |
84 | 84 | } |
85 | 85 | return $col; |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param boolean $vertically |
91 | 91 | * @return \Ajax\semantic\html\collections\HtmlGrid |
92 | 92 | */ |
93 | - public function setDivided($vertically=false){ |
|
94 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
95 | - return $this->addToPropertyCtrl("class", $value,array("divided")); |
|
93 | + public function setDivided($vertically=false) { |
|
94 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
95 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * @param boolean $internal true for internal cells |
101 | 101 | * @return \Ajax\semantic\html\collections\HtmlGrid |
102 | 102 | */ |
103 | - public function setCelled($internal=false){ |
|
104 | - $value=($internal===true)?"internal celled":"celled"; |
|
103 | + public function setCelled($internal=false) { |
|
104 | + $value=($internal===true) ? "internal celled" : "celled"; |
|
105 | 105 | return $this->addToProperty("class", $value); |
106 | 106 | } |
107 | 107 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * automatically resize all elements to split the available width evenly |
110 | 110 | * @return \Ajax\semantic\html\collections\HtmlGrid |
111 | 111 | */ |
112 | - public function setEqualWidth(){ |
|
112 | + public function setEqualWidth() { |
|
113 | 113 | return $this->addToProperty("class", "equal width"); |
114 | 114 | } |
115 | 115 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * @param string $value |
119 | 119 | * @return \Ajax\semantic\html\collections\HtmlGrid |
120 | 120 | */ |
121 | - public function setPadded($value=NULL){ |
|
122 | - if(isset($value)) |
|
123 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
121 | + public function setPadded($value=NULL) { |
|
122 | + if (isset($value)) |
|
123 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
124 | 124 | return $this->addToProperty("class", "padded"); |
125 | 125 | } |
126 | 126 | |
@@ -128,47 +128,47 @@ discard block |
||
128 | 128 | * @param boolean $very |
129 | 129 | * @return \Ajax\semantic\html\collections\HtmlGrid |
130 | 130 | */ |
131 | - public function setRelaxed($very=false){ |
|
132 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
131 | + public function setRelaxed($very=false) { |
|
132 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
133 | 133 | return $this->addToProperty("class", $value); |
134 | 134 | } |
135 | 135 | |
136 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
137 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
136 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
137 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | 141 | * {@inheritDoc} |
142 | 142 | * @see \Ajax\common\html\HtmlCollection::createItem() |
143 | 143 | */ |
144 | - protected function createItem($value){ |
|
145 | - if($this->_createCols===false) |
|
144 | + protected function createItem($value) { |
|
145 | + if ($this->_createCols===false) |
|
146 | 146 | $value=null; |
147 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
147 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
148 | 148 | return $item; |
149 | 149 | } |
150 | 150 | |
151 | - public function setValues($values){ |
|
151 | + public function setValues($values) { |
|
152 | 152 | $count=$this->count(); |
153 | - if($this->_createCols===false){ |
|
154 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
153 | + if ($this->_createCols===false) { |
|
154 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
155 | 155 | $colSize=\sizeof($values[$i]); |
156 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
156 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
157 | 157 | } |
158 | 158 | } |
159 | - $count=\min(array($this->count(),\sizeof($values))); |
|
160 | - for($i=0;$i<$count;$i++){ |
|
161 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
159 | + $count=\min(array($this->count(), \sizeof($values))); |
|
160 | + for ($i=0; $i<$count; $i++) { |
|
161 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - public function rowCount(){ |
|
165 | + public function rowCount() { |
|
166 | 166 | return $this->count(); |
167 | 167 | } |
168 | 168 | |
169 | - public function colCount(){ |
|
169 | + public function colCount() { |
|
170 | 170 | $result=0; |
171 | - if($this->count()>0){ |
|
171 | + if ($this->count()>0) { |
|
172 | 172 | $result=$this->content[0]->count(); |
173 | 173 | } |
174 | 174 | return $result; |
@@ -5,34 +5,34 @@ |
||
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 | |
27 | - public function addHeader($niveau,$content){ |
|
28 | - return $this->insertItem(new HtmlHeader("header-".$this->identifier,$niveau,$content,"page")); |
|
27 | + public function addHeader($niveau, $content) { |
|
28 | + return $this->insertItem(new HtmlHeader("header-".$this->identifier, $niveau, $content, "page")); |
|
29 | 29 | } |
30 | 30 | |
31 | - public function itemsAs($tagName){ |
|
31 | + public function itemsAs($tagName) { |
|
32 | 32 | return $this->contentAs($tagName); |
33 | 33 | } |
34 | 34 | |
35 | - public function asLink(){ |
|
35 | + public function asLink() { |
|
36 | 36 | $this->addToPropertyCtrl("class", "link", array("link")); |
37 | 37 | return $this->contentAs("a"); |
38 | 38 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
31 | 31 | } |
32 | 32 | |
33 | - public function setExclusive($value){ |
|
33 | + public function setExclusive($value) { |
|
34 | 34 | return $this->setParam("exclusive", $value); |
35 | 35 | } |
36 | 36 | |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | * @param string $popup the css selector of the popup |
40 | 40 | * @return \Ajax\semantic\components\Popup |
41 | 41 | */ |
42 | - public function setPopup($popup){ |
|
42 | + public function setPopup($popup) { |
|
43 | 43 | return $this->setParam("popup", $popup); |
44 | 44 | } |
45 | 45 | |
46 | - public function setInline($value){ |
|
46 | + public function setInline($value) { |
|
47 | 47 | return $this->setParam("inline", $value); |
48 | 48 | } |
49 | 49 | |
50 | - public function setPosition($value){ |
|
50 | + public function setPosition($value) { |
|
51 | 51 | return $this->setParam("position", $value); |
52 | 52 | } |
53 | 53 | //TODO other events implementation |