@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | - * @param string $itemTitleMethod |
|
| 171 | + * @param string $titleMethod |
|
| 172 | 172 | */ |
| 173 | 173 | public function setTitleMethod($titleMethod) |
| 174 | 174 | { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | - * @return the $defaultLiClass |
|
| 260 | + * @return string $defaultLiClass |
|
| 261 | 261 | */ |
| 262 | 262 | public function getDefaultLiClass() { |
| 263 | 263 | return $this->defaultLiClass; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | - * @return the $subUlClass |
|
| 275 | + * @return string $subUlClass |
|
| 276 | 276 | */ |
| 277 | 277 | public function getSubUlClass() { |
| 278 | 278 | return $this->subUlClass; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
| 290 | - * @return the $subUlClassLevel1 |
|
| 290 | + * @return string $subUlClassLevel1 |
|
| 291 | 291 | */ |
| 292 | 292 | public function getSubUlClassLevel1() { |
| 293 | 293 | return $this->subUlClassLevel1; |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | - * @return the $subLiClass |
|
| 305 | + * @return string $subLiClass |
|
| 306 | 306 | */ |
| 307 | 307 | public function getSubLiClass() { |
| 308 | 308 | return $this->subLiClass; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | - * @return the $subLiClassLevel0 |
|
| 320 | + * @return string $subLiClassLevel0 |
|
| 321 | 321 | */ |
| 322 | 322 | public function getSubLiClassLevel0() { |
| 323 | 323 | return $this->subLiClassLevel0; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
| 335 | - * @return the $iconPrefixClass |
|
| 335 | + * @return string $iconPrefixClass |
|
| 336 | 336 | */ |
| 337 | 337 | public function getIconPrefixClass() { |
| 338 | 338 | return $this->iconPrefixClass; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | - * @return the $hrefSubToggleOverride |
|
| 350 | + * @return string $hrefSubToggleOverride |
|
| 351 | 351 | */ |
| 352 | 352 | public function getHrefSubToggleOverride() { |
| 353 | 353 | return $this->hrefSubToggleOverride; |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | /** |
| 526 | 526 | * Retrieves a value by property from Locale |
| 527 | 527 | * |
| 528 | - * @param $property |
|
| 528 | + * @param string $property |
|
| 529 | 529 | * @param $locale |
| 530 | 530 | * @param bool $in_locale |
| 531 | 531 | * @return mixed |
@@ -479,12 +479,12 @@ |
||
| 479 | 479 | ''.Locale::getDisplayLanguage(null). // ' - '.Locale::getDefault().' - '.Locale::getPrimaryLanguage(null).''. |
| 480 | 480 | '<span class="caret"></span>'. |
| 481 | 481 | '</a>'. |
| 482 | - sprintf( |
|
| 482 | + sprintf( |
|
| 483 | 483 | '<ul%s>%s</ul>', |
| 484 | 484 | ($subulclass) ? sprintf(' class="%s"', $subulclass) : '', |
| 485 | 485 | $list |
| 486 | - ). |
|
| 487 | - '</li>'. |
|
| 486 | + ). |
|
| 487 | + '</li>'. |
|
| 488 | 488 | '</ul>' |
| 489 | 489 | ; |
| 490 | 490 | |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | |
| 422 | 422 | } catch (\Exception $e) { |
| 423 | 423 | |
| 424 | - $msg = get_class($e) . ': ' . $e->getMessage() . "\n" . $e->getTraceAsString(); |
|
| 424 | + $msg = get_class($e).': '.$e->getMessage()."\n".$e->getTraceAsString(); |
|
| 425 | 425 | trigger_error($msg, E_USER_ERROR); |
| 426 | 426 | return ''; |
| 427 | 427 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | $list = ''; |
| 448 | 448 | $current = Locale::getDefault(); |
| 449 | - foreach($detector->getSupported() as $locale) { |
|
| 449 | + foreach ($detector->getSupported() as $locale) { |
|
| 450 | 450 | if ($this->omitCurrent() && $current === $locale) { |
| 451 | 451 | continue; |
| 452 | 452 | } |
@@ -461,22 +461,22 @@ discard block |
||
| 461 | 461 | $displayName = $this->getLocaleProperty('displayName', $locale, $labelLocale); |
| 462 | 462 | |
| 463 | 463 | $item = sprintf( |
| 464 | - '<li><a href="%s" title="%s"%s>%s</a></li>' . "\n", |
|
| 464 | + '<li><a href="%s" title="%s"%s>%s</a></li>'."\n", |
|
| 465 | 465 | $url, |
| 466 | 466 | $displayName, |
| 467 | 467 | ($current === $locale) ? ' class="active"' : '', |
| 468 | - (($iconprefixclass) ? '<span class="' . $iconprefixclass . $primary . '"></span> ' : '') . $label |
|
| 468 | + (($iconprefixclass) ? '<span class="'.$iconprefixclass.$primary.'"></span> ' : '').$label |
|
| 469 | 469 | ); |
| 470 | 470 | |
| 471 | 471 | $list .= $item; |
| 472 | 472 | } |
| 473 | 473 | $attributes = $this->getAttributes(); |
| 474 | - $html = |
|
| 474 | + $html = |
|
| 475 | 475 | '<ul'.(($class) ? sprintf(' class="%s"', $class) : '').' '.($this->htmlAttribs($attributes)).'>'. |
| 476 | 476 | '<li'.(($liclass) ? sprintf(' class="%s"', $liclass) : '').'>'. |
| 477 | 477 | '<a href="" class="'.(($liclass) ? $liclass.'-toggle' : '').'" data-toggle="'.(($liclass) ? $liclass : '').'" role="button" aria-haspopup="true" aria-expanded="false" title="'.Locale::getDisplayName(null).'">'. |
| 478 | 478 | '<span class="'.(($iconprefixclass) ? $iconprefixclass : '').Locale::getPrimaryLanguage(null).'"></span> '. |
| 479 | - ''.Locale::getDisplayLanguage(null). // ' - '.Locale::getDefault().' - '.Locale::getPrimaryLanguage(null).''. |
|
| 479 | + ''.Locale::getDisplayLanguage(null).// ' - '.Locale::getDefault().' - '.Locale::getPrimaryLanguage(null).''. |
|
| 480 | 480 | '<span class="caret"></span>'. |
| 481 | 481 | '</a>'. |
| 482 | 482 | sprintf( |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | /** |
| 271 | 271 | * generate template object |
| 272 | 272 | * @param Template $template |
| 273 | - * @return ProductTable |
|
| 273 | + * @return Table |
|
| 274 | 274 | */ |
| 275 | 275 | public function setTemplate( $template = null ) { |
| 276 | 276 | if ($template == null) { |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | /** |
| 293 | 293 | * set new table data |
| 294 | 294 | * @param mixed $data |
| 295 | - * @return ProductTable |
|
| 295 | + * @return Table |
|
| 296 | 296 | */ |
| 297 | 297 | public function setData( $data = null) { |
| 298 | 298 | if ( is_array($data) ) { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * @param object|array $options |
| 322 | - * @return ProductTable |
|
| 322 | + * @return Table |
|
| 323 | 323 | */ |
| 324 | 324 | public function setOptions($options) { |
| 325 | 325 | if ( is_array($options) ) { |
@@ -25,23 +25,23 @@ discard block |
||
| 25 | 25 | class Table extends Void |
| 26 | 26 | { |
| 27 | 27 | /** @var \UIComponents\Template\Template $template */ |
| 28 | - public $template = null; |
|
| 28 | + public $template = null; |
|
| 29 | 29 | |
| 30 | - /** @var array $data */ |
|
| 31 | - public $data = array(); |
|
| 30 | + /** @var array $data */ |
|
| 31 | + public $data = array(); |
|
| 32 | 32 | |
| 33 | - /** @var array $options */ |
|
| 34 | - public $options = array(); |
|
| 33 | + /** @var array $options */ |
|
| 34 | + public $options = array(); |
|
| 35 | 35 | |
| 36 | - /** @var array $tags */ |
|
| 37 | - public $tags = array( |
|
| 38 | - "container" => "table", |
|
| 39 | - "row" => "tr", |
|
| 40 | - "cell" => "td", |
|
| 41 | - "headcell" => "th" |
|
| 42 | - ); |
|
| 36 | + /** @var array $tags */ |
|
| 37 | + public $tags = array( |
|
| 38 | + "container" => "table", |
|
| 39 | + "row" => "tr", |
|
| 40 | + "cell" => "td", |
|
| 41 | + "headcell" => "th" |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | + /** |
|
| 45 | 45 | * View helper entry point: |
| 46 | 46 | * Retrieves helper and optionally sets component options to operate on |
| 47 | 47 | * |
@@ -106,235 +106,235 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function render() |
| 108 | 108 | { |
| 109 | - return $this->buildMarkup(); |
|
| 109 | + return $this->buildMarkup(); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * generate table header HTML |
|
| 114 | - * @param mixed $aHTMLTableColumns |
|
| 115 | - * @return self |
|
| 116 | - */ |
|
| 117 | - public function buildHeaderCells ($aHTMLTableColumns) { |
|
| 118 | - $sHTMLTableHeader = ""; |
|
| 119 | - $sHTMLTableColumnGroup = ""; |
|
| 120 | - $aColumns = array(); |
|
| 121 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 122 | - if ($aColumn["field"]) { |
|
| 123 | - $aColumns[] = $aColumn["field"]; |
|
| 124 | - $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 125 | - $sHTMLTableColumnGroup .= "<column class=\"".$aColumn["field"]."\" />"; |
|
| 126 | - } else { |
|
| 127 | - $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 128 | - $sHTMLTableColumnGroup .= "<column class=\"col_".$iColumn."\" />"; |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - $this->getTemplate()->set('s', 'HEADERCELLS', $sHTMLTableHeader); |
|
| 132 | - $this->getTemplate()->set('s', 'COLUMNGROUP', "<columns>".$sHTMLTableColumnGroup."</columns>"); |
|
| 133 | - return ($this); |
|
| 134 | - } |
|
| 112 | + /** |
|
| 113 | + * generate table header HTML |
|
| 114 | + * @param mixed $aHTMLTableColumns |
|
| 115 | + * @return self |
|
| 116 | + */ |
|
| 117 | + public function buildHeaderCells ($aHTMLTableColumns) { |
|
| 118 | + $sHTMLTableHeader = ""; |
|
| 119 | + $sHTMLTableColumnGroup = ""; |
|
| 120 | + $aColumns = array(); |
|
| 121 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 122 | + if ($aColumn["field"]) { |
|
| 123 | + $aColumns[] = $aColumn["field"]; |
|
| 124 | + $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 125 | + $sHTMLTableColumnGroup .= "<column class=\"".$aColumn["field"]."\" />"; |
|
| 126 | + } else { |
|
| 127 | + $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
|
| 128 | + $sHTMLTableColumnGroup .= "<column class=\"col_".$iColumn."\" />"; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + $this->getTemplate()->set('s', 'HEADERCELLS', $sHTMLTableHeader); |
|
| 132 | + $this->getTemplate()->set('s', 'COLUMNGROUP', "<columns>".$sHTMLTableColumnGroup."</columns>"); |
|
| 133 | + return ($this); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * generate table footer HTML |
|
| 138 | - * @param mixed $aHTMLTableColumns |
|
| 139 | - * @return self |
|
| 140 | - */ |
|
| 141 | - public function buildFooterCells ($aHTMLTableColumns) { |
|
| 142 | - $sHTMLTableFooter = ""; |
|
| 143 | - $aColumns = array(); |
|
| 144 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 145 | - if ($aColumn["field"]) { |
|
| 146 | - $aColumns[] = $aColumn["field"]; |
|
| 147 | - $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 148 | - } else { |
|
| 149 | - $sHTMLTableFooter .= "<".$this->tags->cell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - $this->getTemplate()->set('s', 'FOOTERCELLS', $sHTMLTableFooter); |
|
| 153 | - return ($this); |
|
| 154 | - } |
|
| 136 | + /** |
|
| 137 | + * generate table footer HTML |
|
| 138 | + * @param mixed $aHTMLTableColumns |
|
| 139 | + * @return self |
|
| 140 | + */ |
|
| 141 | + public function buildFooterCells ($aHTMLTableColumns) { |
|
| 142 | + $sHTMLTableFooter = ""; |
|
| 143 | + $aColumns = array(); |
|
| 144 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 145 | + if ($aColumn["field"]) { |
|
| 146 | + $aColumns[] = $aColumn["field"]; |
|
| 147 | + $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 148 | + } else { |
|
| 149 | + $sHTMLTableFooter .= "<".$this->tags->cell." class=\"col_".$iColumn."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + $this->getTemplate()->set('s', 'FOOTERCELLS', $sHTMLTableFooter); |
|
| 153 | + return ($this); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * generate table body HTML |
|
| 158 | - * @param array $aRowData |
|
| 159 | - * @param mixed $aHTMLTableColumns |
|
| 160 | - * @return array |
|
| 161 | - */ |
|
| 162 | - public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
| 163 | - $aRows = array(); |
|
| 164 | - foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
| 165 | - $sCells = ""; |
|
| 166 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 167 | - $mCellValue = $oRowData[$aColumn["field"]]; |
|
| 168 | - if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
|
| 169 | - $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
|
| 170 | - } |
|
| 171 | - if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
| 172 | - $sClassname = $aColumn["field"]; |
|
| 173 | - } else { |
|
| 174 | - $sClassname = "col_".$iColumn; |
|
| 175 | - } |
|
| 176 | - $sCells .= "<".$this->tags->cell." class=\"".$sClassname."\">". |
|
| 177 | - $mCellValue. |
|
| 178 | - "</".$this->tags->cell.">"; |
|
| 179 | - } |
|
| 156 | + /** |
|
| 157 | + * generate table body HTML |
|
| 158 | + * @param array $aRowData |
|
| 159 | + * @param mixed $aHTMLTableColumns |
|
| 160 | + * @return array |
|
| 161 | + */ |
|
| 162 | + public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
| 163 | + $aRows = array(); |
|
| 164 | + foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
| 165 | + $sCells = ""; |
|
| 166 | + foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 167 | + $mCellValue = $oRowData[$aColumn["field"]]; |
|
| 168 | + if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
|
| 169 | + $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
|
| 170 | + } |
|
| 171 | + if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
| 172 | + $sClassname = $aColumn["field"]; |
|
| 173 | + } else { |
|
| 174 | + $sClassname = "col_".$iColumn; |
|
| 175 | + } |
|
| 176 | + $sCells .= "<".$this->tags->cell." class=\"".$sClassname."\">". |
|
| 177 | + $mCellValue. |
|
| 178 | + "</".$this->tags->cell.">"; |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - $aRows[] = $sCells; |
|
| 182 | - } |
|
| 181 | + $aRows[] = $sCells; |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - foreach ($aRows as $iRow => $sRow) { |
|
| 185 | - $this->getTemplate()->set('d', 'ROWID', "row_".$aRowData[$iRow]["productID"]); |
|
| 186 | - $this->getTemplate()->set('d', 'BODYCELLS', $sRow); |
|
| 187 | - if (($iRow % 2) == 0) { |
|
| 188 | - $this->getTemplate()->set('d', 'CSS_CLASS', 'even'); |
|
| 189 | - } else { |
|
| 190 | - $this->getTemplate()->set('d', 'CSS_CLASS', 'odd'); |
|
| 191 | - } |
|
| 192 | - $this->getTemplate()->next(); |
|
| 184 | + foreach ($aRows as $iRow => $sRow) { |
|
| 185 | + $this->getTemplate()->set('d', 'ROWID', "row_".$aRowData[$iRow]["productID"]); |
|
| 186 | + $this->getTemplate()->set('d', 'BODYCELLS', $sRow); |
|
| 187 | + if (($iRow % 2) == 0) { |
|
| 188 | + $this->getTemplate()->set('d', 'CSS_CLASS', 'even'); |
|
| 189 | + } else { |
|
| 190 | + $this->getTemplate()->set('d', 'CSS_CLASS', 'odd'); |
|
| 191 | + } |
|
| 192 | + $this->getTemplate()->next(); |
|
| 193 | 193 | |
| 194 | - } |
|
| 195 | - } |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - /** |
|
| 198 | - * generate mini table mark-up template |
|
| 199 | - * @return string |
|
| 200 | - */ |
|
| 201 | - public function buildMarkupTemplate () { |
|
| 202 | - $aHTML = array( |
|
| 203 | - "<".$this->tags->container.">", |
|
| 204 | - "<".$this->tags->row.">", |
|
| 205 | - "{HEADERCELLS}", |
|
| 206 | - "</".$this->tags->row.">", |
|
| 207 | - "<!-- BEGIN:BLOCK -->", |
|
| 208 | - "<".$this->tags->row.">", |
|
| 209 | - "{BODYCELLS}", |
|
| 210 | - "</".$this->tags->row.">", |
|
| 211 | - "<!-- END:BLOCK -->", |
|
| 212 | - "<".$this->tags->row.">", |
|
| 213 | - "{FOOTERCELLS}", |
|
| 214 | - "</".$this->tags->row.">", |
|
| 215 | - "</".$this->tags->container.">" |
|
| 216 | - ); |
|
| 217 | - $sHTML = implode("", $aHTML); |
|
| 218 | - return $sHTML; |
|
| 219 | - } |
|
| 197 | + /** |
|
| 198 | + * generate mini table mark-up template |
|
| 199 | + * @return string |
|
| 200 | + */ |
|
| 201 | + public function buildMarkupTemplate () { |
|
| 202 | + $aHTML = array( |
|
| 203 | + "<".$this->tags->container.">", |
|
| 204 | + "<".$this->tags->row.">", |
|
| 205 | + "{HEADERCELLS}", |
|
| 206 | + "</".$this->tags->row.">", |
|
| 207 | + "<!-- BEGIN:BLOCK -->", |
|
| 208 | + "<".$this->tags->row.">", |
|
| 209 | + "{BODYCELLS}", |
|
| 210 | + "</".$this->tags->row.">", |
|
| 211 | + "<!-- END:BLOCK -->", |
|
| 212 | + "<".$this->tags->row.">", |
|
| 213 | + "{FOOTERCELLS}", |
|
| 214 | + "</".$this->tags->row.">", |
|
| 215 | + "</".$this->tags->container.">" |
|
| 216 | + ); |
|
| 217 | + $sHTML = implode("", $aHTML); |
|
| 218 | + return $sHTML; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * generate table mark-up |
|
| 223 | - * @return string |
|
| 224 | - */ |
|
| 225 | - public function buildMarkup () { |
|
| 226 | - $sHTML = ""; |
|
| 221 | + /** |
|
| 222 | + * generate table mark-up |
|
| 223 | + * @return string |
|
| 224 | + */ |
|
| 225 | + public function buildMarkup () { |
|
| 226 | + $sHTML = ""; |
|
| 227 | 227 | |
| 228 | - $sTableID = $this->getOptions("formID"); |
|
| 229 | - if (!$sTableID) { |
|
| 230 | - $sTableID = "table" . md5(microtime()); |
|
| 231 | - $this->options["formID"] = $sTableID; |
|
| 232 | - } |
|
| 228 | + $sTableID = $this->getOptions("formID"); |
|
| 229 | + if (!$sTableID) { |
|
| 230 | + $sTableID = "table" . md5(microtime()); |
|
| 231 | + $this->options["formID"] = $sTableID; |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - $this->getTemplate()->reset(); |
|
| 235 | - $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
| 236 | - $this->buildHeaderCells( $this->getOptions("columns") ); |
|
| 237 | - $this->buildFooterCells( $this->getOptions("footer") ); |
|
| 238 | - $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
| 239 | - $sTemplate = $this->getOptions("template"); |
|
| 240 | - if ($sTemplate == "") { |
|
| 241 | - $sTemplate = $this->buildMarkupTemplate(); |
|
| 242 | - } |
|
| 243 | - $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
| 244 | - return $sHTML; |
|
| 245 | - } |
|
| 234 | + $this->getTemplate()->reset(); |
|
| 235 | + $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
| 236 | + $this->buildHeaderCells( $this->getOptions("columns") ); |
|
| 237 | + $this->buildFooterCells( $this->getOptions("footer") ); |
|
| 238 | + $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
| 239 | + $sTemplate = $this->getOptions("template"); |
|
| 240 | + if ($sTemplate == "") { |
|
| 241 | + $sTemplate = $this->buildMarkupTemplate(); |
|
| 242 | + } |
|
| 243 | + $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
| 244 | + return $sHTML; |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - /** |
|
| 248 | - * generate table JSON data |
|
| 249 | - * @return string |
|
| 250 | - */ |
|
| 251 | - public function buildData () { |
|
| 252 | - $sJSON = "[]"; |
|
| 253 | - if (!empty($this->data)) { |
|
| 254 | - $sJSON = json_encode($this->data); |
|
| 255 | - } |
|
| 256 | - return $sJSON; |
|
| 257 | - } |
|
| 247 | + /** |
|
| 248 | + * generate table JSON data |
|
| 249 | + * @return string |
|
| 250 | + */ |
|
| 251 | + public function buildData () { |
|
| 252 | + $sJSON = "[]"; |
|
| 253 | + if (!empty($this->data)) { |
|
| 254 | + $sJSON = json_encode($this->data); |
|
| 255 | + } |
|
| 256 | + return $sJSON; |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * return template object |
|
| 261 | - * @return Template |
|
| 262 | - */ |
|
| 263 | - public function getTemplate() { |
|
| 264 | - if ($this->template == null) { |
|
| 265 | - $this->setTemplate(); |
|
| 266 | - } |
|
| 267 | - return $this->template; |
|
| 268 | - } |
|
| 259 | + /** |
|
| 260 | + * return template object |
|
| 261 | + * @return Template |
|
| 262 | + */ |
|
| 263 | + public function getTemplate() { |
|
| 264 | + if ($this->template == null) { |
|
| 265 | + $this->setTemplate(); |
|
| 266 | + } |
|
| 267 | + return $this->template; |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * generate template object |
|
| 272 | - * @param Template $template |
|
| 273 | - * @return ProductTable |
|
| 274 | - */ |
|
| 275 | - public function setTemplate( $template = null ) { |
|
| 276 | - if ($template == null) { |
|
| 277 | - $this->template = new Template; |
|
| 278 | - } else { |
|
| 279 | - $this->template = $template; |
|
| 280 | - } |
|
| 281 | - return ($this); |
|
| 282 | - } |
|
| 270 | + /** |
|
| 271 | + * generate template object |
|
| 272 | + * @param Template $template |
|
| 273 | + * @return ProductTable |
|
| 274 | + */ |
|
| 275 | + public function setTemplate( $template = null ) { |
|
| 276 | + if ($template == null) { |
|
| 277 | + $this->template = new Template; |
|
| 278 | + } else { |
|
| 279 | + $this->template = $template; |
|
| 280 | + } |
|
| 281 | + return ($this); |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - /** |
|
| 285 | - * return table data |
|
| 286 | - * @return mixed |
|
| 287 | - */ |
|
| 288 | - public function getData() { |
|
| 289 | - return $this->data; |
|
| 290 | - } |
|
| 284 | + /** |
|
| 285 | + * return table data |
|
| 286 | + * @return mixed |
|
| 287 | + */ |
|
| 288 | + public function getData() { |
|
| 289 | + return $this->data; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * set new table data |
|
| 294 | - * @param mixed $data |
|
| 295 | - * @return ProductTable |
|
| 296 | - */ |
|
| 297 | - public function setData( $data = null) { |
|
| 298 | - if ( is_array($data) ) { |
|
| 299 | - $this->data = $data; |
|
| 300 | - } |
|
| 301 | - return $this; |
|
| 302 | - } |
|
| 292 | + /** |
|
| 293 | + * set new table data |
|
| 294 | + * @param mixed $data |
|
| 295 | + * @return ProductTable |
|
| 296 | + */ |
|
| 297 | + public function setData( $data = null) { |
|
| 298 | + if ( is_array($data) ) { |
|
| 299 | + $this->data = $data; |
|
| 300 | + } |
|
| 301 | + return $this; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - /** |
|
| 305 | - * return option by key or complete option set |
|
| 306 | - * @param string $key |
|
| 307 | - * @return mixed |
|
| 308 | - */ |
|
| 309 | - public function getOptions( $key = "" ) { |
|
| 310 | - if ( !empty($key) ) { |
|
| 311 | - if ( isset($this->options[$key]) ) { |
|
| 312 | - return $this->options[$key]; |
|
| 313 | - } else { |
|
| 314 | - return false; |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - return $this->options; |
|
| 318 | - } |
|
| 304 | + /** |
|
| 305 | + * return option by key or complete option set |
|
| 306 | + * @param string $key |
|
| 307 | + * @return mixed |
|
| 308 | + */ |
|
| 309 | + public function getOptions( $key = "" ) { |
|
| 310 | + if ( !empty($key) ) { |
|
| 311 | + if ( isset($this->options[$key]) ) { |
|
| 312 | + return $this->options[$key]; |
|
| 313 | + } else { |
|
| 314 | + return false; |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + return $this->options; |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | - /** |
|
| 321 | - * @param object|array $options |
|
| 322 | - * @return ProductTable |
|
| 323 | - */ |
|
| 324 | - public function setOptions($options) { |
|
| 325 | - if ( is_array($options) ) { |
|
| 326 | - $this->options = $options; |
|
| 327 | - } else if ( is_object($options) ) { |
|
| 328 | - $this->options = (array)$options; |
|
| 329 | - } else { |
|
| 330 | - throw new \Exception("invalid table options"); |
|
| 331 | - } |
|
| 332 | - if ( isset($this->options["data"]) ) { |
|
| 333 | - $this->setData($this->getOptions("data")); |
|
| 334 | - unset( $this->options->data ); |
|
| 335 | - } |
|
| 336 | - return $this; |
|
| 337 | - } |
|
| 320 | + /** |
|
| 321 | + * @param object|array $options |
|
| 322 | + * @return ProductTable |
|
| 323 | + */ |
|
| 324 | + public function setOptions($options) { |
|
| 325 | + if ( is_array($options) ) { |
|
| 326 | + $this->options = $options; |
|
| 327 | + } else if ( is_object($options) ) { |
|
| 328 | + $this->options = (array)$options; |
|
| 329 | + } else { |
|
| 330 | + throw new \Exception("invalid table options"); |
|
| 331 | + } |
|
| 332 | + if ( isset($this->options["data"]) ) { |
|
| 333 | + $this->setData($this->getOptions("data")); |
|
| 334 | + unset( $this->options->data ); |
|
| 335 | + } |
|
| 336 | + return $this; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | 339 | |
| 340 | 340 | } |
| 341 | 341 | \ No newline at end of file |
@@ -51,16 +51,16 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function __invoke($config = array(), $options = array()) |
| 53 | 53 | { |
| 54 | - if ( is_object($options) && method_exists($options, 'toArray') ) { |
|
| 54 | + if (is_object($options) && method_exists($options, 'toArray')) { |
|
| 55 | 55 | $options = $options->toArray(); |
| 56 | - } else if ( is_object($options) ) { |
|
| 57 | - $options = (array)$options; |
|
| 56 | + } else if (is_object($options)) { |
|
| 57 | + $options = (array) $options; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if ( is_object($config) && method_exists($config, 'toArray') ) { |
|
| 60 | + if (is_object($config) && method_exists($config, 'toArray')) { |
|
| 61 | 61 | $config = $config->toArray(); |
| 62 | - } else if ( is_object($options) ) { |
|
| 63 | - $config = (array)$config; |
|
| 62 | + } else if (is_object($options)) { |
|
| 63 | + $config = (array) $config; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $this->setOptions($config); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->setContent($options['children']); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->tags = (object)$this->tags; |
|
| 96 | + $this->tags = (object) $this->tags; |
|
| 97 | 97 | |
| 98 | 98 | $component = clone $this; |
| 99 | 99 | return $component; |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | * @param mixed $aHTMLTableColumns |
| 115 | 115 | * @return self |
| 116 | 116 | */ |
| 117 | - public function buildHeaderCells ($aHTMLTableColumns) { |
|
| 117 | + public function buildHeaderCells($aHTMLTableColumns) { |
|
| 118 | 118 | $sHTMLTableHeader = ""; |
| 119 | 119 | $sHTMLTableColumnGroup = ""; |
| 120 | 120 | $aColumns = array(); |
| 121 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 121 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 122 | 122 | if ($aColumn["field"]) { |
| 123 | 123 | $aColumns[] = $aColumn["field"]; |
| 124 | 124 | $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | * @param mixed $aHTMLTableColumns |
| 139 | 139 | * @return self |
| 140 | 140 | */ |
| 141 | - public function buildFooterCells ($aHTMLTableColumns) { |
|
| 141 | + public function buildFooterCells($aHTMLTableColumns) { |
|
| 142 | 142 | $sHTMLTableFooter = ""; |
| 143 | 143 | $aColumns = array(); |
| 144 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 144 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 145 | 145 | if ($aColumn["field"]) { |
| 146 | 146 | $aColumns[] = $aColumn["field"]; |
| 147 | 147 | $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | * @param mixed $aHTMLTableColumns |
| 160 | 160 | * @return array |
| 161 | 161 | */ |
| 162 | - public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
| 162 | + public function buildBodyCells($aRowData, $aHTMLTableColumns) { |
|
| 163 | 163 | $aRows = array(); |
| 164 | - foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
| 164 | + foreach ((array) $aRowData as $iRow => $oRowData) { |
|
| 165 | 165 | $sCells = ""; |
| 166 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 166 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 167 | 167 | $mCellValue = $oRowData[$aColumn["field"]]; |
| 168 | 168 | if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
| 169 | 169 | $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
| 170 | 170 | } |
| 171 | - if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
| 171 | + if (isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]])) { |
|
| 172 | 172 | $sClassname = $aColumn["field"]; |
| 173 | 173 | } else { |
| 174 | 174 | $sClassname = "col_".$iColumn; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * generate mini table mark-up template |
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | - public function buildMarkupTemplate () { |
|
| 201 | + public function buildMarkupTemplate() { |
|
| 202 | 202 | $aHTML = array( |
| 203 | 203 | "<".$this->tags->container.">", |
| 204 | 204 | "<".$this->tags->row.">", |
@@ -222,25 +222,25 @@ discard block |
||
| 222 | 222 | * generate table mark-up |
| 223 | 223 | * @return string |
| 224 | 224 | */ |
| 225 | - public function buildMarkup () { |
|
| 225 | + public function buildMarkup() { |
|
| 226 | 226 | $sHTML = ""; |
| 227 | 227 | |
| 228 | 228 | $sTableID = $this->getOptions("formID"); |
| 229 | 229 | if (!$sTableID) { |
| 230 | - $sTableID = "table" . md5(microtime()); |
|
| 230 | + $sTableID = "table".md5(microtime()); |
|
| 231 | 231 | $this->options["formID"] = $sTableID; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $this->getTemplate()->reset(); |
| 235 | - $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
| 236 | - $this->buildHeaderCells( $this->getOptions("columns") ); |
|
| 237 | - $this->buildFooterCells( $this->getOptions("footer") ); |
|
| 238 | - $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
| 235 | + $this->getTemplate()->set('s', 'TABLEID', $sTableID); |
|
| 236 | + $this->buildHeaderCells($this->getOptions("columns")); |
|
| 237 | + $this->buildFooterCells($this->getOptions("footer")); |
|
| 238 | + $this->buildBodyCells($this->getData(), $this->getOptions("columns")); |
|
| 239 | 239 | $sTemplate = $this->getOptions("template"); |
| 240 | 240 | if ($sTemplate == "") { |
| 241 | 241 | $sTemplate = $this->buildMarkupTemplate(); |
| 242 | 242 | } |
| 243 | - $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
| 243 | + $sHTML = $this->getTemplate()->generate($sTemplate, true); |
|
| 244 | 244 | return $sHTML; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * generate table JSON data |
| 249 | 249 | * @return string |
| 250 | 250 | */ |
| 251 | - public function buildData () { |
|
| 251 | + public function buildData() { |
|
| 252 | 252 | $sJSON = "[]"; |
| 253 | 253 | if (!empty($this->data)) { |
| 254 | 254 | $sJSON = json_encode($this->data); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param Template $template |
| 273 | 273 | * @return ProductTable |
| 274 | 274 | */ |
| 275 | - public function setTemplate( $template = null ) { |
|
| 275 | + public function setTemplate($template = null) { |
|
| 276 | 276 | if ($template == null) { |
| 277 | 277 | $this->template = new Template; |
| 278 | 278 | } else { |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | * @param mixed $data |
| 295 | 295 | * @return ProductTable |
| 296 | 296 | */ |
| 297 | - public function setData( $data = null) { |
|
| 298 | - if ( is_array($data) ) { |
|
| 297 | + public function setData($data = null) { |
|
| 298 | + if (is_array($data)) { |
|
| 299 | 299 | $this->data = $data; |
| 300 | 300 | } |
| 301 | 301 | return $this; |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | * @param string $key |
| 307 | 307 | * @return mixed |
| 308 | 308 | */ |
| 309 | - public function getOptions( $key = "" ) { |
|
| 310 | - if ( !empty($key) ) { |
|
| 311 | - if ( isset($this->options[$key]) ) { |
|
| 309 | + public function getOptions($key = "") { |
|
| 310 | + if (!empty($key)) { |
|
| 311 | + if (isset($this->options[$key])) { |
|
| 312 | 312 | return $this->options[$key]; |
| 313 | 313 | } else { |
| 314 | 314 | return false; |
@@ -322,16 +322,16 @@ discard block |
||
| 322 | 322 | * @return ProductTable |
| 323 | 323 | */ |
| 324 | 324 | public function setOptions($options) { |
| 325 | - if ( is_array($options) ) { |
|
| 325 | + if (is_array($options)) { |
|
| 326 | 326 | $this->options = $options; |
| 327 | - } else if ( is_object($options) ) { |
|
| 328 | - $this->options = (array)$options; |
|
| 327 | + } else if (is_object($options)) { |
|
| 328 | + $this->options = (array) $options; |
|
| 329 | 329 | } else { |
| 330 | 330 | throw new \Exception("invalid table options"); |
| 331 | 331 | } |
| 332 | - if ( isset($this->options["data"]) ) { |
|
| 332 | + if (isset($this->options["data"])) { |
|
| 333 | 333 | $this->setData($this->getOptions("data")); |
| 334 | - unset( $this->options->data ); |
|
| 334 | + unset($this->options->data); |
|
| 335 | 335 | } |
| 336 | 336 | return $this; |
| 337 | 337 | } |
@@ -220,7 +220,7 @@ |
||
| 220 | 220 | // |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | - * @return the $tagname |
|
| 223 | + * @return string $tagname |
|
| 224 | 224 | */ |
| 225 | 225 | public function getTagname() { |
| 226 | 226 | return $this->tagname; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $escaper = $this->view->plugin('escapeHtmlAttr'); |
| 98 | 98 | |
| 99 | 99 | if ($found) { |
| 100 | - $foundPage = $found['page']; |
|
| 100 | + $foundPage = $found['page']; |
|
| 101 | 101 | $foundDepth = $found['depth']; |
| 102 | 102 | } else { |
| 103 | 103 | $foundPage = null; |
@@ -146,28 +146,27 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // make sure indentation is correct |
| 148 | 148 | $depth -= $minDepth; |
| 149 | - $myIndent = $indent . str_repeat(' ', $depth); |
|
| 149 | + $myIndent = $indent.str_repeat(' ', $depth); |
|
| 150 | 150 | |
| 151 | 151 | if ($depth > $prevDepth) { |
| 152 | 152 | // start new ul tag |
| 153 | - $ulClass = '' . |
|
| 154 | - ($depth == 0 ? $this->getUlClass() : |
|
| 155 | - ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
| 156 | - ) . |
|
| 157 | - ' level_' . $depth . |
|
| 153 | + $ulClass = ''. |
|
| 154 | + ($depth == 0 ? $this->getUlClass() : ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
| 155 | + ). |
|
| 156 | + ' level_'.$depth. |
|
| 158 | 157 | ''; |
| 159 | - if ($ulClass && $depth == 0) { |
|
| 160 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
| 158 | + if ($ulClass && $depth == 0) { |
|
| 159 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
| 161 | 160 | } else { |
| 162 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
| 161 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
| 163 | 162 | } |
| 164 | - $html .= $myIndent . '<' . $this->getTagname() . $ulClass . '>' . PHP_EOL; |
|
| 163 | + $html .= $myIndent.'<'.$this->getTagname().$ulClass.'>'.PHP_EOL; |
|
| 165 | 164 | } elseif ($prevDepth > $depth) { |
| 166 | 165 | // close li/ul tags until we're at current depth |
| 167 | 166 | for ($i = $prevDepth; $i > $depth; $i--) { |
| 168 | - $ind = $indent . str_repeat(' ', $i); |
|
| 167 | + $ind = $indent.str_repeat(' ', $i); |
|
| 169 | 168 | //$html .= $ind . ' </li>' . PHP_EOL; |
| 170 | - $html .= $ind . '</' . $this->getTagname() . '>' . PHP_EOL; |
|
| 169 | + $html .= $ind.'</'.$this->getTagname().'>'.PHP_EOL; |
|
| 171 | 170 | } |
| 172 | 171 | // close previous li tag |
| 173 | 172 | //$html .= $myIndent . ' </li>' . PHP_EOL; |
@@ -193,10 +192,10 @@ discard block |
||
| 193 | 192 | if ($addClassToListItem && $page->getClass()) { |
| 194 | 193 | $liClasses[] = $page->getClass(); |
| 195 | 194 | } |
| 196 | - $liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"'; |
|
| 195 | + $liClass = empty($liClasses) ? '' : ' class="'.$escaper(implode(' ', $liClasses)).'"'; |
|
| 197 | 196 | |
| 198 | 197 | $html .= /* $myIndent . ' <li' . $liClass . '>' . PHP_EOL |
| 199 | - . */ $myIndent . ' ' . $this->htmlify($page, $escapeLabels, $addClassToListItem) . PHP_EOL; |
|
| 198 | + . */ $myIndent.' '.$this->htmlify($page, $escapeLabels, $addClassToListItem).PHP_EOL; |
|
| 200 | 199 | |
| 201 | 200 | // store as previous depth for next iteration |
| 202 | 201 | $prevDepth = $depth; |
@@ -204,10 +203,10 @@ discard block |
||
| 204 | 203 | |
| 205 | 204 | if ($html) { |
| 206 | 205 | // done iterating container; close open ul/li tags |
| 207 | - for ($i = $prevDepth+1; $i > 0; $i--) { |
|
| 208 | - $myIndent = $indent . str_repeat(' ', $i-1); |
|
| 206 | + for ($i = $prevDepth + 1; $i > 0; $i--) { |
|
| 207 | + $myIndent = $indent.str_repeat(' ', $i - 1); |
|
| 209 | 208 | $html .= /*$myIndent . ' </li>' . PHP_EOL |
| 210 | - . */ $myIndent . '</' . $this->getTagname() . '>' . PHP_EOL; |
|
| 209 | + . */ $myIndent.'</'.$this->getTagname().'>'.PHP_EOL; |
|
| 211 | 210 | } |
| 212 | 211 | $html = rtrim($html, PHP_EOL); |
| 213 | 212 | } |
@@ -230,7 +229,7 @@ discard block |
||
| 230 | 229 | * @param string $tagname |
| 231 | 230 | */ |
| 232 | 231 | public function setTagname($tagname) { |
| 233 | - if ( null !== $tagname ) { |
|
| 232 | + if (null !== $tagname) { |
|
| 234 | 233 | $this->tagname = $tagname; |
| 235 | 234 | } |
| 236 | 235 | return $this; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * If no container is set, a new container will be instantiated and |
| 114 | 114 | * stored in the helper. |
| 115 | 115 | * |
| 116 | - * @return Navigation\AbstractContainer navigation container |
|
| 116 | + * @return AbstractContainer navigation container |
|
| 117 | 117 | */ |
| 118 | 118 | public function getContainer() |
| 119 | 119 | { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * {@link getMinDepth()}. A |
| 339 | 339 | * null value means no minimum |
| 340 | 340 | * depth required. |
| 341 | - * @param int|null $maxDepth [optional] maximum depth |
|
| 341 | + * @param integer $maxDepth [optional] maximum depth |
|
| 342 | 342 | * a page can have to be |
| 343 | 343 | * valid. Default is to use |
| 344 | 344 | * {@link getMaxDepth()}. A |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
| 482 | - * @return the $defaultLiClass |
|
| 482 | + * @return string $defaultLiClass |
|
| 483 | 483 | */ |
| 484 | 484 | public function getDefaultLiClass() { |
| 485 | 485 | return $this->defaultLiClass; |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /** |
| 497 | - * @return the $subUlClass |
|
| 497 | + * @return string $subUlClass |
|
| 498 | 498 | */ |
| 499 | 499 | public function getSubUlClass() { |
| 500 | 500 | return $this->subUlClass; |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | /** |
| 512 | - * @return the $subUlClassLevel1 |
|
| 512 | + * @return string $subUlClassLevel1 |
|
| 513 | 513 | */ |
| 514 | 514 | public function getSubUlClassLevel1() { |
| 515 | 515 | return $this->subUlClassLevel1; |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | /** |
| 527 | - * @return the $subLiClass |
|
| 527 | + * @return string $subLiClass |
|
| 528 | 528 | */ |
| 529 | 529 | public function getSubLiClass() { |
| 530 | 530 | return $this->subLiClass; |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | /** |
| 542 | - * @return the $subLiClassLevel0 |
|
| 542 | + * @return string $subLiClassLevel0 |
|
| 543 | 543 | */ |
| 544 | 544 | public function getSubLiClassLevel0() { |
| 545 | 545 | return $this->subLiClassLevel0; |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | /** |
| 557 | - * @return the $iconPrefixClass |
|
| 557 | + * @return string $iconPrefixClass |
|
| 558 | 558 | */ |
| 559 | 559 | public function getIconPrefixClass() { |
| 560 | 560 | return $this->iconPrefixClass; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | /** |
| 572 | - * @return the $hrefSubToggleOverride |
|
| 572 | + * @return string $hrefSubToggleOverride |
|
| 573 | 573 | */ |
| 574 | 574 | public function getHrefSubToggleOverride() { |
| 575 | 575 | return $this->hrefSubToggleOverride; |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | class Menu extends \Zend\View\Helper\Navigation\Menu |
| 29 | 29 | { |
| 30 | - use \UIComponents\View\Helper\Traits\ComponentClassnamesTrait; |
|
| 31 | - use \UIComponents\View\Helper\Traits\ComponentAttributesTrait; |
|
| 30 | + use \UIComponents\View\Helper\Traits\ComponentClassnamesTrait; |
|
| 31 | + use \UIComponents\View\Helper\Traits\ComponentAttributesTrait; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * default CSS class to use for li elements |
@@ -351,10 +351,10 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function findActive($container = null, $minDepth = null, $maxDepth = -1) |
| 353 | 353 | { |
| 354 | - if ( null == $container ) { |
|
| 355 | - $container = $this->getContainer(); |
|
| 356 | - } |
|
| 357 | - return parent::findActive($container, $minDepth, $maxDepth); |
|
| 354 | + if ( null == $container ) { |
|
| 355 | + $container = $this->getContainer(); |
|
| 356 | + } |
|
| 357 | + return parent::findActive($container, $minDepth, $maxDepth); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $escaper = $this->view->plugin('escapeHtmlAttr'); |
| 211 | 211 | |
| 212 | 212 | if ($found) { |
| 213 | - $foundPage = $found['page']; |
|
| 213 | + $foundPage = $found['page']; |
|
| 214 | 214 | $foundDepth = $found['depth']; |
| 215 | 215 | } else { |
| 216 | 216 | $foundPage = null; |
@@ -259,34 +259,33 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | // make sure indentation is correct |
| 261 | 261 | $depth -= $minDepth; |
| 262 | - $myIndent = $indent . str_repeat(' ', $depth); |
|
| 262 | + $myIndent = $indent.str_repeat(' ', $depth); |
|
| 263 | 263 | $attributes = $this->getAttributes(); |
| 264 | 264 | if ($depth > $prevDepth) { |
| 265 | 265 | // start new ul tag |
| 266 | - $ulClass = '' . |
|
| 267 | - ($depth == 0 ? $this->getUlClass() : |
|
| 268 | - ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
| 269 | - ) . |
|
| 270 | - ' level_' . $depth . |
|
| 266 | + $ulClass = ''. |
|
| 267 | + ($depth == 0 ? $this->getUlClass() : ($depth == 1 ? $this->getSubUlClassLevel1() : $this->getSubUlClass()) |
|
| 268 | + ). |
|
| 269 | + ' level_'.$depth. |
|
| 271 | 270 | ''; |
| 272 | - if ($ulClass && $depth == 0) { |
|
| 273 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
| 271 | + if ($ulClass && $depth == 0) { |
|
| 272 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
| 274 | 273 | } else { |
| 275 | - $ulClass = ' class="' . $escaper($ulClass) . '"'; |
|
| 274 | + $ulClass = ' class="'.$escaper($ulClass).'"'; |
|
| 276 | 275 | } |
| 277 | - $html .= $myIndent . '<ul' . $ulClass . ' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>' . PHP_EOL; |
|
| 276 | + $html .= $myIndent.'<ul'.$ulClass.' '.($depth == 0 ? $this->htmlAttribs($attributes) : '').'>'.PHP_EOL; |
|
| 278 | 277 | } elseif ($prevDepth > $depth) { |
| 279 | 278 | // close li/ul tags until we're at current depth |
| 280 | 279 | for ($i = $prevDepth; $i > $depth; $i--) { |
| 281 | - $ind = $indent . str_repeat(' ', $i); |
|
| 282 | - $html .= $ind . ' </li>' . PHP_EOL; |
|
| 283 | - $html .= $ind . '</ul>' . PHP_EOL; |
|
| 280 | + $ind = $indent.str_repeat(' ', $i); |
|
| 281 | + $html .= $ind.' </li>'.PHP_EOL; |
|
| 282 | + $html .= $ind.'</ul>'.PHP_EOL; |
|
| 284 | 283 | } |
| 285 | 284 | // close previous li tag |
| 286 | - $html .= $myIndent . ' </li>' . PHP_EOL; |
|
| 285 | + $html .= $myIndent.' </li>'.PHP_EOL; |
|
| 287 | 286 | } else { |
| 288 | 287 | // close previous li tag |
| 289 | - $html .= $myIndent . ' </li>' . PHP_EOL; |
|
| 288 | + $html .= $myIndent.' </li>'.PHP_EOL; |
|
| 290 | 289 | } |
| 291 | 290 | |
| 292 | 291 | // render li tag and page |
@@ -306,10 +305,10 @@ discard block |
||
| 306 | 305 | if ($addClassToListItem && $page->getClass()) { |
| 307 | 306 | $liClasses[] = $page->getClass(); |
| 308 | 307 | } |
| 309 | - $liClass = empty($liClasses) ? '' : ' class="' . $escaper(implode(' ', $liClasses)) . '"'; |
|
| 308 | + $liClass = empty($liClasses) ? '' : ' class="'.$escaper(implode(' ', $liClasses)).'"'; |
|
| 310 | 309 | |
| 311 | - $html .= $myIndent . ' <li' . $liClass . '>' . PHP_EOL |
|
| 312 | - . $myIndent . ' ' . $this->htmlify($page, $escapeLabels, $addClassToListItem) . PHP_EOL; |
|
| 310 | + $html .= $myIndent.' <li'.$liClass.'>'.PHP_EOL |
|
| 311 | + . $myIndent.' '.$this->htmlify($page, $escapeLabels, $addClassToListItem).PHP_EOL; |
|
| 313 | 312 | |
| 314 | 313 | // store as previous depth for next iteration |
| 315 | 314 | $prevDepth = $depth; |
@@ -317,10 +316,10 @@ discard block |
||
| 317 | 316 | |
| 318 | 317 | if ($html) { |
| 319 | 318 | // done iterating container; close open ul/li tags |
| 320 | - for ($i = $prevDepth+1; $i > 0; $i--) { |
|
| 321 | - $myIndent = $indent . str_repeat(' ', $i-1); |
|
| 322 | - $html .= $myIndent . ' </li>' . PHP_EOL |
|
| 323 | - . $myIndent . '</ul>' . PHP_EOL; |
|
| 319 | + for ($i = $prevDepth + 1; $i > 0; $i--) { |
|
| 320 | + $myIndent = $indent.str_repeat(' ', $i - 1); |
|
| 321 | + $html .= $myIndent.' </li>'.PHP_EOL |
|
| 322 | + . $myIndent.'</ul>'.PHP_EOL; |
|
| 324 | 323 | } |
| 325 | 324 | $html = rtrim($html, PHP_EOL); |
| 326 | 325 | } |
@@ -351,7 +350,7 @@ discard block |
||
| 351 | 350 | */ |
| 352 | 351 | public function findActive($container = null, $minDepth = null, $maxDepth = -1) |
| 353 | 352 | { |
| 354 | - if ( null == $container ) { |
|
| 353 | + if (null == $container) { |
|
| 355 | 354 | $container = $this->getContainer(); |
| 356 | 355 | } |
| 357 | 356 | return parent::findActive($container, $minDepth, $maxDepth); |
@@ -380,7 +379,7 @@ discard block |
||
| 380 | 379 | 'title' => $this->translate($page->getTitle(), $page->getTextDomain()), |
| 381 | 380 | ]; |
| 382 | 381 | $classnames = array(); |
| 383 | - if ( $addClassToListItem === false ) { |
|
| 382 | + if ($addClassToListItem === false) { |
|
| 384 | 383 | $class = $page->getClass(); |
| 385 | 384 | if (!empty($class)) { |
| 386 | 385 | $classnames[] = $page->getClass(); |
@@ -389,7 +388,7 @@ discard block |
||
| 389 | 388 | $maxDepth = $this->getMaxDepth(); |
| 390 | 389 | $depth = $page->get('level'); |
| 391 | 390 | $isBelowMaxLevel = ($maxDepth > $depth) || ($maxDepth === null) || ($maxDepth === false); |
| 392 | - if ( !empty($page->pages) && $isBelowMaxLevel ) { |
|
| 391 | + if (!empty($page->pages) && $isBelowMaxLevel) { |
|
| 393 | 392 | $classnames[] = 'dropdown-toggle'; |
| 394 | 393 | $attribs['data-toggle'] = (($depth == 0) ? $this->getSubLiClassLevel0() : $this->getSubLiClass()); |
| 395 | 394 | } |
@@ -408,8 +407,8 @@ discard block |
||
| 408 | 407 | $attribs['href'] = '#'; |
| 409 | 408 | } |
| 410 | 409 | |
| 411 | - $html = '<' . $element . $this->htmlAttribs($attribs) . '>'; |
|
| 412 | - $html .= ($page->get('icon') ? '<span class="' . $this->getIconPrefixClass() . '' . $page->get('icon') . '"></span> ' : '' ); |
|
| 410 | + $html = '<'.$element.$this->htmlAttribs($attribs).'>'; |
|
| 411 | + $html .= ($page->get('icon') ? '<span class="'.$this->getIconPrefixClass().''.$page->get('icon').'"></span> ' : ''); |
|
| 413 | 412 | $label = $this->translate($page->getLabel(), $page->getTextDomain()); |
| 414 | 413 | if ($escapeLabel === true) { |
| 415 | 414 | /** @var \Zend\View\Helper\EscapeHtml $escaper */ |
@@ -418,7 +417,7 @@ discard block |
||
| 418 | 417 | } else { |
| 419 | 418 | $html .= $label; |
| 420 | 419 | } |
| 421 | - $html .= '</' . $element . '>'; |
|
| 420 | + $html .= '</'.$element.'>'; |
|
| 422 | 421 | |
| 423 | 422 | return $html; |
| 424 | 423 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * Implements {@link HelperInterface::setAcl()}. |
| 68 | 68 | * |
| 69 | - * @param Acl\AclInterface $acl ACL object. |
|
| 70 | - * @return AbstractHelper |
|
| 69 | + * @param AclInterface $acl ACL object. |
|
| 70 | + * @return ComponentAclTrait |
|
| 71 | 71 | */ |
| 72 | 72 | public function setAcl(AclInterface $acl = null) |
| 73 | 73 | { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param mixed $role [optional] role to set. Expects a string, an |
| 119 | 119 | * instance of type {@link Acl\Role\RoleInterface}, or null. Default |
| 120 | 120 | * is null, which will set no role. |
| 121 | - * @return AbstractHelper |
|
| 121 | + * @return ComponentAclTrait |
|
| 122 | 122 | * @throws Exception\InvalidArgumentException |
| 123 | 123 | */ |
| 124 | 124 | public function setRole($role = null) |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * Implements {@link HelperInterface::setUseAcl()}. |
| 182 | 182 | * |
| 183 | 183 | * @param bool $useAcl |
| 184 | - * @return AbstractHelper |
|
| 184 | + * @return ComponentAclTrait |
|
| 185 | 185 | */ |
| 186 | 186 | public function setUseAcl($useAcl = true) |
| 187 | 187 | { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected static $defaultRole; |
| 63 | 63 | |
| 64 | - /** |
|
| 64 | + /** |
|
| 65 | 65 | * Sets ACL to use when iterating pages |
| 66 | 66 | * |
| 67 | 67 | * Implements {@link HelperInterface::setAcl()}. |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - /** |
|
| 113 | + /** |
|
| 114 | 114 | * Sets ACL role(s) to use when iterating pages |
| 115 | 115 | * |
| 116 | 116 | * Implements {@link HelperInterface::setRole()}. |
@@ -237,7 +237,7 @@ |
||
| 237 | 237 | * {@link getMinDepth()}. A |
| 238 | 238 | * null value means no minimum |
| 239 | 239 | * depth required. |
| 240 | - * @param int|null $maxDepth [optional] maximum depth |
|
| 240 | + * @param integer $maxDepth [optional] maximum depth |
|
| 241 | 241 | * a page can have to be |
| 242 | 242 | * valid. Default is to use |
| 243 | 243 | * {@link getMaxDepth()}. A |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * Set the event manager. |
| 41 | 41 | * |
| 42 | 42 | * @param EventManagerInterface $events |
| 43 | - * @return AbstractHelper |
|
| 43 | + * @return ComponentServiceManagersTrait |
|
| 44 | 44 | */ |
| 45 | 45 | public function setEventManager(EventManagerInterface $events) |
| 46 | 46 | { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * Set the service locator. |
| 92 | 92 | * |
| 93 | 93 | * @param ServiceLocatorInterface $serviceLocator |
| 94 | - * @return AbstractHelper |
|
| 94 | + * @return ComponentServiceManagersTrait |
|
| 95 | 95 | */ |
| 96 | 96 | public function setServiceLocator(ServiceLocatorInterface $serviceLocator) |
| 97 | 97 | { |
@@ -36,12 +36,12 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | protected $serviceLocator; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Set the event manager. |
|
| 41 | - * |
|
| 42 | - * @param EventManagerInterface $events |
|
| 43 | - * @return AbstractHelper |
|
| 44 | - */ |
|
| 39 | + /** |
|
| 40 | + * Set the event manager. |
|
| 41 | + * |
|
| 42 | + * @param EventManagerInterface $events |
|
| 43 | + * @return AbstractHelper |
|
| 44 | + */ |
|
| 45 | 45 | public function setEventManager(EventManagerInterface $events) |
| 46 | 46 | { |
| 47 | 47 | $events->setIdentifiers([ |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * Helper entry point |
| 31 | 31 | * |
| 32 | 32 | * @param string|AbstractContainer $container container to operate on |
| 33 | - * @return Bootstrap |
|
| 33 | + * @return Utilities |
|
| 34 | 34 | */ |
| 35 | 35 | public function __invoke($container = null) |
| 36 | 36 | { |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | * View helper entry point: |
| 28 | 28 | * Retrieves helper and optionally sets container to operate on |
| 29 | 29 | * |
| 30 | - * @param AbstractContainer $container [optional] container to operate on |
|
| 31 | - * @return self |
|
| 30 | + * @return \Zend\Config\Config |
|
| 32 | 31 | */ |
| 33 | 32 | public function __invoke() |
| 34 | 33 | { |
@@ -38,7 +37,7 @@ discard block |
||
| 38 | 37 | /** |
| 39 | 38 | * render nothing |
| 40 | 39 | * |
| 41 | - * @return string |
|
| 40 | + * @return \Zend\Config\Config |
|
| 42 | 41 | */ |
| 43 | 42 | public function render($container = null) |
| 44 | 43 | { |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function render($container = null) |
| 44 | 44 | { |
| 45 | - $config = new \Zend\Config\Config( $this->getServiceLocator()->getServiceLocator()->get('Config') ); |
|
| 45 | + $config = new \Zend\Config\Config($this->getServiceLocator()->getServiceLocator()->get('Config')); |
|
| 46 | 46 | return $config; |
| 47 | 47 | } |
| 48 | 48 | |