@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function createItem($value) { |
20 | 20 | $count=$this->count(); |
21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
22 | 22 | return $item; |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addHeader($niveau, $content) { |
26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
27 | 27 | $this->wrap($header); |
28 | 28 | return $header; |
29 | 29 | } |
30 | 30 | |
31 | - public function getItemPart($index,$partName="header"){ |
|
31 | + public function getItemPart($index, $partName="header") { |
|
32 | 32 | return $this->getItem($index)->getPart($partName); |
33 | 33 | } |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | public function asLink() { |
40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
41 | 41 | return $this->contentAs("a"); |
42 | 42 | } |
43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function run(JsUtils $js) { |
63 | - if ($this->_hasCheckedList === true) { |
|
64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
63 | + if ($this->_hasCheckedList===true) { |
|
64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
66 | 66 | $this->executeOnRun($jsCode); |
67 | 67 | } |
68 | 68 | return parent::run($js); |
@@ -86,24 +86,24 @@ discard block |
||
86 | 86 | |
87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
88 | 88 | $count=$this->count(); |
89 | - $identifier=$this->identifier . "-" . $count; |
|
89 | + $identifier=$this->identifier."-".$count; |
|
90 | 90 | if (isset($masterItem)) { |
91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
92 | 92 | $masterO->getHtmlCk()->addToProperty("class", "master"); |
93 | 93 | $masterO->setClass("item"); |
94 | 94 | $this->addItem($masterO); |
95 | 95 | } |
96 | - $fields=array (); |
|
96 | + $fields=array(); |
|
97 | 97 | $i=0; |
98 | - foreach ( $items as $val => $caption ) { |
|
99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
100 | - if (\array_search($val, $values) !== false) { |
|
98 | + foreach ($items as $val => $caption) { |
|
99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
100 | + if (\array_search($val, $values)!==false) { |
|
101 | 101 | $itemO->getField()->setProperty("checked", ""); |
102 | 102 | } |
103 | 103 | $itemO->setClass("item"); |
104 | 104 | $fields[]=$itemO; |
105 | 105 | } |
106 | - if (isset($masterO) === true) { |
|
106 | + if (isset($masterO)===true) { |
|
107 | 107 | $list=new HtmlList("", $fields); |
108 | 108 | $list->setClass("list"); |
109 | 109 | $masterO->addContent($list); |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function setIcons($icons){ |
|
118 | - if(!\is_array($icons)){ |
|
117 | + public function setIcons($icons) { |
|
118 | + if (!\is_array($icons)) { |
|
119 | 119 | $icons=\array_fill(0, \sizeof($this->content), $icons); |
120 | 120 | } |
121 | - $max=\min(\sizeof($icons),\sizeof($this->content)); |
|
122 | - for($i=0;$i<$max;$i++){ |
|
121 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
122 | + for ($i=0; $i<$max; $i++) { |
|
123 | 123 | $this->content[$i]->addIcon($icons[$i]); |
124 | 124 | } |
125 | 125 | return $this; |
@@ -19,56 +19,56 @@ discard block |
||
19 | 19 | protected $_colWidths; |
20 | 20 | |
21 | 21 | public function __construct($identifier, $modelInstance=NULL) { |
22 | - parent::__construct($identifier, null,$modelInstance); |
|
23 | - $this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false); |
|
22 | + parent::__construct($identifier, null, $modelInstance); |
|
23 | + $this->_init(new DeInstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false); |
|
24 | 24 | $this->content["table"]->setDefinition(); |
25 | 25 | } |
26 | 26 | |
27 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
28 | - if(!$this->_generated){ |
|
27 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
28 | + if (!$this->_generated) { |
|
29 | 29 | $this->_instanceViewer->setInstance($this->_modelInstance); |
30 | 30 | |
31 | 31 | $table=$this->content["table"]; |
32 | 32 | $this->_generateContent($table); |
33 | 33 | |
34 | - if(isset($this->_toolbar)){ |
|
34 | + if (isset($this->_toolbar)) { |
|
35 | 35 | $this->_setToolbarPosition($table); |
36 | 36 | } |
37 | - if(isset($this->_colWidths)){ |
|
37 | + if (isset($this->_colWidths)) { |
|
38 | 38 | $this->_applyStyleAttributes($table); |
39 | 39 | } |
40 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
40 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
41 | 41 | $this->_compileForm(); |
42 | 42 | $this->_generated=true; |
43 | 43 | } |
44 | - return parent::compile($js,$view); |
|
44 | + return parent::compile($js, $view); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @param HtmlTable $table |
49 | 49 | */ |
50 | - protected function _generateContent($table){ |
|
51 | - $values= $this->_instanceViewer->getValues(); |
|
50 | + protected function _generateContent($table) { |
|
51 | + $values=$this->_instanceViewer->getValues(); |
|
52 | 52 | $captions=$this->_instanceViewer->getCaptions(); |
53 | 53 | $count=$this->_instanceViewer->count(); |
54 | 54 | |
55 | - for($i=0;$i<$count;$i++){ |
|
56 | - $table->addRow([$captions[$i],$values[$i]]); |
|
55 | + for ($i=0; $i<$count; $i++) { |
|
56 | + $table->addRow([$captions[$i], $values[$i]]); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - protected function _applyStyleAttributes(HtmlTable $table){ |
|
60 | + protected function _applyStyleAttributes(HtmlTable $table) { |
|
61 | 61 | $table->setColWidths($this->_colWidths); |
62 | 62 | } |
63 | - protected function _getFieldName($index){ |
|
63 | + protected function _getFieldName($index) { |
|
64 | 64 | return $this->_instanceViewer->getFieldName($index); |
65 | 65 | } |
66 | 66 | |
67 | - protected function _getFieldCaption($index){ |
|
67 | + protected function _getFieldCaption($index) { |
|
68 | 68 | return null; |
69 | 69 | } |
70 | 70 | |
71 | - protected function _getFieldIdentifier($prefix,$name=""){ |
|
71 | + protected function _getFieldIdentifier($prefix, $name="") { |
|
72 | 72 | return $this->identifier."-{$prefix}-".$name; |
73 | 73 | } |
74 | 74 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | return $this; |
101 | 101 | } |
102 | 102 | |
103 | - public function asForm(){ |
|
103 | + public function asForm() { |
|
104 | 104 | return $this->getForm(); |
105 | 105 | } |
106 | 106 | |
107 | - public function setColCaptionWidth($width){ |
|
107 | + public function setColCaptionWidth($width) { |
|
108 | 108 | $this->_colWidths[0]=$width; |
109 | 109 | return $this; |
110 | 110 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function setColWidths($widths){ |
|
117 | + public function setColWidths($widths) { |
|
118 | 118 | $this->_colWidths=$widths; |
119 | 119 | return $this; |
120 | 120 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | */ |
13 | 13 | class HtmlTableContent extends HtmlSemCollection { |
14 | - protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ]; |
|
14 | + protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"]; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function setRowCount($rowCount, $colCount) { |
36 | 36 | $count=$this->count(); |
37 | - for($i=$count; $i < $rowCount; $i++) { |
|
37 | + for ($i=$count; $i<$rowCount; $i++) { |
|
38 | 38 | $this->addItem($colCount); |
39 | 39 | } |
40 | 40 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $tr=new HtmlTR("", $value); |
57 | 57 | $tr->setContainer($this, $count); |
58 | 58 | $tr->setTdTagName($this->_tdTagNames[$this->tagName]); |
59 | - if (isset($value) === true) { |
|
59 | + if (isset($value)===true) { |
|
60 | 60 | $tr->setColCount($value); |
61 | 61 | } |
62 | 62 | return $tr; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function setCellValue($row, $col, $value="") { |
116 | 116 | $cell=$this->getCell($row, $col); |
117 | - if (isset($cell) === true) { |
|
117 | + if (isset($cell)===true) { |
|
118 | 118 | $cell->setValue($value); |
119 | 119 | } |
120 | 120 | return $this; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param mixed $values |
126 | 126 | */ |
127 | 127 | public function setValues($values=array()) { |
128 | - return $this->_addOrSetValues($values, function($row,$_values){$row->setValues($_values);}); |
|
128 | + return $this->_addOrSetValues($values, function($row, $_values) {$row->setValues($_values); }); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param mixed $values |
134 | 134 | */ |
135 | 135 | public function addValues($values=array()) { |
136 | - return $this->_addOrSetValues($values, function($row,$_values){$row->addValues($_values);}); |
|
136 | + return $this->_addOrSetValues($values, function($row, $_values) {$row->addValues($_values); }); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -141,21 +141,21 @@ discard block |
||
141 | 141 | * @param mixed $values |
142 | 142 | * @param callable $callback |
143 | 143 | */ |
144 | - protected function _addOrSetValues($values,$callback) { |
|
144 | + protected function _addOrSetValues($values, $callback) { |
|
145 | 145 | $count=$this->count(); |
146 | 146 | $isArray=true; |
147 | 147 | if (!\is_array($values)) { |
148 | 148 | $values=\array_fill(0, $count, $values); |
149 | 149 | $isArray=false; |
150 | 150 | } |
151 | - if (JArray::dimension($values) == 1 && $isArray) |
|
152 | - $values=[ $values ]; |
|
151 | + if (JArray::dimension($values)==1 && $isArray) |
|
152 | + $values=[$values]; |
|
153 | 153 | |
154 | 154 | $count=\min(\sizeof($values), $count); |
155 | 155 | |
156 | - for($i=0; $i < $count; $i++) { |
|
156 | + for ($i=0; $i<$count; $i++) { |
|
157 | 157 | $row=$this->content[$i]; |
158 | - $callback($row,$values[$i]); |
|
158 | + $callback($row, $values[$i]); |
|
159 | 159 | } |
160 | 160 | return $this; |
161 | 161 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $values=\array_fill(0, $count, $values); |
167 | 167 | } |
168 | 168 | $count=\min(\sizeof($values), $count); |
169 | - for($i=0; $i < $count; $i++) { |
|
169 | + for ($i=0; $i<$count; $i++) { |
|
170 | 170 | $this->getCell($i, $colIndex)->setValue($values[$i]); |
171 | 171 | } |
172 | 172 | return $this; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | public function addColVariations($colIndex, $variations=array()) { |
176 | 176 | $count=$this->count(); |
177 | - for($i=0; $i < $count; $i++) { |
|
177 | + for ($i=0; $i<$count; $i++) { |
|
178 | 178 | $this->getCell($i, $colIndex)->addVariations($variations); |
179 | 179 | } |
180 | 180 | return $this; |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | |
192 | 192 | private function colAlign($colIndex, $function) { |
193 | 193 | $count=$this->count(); |
194 | - for($i=0; $i < $count; $i++) { |
|
194 | + for ($i=0; $i<$count; $i++) { |
|
195 | 195 | $index=$this->content[$i]->getColPosition($colIndex); |
196 | - if ($index !== NULL) |
|
196 | + if ($index!==NULL) |
|
197 | 197 | $this->getCell($i, $index)->$function(); |
198 | 198 | } |
199 | 199 | return $this; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function getColCount() { |
227 | 227 | $result=0; |
228 | - if ($this->count() > 0) |
|
228 | + if ($this->count()>0) |
|
229 | 229 | $result=$this->getItem(0)->count(); |
230 | 230 | return $result; |
231 | 231 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function delete($rowIndex, $colIndex=NULL) { |
240 | 240 | if (isset($colIndex)) { |
241 | 241 | $row=$this->getItem($rowIndex); |
242 | - if (isset($row) === true) { |
|
242 | + if (isset($row)===true) { |
|
243 | 243 | $row->delete($colIndex); |
244 | 244 | } |
245 | 245 | } else { |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function conditionalCellFormat($callback, $format) { |
274 | 274 | $rows=$this->content; |
275 | - foreach ( $rows as $row ) { |
|
275 | + foreach ($rows as $row) { |
|
276 | 276 | $row->conditionalCellFormat($callback, $format); |
277 | 277 | } |
278 | 278 | return $this; |
279 | 279 | } |
280 | 280 | |
281 | - public function conditionalColFormat($colIndex,$callback,$format){ |
|
281 | + public function conditionalColFormat($colIndex, $callback, $format) { |
|
282 | 282 | $rows=$this->content; |
283 | - foreach ( $rows as $row ) { |
|
283 | + foreach ($rows as $row) { |
|
284 | 284 | $cell=$row->getItem($colIndex); |
285 | - $cell->conditionnalCellFormat($callback,$format); |
|
285 | + $cell->conditionnalCellFormat($callback, $format); |
|
286 | 286 | } |
287 | 287 | return $this; |
288 | 288 | } |
@@ -294,17 +294,17 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function conditionalRowFormat($callback, $format) { |
296 | 296 | $rows=$this->content; |
297 | - foreach ( $rows as $row ) { |
|
297 | + foreach ($rows as $row) { |
|
298 | 298 | $row->conditionalRowFormat($callback, $format); |
299 | 299 | } |
300 | 300 | return $this; |
301 | 301 | } |
302 | 302 | |
303 | - public function hideColumn($colIndex){ |
|
303 | + public function hideColumn($colIndex) { |
|
304 | 304 | $rows=$this->content; |
305 | - foreach ( $rows as $row ) { |
|
305 | + foreach ($rows as $row) { |
|
306 | 306 | $cell=$row->getItem($colIndex); |
307 | - $cell->addToProperty("style","display:none;"); |
|
307 | + $cell->addToProperty("style", "display:none;"); |
|
308 | 308 | } |
309 | 309 | return $this; |
310 | 310 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function applyCells($callback) { |
317 | 317 | $rows=$this->content; |
318 | - foreach ( $rows as $row ) { |
|
318 | + foreach ($rows as $row) { |
|
319 | 319 | $row->applyCells($callback); |
320 | 320 | } |
321 | 321 | return $this; |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function applyRows($callback) { |
329 | 329 | $rows=$this->content; |
330 | - foreach ( $rows as $row ) { |
|
330 | + foreach ($rows as $row) { |
|
331 | 331 | $row->apply($callback); |
332 | 332 | } |
333 | 333 | return $this; |
@@ -15,117 +15,117 @@ discard block |
||
15 | 15 | protected $_paramParts=array(); |
16 | 16 | |
17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
18 | - parent::__construct($identifier, "div","ui modal"); |
|
19 | - if(isset($header)){ |
|
18 | + parent::__construct($identifier, "div", "ui modal"); |
|
19 | + if (isset($header)) { |
|
20 | 20 | $this->setHeader($header); |
21 | 21 | } |
22 | - if(isset($content)){ |
|
22 | + if (isset($content)) { |
|
23 | 23 | $this->setContent($content); |
24 | 24 | } |
25 | - if(isset($actions)){ |
|
25 | + if (isset($actions)) { |
|
26 | 26 | $this->setActions($actions); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setHeader($value) { |
31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContent($value) { |
36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActions($actions) { |
41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
42 | - if(\is_array($actions)){ |
|
43 | - foreach ($actions as $action){ |
|
41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
42 | + if (\is_array($actions)) { |
|
43 | + foreach ($actions as $action) { |
|
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | 46 | } |
47 | - else{ |
|
47 | + else { |
|
48 | 48 | $this->addAction($actions); |
49 | 49 | } |
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function addAction($action){ |
|
54 | - if(!$action instanceof BaseHtml){ |
|
53 | + public function addAction($action) { |
|
54 | + if (!$action instanceof BaseHtml) { |
|
55 | 55 | $class=""; |
56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
57 | 57 | $class="approve"; |
58 | 58 | } |
59 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
59 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
60 | 60 | $class="cancel"; |
61 | 61 | } |
62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
63 | - if($class!=="") |
|
62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
63 | + if ($class!=="") |
|
64 | 64 | $action->addToProperty("class", $class); |
65 | 65 | } |
66 | 66 | return $this->addElementInPart($action, "actions"); |
67 | 67 | } |
68 | 68 | |
69 | - public function addContent($content,$before=false){ |
|
70 | - $this->content["content"]->addContent($content,$before); |
|
69 | + public function addContent($content, $before=false) { |
|
70 | + $this->content["content"]->addContent($content, $before); |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function addImageContent($image,$description=NULL){ |
|
74 | + public function addImageContent($image, $description=NULL) { |
|
75 | 75 | $content=$this->content["content"]; |
76 | - if(isset($description)){ |
|
77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
78 | - $content->addContent($description,true); |
|
76 | + if (isset($description)) { |
|
77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
78 | + $content->addContent($description, true); |
|
79 | 79 | } |
80 | - if($image!==""){ |
|
81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
82 | - $content->addContent($img,true); |
|
83 | - $content->addToProperty("class","image"); |
|
80 | + if ($image!=="") { |
|
81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
82 | + $content->addContent($img, true); |
|
83 | + $content->addToProperty("class", "image"); |
|
84 | 84 | } |
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - public function addIconContent($icon,$description=NULL){ |
|
88 | + public function addIconContent($icon, $description=NULL) { |
|
89 | 89 | $content=$this->content["content"]; |
90 | - if(isset($description)){ |
|
91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
92 | - $content->addContent($description,true); |
|
90 | + if (isset($description)) { |
|
91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
92 | + $content->addContent($description, true); |
|
93 | 93 | } |
94 | - if($icon!==""){ |
|
95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
96 | - $content->addContent($img,true); |
|
97 | - $content->addToProperty("class","image"); |
|
94 | + if ($icon!=="") { |
|
95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
96 | + $content->addContent($img, true); |
|
97 | + $content->addToProperty("class", "image"); |
|
98 | 98 | } |
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - private function addContentInPart($content,$uiClass,$part) { |
|
103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
102 | + private function addContentInPart($content, $uiClass, $part) { |
|
103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
104 | 104 | } |
105 | 105 | |
106 | - private function addElementInPart($element,$part) { |
|
106 | + private function addElementInPart($element, $part) { |
|
107 | 107 | $this->content[$part]->addContent($element); |
108 | 108 | return $element; |
109 | 109 | } |
110 | 110 | |
111 | - public function showDimmer($value){ |
|
112 | - $value=$value?"show":"hide"; |
|
111 | + public function showDimmer($value) { |
|
112 | + $value=$value ? "show" : "hide"; |
|
113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function setInverted($recursive=true){ |
|
117 | + public function setInverted($recursive=true) { |
|
118 | 118 | $this->_params["inverted"]=true; |
119 | 119 | return $this; |
120 | 120 | } |
121 | 121 | |
122 | - public function setBasic(){ |
|
122 | + public function setBasic() { |
|
123 | 123 | return $this->addToProperty("class", "basic"); |
124 | 124 | } |
125 | 125 | |
126 | 126 | |
127 | - public function setTransition($value){ |
|
128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
127 | + public function setTransition($value) { |
|
128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @param string $viewName |
136 | 136 | * @param $params The parameters to pass to the view |
137 | 137 | */ |
138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @param string $actionName the action name |
148 | 148 | * @param array $params |
149 | 149 | */ |
150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
159 | 159 | */ |
160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
162 | 162 | return parent::compile($js, $view); |
163 | 163 | } |
164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * @see BaseHtml::run() |
167 | 167 | */ |
168 | 168 | public function run(JsUtils $js) { |
169 | - if(isset($this->_bsComponent)===false) |
|
170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
169 | + if (isset($this->_bsComponent)===false) |
|
170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
171 | 171 | $this->addEventsOnRun($js); |
172 | 172 | return $this->_bsComponent; |
173 | 173 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @property HtmlSemDoubleElement $_self |
16 | 16 | */ |
17 | 17 | trait BaseTrait { |
18 | - protected $_variations=[ ]; |
|
19 | - protected $_states=[ ]; |
|
18 | + protected $_variations=[]; |
|
19 | + protected $_states=[]; |
|
20 | 20 | protected $_baseClass; |
21 | 21 | |
22 | 22 | abstract protected function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | abstract public function setProperty($name, $value); |
31 | 31 | |
32 | - abstract public function addContent($content,$before=false); |
|
32 | + abstract public function addContent($content, $before=false); |
|
33 | 33 | |
34 | 34 | abstract public function onCreate($jsCode); |
35 | 35 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->_self->setProperty("class", $this->_self->_baseClass); |
51 | 51 | if (\is_string($variations)) |
52 | 52 | $variations=\explode(" ", $variations); |
53 | - foreach ( $variations as $variation ) { |
|
53 | + foreach ($variations as $variation) { |
|
54 | 54 | $this->_self->addVariation($variation); |
55 | 55 | } |
56 | 56 | return $this; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function addVariations($variations=array()) { |
65 | 65 | if (\is_string($variations)) |
66 | 66 | $variations=\explode(" ", $variations); |
67 | - foreach ( $variations as $variation ) { |
|
67 | + foreach ($variations as $variation) { |
|
68 | 68 | $this->_self->addVariation($variation); |
69 | 69 | } |
70 | 70 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function addStates($states=array()) { |
74 | 74 | if (\is_string($states)) |
75 | 75 | $states=\explode(" ", $states); |
76 | - foreach ( $states as $state ) { |
|
76 | + foreach ($states as $state) { |
|
77 | 77 | $this->_self->addState($state); |
78 | 78 | } |
79 | 79 | return $this; |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | $this->_self->setProperty("class", $this->_self->_baseClass); |
84 | 84 | if (\is_string($states)) |
85 | 85 | $states=\explode(" ", $states); |
86 | - foreach ( $states as $state ) { |
|
86 | + foreach ($states as $state) { |
|
87 | 87 | $this->_self->addState($state); |
88 | 88 | } |
89 | 89 | return $this; |
90 | 90 | } |
91 | 91 | |
92 | 92 | public function addIcon($icon, $before=true) { |
93 | - return $this->_self->addContent(new HtmlIcon("icon-" . $this->_self->identifier, $icon), $before); |
|
93 | + return $this->_self->addContent(new HtmlIcon("icon-".$this->_self->identifier, $icon), $before); |
|
94 | 94 | } |
95 | 95 | |
96 | - public function addSticky($context="body"){ |
|
96 | + public function addSticky($context="body") { |
|
97 | 97 | $this->_self->onCreate("$('#".$this->_self->identifier."').sticky({ context: '".$context."'});"); |
98 | 98 | return $this; |
99 | 99 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return HtmlSemDoubleElement |
115 | 115 | */ |
116 | 116 | public function setDisabled($disable=true) { |
117 | - if($disable) |
|
117 | + if ($disable) |
|
118 | 118 | $this->_self->addToProperty("class", "disabled"); |
119 | 119 | return $this; |
120 | 120 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return HtmlSemDoubleElement |
142 | 142 | */ |
143 | - public function asHeader(){ |
|
143 | + public function asHeader() { |
|
144 | 144 | return $this->_self->addToProperty("class", "header"); |
145 | 145 | } |
146 | 146 | |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | * show it is currently the active user selection |
149 | 149 | * @return HtmlSemDoubleElement |
150 | 150 | */ |
151 | - public function setActive($value=true){ |
|
152 | - if($value) |
|
151 | + public function setActive($value=true) { |
|
152 | + if ($value) |
|
153 | 153 | $this->_self->addToProperty("class", "active"); |
154 | 154 | return $this; |
155 | 155 | } |
156 | 156 | |
157 | - public function setAttached($value=true){ |
|
158 | - if($value) |
|
159 | - $this->_self->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
157 | + public function setAttached($value=true) { |
|
158 | + if ($value) |
|
159 | + $this->_self->addToPropertyCtrl("class", "attached", array("attached")); |
|
160 | 160 | return $this; |
161 | 161 | } |
162 | 162 | |
@@ -164,13 +164,13 @@ discard block |
||
164 | 164 | * can be formatted to appear on dark backgrounds |
165 | 165 | */ |
166 | 166 | public function setInverted($recursive=true) { |
167 | - if($recursive===true){ |
|
167 | + if ($recursive===true) { |
|
168 | 168 | $content=$this->_self->getContent(); |
169 | - if($content instanceof HtmlSemDoubleElement) |
|
169 | + if ($content instanceof HtmlSemDoubleElement) |
|
170 | 170 | $content->setInverted($recursive); |
171 | - elseif(\is_array($content) || $content instanceof \Traversable){ |
|
172 | - foreach ($content as $elm){ |
|
173 | - if($elm instanceof HtmlSemDoubleElement){ |
|
171 | + elseif (\is_array($content) || $content instanceof \Traversable) { |
|
172 | + foreach ($content as $elm) { |
|
173 | + if ($elm instanceof HtmlSemDoubleElement) { |
|
174 | 174 | $elm->setInverted($recursive); |
175 | 175 | } |
176 | 176 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | public function setFloated($direction="right") { |
187 | - return $this->_self->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
187 | + return $this->_self->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public function floatRight() { |
@@ -199,14 +199,14 @@ discard block |
||
199 | 199 | return $this->_self->_baseClass; |
200 | 200 | } |
201 | 201 | |
202 | - protected function addBehavior(&$array,$key,$value,$before="",$after=""){ |
|
203 | - if(\is_string($value)){ |
|
204 | - if(isset($array[$key])){ |
|
202 | + protected function addBehavior(&$array, $key, $value, $before="", $after="") { |
|
203 | + if (\is_string($value)) { |
|
204 | + if (isset($array[$key])) { |
|
205 | 205 | $p=JString::replaceAtFirstAndLast($array[$key], $before, "", $after, ""); |
206 | 206 | $array[$key]=$before.$p.$value.$after; |
207 | - }else |
|
207 | + } else |
|
208 | 208 | $array[$key]=$before.$value.$after; |
209 | - }else{ |
|
209 | + } else { |
|
210 | 210 | $array[$key]=$value; |
211 | 211 | } |
212 | 212 | return $this; |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * @version 1.3 |
16 | 16 | */ |
17 | 17 | abstract class BaseHtml extends BaseWidget { |
18 | - use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait; |
|
18 | + use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait; |
|
19 | 19 | protected $_template; |
20 | 20 | protected $tagName; |
21 | - protected $_wrapBefore=array (); |
|
22 | - protected $_wrapAfter=array (); |
|
21 | + protected $_wrapBefore=array(); |
|
22 | + protected $_wrapAfter=array(); |
|
23 | 23 | protected $_bsComponent; |
24 | 24 | protected $_compiled=false; |
25 | 25 | |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | */ |
31 | 31 | abstract public function run(JsUtils $js); |
32 | 32 | |
33 | - private function _callSetter($setter,$key,$value,&$array){ |
|
33 | + private function _callSetter($setter, $key, $value, &$array) { |
|
34 | 34 | $result=false; |
35 | 35 | if (method_exists($this, $setter) && !JString::startswith($key, "_")) { |
36 | 36 | try { |
37 | 37 | $this->$setter($value); |
38 | 38 | unset($array[$key]); |
39 | 39 | $result=true; |
40 | - } catch ( \Exception $e ) { |
|
40 | + }catch (\Exception $e) { |
|
41 | 41 | $result=false; |
42 | 42 | } |
43 | 43 | } |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | protected function getTemplate(JsUtils $js=NULL) { |
48 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
48 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | protected function ctrl($name, $value, $typeCtrl) { |
52 | 52 | if (\is_array($typeCtrl)) { |
53 | - if (array_search($value, $typeCtrl) === false) { |
|
54 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
53 | + if (array_search($value, $typeCtrl)===false) { |
|
54 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
55 | 55 | } |
56 | 56 | } else { |
57 | 57 | if (!$typeCtrl($value)) { |
58 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
58 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | return true; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | |
66 | 66 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
67 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
67 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
68 | 68 | return $name=$value; |
69 | 69 | } |
70 | 70 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
74 | 74 | if (\is_array($typeCtrl)) { |
75 | 75 | $this->removeOldValues($name, $typeCtrl); |
76 | - $name.=$separator . $value; |
|
76 | + $name.=$separator.$value; |
|
77 | 77 | } |
78 | 78 | return $this; |
79 | 79 | } |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | |
82 | 82 | |
83 | 83 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
84 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
84 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
85 | 85 | if (\is_array($typeCtrl)) { |
86 | 86 | $this->removeOldValues($name, $typeCtrl); |
87 | 87 | } |
88 | - $name.=$separator . $value; |
|
88 | + $name.=$separator.$value; |
|
89 | 89 | } |
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | 93 | protected function addToMember(&$name, $value, $separator=" ") { |
94 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
94 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 | |
@@ -102,18 +102,18 @@ discard block |
||
102 | 102 | $oldValue=trim($oldValue); |
103 | 103 | } |
104 | 104 | |
105 | - protected function _getElementBy($callback,$elements){ |
|
105 | + protected function _getElementBy($callback, $elements) { |
|
106 | 106 | if (\is_array($elements)) { |
107 | 107 | $elements=\array_values($elements); |
108 | 108 | $flag=false; |
109 | 109 | $index=0; |
110 | - while ( !$flag && $index < sizeof($elements) ) { |
|
110 | + while (!$flag && $index<sizeof($elements)) { |
|
111 | 111 | if ($elements[$index] instanceof BaseHtml) |
112 | 112 | $flag=($callback($elements[$index])); |
113 | 113 | $index++; |
114 | 114 | } |
115 | - if ($flag === true) |
|
116 | - return $elements[$index - 1]; |
|
115 | + if ($flag===true) |
|
116 | + return $elements[$index-1]; |
|
117 | 117 | } elseif ($elements instanceof BaseHtml) { |
118 | 118 | if ($callback($elements)) |
119 | 119 | return $elements; |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | public function fromArray($array) { |
144 | - foreach ( $this as $key => $value ) { |
|
145 | - if(array_key_exists($key, $array)===true) |
|
146 | - $this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array); |
|
144 | + foreach ($this as $key => $value) { |
|
145 | + if (array_key_exists($key, $array)===true) |
|
146 | + $this->_callSetter("set".ucfirst($key), $key, $array[$key], $array); |
|
147 | 147 | } |
148 | - foreach ( $array as $key => $value ) { |
|
149 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
150 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
148 | + foreach ($array as $key => $value) { |
|
149 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
150 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | return $array; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | public function fromDatabaseObjects($objects, $function) { |
157 | 157 | if (isset($objects)) { |
158 | - foreach ( $objects as $object ) { |
|
158 | + foreach ($objects as $object) { |
|
159 | 159 | $this->fromDatabaseObject($object, $function); |
160 | 160 | } |
161 | 161 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | |
178 | 178 | public function getElementById($identifier, $elements) { |
179 | - return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements); |
|
179 | + return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | public function getBsComponent() { |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
192 | - if(!$this->_compiled){ |
|
193 | - if(isset($js)){ |
|
192 | + if (!$this->_compiled) { |
|
193 | + if (isset($js)) { |
|
194 | 194 | $beforeCompile=$js->getParam("beforeCompileHtml"); |
195 | - if(\is_callable($beforeCompile)){ |
|
196 | - $beforeCompile($this,$js,$view); |
|
195 | + if (\is_callable($beforeCompile)) { |
|
196 | + $beforeCompile($this, $js, $view); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | $this->_compiled=true; |
@@ -201,21 +201,21 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
204 | - $this->compile_once($js,$view); |
|
204 | + $this->compile_once($js, $view); |
|
205 | 205 | $result=$this->getTemplate($js); |
206 | - foreach ( $this as $key => $value ) { |
|
207 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
206 | + foreach ($this as $key => $value) { |
|
207 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
208 | 208 | if (\is_array($value)) { |
209 | 209 | $v=PropertyWrapper::wrap($value, $js); |
210 | 210 | } else { |
211 | 211 | $v=$value; |
212 | 212 | } |
213 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
213 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | if (isset($js)===true) { |
217 | 217 | $this->run($js); |
218 | - if (isset($view) === true) { |
|
218 | + if (isset($view)===true) { |
|
219 | 219 | $js->addViewElement($this->_identifier, $result, $view); |
220 | 220 | } |
221 | 221 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct($identifier, $rowCount, $colCount) { |
29 | 29 | parent::__construct($identifier, "table", "ui table"); |
30 | - $this->content=array (); |
|
30 | + $this->content=array(); |
|
31 | 31 | $this->setRowCount($rowCount, $colCount); |
32 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
33 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
32 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
33 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
34 | 34 | $this->_afterCompileEvents=[]; |
35 | 35 | } |
36 | 36 | |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | * @return HtmlTableContent |
41 | 41 | */ |
42 | 42 | public function getPart($key) { |
43 | - if (\array_key_exists($key, $this->content) === false) { |
|
43 | + if (\array_key_exists($key, $this->content)===false) { |
|
44 | 44 | $this->content[$key]=new HtmlTableContent("", $key); |
45 | - if ($key !== "tbody") { |
|
45 | + if ($key!=="tbody") { |
|
46 | 46 | $this->content[$key]->setRowCount(1, $this->_colCount); |
47 | 47 | } |
48 | 48 | } |
49 | 49 | return $this->content[$key]; |
50 | 50 | } |
51 | 51 | |
52 | - protected function _getFirstPart(){ |
|
53 | - if(isset($this->content["thead"])){ |
|
52 | + protected function _getFirstPart() { |
|
53 | + if (isset($this->content["thead"])) { |
|
54 | 54 | return $this->content["thead"]; |
55 | 55 | } |
56 | 56 | return $this->content["tbody"]; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return boolean |
96 | 96 | */ |
97 | 97 | public function hasPart($key) { |
98 | - return \array_key_exists($key, $this->content) === true; |
|
98 | + return \array_key_exists($key, $this->content)===true; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | private function colAlign($colIndex, $function) { |
232 | 232 | if (\is_array($colIndex)) { |
233 | - foreach ( $colIndex as $cIndex ) { |
|
233 | + foreach ($colIndex as $cIndex) { |
|
234 | 234 | $this->colAlign($cIndex, $function); |
235 | 235 | } |
236 | 236 | } else { |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @see HtmlSemDoubleElement::compile() |
292 | 292 | */ |
293 | 293 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
294 | - if(\sizeof($this->_compileParts)<3){ |
|
294 | + if (\sizeof($this->_compileParts)<3) { |
|
295 | 295 | $this->_template="%content%"; |
296 | 296 | $this->refresh(); |
297 | 297 | } |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
303 | - parent::compile_once($js,$view); |
|
303 | + parent::compile_once($js, $view); |
|
304 | 304 | if ($this->propertyContains("class", "sortable")) { |
305 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
305 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
306 | 306 | } |
307 | - if(isset($this->_activeRowSelector)){ |
|
307 | + if (isset($this->_activeRowSelector)) { |
|
308 | 308 | $this->_activeRowSelector->compile(); |
309 | 309 | } |
310 | 310 | } |
@@ -318,13 +318,13 @@ discard block |
||
318 | 318 | public function fromDatabaseObject($object, $function) { |
319 | 319 | $result=$function($object); |
320 | 320 | if (\is_array($result)) { |
321 | - $result= $this->addRow($function($object)); |
|
321 | + $result=$this->addRow($function($object)); |
|
322 | 322 | } else { |
323 | - $result= $this->getBody()->_addRow($result); |
|
323 | + $result=$this->getBody()->_addRow($result); |
|
324 | 324 | } |
325 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
326 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
327 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
325 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
326 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
327 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
328 | 328 | } |
329 | 329 | return $result; |
330 | 330 | } |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | return $this; |
340 | 340 | } |
341 | 341 | |
342 | - public function refresh(){ |
|
342 | + public function refresh() { |
|
343 | 343 | $this->_footer=$this->getFooter(); |
344 | 344 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
345 | 345 | } |
346 | 346 | |
347 | - public function run(JsUtils $js){ |
|
348 | - $result= parent::run($js); |
|
349 | - if(isset($this->_footer)) |
|
347 | + public function run(JsUtils $js) { |
|
348 | + $result=parent::run($js); |
|
349 | + if (isset($this->_footer)) |
|
350 | 350 | $this->_footer->run($js); |
351 | 351 | return $result; |
352 | 352 | } |
@@ -369,38 +369,38 @@ discard block |
||
369 | 369 | * @param boolean $multiple |
370 | 370 | * @return HtmlTable |
371 | 371 | */ |
372 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
373 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
372 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
373 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
374 | 374 | return $this; |
375 | 375 | } |
376 | 376 | |
377 | - public function hideColumn($colIndex){ |
|
378 | - if(isset($this->content["thead"])){ |
|
377 | + public function hideColumn($colIndex) { |
|
378 | + if (isset($this->content["thead"])) { |
|
379 | 379 | $this->content["thead"]->hideColumn($colIndex); |
380 | 380 | } |
381 | 381 | $this->content["tbody"]->hideColumn($colIndex); |
382 | - if(isset($this->content["tfoot"])){ |
|
382 | + if (isset($this->content["tfoot"])) { |
|
383 | 383 | $this->content["tfoot"]->hideColumn($colIndex); |
384 | 384 | } |
385 | 385 | return $this; |
386 | 386 | } |
387 | 387 | |
388 | - public function setColWidth($colIndex,$width){ |
|
388 | + public function setColWidth($colIndex, $width) { |
|
389 | 389 | $part=$this->_getFirstPart(); |
390 | - if($part!==null && $part->count()>0) |
|
390 | + if ($part!==null && $part->count()>0) |
|
391 | 391 | $part->getCell(0, $colIndex)->setWidth($width); |
392 | 392 | return $this; |
393 | 393 | } |
394 | 394 | |
395 | - public function setColWidths($widths){ |
|
395 | + public function setColWidths($widths) { |
|
396 | 396 | $part=$this->_getFirstPart(); |
397 | - if($part!==null && $part->count()>0){ |
|
397 | + if ($part!==null && $part->count()>0) { |
|
398 | 398 | $count=$part->getColCount(); |
399 | - if(!\is_array($widths)){ |
|
399 | + if (!\is_array($widths)) { |
|
400 | 400 | $widths=\array_fill(0, $count, $widths); |
401 | 401 | } |
402 | - $max=\min(\sizeof($widths),$count); |
|
403 | - for($i=0;$i<$max;$i++){ |
|
402 | + $max=\min(\sizeof($widths), $count); |
|
403 | + for ($i=0; $i<$max; $i++) { |
|
404 | 404 | $part->getCell(0, $i)->setWidth($widths[$i]); |
405 | 405 | } |
406 | 406 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | class HtmlCardGroups extends HtmlViewGroups { |
9 | 9 | |
10 | 10 | public function __construct($identifier, $cards=array()) { |
11 | - parent::__construct($identifier, "ui cards",$cards); |
|
11 | + parent::__construct($identifier, "ui cards", $cards); |
|
12 | 12 | } |
13 | 13 | |
14 | - protected function createElement(){ |
|
15 | - return new HtmlCard("card-" . $this->count()); |
|
14 | + protected function createElement() { |
|
15 | + return new HtmlCard("card-".$this->count()); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function newItem($identifier) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | abstract class HtmlViewGroups extends HtmlSemCollection { |
10 | 10 | |
11 | - public function __construct($identifier, $uiClass,$items=array()) { |
|
11 | + public function __construct($identifier, $uiClass, $items=array()) { |
|
12 | 12 | parent::__construct($identifier, "div", $uiClass); |
13 | 13 | $this->addItems($items); |
14 | 14 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param int $wide |
41 | 41 | */ |
42 | 42 | public function setWide($wide) { |
43 | - $wide=Wide::getConstants()["W" . $wide]; |
|
43 | + $wide=Wide::getConstants()["W".$wide]; |
|
44 | 44 | return $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
45 | 45 | } |
46 | 46 |