@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 71 | 71 | * @return string HTML code |
| 72 | 72 | */ |
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 74 | 74 | { |
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 76 | 76 | |
| 77 | 77 | $html = ''; |
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + foreach ($this->getSubClients() as $subclient) { |
|
| 79 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 80 | 80 | } |
| 81 | 81 | $view->treeBody = $html; |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/filter/tree/standard/template-body'; |
| 104 | 104 | $default = 'catalog/filter/tree-body-default.php'; |
| 105 | 105 | |
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + return $view->render($view->config($tplconf, $default)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | 116 | * @return string|null String including HTML tags for the header on error |
| 117 | 117 | */ |
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 119 | 119 | { |
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 121 | 121 | |
| 122 | 122 | $html = ''; |
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + foreach ($this->getSubClients() as $subclient) { |
|
| 124 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 125 | 125 | } |
| 126 | 126 | $view->treeHeader = $html; |
| 127 | 127 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/catalog/filter/tree/standard/template-header'; |
| 150 | 150 | $default = 'catalog/filter/tree-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/catalog/filter/tree/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the catalog filter tree html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/catalog/filter/tree/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'catalog/filter/tree/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('catalog/filter/tree/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,16 +259,16 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - if( !isset( $this->cache ) ) |
|
| 264 | + if (!isset($this->cache)) |
|
| 265 | 265 | { |
| 266 | 266 | $catItems = array(); |
| 267 | 267 | $context = $this->getContext(); |
| 268 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 268 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 269 | 269 | |
| 270 | - $currentid = (string) $view->param( 'f_catid', '' ); |
|
| 271 | - $currentid = ( $currentid != '' ? $currentid : null ); |
|
| 270 | + $currentid = (string) $view->param('f_catid', ''); |
|
| 271 | + $currentid = ($currentid != '' ? $currentid : null); |
|
| 272 | 272 | |
| 273 | 273 | /** client/html/catalog/filter/tree/startid |
| 274 | 274 | * The ID of the category node that should be the root of the displayed category tree |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | * @see client/html/catalog/filter/tree/levels-only |
| 290 | 290 | * @see client/html/catalog/filter/tree/domains |
| 291 | 291 | */ |
| 292 | - $startid = $view->config( 'client/html/catalog/filter/tree/startid', '' ); |
|
| 293 | - $startid = ( $startid != '' ? $startid : null ); |
|
| 292 | + $startid = $view->config('client/html/catalog/filter/tree/startid', ''); |
|
| 293 | + $startid = ($startid != '' ? $startid : null); |
|
| 294 | 294 | |
| 295 | 295 | /** client/html/catalog/filter/tree/domains |
| 296 | 296 | * List of domain names whose items should be fetched with the filter categories |
@@ -310,35 +310,35 @@ discard block |
||
| 310 | 310 | * @see client/html/catalog/filter/tree/levels-always |
| 311 | 311 | * @see client/html/catalog/filter/tree/levels-only |
| 312 | 312 | */ |
| 313 | - $ref = $view->config( 'client/html/catalog/filter/tree/domains', array( 'text', 'media' ) ); |
|
| 313 | + $ref = $view->config('client/html/catalog/filter/tree/domains', array('text', 'media')); |
|
| 314 | 314 | |
| 315 | 315 | |
| 316 | - if( $currentid !== null ) |
|
| 316 | + if ($currentid !== null) |
|
| 317 | 317 | { |
| 318 | - $catItems = $controller->getCatalogPath( $currentid ); |
|
| 318 | + $catItems = $controller->getCatalogPath($currentid); |
|
| 319 | 319 | |
| 320 | - if( $startid ) |
|
| 320 | + if ($startid) |
|
| 321 | 321 | { |
| 322 | - foreach( $catItems as $key => $item ) |
|
| 322 | + foreach ($catItems as $key => $item) |
|
| 323 | 323 | { |
| 324 | - if( $key == $startid ) { |
|
| 324 | + if ($key == $startid) { |
|
| 325 | 325 | break; |
| 326 | 326 | } |
| 327 | - unset( $catItems[$key] ); |
|
| 327 | + unset($catItems[$key]); |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if( ( $node = reset( $catItems ) ) === false ) |
|
| 332 | + if (($node = reset($catItems)) === false) |
|
| 333 | 333 | { |
| 334 | - $node = $controller->getCatalogTree( $startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ); |
|
| 335 | - $catItems = array( $node->getId() => $node ); |
|
| 334 | + $node = $controller->getCatalogTree($startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE); |
|
| 335 | + $catItems = array($node->getId() => $node); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | |
| 339 | 339 | $search = $controller->createCatalogFilter(); |
| 340 | - $expr = $search->compare( '==', 'catalog.parentid', array_keys( $catItems ) ); |
|
| 341 | - $expr = $search->combine( '||', array( $expr, $search->compare( '==', 'catalog.id', $node->getId() ) ) ); |
|
| 340 | + $expr = $search->compare('==', 'catalog.parentid', array_keys($catItems)); |
|
| 341 | + $expr = $search->combine('||', array($expr, $search->compare('==', 'catalog.id', $node->getId()))); |
|
| 342 | 342 | |
| 343 | 343 | /** client/html/catalog/filter/tree/levels-always |
| 344 | 344 | * The number of levels in the category tree that should be always displayed |
@@ -364,8 +364,8 @@ discard block |
||
| 364 | 364 | * @see client/html/catalog/filter/tree/levels-only |
| 365 | 365 | * @see client/html/catalog/filter/tree/domains |
| 366 | 366 | */ |
| 367 | - if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-always' ) ) != null ) { |
|
| 368 | - $expr = $search->combine( '||', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) ); |
|
| 367 | + if (($levels = $view->config('client/html/catalog/filter/tree/levels-always')) != null) { |
|
| 368 | + $expr = $search->combine('||', array($expr, $search->compare('<=', 'catalog.level', $levels))); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** client/html/catalog/filter/tree/levels-only |
@@ -389,26 +389,26 @@ discard block |
||
| 389 | 389 | * @see client/html/catalog/filter/tree/levels-always |
| 390 | 390 | * @see client/html/catalog/filter/tree/domains |
| 391 | 391 | */ |
| 392 | - if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-only' ) ) != null ) { |
|
| 393 | - $expr = $search->combine( '&&', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) ); |
|
| 392 | + if (($levels = $view->config('client/html/catalog/filter/tree/levels-only')) != null) { |
|
| 393 | + $expr = $search->combine('&&', array($expr, $search->compare('<=', 'catalog.level', $levels))); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - $search->setConditions( $expr ); |
|
| 396 | + $search->setConditions($expr); |
|
| 397 | 397 | |
| 398 | 398 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE; |
| 399 | 399 | |
| 400 | 400 | $view->treeCatalogPath = $catItems; |
| 401 | - $view->treeCatalogTree = $controller->getCatalogTree( $startid, $ref, $level, $search ); |
|
| 402 | - $view->treeCatalogIds = $this->getCatalogIds( $view->treeCatalogTree, $catItems, $currentid ); |
|
| 403 | - $view->treeFilterParams = $this->getClientParams( $view->param(), array( 'f' ) ); |
|
| 401 | + $view->treeCatalogTree = $controller->getCatalogTree($startid, $ref, $level, $search); |
|
| 402 | + $view->treeCatalogIds = $this->getCatalogIds($view->treeCatalogTree, $catItems, $currentid); |
|
| 403 | + $view->treeFilterParams = $this->getClientParams($view->param(), array('f')); |
|
| 404 | 404 | |
| 405 | - $this->addMetaItemCatalog( $view->treeCatalogTree, $this->expire, $this->tags ); |
|
| 405 | + $this->addMetaItemCatalog($view->treeCatalogTree, $this->expire, $this->tags); |
|
| 406 | 406 | |
| 407 | 407 | $this->cache = $view; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 411 | - $tags = array_merge( $tags, $this->tags ); |
|
| 410 | + $expire = $this->expires($this->expire, $expire); |
|
| 411 | + $tags = array_merge($tags, $this->tags); |
|
| 412 | 412 | |
| 413 | 413 | return $this->cache; |
| 414 | 414 | } |
@@ -425,22 +425,22 @@ discard block |
||
| 425 | 425 | * @param string $currentId Currently selected category |
| 426 | 426 | * @return array List of category IDs |
| 427 | 427 | */ |
| 428 | - protected function getCatalogIds( \Aimeos\MShop\Catalog\Item\Iface $tree, array $path, $currentId ) |
|
| 428 | + protected function getCatalogIds(\Aimeos\MShop\Catalog\Item\Iface $tree, array $path, $currentId) |
|
| 429 | 429 | { |
| 430 | - if( $tree->getId() == $currentId ) |
|
| 430 | + if ($tree->getId() == $currentId) |
|
| 431 | 431 | { |
| 432 | 432 | $ids = array(); |
| 433 | - foreach( $tree->getChildren() as $item ) { |
|
| 433 | + foreach ($tree->getChildren() as $item) { |
|
| 434 | 434 | $ids[] = $item->getId(); |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | return $ids; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - foreach( $tree->getChildren() as $child ) |
|
| 440 | + foreach ($tree->getChildren() as $child) |
|
| 441 | 441 | { |
| 442 | - if( isset( $path[$child->getId()] ) ) { |
|
| 443 | - return $this->getCatalogIds( $child, $path, $currentId ); |
|
| 442 | + if (isset($path[$child->getId()])) { |
|
| 443 | + return $this->getCatalogIds($child, $path, $currentId); |
|
| 444 | 444 | } |
| 445 | 445 | } |
| 446 | 446 | |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | * @param string|null &$expire Expiration date that will be overwritten if an earlier date is found |
| 456 | 456 | * @param array &$tags List of tags the new tags will be added to |
| 457 | 457 | */ |
| 458 | - protected function addMetaItemCatalog( \Aimeos\MShop\Catalog\Item\Iface $tree, &$expire, array &$tags = array() ) |
|
| 458 | + protected function addMetaItemCatalog(\Aimeos\MShop\Catalog\Item\Iface $tree, &$expire, array &$tags = array()) |
|
| 459 | 459 | { |
| 460 | - $this->addMetaItem( $tree, 'catalog', $expire, $tags ); |
|
| 460 | + $this->addMetaItem($tree, 'catalog', $expire, $tags); |
|
| 461 | 461 | |
| 462 | - foreach( $tree->getChildren() as $child ) { |
|
| 463 | - $this->addMetaItemCatalog( $child, $expire, $tags ); |
|
| 462 | + foreach ($tree->getChildren() as $child) { |
|
| 463 | + $this->addMetaItemCatalog($child, $expire, $tags); |
|
| 464 | 464 | } |
| 465 | 465 | } |
| 466 | 466 | } |