@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @since 2014.09 |
| 90 | 90 | * @category Developer |
| 91 | 91 | */ |
| 92 | - private $subPartNames = array( 'image', 'breadcrumb', 'navigator' ); |
|
| 92 | + private $subPartNames = array('image', 'breadcrumb', 'navigator'); |
|
| 93 | 93 | |
| 94 | 94 | private $tags = array(); |
| 95 | 95 | private $expire; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 105 | 105 | * @return string HTML code |
| 106 | 106 | */ |
| 107 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 107 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 108 | 108 | { |
| 109 | - $prefixes = array( 'f' ); |
|
| 109 | + $prefixes = array('f'); |
|
| 110 | 110 | $context = $this->getContext(); |
| 111 | 111 | |
| 112 | 112 | /** client/html/catalog/stage |
@@ -121,41 +121,41 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | $confkey = 'client/html/catalog/stage'; |
| 123 | 123 | |
| 124 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 124 | + if ($context->getUserId() != null || ($html = $this->getCached('body', $uid, $prefixes, $confkey)) === null) |
|
| 125 | 125 | { |
| 126 | 126 | $view = $this->getView(); |
| 127 | 127 | |
| 128 | 128 | try |
| 129 | 129 | { |
| 130 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 130 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 131 | 131 | |
| 132 | 132 | $output = ''; |
| 133 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | - $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 133 | + foreach ($this->getSubClients() as $subclient) { |
|
| 134 | + $output .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 135 | 135 | } |
| 136 | 136 | $view->stageBody = $output; |
| 137 | 137 | } |
| 138 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 138 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 139 | 139 | { |
| 140 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 141 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 140 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 141 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 142 | 142 | } |
| 143 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 143 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 144 | 144 | { |
| 145 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 146 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 145 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 146 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 147 | 147 | } |
| 148 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 148 | + catch (\Aimeos\MShop\Exception $e) |
|
| 149 | 149 | { |
| 150 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 151 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 150 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 151 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 152 | 152 | } |
| 153 | - catch( \Exception $e ) |
|
| 153 | + catch (\Exception $e) |
|
| 154 | 154 | { |
| 155 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 155 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 156 | 156 | |
| 157 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 158 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 157 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 158 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** client/html/catalog/stage/standard/template-body |
@@ -181,13 +181,13 @@ discard block |
||
| 181 | 181 | $tplconf = 'client/html/catalog/stage/standard/template-body'; |
| 182 | 182 | $default = 'catalog/stage/body-default.php'; |
| 183 | 183 | |
| 184 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 184 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 185 | 185 | |
| 186 | - $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 186 | + $this->setCached('body', $uid, $prefixes, $confkey, $html, $tags, $expire); |
|
| 187 | 187 | } |
| 188 | 188 | else |
| 189 | 189 | { |
| 190 | - $html = $this->modifyBody( $html, $uid ); |
|
| 190 | + $html = $this->modifyBody($html, $uid); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | return $html; |
@@ -202,29 +202,29 @@ discard block |
||
| 202 | 202 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 203 | 203 | * @return string|null String including HTML tags for the header on error |
| 204 | 204 | */ |
| 205 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 205 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 206 | 206 | { |
| 207 | - $prefixes = array( 'f' ); |
|
| 207 | + $prefixes = array('f'); |
|
| 208 | 208 | $context = $this->getContext(); |
| 209 | 209 | $confkey = 'client/html/catalog/stage'; |
| 210 | 210 | |
| 211 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 211 | + if ($context->getUserId() != null || ($html = $this->getCached('header', $uid, $prefixes, $confkey)) === null) |
|
| 212 | 212 | { |
| 213 | 213 | $view = $this->getView(); |
| 214 | 214 | |
| 215 | 215 | try |
| 216 | 216 | { |
| 217 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 217 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 218 | 218 | |
| 219 | 219 | $html = ''; |
| 220 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 221 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 220 | + foreach ($this->getSubClients() as $subclient) { |
|
| 221 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 222 | 222 | } |
| 223 | 223 | $view->stageHeader = $html; |
| 224 | 224 | } |
| 225 | - catch( \Exception $e ) |
|
| 225 | + catch (\Exception $e) |
|
| 226 | 226 | { |
| 227 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 227 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** client/html/catalog/stage/standard/template-header |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | $tplconf = 'client/html/catalog/stage/standard/template-header'; |
| 252 | 252 | $default = 'catalog/stage/header-default.php'; |
| 253 | 253 | |
| 254 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 254 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 255 | 255 | |
| 256 | - $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 256 | + $this->setCached('header', $uid, $prefixes, $confkey, $html, $tags, $expire); |
|
| 257 | 257 | } |
| 258 | 258 | else |
| 259 | 259 | { |
| 260 | - $html = $this->modifyHeader( $html, $uid ); |
|
| 260 | + $html = $this->modifyHeader($html, $uid); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | return $html; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param string|null $name Name of the sub-client (Default if null) |
| 272 | 272 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 273 | 273 | */ |
| 274 | - public function getSubClient( $type, $name = null ) |
|
| 274 | + public function getSubClient($type, $name = null) |
|
| 275 | 275 | { |
| 276 | 276 | /** client/html/catalog/stage/decorators/excludes |
| 277 | 277 | * Excludes decorators added by the "common" option from the catalog stage html client |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * @see client/html/catalog/stage/decorators/excludes |
| 347 | 347 | * @see client/html/catalog/stage/decorators/global |
| 348 | 348 | */ |
| 349 | - return $this->createSubClient( 'catalog/stage/' . $type, $name ); |
|
| 349 | + return $this->createSubClient('catalog/stage/'.$type, $name); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | |
@@ -363,28 +363,28 @@ discard block |
||
| 363 | 363 | { |
| 364 | 364 | parent::process(); |
| 365 | 365 | } |
| 366 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 366 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 367 | 367 | { |
| 368 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 369 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 368 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 369 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 370 | 370 | } |
| 371 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 371 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 372 | 372 | { |
| 373 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 374 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 373 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 374 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 375 | 375 | } |
| 376 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 376 | + catch (\Aimeos\MShop\Exception $e) |
|
| 377 | 377 | { |
| 378 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 379 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 378 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 379 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 380 | 380 | } |
| 381 | - catch( \Exception $e ) |
|
| 381 | + catch (\Exception $e) |
|
| 382 | 382 | { |
| 383 | 383 | $context = $this->getContext(); |
| 384 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 384 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 385 | 385 | |
| 386 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 387 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 386 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 387 | + $view->stageErrorList = $view->get('stageErrorList', array()) + $error; |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -396,15 +396,15 @@ discard block |
||
| 396 | 396 | * @param array $prefixes List of prefixes the parameters must start with |
| 397 | 397 | * @return array Associative list of parameters used by the html client |
| 398 | 398 | */ |
| 399 | - protected function getClientParams( array $params, array $prefixes = array( 'f', 'l', 'd', 'a' ) ) |
|
| 399 | + protected function getClientParams(array $params, array $prefixes = array('f', 'l', 'd', 'a')) |
|
| 400 | 400 | { |
| 401 | - $list = parent::getClientParams( $params, array_merge( $prefixes, array( 'l', 'd' ) ) ); |
|
| 401 | + $list = parent::getClientParams($params, array_merge($prefixes, array('l', 'd'))); |
|
| 402 | 402 | |
| 403 | - if( isset( $list['l_pos'] ) && isset( $list['d_prodid'] ) ) |
|
| 403 | + if (isset($list['l_pos']) && isset($list['d_prodid'])) |
|
| 404 | 404 | { |
| 405 | 405 | $context = $this->getContext(); |
| 406 | 406 | $site = $context->getLocale()->getSite()->getCode(); |
| 407 | - $list += (array) $context->getSession()->get( 'aimeos/catalog/lists/params/last/' . $site, array() ); |
|
| 407 | + $list += (array) $context->getSession()->get('aimeos/catalog/lists/params/last/'.$site, array()); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | return $list; |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | protected function getSubClientNames() |
| 420 | 420 | { |
| 421 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 421 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | |
@@ -430,26 +430,26 @@ discard block |
||
| 430 | 430 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 431 | 431 | * @return \Aimeos\MW\View\Iface Modified view object |
| 432 | 432 | */ |
| 433 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 433 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 434 | 434 | { |
| 435 | - if( !isset( $this->cache ) ) |
|
| 435 | + if (!isset($this->cache)) |
|
| 436 | 436 | { |
| 437 | - $params = $this->getClientParams( $view->param(), array( 'f' ) ); |
|
| 437 | + $params = $this->getClientParams($view->param(), array('f')); |
|
| 438 | 438 | |
| 439 | - if( isset( $params['f_catid'] ) && $params['f_catid'] != '' ) |
|
| 439 | + if (isset($params['f_catid']) && $params['f_catid'] != '') |
|
| 440 | 440 | { |
| 441 | 441 | $context = $this->getContext(); |
| 442 | 442 | $config = $context->getConfig(); |
| 443 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 443 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 444 | 444 | |
| 445 | - $default = array( 'attribute', 'media', 'text' ); |
|
| 445 | + $default = array('attribute', 'media', 'text'); |
|
| 446 | 446 | |
| 447 | 447 | /** client/html/catalog/domains |
| 448 | 448 | * A list of domain names whose items should be available in the catalog view templates |
| 449 | 449 | * |
| 450 | 450 | * @see client/html/catalog/stage/domains |
| 451 | 451 | */ |
| 452 | - $domains = $config->get( 'client/html/catalog/domains', $default ); |
|
| 452 | + $domains = $config->get('client/html/catalog/domains', $default); |
|
| 453 | 453 | |
| 454 | 454 | /** client/html/catalog/stage/standard/domains |
| 455 | 455 | * A list of domain names whose items should be available in the catalog stage view template |
@@ -472,15 +472,15 @@ discard block |
||
| 472 | 472 | * @see client/html/catalog/detail/domains |
| 473 | 473 | * @see client/html/catalog/lists/domains |
| 474 | 474 | */ |
| 475 | - $domains = $config->get( 'client/html/catalog/stage/standard/domains', $domains ); |
|
| 476 | - $stageCatPath = $controller->getCatalogPath( $params['f_catid'], $domains ); |
|
| 475 | + $domains = $config->get('client/html/catalog/stage/standard/domains', $domains); |
|
| 476 | + $stageCatPath = $controller->getCatalogPath($params['f_catid'], $domains); |
|
| 477 | 477 | |
| 478 | - if( ( $categoryItem = end( $stageCatPath ) ) !== false ) { |
|
| 478 | + if (($categoryItem = end($stageCatPath)) !== false) { |
|
| 479 | 479 | $view->stageCurrentCatItem = $categoryItem; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - $this->addMetaItem( $stageCatPath, 'catalog', $this->expire, $this->tags ); |
|
| 483 | - $this->addMetaList( array_keys( $stageCatPath ), 'catalog', $this->expire ); |
|
| 482 | + $this->addMetaItem($stageCatPath, 'catalog', $this->expire, $this->tags); |
|
| 483 | + $this->addMetaList(array_keys($stageCatPath), 'catalog', $this->expire); |
|
| 484 | 484 | |
| 485 | 485 | $view->stageCatPath = $stageCatPath; |
| 486 | 486 | } |
@@ -490,8 +490,8 @@ discard block |
||
| 490 | 490 | $this->cache = $view; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 494 | - $tags = array_merge( $tags, $this->tags ); |
|
| 493 | + $expire = $this->expires($this->expire, $expire); |
|
| 494 | + $tags = array_merge($tags, $this->tags); |
|
| 495 | 495 | |
| 496 | 496 | return $this->cache; |
| 497 | 497 | } |
@@ -211,23 +211,19 @@ discard block |
||
| 211 | 211 | $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 212 | 212 | } |
| 213 | 213 | $view->detailBody = $output; |
| 214 | - } |
|
| 215 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 214 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 216 | 215 | { |
| 217 | 216 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 218 | 217 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 219 | - } |
|
| 220 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 218 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 221 | 219 | { |
| 222 | 220 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 223 | 221 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 224 | - } |
|
| 225 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 222 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 226 | 223 | { |
| 227 | 224 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 228 | 225 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 229 | - } |
|
| 230 | - catch( \Exception $e ) |
|
| 226 | + } catch( \Exception $e ) |
|
| 231 | 227 | { |
| 232 | 228 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 233 | 229 | |
@@ -261,8 +257,7 @@ discard block |
||
| 261 | 257 | $html = $view->render( $view->config( $tplconf, $default ) ); |
| 262 | 258 | |
| 263 | 259 | $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
| 264 | - } |
|
| 265 | - else |
|
| 260 | + } else |
|
| 266 | 261 | { |
| 267 | 262 | $html = $this->modifyBody( $html, $uid ); |
| 268 | 263 | } |
@@ -299,8 +294,7 @@ discard block |
||
| 299 | 294 | $output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
| 300 | 295 | } |
| 301 | 296 | $view->detailHeader = $output; |
| 302 | - } |
|
| 303 | - catch( \Exception $e ) |
|
| 297 | + } catch( \Exception $e ) |
|
| 304 | 298 | { |
| 305 | 299 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 306 | 300 | } |
@@ -332,8 +326,7 @@ discard block |
||
| 332 | 326 | $html = $view->render( $view->config( $tplconf, $default ) ); |
| 333 | 327 | |
| 334 | 328 | $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
| 335 | - } |
|
| 336 | - else |
|
| 329 | + } else |
|
| 337 | 330 | { |
| 338 | 331 | $html = $this->modifyHeader( $html, $uid ); |
| 339 | 332 | } |
@@ -446,23 +439,19 @@ discard block |
||
| 446 | 439 | $context->getSession()->set( 'aimeos/catalog/detail/params/last' . $site, $params ); |
| 447 | 440 | |
| 448 | 441 | parent::process(); |
| 449 | - } |
|
| 450 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 442 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 451 | 443 | { |
| 452 | 444 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 453 | 445 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 454 | - } |
|
| 455 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 446 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 456 | 447 | { |
| 457 | 448 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 458 | 449 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 459 | - } |
|
| 460 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 450 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 461 | 451 | { |
| 462 | 452 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 463 | 453 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 464 | - } |
|
| 465 | - catch( \Exception $e ) |
|
| 454 | + } catch( \Exception $e ) |
|
| 466 | 455 | { |
| 467 | 456 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 468 | 457 | |
@@ -19,480 +19,480 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/stage/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog stage section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/stage/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/catalog/stage/image/name |
|
| 61 | - * Name of the image part used by the catalog stage client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Stage\Image\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.03 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/catalog/stage/breadcrumb/name |
|
| 72 | - * Name of the breadcrumb part used by the catalog stage client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Stage\Breadcrumb\Myname". |
|
| 75 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | - * |
|
| 77 | - * @param string Last part of the client class name |
|
| 78 | - * @since 2014.03 |
|
| 79 | - * @category Developer |
|
| 80 | - */ |
|
| 81 | - |
|
| 82 | - /** client/html/catalog/stage/navigator/name |
|
| 83 | - * Name of the navigator part used by the catalog stage client implementation |
|
| 84 | - * |
|
| 85 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Stage\Breadcrumb\Myname". |
|
| 86 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | - * |
|
| 88 | - * @param string Last part of the client class name |
|
| 89 | - * @since 2014.09 |
|
| 90 | - * @category Developer |
|
| 91 | - */ |
|
| 92 | - private $subPartNames = array( 'image', 'breadcrumb', 'navigator' ); |
|
| 93 | - |
|
| 94 | - private $tags = array(); |
|
| 95 | - private $expire; |
|
| 96 | - private $cache; |
|
| 97 | - |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * Returns the HTML code for insertion into the body. |
|
| 101 | - * |
|
| 102 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 103 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 104 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 105 | - * @return string HTML code |
|
| 106 | - */ |
|
| 107 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 108 | - { |
|
| 109 | - $prefixes = array( 'f' ); |
|
| 110 | - $context = $this->getContext(); |
|
| 111 | - |
|
| 112 | - /** client/html/catalog/stage |
|
| 113 | - * All parameters defined for the catalog stage component and its subparts |
|
| 114 | - * |
|
| 115 | - * This returns all settings related to the stage component. |
|
| 116 | - * Please refer to the single settings for details. |
|
| 117 | - * |
|
| 118 | - * @param array Associative list of name/value settings |
|
| 119 | - * @category Developer |
|
| 120 | - * @see client/html/catalog#stage |
|
| 121 | - */ |
|
| 122 | - $confkey = 'client/html/catalog/stage'; |
|
| 123 | - |
|
| 124 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 125 | - { |
|
| 126 | - $view = $this->getView(); |
|
| 127 | - |
|
| 128 | - try |
|
| 129 | - { |
|
| 130 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 131 | - |
|
| 132 | - $output = ''; |
|
| 133 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | - $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 135 | - } |
|
| 136 | - $view->stageBody = $output; |
|
| 137 | - } |
|
| 138 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 139 | - { |
|
| 140 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 141 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 142 | - } |
|
| 143 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 144 | - { |
|
| 145 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 146 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 147 | - } |
|
| 148 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 149 | - { |
|
| 150 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 151 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 152 | - } |
|
| 153 | - catch( \Exception $e ) |
|
| 154 | - { |
|
| 155 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 156 | - |
|
| 157 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 158 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** client/html/catalog/stage/standard/template-body |
|
| 162 | - * Relative path to the HTML body template of the catalog stage client. |
|
| 163 | - * |
|
| 164 | - * The template file contains the HTML code and processing instructions |
|
| 165 | - * to generate the result shown in the body of the frontend. The |
|
| 166 | - * configuration string is the path to the template file relative |
|
| 167 | - * to the templates directory (usually in client/html/templates). |
|
| 168 | - * |
|
| 169 | - * You can overwrite the template file configuration in extensions and |
|
| 170 | - * provide alternative templates. These alternative templates should be |
|
| 171 | - * named like the default one but with the string "standard" replaced by |
|
| 172 | - * an unique name. You may use the name of your project for this. If |
|
| 173 | - * you've implemented an alternative client class as well, "standard" |
|
| 174 | - * should be replaced by the name of the new class. |
|
| 175 | - * |
|
| 176 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 177 | - * @since 2014.03 |
|
| 178 | - * @category Developer |
|
| 179 | - * @see client/html/catalog/stage/standard/template-header |
|
| 180 | - */ |
|
| 181 | - $tplconf = 'client/html/catalog/stage/standard/template-body'; |
|
| 182 | - $default = 'catalog/stage/body-default.php'; |
|
| 183 | - |
|
| 184 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 185 | - |
|
| 186 | - $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 187 | - } |
|
| 188 | - else |
|
| 189 | - { |
|
| 190 | - $html = $this->modifyBody( $html, $uid ); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - return $html; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Returns the HTML string for insertion into the header. |
|
| 199 | - * |
|
| 200 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 201 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 202 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 203 | - * @return string String including HTML tags for the header on error |
|
| 204 | - */ |
|
| 205 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 206 | - { |
|
| 207 | - $prefixes = array( 'f' ); |
|
| 208 | - $context = $this->getContext(); |
|
| 209 | - $confkey = 'client/html/catalog/stage'; |
|
| 210 | - |
|
| 211 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 212 | - { |
|
| 213 | - $view = $this->getView(); |
|
| 214 | - |
|
| 215 | - try |
|
| 216 | - { |
|
| 217 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 218 | - |
|
| 219 | - $html = ''; |
|
| 220 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 221 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 222 | - } |
|
| 223 | - $view->stageHeader = $html; |
|
| 224 | - } |
|
| 225 | - catch( \Exception $e ) |
|
| 226 | - { |
|
| 227 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** client/html/catalog/stage/standard/template-header |
|
| 231 | - * Relative path to the HTML header template of the catalog stage client. |
|
| 232 | - * |
|
| 233 | - * The template file contains the HTML code and processing instructions |
|
| 234 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 235 | - * of the rendered page in the frontend. The configuration string is the |
|
| 236 | - * path to the template file relative to the templates directory (usually |
|
| 237 | - * in client/html/templates). |
|
| 238 | - * |
|
| 239 | - * You can overwrite the template file configuration in extensions and |
|
| 240 | - * provide alternative templates. These alternative templates should be |
|
| 241 | - * named like the default one but with the string "standard" replaced by |
|
| 242 | - * an unique name. You may use the name of your project for this. If |
|
| 243 | - * you've implemented an alternative client class as well, "standard" |
|
| 244 | - * should be replaced by the name of the new class. |
|
| 245 | - * |
|
| 246 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 247 | - * @since 2014.03 |
|
| 248 | - * @category Developer |
|
| 249 | - * @see client/html/catalog/stage/standard/template-body |
|
| 250 | - */ |
|
| 251 | - $tplconf = 'client/html/catalog/stage/standard/template-header'; |
|
| 252 | - $default = 'catalog/stage/header-default.php'; |
|
| 253 | - |
|
| 254 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 255 | - |
|
| 256 | - $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 257 | - } |
|
| 258 | - else |
|
| 259 | - { |
|
| 260 | - $html = $this->modifyHeader( $html, $uid ); |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - return $html; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - |
|
| 267 | - /** |
|
| 268 | - * Returns the sub-client given by its name. |
|
| 269 | - * |
|
| 270 | - * @param string $type Name of the client type |
|
| 271 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 272 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 273 | - */ |
|
| 274 | - public function getSubClient( $type, $name = null ) |
|
| 275 | - { |
|
| 276 | - /** client/html/catalog/stage/decorators/excludes |
|
| 277 | - * Excludes decorators added by the "common" option from the catalog stage html client |
|
| 278 | - * |
|
| 279 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 280 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 281 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 282 | - * modify what is returned to the caller. |
|
| 283 | - * |
|
| 284 | - * This option allows you to remove a decorator added via |
|
| 285 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 286 | - * around the html client. |
|
| 287 | - * |
|
| 288 | - * client/html/catalog/stage/decorators/excludes = array( 'decorator1' ) |
|
| 289 | - * |
|
| 290 | - * This would remove the decorator named "decorator1" from the list of |
|
| 291 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 292 | - * "client/html/common/decorators/default" to the html client. |
|
| 293 | - * |
|
| 294 | - * @param array List of decorator names |
|
| 295 | - * @since 2014.05 |
|
| 296 | - * @category Developer |
|
| 297 | - * @see client/html/common/decorators/default |
|
| 298 | - * @see client/html/catalog/stage/decorators/global |
|
| 299 | - * @see client/html/catalog/stage/decorators/local |
|
| 300 | - */ |
|
| 301 | - |
|
| 302 | - /** client/html/catalog/stage/decorators/global |
|
| 303 | - * Adds a list of globally available decorators only to the catalog stage html client |
|
| 304 | - * |
|
| 305 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 306 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 307 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 308 | - * modify what is returned to the caller. |
|
| 309 | - * |
|
| 310 | - * This option allows you to wrap global decorators |
|
| 311 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 312 | - * |
|
| 313 | - * client/html/catalog/stage/decorators/global = array( 'decorator1' ) |
|
| 314 | - * |
|
| 315 | - * This would add the decorator named "decorator1" defined by |
|
| 316 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 317 | - * |
|
| 318 | - * @param array List of decorator names |
|
| 319 | - * @since 2014.05 |
|
| 320 | - * @category Developer |
|
| 321 | - * @see client/html/common/decorators/default |
|
| 322 | - * @see client/html/catalog/stage/decorators/excludes |
|
| 323 | - * @see client/html/catalog/stage/decorators/local |
|
| 324 | - */ |
|
| 325 | - |
|
| 326 | - /** client/html/catalog/stage/decorators/local |
|
| 327 | - * Adds a list of local decorators only to the catalog stage html client |
|
| 328 | - * |
|
| 329 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 330 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 331 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 332 | - * modify what is returned to the caller. |
|
| 333 | - * |
|
| 334 | - * This option allows you to wrap local decorators |
|
| 335 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 336 | - * |
|
| 337 | - * client/html/catalog/stage/decorators/local = array( 'decorator2' ) |
|
| 338 | - * |
|
| 339 | - * This would add the decorator named "decorator2" defined by |
|
| 340 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 341 | - * |
|
| 342 | - * @param array List of decorator names |
|
| 343 | - * @since 2014.05 |
|
| 344 | - * @category Developer |
|
| 345 | - * @see client/html/common/decorators/default |
|
| 346 | - * @see client/html/catalog/stage/decorators/excludes |
|
| 347 | - * @see client/html/catalog/stage/decorators/global |
|
| 348 | - */ |
|
| 349 | - return $this->createSubClient( 'catalog/stage/' . $type, $name ); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * Processes the input, e.g. store given values. |
|
| 355 | - * A view must be available and this method doesn't generate any output |
|
| 356 | - * besides setting view variables. |
|
| 357 | - */ |
|
| 358 | - public function process() |
|
| 359 | - { |
|
| 360 | - $view = $this->getView(); |
|
| 361 | - |
|
| 362 | - try |
|
| 363 | - { |
|
| 364 | - parent::process(); |
|
| 365 | - } |
|
| 366 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 367 | - { |
|
| 368 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 369 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 370 | - } |
|
| 371 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 372 | - { |
|
| 373 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 374 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 375 | - } |
|
| 376 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 377 | - { |
|
| 378 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 379 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 380 | - } |
|
| 381 | - catch( \Exception $e ) |
|
| 382 | - { |
|
| 383 | - $context = $this->getContext(); |
|
| 384 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 385 | - |
|
| 386 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 387 | - $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 388 | - } |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - |
|
| 392 | - /** |
|
| 393 | - * Returns the parameters used by the html client. |
|
| 394 | - * |
|
| 395 | - * @param array $params Associative list of all parameters |
|
| 396 | - * @param string[] $prefixes List of prefixes the parameters must start with |
|
| 397 | - * @return array Associative list of parameters used by the html client |
|
| 398 | - */ |
|
| 399 | - protected function getClientParams( array $params, array $prefixes = array( 'f', 'l', 'd', 'a' ) ) |
|
| 400 | - { |
|
| 401 | - $list = parent::getClientParams( $params, array_merge( $prefixes, array( 'l', 'd' ) ) ); |
|
| 402 | - |
|
| 403 | - if( isset( $list['l_pos'] ) && isset( $list['d_prodid'] ) ) |
|
| 404 | - { |
|
| 405 | - $context = $this->getContext(); |
|
| 406 | - $site = $context->getLocale()->getSite()->getCode(); |
|
| 407 | - $list += (array) $context->getSession()->get( 'aimeos/catalog/lists/params/last/' . $site, array() ); |
|
| 408 | - } |
|
| 409 | - |
|
| 410 | - return $list; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - |
|
| 414 | - /** |
|
| 415 | - * Returns the list of sub-client names configured for the client. |
|
| 416 | - * |
|
| 417 | - * @return array List of HTML client names |
|
| 418 | - */ |
|
| 419 | - protected function getSubClientNames() |
|
| 420 | - { |
|
| 421 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 422 | - } |
|
| 423 | - |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * Sets the necessary parameter values in the view. |
|
| 427 | - * |
|
| 428 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 429 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 430 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 431 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 432 | - */ |
|
| 433 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 434 | - { |
|
| 435 | - if( !isset( $this->cache ) ) |
|
| 436 | - { |
|
| 437 | - $params = $this->getClientParams( $view->param(), array( 'f' ) ); |
|
| 438 | - |
|
| 439 | - if( isset( $params['f_catid'] ) && $params['f_catid'] != '' ) |
|
| 440 | - { |
|
| 441 | - $context = $this->getContext(); |
|
| 442 | - $config = $context->getConfig(); |
|
| 443 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 444 | - |
|
| 445 | - $default = array( 'attribute', 'media', 'text' ); |
|
| 446 | - |
|
| 447 | - /** client/html/catalog/domains |
|
| 448 | - * A list of domain names whose items should be available in the catalog view templates |
|
| 449 | - * |
|
| 450 | - * @see client/html/catalog/stage/domains |
|
| 451 | - */ |
|
| 452 | - $domains = $config->get( 'client/html/catalog/domains', $default ); |
|
| 453 | - |
|
| 454 | - /** client/html/catalog/stage/standard/domains |
|
| 455 | - * A list of domain names whose items should be available in the catalog stage view template |
|
| 456 | - * |
|
| 457 | - * The templates rendering the catalog stage section use the texts and |
|
| 458 | - * maybe images and attributes associated to the categories. You can |
|
| 459 | - * configure your own list of domains (attribute, media, price, product, |
|
| 460 | - * text, etc. are domains) whose items are fetched from the storage. |
|
| 461 | - * Please keep in mind that the more domains you add to the configuration, |
|
| 462 | - * the more time is required for fetching the content! |
|
| 463 | - * |
|
| 464 | - * This configuration option overwrites the "client/html/catalog/domains" |
|
| 465 | - * option that allows to configure the domain names of the items fetched |
|
| 466 | - * for all catalog related data. |
|
| 467 | - * |
|
| 468 | - * @param array List of domain names |
|
| 469 | - * @since 2014.03 |
|
| 470 | - * @category Developer |
|
| 471 | - * @see client/html/catalog/domains |
|
| 472 | - * @see client/html/catalog/detail/domains |
|
| 473 | - * @see client/html/catalog/lists/domains |
|
| 474 | - */ |
|
| 475 | - $domains = $config->get( 'client/html/catalog/stage/standard/domains', $domains ); |
|
| 476 | - $stageCatPath = $controller->getCatalogPath( $params['f_catid'], $domains ); |
|
| 477 | - |
|
| 478 | - if( ( $categoryItem = end( $stageCatPath ) ) !== false ) { |
|
| 479 | - $view->stageCurrentCatItem = $categoryItem; |
|
| 480 | - } |
|
| 481 | - |
|
| 482 | - $this->addMetaItem( $stageCatPath, 'catalog', $this->expire, $this->tags ); |
|
| 483 | - $this->addMetaList( array_keys( $stageCatPath ), 'catalog', $this->expire ); |
|
| 484 | - |
|
| 485 | - $view->stageCatPath = $stageCatPath; |
|
| 486 | - } |
|
| 487 | - |
|
| 488 | - $view->stageParams = $params; |
|
| 489 | - |
|
| 490 | - $this->cache = $view; |
|
| 491 | - } |
|
| 492 | - |
|
| 493 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 494 | - $tags = array_merge( $tags, $this->tags ); |
|
| 495 | - |
|
| 496 | - return $this->cache; |
|
| 497 | - } |
|
| 25 | + /** client/html/catalog/stage/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog stage section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/stage/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/catalog/stage/image/name |
|
| 61 | + * Name of the image part used by the catalog stage client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Stage\Image\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.03 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/catalog/stage/breadcrumb/name |
|
| 72 | + * Name of the breadcrumb part used by the catalog stage client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Stage\Breadcrumb\Myname". |
|
| 75 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | + * |
|
| 77 | + * @param string Last part of the client class name |
|
| 78 | + * @since 2014.03 |
|
| 79 | + * @category Developer |
|
| 80 | + */ |
|
| 81 | + |
|
| 82 | + /** client/html/catalog/stage/navigator/name |
|
| 83 | + * Name of the navigator part used by the catalog stage client implementation |
|
| 84 | + * |
|
| 85 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Stage\Breadcrumb\Myname". |
|
| 86 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | + * |
|
| 88 | + * @param string Last part of the client class name |
|
| 89 | + * @since 2014.09 |
|
| 90 | + * @category Developer |
|
| 91 | + */ |
|
| 92 | + private $subPartNames = array( 'image', 'breadcrumb', 'navigator' ); |
|
| 93 | + |
|
| 94 | + private $tags = array(); |
|
| 95 | + private $expire; |
|
| 96 | + private $cache; |
|
| 97 | + |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * Returns the HTML code for insertion into the body. |
|
| 101 | + * |
|
| 102 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 103 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 104 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 105 | + * @return string HTML code |
|
| 106 | + */ |
|
| 107 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 108 | + { |
|
| 109 | + $prefixes = array( 'f' ); |
|
| 110 | + $context = $this->getContext(); |
|
| 111 | + |
|
| 112 | + /** client/html/catalog/stage |
|
| 113 | + * All parameters defined for the catalog stage component and its subparts |
|
| 114 | + * |
|
| 115 | + * This returns all settings related to the stage component. |
|
| 116 | + * Please refer to the single settings for details. |
|
| 117 | + * |
|
| 118 | + * @param array Associative list of name/value settings |
|
| 119 | + * @category Developer |
|
| 120 | + * @see client/html/catalog#stage |
|
| 121 | + */ |
|
| 122 | + $confkey = 'client/html/catalog/stage'; |
|
| 123 | + |
|
| 124 | + if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 125 | + { |
|
| 126 | + $view = $this->getView(); |
|
| 127 | + |
|
| 128 | + try |
|
| 129 | + { |
|
| 130 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 131 | + |
|
| 132 | + $output = ''; |
|
| 133 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | + $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 135 | + } |
|
| 136 | + $view->stageBody = $output; |
|
| 137 | + } |
|
| 138 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 139 | + { |
|
| 140 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 141 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 142 | + } |
|
| 143 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 144 | + { |
|
| 145 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 146 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 147 | + } |
|
| 148 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 149 | + { |
|
| 150 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 151 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 152 | + } |
|
| 153 | + catch( \Exception $e ) |
|
| 154 | + { |
|
| 155 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 156 | + |
|
| 157 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 158 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** client/html/catalog/stage/standard/template-body |
|
| 162 | + * Relative path to the HTML body template of the catalog stage client. |
|
| 163 | + * |
|
| 164 | + * The template file contains the HTML code and processing instructions |
|
| 165 | + * to generate the result shown in the body of the frontend. The |
|
| 166 | + * configuration string is the path to the template file relative |
|
| 167 | + * to the templates directory (usually in client/html/templates). |
|
| 168 | + * |
|
| 169 | + * You can overwrite the template file configuration in extensions and |
|
| 170 | + * provide alternative templates. These alternative templates should be |
|
| 171 | + * named like the default one but with the string "standard" replaced by |
|
| 172 | + * an unique name. You may use the name of your project for this. If |
|
| 173 | + * you've implemented an alternative client class as well, "standard" |
|
| 174 | + * should be replaced by the name of the new class. |
|
| 175 | + * |
|
| 176 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 177 | + * @since 2014.03 |
|
| 178 | + * @category Developer |
|
| 179 | + * @see client/html/catalog/stage/standard/template-header |
|
| 180 | + */ |
|
| 181 | + $tplconf = 'client/html/catalog/stage/standard/template-body'; |
|
| 182 | + $default = 'catalog/stage/body-default.php'; |
|
| 183 | + |
|
| 184 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 185 | + |
|
| 186 | + $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 187 | + } |
|
| 188 | + else |
|
| 189 | + { |
|
| 190 | + $html = $this->modifyBody( $html, $uid ); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + return $html; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Returns the HTML string for insertion into the header. |
|
| 199 | + * |
|
| 200 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 201 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 202 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 203 | + * @return string String including HTML tags for the header on error |
|
| 204 | + */ |
|
| 205 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 206 | + { |
|
| 207 | + $prefixes = array( 'f' ); |
|
| 208 | + $context = $this->getContext(); |
|
| 209 | + $confkey = 'client/html/catalog/stage'; |
|
| 210 | + |
|
| 211 | + if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 212 | + { |
|
| 213 | + $view = $this->getView(); |
|
| 214 | + |
|
| 215 | + try |
|
| 216 | + { |
|
| 217 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 218 | + |
|
| 219 | + $html = ''; |
|
| 220 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 221 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 222 | + } |
|
| 223 | + $view->stageHeader = $html; |
|
| 224 | + } |
|
| 225 | + catch( \Exception $e ) |
|
| 226 | + { |
|
| 227 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** client/html/catalog/stage/standard/template-header |
|
| 231 | + * Relative path to the HTML header template of the catalog stage client. |
|
| 232 | + * |
|
| 233 | + * The template file contains the HTML code and processing instructions |
|
| 234 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 235 | + * of the rendered page in the frontend. The configuration string is the |
|
| 236 | + * path to the template file relative to the templates directory (usually |
|
| 237 | + * in client/html/templates). |
|
| 238 | + * |
|
| 239 | + * You can overwrite the template file configuration in extensions and |
|
| 240 | + * provide alternative templates. These alternative templates should be |
|
| 241 | + * named like the default one but with the string "standard" replaced by |
|
| 242 | + * an unique name. You may use the name of your project for this. If |
|
| 243 | + * you've implemented an alternative client class as well, "standard" |
|
| 244 | + * should be replaced by the name of the new class. |
|
| 245 | + * |
|
| 246 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 247 | + * @since 2014.03 |
|
| 248 | + * @category Developer |
|
| 249 | + * @see client/html/catalog/stage/standard/template-body |
|
| 250 | + */ |
|
| 251 | + $tplconf = 'client/html/catalog/stage/standard/template-header'; |
|
| 252 | + $default = 'catalog/stage/header-default.php'; |
|
| 253 | + |
|
| 254 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 255 | + |
|
| 256 | + $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 257 | + } |
|
| 258 | + else |
|
| 259 | + { |
|
| 260 | + $html = $this->modifyHeader( $html, $uid ); |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + return $html; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + |
|
| 267 | + /** |
|
| 268 | + * Returns the sub-client given by its name. |
|
| 269 | + * |
|
| 270 | + * @param string $type Name of the client type |
|
| 271 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 272 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 273 | + */ |
|
| 274 | + public function getSubClient( $type, $name = null ) |
|
| 275 | + { |
|
| 276 | + /** client/html/catalog/stage/decorators/excludes |
|
| 277 | + * Excludes decorators added by the "common" option from the catalog stage html client |
|
| 278 | + * |
|
| 279 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 280 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 281 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 282 | + * modify what is returned to the caller. |
|
| 283 | + * |
|
| 284 | + * This option allows you to remove a decorator added via |
|
| 285 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 286 | + * around the html client. |
|
| 287 | + * |
|
| 288 | + * client/html/catalog/stage/decorators/excludes = array( 'decorator1' ) |
|
| 289 | + * |
|
| 290 | + * This would remove the decorator named "decorator1" from the list of |
|
| 291 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 292 | + * "client/html/common/decorators/default" to the html client. |
|
| 293 | + * |
|
| 294 | + * @param array List of decorator names |
|
| 295 | + * @since 2014.05 |
|
| 296 | + * @category Developer |
|
| 297 | + * @see client/html/common/decorators/default |
|
| 298 | + * @see client/html/catalog/stage/decorators/global |
|
| 299 | + * @see client/html/catalog/stage/decorators/local |
|
| 300 | + */ |
|
| 301 | + |
|
| 302 | + /** client/html/catalog/stage/decorators/global |
|
| 303 | + * Adds a list of globally available decorators only to the catalog stage html client |
|
| 304 | + * |
|
| 305 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 306 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 307 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 308 | + * modify what is returned to the caller. |
|
| 309 | + * |
|
| 310 | + * This option allows you to wrap global decorators |
|
| 311 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 312 | + * |
|
| 313 | + * client/html/catalog/stage/decorators/global = array( 'decorator1' ) |
|
| 314 | + * |
|
| 315 | + * This would add the decorator named "decorator1" defined by |
|
| 316 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 317 | + * |
|
| 318 | + * @param array List of decorator names |
|
| 319 | + * @since 2014.05 |
|
| 320 | + * @category Developer |
|
| 321 | + * @see client/html/common/decorators/default |
|
| 322 | + * @see client/html/catalog/stage/decorators/excludes |
|
| 323 | + * @see client/html/catalog/stage/decorators/local |
|
| 324 | + */ |
|
| 325 | + |
|
| 326 | + /** client/html/catalog/stage/decorators/local |
|
| 327 | + * Adds a list of local decorators only to the catalog stage html client |
|
| 328 | + * |
|
| 329 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 330 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 331 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 332 | + * modify what is returned to the caller. |
|
| 333 | + * |
|
| 334 | + * This option allows you to wrap local decorators |
|
| 335 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 336 | + * |
|
| 337 | + * client/html/catalog/stage/decorators/local = array( 'decorator2' ) |
|
| 338 | + * |
|
| 339 | + * This would add the decorator named "decorator2" defined by |
|
| 340 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 341 | + * |
|
| 342 | + * @param array List of decorator names |
|
| 343 | + * @since 2014.05 |
|
| 344 | + * @category Developer |
|
| 345 | + * @see client/html/common/decorators/default |
|
| 346 | + * @see client/html/catalog/stage/decorators/excludes |
|
| 347 | + * @see client/html/catalog/stage/decorators/global |
|
| 348 | + */ |
|
| 349 | + return $this->createSubClient( 'catalog/stage/' . $type, $name ); |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * Processes the input, e.g. store given values. |
|
| 355 | + * A view must be available and this method doesn't generate any output |
|
| 356 | + * besides setting view variables. |
|
| 357 | + */ |
|
| 358 | + public function process() |
|
| 359 | + { |
|
| 360 | + $view = $this->getView(); |
|
| 361 | + |
|
| 362 | + try |
|
| 363 | + { |
|
| 364 | + parent::process(); |
|
| 365 | + } |
|
| 366 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 367 | + { |
|
| 368 | + $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 369 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 370 | + } |
|
| 371 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 372 | + { |
|
| 373 | + $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 374 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 375 | + } |
|
| 376 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 377 | + { |
|
| 378 | + $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 379 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 380 | + } |
|
| 381 | + catch( \Exception $e ) |
|
| 382 | + { |
|
| 383 | + $context = $this->getContext(); |
|
| 384 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 385 | + |
|
| 386 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 387 | + $view->stageErrorList = $view->get( 'stageErrorList', array() ) + $error; |
|
| 388 | + } |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + |
|
| 392 | + /** |
|
| 393 | + * Returns the parameters used by the html client. |
|
| 394 | + * |
|
| 395 | + * @param array $params Associative list of all parameters |
|
| 396 | + * @param string[] $prefixes List of prefixes the parameters must start with |
|
| 397 | + * @return array Associative list of parameters used by the html client |
|
| 398 | + */ |
|
| 399 | + protected function getClientParams( array $params, array $prefixes = array( 'f', 'l', 'd', 'a' ) ) |
|
| 400 | + { |
|
| 401 | + $list = parent::getClientParams( $params, array_merge( $prefixes, array( 'l', 'd' ) ) ); |
|
| 402 | + |
|
| 403 | + if( isset( $list['l_pos'] ) && isset( $list['d_prodid'] ) ) |
|
| 404 | + { |
|
| 405 | + $context = $this->getContext(); |
|
| 406 | + $site = $context->getLocale()->getSite()->getCode(); |
|
| 407 | + $list += (array) $context->getSession()->get( 'aimeos/catalog/lists/params/last/' . $site, array() ); |
|
| 408 | + } |
|
| 409 | + |
|
| 410 | + return $list; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + |
|
| 414 | + /** |
|
| 415 | + * Returns the list of sub-client names configured for the client. |
|
| 416 | + * |
|
| 417 | + * @return array List of HTML client names |
|
| 418 | + */ |
|
| 419 | + protected function getSubClientNames() |
|
| 420 | + { |
|
| 421 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 422 | + } |
|
| 423 | + |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * Sets the necessary parameter values in the view. |
|
| 427 | + * |
|
| 428 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 429 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 430 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 431 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 432 | + */ |
|
| 433 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 434 | + { |
|
| 435 | + if( !isset( $this->cache ) ) |
|
| 436 | + { |
|
| 437 | + $params = $this->getClientParams( $view->param(), array( 'f' ) ); |
|
| 438 | + |
|
| 439 | + if( isset( $params['f_catid'] ) && $params['f_catid'] != '' ) |
|
| 440 | + { |
|
| 441 | + $context = $this->getContext(); |
|
| 442 | + $config = $context->getConfig(); |
|
| 443 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 444 | + |
|
| 445 | + $default = array( 'attribute', 'media', 'text' ); |
|
| 446 | + |
|
| 447 | + /** client/html/catalog/domains |
|
| 448 | + * A list of domain names whose items should be available in the catalog view templates |
|
| 449 | + * |
|
| 450 | + * @see client/html/catalog/stage/domains |
|
| 451 | + */ |
|
| 452 | + $domains = $config->get( 'client/html/catalog/domains', $default ); |
|
| 453 | + |
|
| 454 | + /** client/html/catalog/stage/standard/domains |
|
| 455 | + * A list of domain names whose items should be available in the catalog stage view template |
|
| 456 | + * |
|
| 457 | + * The templates rendering the catalog stage section use the texts and |
|
| 458 | + * maybe images and attributes associated to the categories. You can |
|
| 459 | + * configure your own list of domains (attribute, media, price, product, |
|
| 460 | + * text, etc. are domains) whose items are fetched from the storage. |
|
| 461 | + * Please keep in mind that the more domains you add to the configuration, |
|
| 462 | + * the more time is required for fetching the content! |
|
| 463 | + * |
|
| 464 | + * This configuration option overwrites the "client/html/catalog/domains" |
|
| 465 | + * option that allows to configure the domain names of the items fetched |
|
| 466 | + * for all catalog related data. |
|
| 467 | + * |
|
| 468 | + * @param array List of domain names |
|
| 469 | + * @since 2014.03 |
|
| 470 | + * @category Developer |
|
| 471 | + * @see client/html/catalog/domains |
|
| 472 | + * @see client/html/catalog/detail/domains |
|
| 473 | + * @see client/html/catalog/lists/domains |
|
| 474 | + */ |
|
| 475 | + $domains = $config->get( 'client/html/catalog/stage/standard/domains', $domains ); |
|
| 476 | + $stageCatPath = $controller->getCatalogPath( $params['f_catid'], $domains ); |
|
| 477 | + |
|
| 478 | + if( ( $categoryItem = end( $stageCatPath ) ) !== false ) { |
|
| 479 | + $view->stageCurrentCatItem = $categoryItem; |
|
| 480 | + } |
|
| 481 | + |
|
| 482 | + $this->addMetaItem( $stageCatPath, 'catalog', $this->expire, $this->tags ); |
|
| 483 | + $this->addMetaList( array_keys( $stageCatPath ), 'catalog', $this->expire ); |
|
| 484 | + |
|
| 485 | + $view->stageCatPath = $stageCatPath; |
|
| 486 | + } |
|
| 487 | + |
|
| 488 | + $view->stageParams = $params; |
|
| 489 | + |
|
| 490 | + $this->cache = $view; |
|
| 491 | + } |
|
| 492 | + |
|
| 493 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 494 | + $tags = array_merge( $tags, $this->tags ); |
|
| 495 | + |
|
| 496 | + return $this->cache; |
|
| 497 | + } |
|
| 498 | 498 | } |
@@ -19,264 +19,264 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/stage/image/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog stage image section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/stage/image/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/catalog/stage/image/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog stage image section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/stage/image/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->imageBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->imageBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/catalog/stage/image/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the catalog stage image client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * should be replaced by the name of the new class. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2014.03 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/catalog/stage/image/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/catalog/stage/image/standard/template-body'; |
|
| 102 | - $default = 'catalog/stage/image-body-default.php'; |
|
| 81 | + /** client/html/catalog/stage/image/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the catalog stage image client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * should be replaced by the name of the new class. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2014.03 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/catalog/stage/image/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/catalog/stage/image/standard/template-body'; |
|
| 102 | + $default = 'catalog/stage/image-body-default.php'; |
|
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns the HTML string for insertion into the header. |
|
| 110 | - * |
|
| 111 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | - */ |
|
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML string for insertion into the header. |
|
| 110 | + * |
|
| 111 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | + * @return string|null String including HTML tags for the header on error |
|
| 115 | + */ |
|
| 116 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | 119 | |
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->imageHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->imageHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/catalog/stage/image/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the catalog stage image client. |
|
| 128 | - * |
|
| 129 | - * The template file contains the HTML code and processing instructions |
|
| 130 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | - * of the rendered page in the frontend. The configuration string is the |
|
| 132 | - * path to the template file relative to the templates directory (usually |
|
| 133 | - * in client/html/templates). |
|
| 134 | - * |
|
| 135 | - * You can overwrite the template file configuration in extensions and |
|
| 136 | - * provide alternative templates. These alternative templates should be |
|
| 137 | - * named like the default one but with the string "standard" replaced by |
|
| 138 | - * an unique name. You may use the name of your project for this. If |
|
| 139 | - * you've implemented an alternative client class as well, "standard" |
|
| 140 | - * should be replaced by the name of the new class. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2014.03 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/catalog/stage/image/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/catalog/stage/image/standard/template-header'; |
|
| 148 | - $default = 'catalog/stage/image-header-default.php'; |
|
| 126 | + /** client/html/catalog/stage/image/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the catalog stage image client. |
|
| 128 | + * |
|
| 129 | + * The template file contains the HTML code and processing instructions |
|
| 130 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | + * of the rendered page in the frontend. The configuration string is the |
|
| 132 | + * path to the template file relative to the templates directory (usually |
|
| 133 | + * in client/html/templates). |
|
| 134 | + * |
|
| 135 | + * You can overwrite the template file configuration in extensions and |
|
| 136 | + * provide alternative templates. These alternative templates should be |
|
| 137 | + * named like the default one but with the string "standard" replaced by |
|
| 138 | + * an unique name. You may use the name of your project for this. If |
|
| 139 | + * you've implemented an alternative client class as well, "standard" |
|
| 140 | + * should be replaced by the name of the new class. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2014.03 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/catalog/stage/image/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/catalog/stage/image/standard/template-header'; |
|
| 148 | + $default = 'catalog/stage/image-header-default.php'; |
|
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Returns the sub-client given by its name. |
|
| 156 | - * |
|
| 157 | - * @param string $type Name of the client type |
|
| 158 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | - */ |
|
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 162 | - { |
|
| 163 | - /** client/html/catalog/stage/image/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the catalog stage image html client |
|
| 165 | - * |
|
| 166 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | - * modify what is returned to the caller. |
|
| 170 | - * |
|
| 171 | - * This option allows you to remove a decorator added via |
|
| 172 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | - * around the html client. |
|
| 174 | - * |
|
| 175 | - * client/html/catalog/stage/image/decorators/excludes = array( 'decorator1' ) |
|
| 176 | - * |
|
| 177 | - * This would remove the decorator named "decorator1" from the list of |
|
| 178 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | - * "client/html/common/decorators/default" to the html client. |
|
| 180 | - * |
|
| 181 | - * @param array List of decorator names |
|
| 182 | - * @since 2014.05 |
|
| 183 | - * @category Developer |
|
| 184 | - * @see client/html/common/decorators/default |
|
| 185 | - * @see client/html/catalog/stage/image/decorators/global |
|
| 186 | - * @see client/html/catalog/stage/image/decorators/local |
|
| 187 | - */ |
|
| 154 | + /** |
|
| 155 | + * Returns the sub-client given by its name. |
|
| 156 | + * |
|
| 157 | + * @param string $type Name of the client type |
|
| 158 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | + */ |
|
| 161 | + public function getSubClient( $type, $name = null ) |
|
| 162 | + { |
|
| 163 | + /** client/html/catalog/stage/image/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the catalog stage image html client |
|
| 165 | + * |
|
| 166 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | + * modify what is returned to the caller. |
|
| 170 | + * |
|
| 171 | + * This option allows you to remove a decorator added via |
|
| 172 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | + * around the html client. |
|
| 174 | + * |
|
| 175 | + * client/html/catalog/stage/image/decorators/excludes = array( 'decorator1' ) |
|
| 176 | + * |
|
| 177 | + * This would remove the decorator named "decorator1" from the list of |
|
| 178 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | + * "client/html/common/decorators/default" to the html client. |
|
| 180 | + * |
|
| 181 | + * @param array List of decorator names |
|
| 182 | + * @since 2014.05 |
|
| 183 | + * @category Developer |
|
| 184 | + * @see client/html/common/decorators/default |
|
| 185 | + * @see client/html/catalog/stage/image/decorators/global |
|
| 186 | + * @see client/html/catalog/stage/image/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/catalog/stage/image/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the catalog stage image html client |
|
| 191 | - * |
|
| 192 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | - * modify what is returned to the caller. |
|
| 196 | - * |
|
| 197 | - * This option allows you to wrap global decorators |
|
| 198 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | - * |
|
| 200 | - * client/html/catalog/stage/image/decorators/global = array( 'decorator1' ) |
|
| 201 | - * |
|
| 202 | - * This would add the decorator named "decorator1" defined by |
|
| 203 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | - * |
|
| 205 | - * @param array List of decorator names |
|
| 206 | - * @since 2014.05 |
|
| 207 | - * @category Developer |
|
| 208 | - * @see client/html/common/decorators/default |
|
| 209 | - * @see client/html/catalog/stage/image/decorators/excludes |
|
| 210 | - * @see client/html/catalog/stage/image/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/catalog/stage/image/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the catalog stage image html client |
|
| 191 | + * |
|
| 192 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | + * modify what is returned to the caller. |
|
| 196 | + * |
|
| 197 | + * This option allows you to wrap global decorators |
|
| 198 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | + * |
|
| 200 | + * client/html/catalog/stage/image/decorators/global = array( 'decorator1' ) |
|
| 201 | + * |
|
| 202 | + * This would add the decorator named "decorator1" defined by |
|
| 203 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | + * |
|
| 205 | + * @param array List of decorator names |
|
| 206 | + * @since 2014.05 |
|
| 207 | + * @category Developer |
|
| 208 | + * @see client/html/common/decorators/default |
|
| 209 | + * @see client/html/catalog/stage/image/decorators/excludes |
|
| 210 | + * @see client/html/catalog/stage/image/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/catalog/stage/image/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the catalog stage image html client |
|
| 215 | - * |
|
| 216 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | - * modify what is returned to the caller. |
|
| 220 | - * |
|
| 221 | - * This option allows you to wrap local decorators |
|
| 222 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/catalog/stage/image/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | - * |
|
| 229 | - * @param array List of decorator names |
|
| 230 | - * @since 2014.05 |
|
| 231 | - * @category Developer |
|
| 232 | - * @see client/html/common/decorators/default |
|
| 233 | - * @see client/html/catalog/stage/image/decorators/excludes |
|
| 234 | - * @see client/html/catalog/stage/image/decorators/global |
|
| 235 | - */ |
|
| 236 | - return $this->createSubClient( 'catalog/stage/image/' . $type, $name ); |
|
| 237 | - } |
|
| 213 | + /** client/html/catalog/stage/image/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the catalog stage image html client |
|
| 215 | + * |
|
| 216 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | + * modify what is returned to the caller. |
|
| 220 | + * |
|
| 221 | + * This option allows you to wrap local decorators |
|
| 222 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/catalog/stage/image/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | + * |
|
| 229 | + * @param array List of decorator names |
|
| 230 | + * @since 2014.05 |
|
| 231 | + * @category Developer |
|
| 232 | + * @see client/html/common/decorators/default |
|
| 233 | + * @see client/html/catalog/stage/image/decorators/excludes |
|
| 234 | + * @see client/html/catalog/stage/image/decorators/global |
|
| 235 | + */ |
|
| 236 | + return $this->createSubClient( 'catalog/stage/image/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * Sets the necessary parameter values in the view. |
|
| 253 | - * |
|
| 254 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 255 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 256 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 257 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 258 | - */ |
|
| 259 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | - { |
|
| 261 | - if( !isset( $this->cache ) ) |
|
| 262 | - { |
|
| 263 | - $mediaItems = array(); |
|
| 264 | - $catPath = $view->get( 'stageCatPath', array() ); |
|
| 251 | + /** |
|
| 252 | + * Sets the necessary parameter values in the view. |
|
| 253 | + * |
|
| 254 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 255 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 256 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 257 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 258 | + */ |
|
| 259 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + { |
|
| 261 | + if( !isset( $this->cache ) ) |
|
| 262 | + { |
|
| 263 | + $mediaItems = array(); |
|
| 264 | + $catPath = $view->get( 'stageCatPath', array() ); |
|
| 265 | 265 | |
| 266 | - foreach( array_reverse( $catPath ) as $catItem ) |
|
| 267 | - { |
|
| 268 | - $mediaItems = $catItem->getRefItems( 'media', 'default', 'stage' ); |
|
| 266 | + foreach( array_reverse( $catPath ) as $catItem ) |
|
| 267 | + { |
|
| 268 | + $mediaItems = $catItem->getRefItems( 'media', 'default', 'stage' ); |
|
| 269 | 269 | |
| 270 | - if( !empty( $mediaItems ) ) { |
|
| 271 | - break; |
|
| 272 | - } |
|
| 273 | - } |
|
| 270 | + if( !empty( $mediaItems ) ) { |
|
| 271 | + break; |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - $view->imageItems = $mediaItems; |
|
| 275 | + $view->imageItems = $mediaItems; |
|
| 276 | 276 | |
| 277 | - $this->cache = $view; |
|
| 278 | - } |
|
| 277 | + $this->cache = $view; |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - return $this->cache; |
|
| 281 | - } |
|
| 280 | + return $this->cache; |
|
| 281 | + } |
|
| 282 | 282 | } |
| 283 | 283 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->imageBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/catalog/stage/image/standard/template-body'; |
| 102 | 102 | $default = 'catalog/stage/image-body-default.php'; |
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + return $view->render($view->config($tplconf, $default)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | 114 | * @return string|null String including HTML tags for the header on error |
| 115 | 115 | */ |
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 119 | 119 | |
| 120 | 120 | $html = ''; |
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + foreach ($this->getSubClients() as $subclient) { |
|
| 122 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 123 | 123 | } |
| 124 | 124 | $view->imageHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/catalog/stage/image/standard/template-header'; |
| 148 | 148 | $default = 'catalog/stage/image-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/catalog/stage/image/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the catalog stage image html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/catalog/stage/image/decorators/excludes |
| 234 | 234 | * @see client/html/catalog/stage/image/decorators/global |
| 235 | 235 | */ |
| 236 | - return $this->createSubClient( 'catalog/stage/image/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('catalog/stage/image/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -256,18 +256,18 @@ discard block |
||
| 256 | 256 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 257 | 257 | * @return \Aimeos\MW\View\Iface Modified view object |
| 258 | 258 | */ |
| 259 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 259 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 260 | 260 | { |
| 261 | - if( !isset( $this->cache ) ) |
|
| 261 | + if (!isset($this->cache)) |
|
| 262 | 262 | { |
| 263 | 263 | $mediaItems = array(); |
| 264 | - $catPath = $view->get( 'stageCatPath', array() ); |
|
| 264 | + $catPath = $view->get('stageCatPath', array()); |
|
| 265 | 265 | |
| 266 | - foreach( array_reverse( $catPath ) as $catItem ) |
|
| 266 | + foreach (array_reverse($catPath) as $catItem) |
|
| 267 | 267 | { |
| 268 | - $mediaItems = $catItem->getRefItems( 'media', 'default', 'stage' ); |
|
| 268 | + $mediaItems = $catItem->getRefItems('media', 'default', 'stage'); |
|
| 269 | 269 | |
| 270 | - if( !empty( $mediaItems ) ) { |
|
| 270 | + if (!empty($mediaItems)) { |
|
| 271 | 271 | break; |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/lists/head/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog list head section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/lists/head/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | - |
|
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->headBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/catalog/lists/head/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the catalog list head client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/catalog/lists/head/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/catalog/lists/head/standard/template-body'; |
|
| 101 | - $default = 'catalog/lists/head-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->headHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/catalog/lists/head/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the catalog list head client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/catalog/lists/head/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/catalog/lists/head/standard/template-header'; |
|
| 147 | - $default = 'catalog/lists/head-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/catalog/lists/head/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the catalog list head html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/catalog/lists/head/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/catalog/lists/head/decorators/global |
|
| 185 | - * @see client/html/catalog/lists/head/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/catalog/lists/head/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the catalog list head html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/catalog/lists/head/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/catalog/lists/head/decorators/excludes |
|
| 209 | - * @see client/html/catalog/lists/head/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/catalog/lists/head/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the catalog list head html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/catalog/lists/head/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/catalog/lists/head/decorators/excludes |
|
| 233 | - * @see client/html/catalog/lists/head/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'catalog/lists/head/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/catalog/lists/head/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog list head section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/lists/head/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->headBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/catalog/lists/head/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the catalog list head client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/catalog/lists/head/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/catalog/lists/head/standard/template-body'; |
|
| 101 | + $default = 'catalog/lists/head-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->headHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/catalog/lists/head/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the catalog list head client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/catalog/lists/head/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/catalog/lists/head/standard/template-header'; |
|
| 147 | + $default = 'catalog/lists/head-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/catalog/lists/head/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the catalog list head html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/catalog/lists/head/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/catalog/lists/head/decorators/global |
|
| 185 | + * @see client/html/catalog/lists/head/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/catalog/lists/head/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the catalog list head html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/catalog/lists/head/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/catalog/lists/head/decorators/excludes |
|
| 209 | + * @see client/html/catalog/lists/head/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/catalog/lists/head/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the catalog list head html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/catalog/lists/head/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/catalog/lists/head/decorators/excludes |
|
| 233 | + * @see client/html/catalog/lists/head/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'catalog/lists/head/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->headBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/catalog/lists/head/standard/template-body'; |
| 101 | 101 | $default = 'catalog/lists/head-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->headHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/catalog/lists/head/standard/template-header'; |
| 147 | 147 | $default = 'catalog/lists/head-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/catalog/lists/head/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the catalog list head html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/catalog/lists/head/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'catalog/lists/head/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('catalog/lists/head/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,69 +19,69 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Factory |
| 22 | - extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Creates a list client object. |
|
| 27 | - * |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | - * @param string|null $name Client name (default: "Standard") |
|
| 31 | - * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | - * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | - */ |
|
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | - { |
|
| 36 | - /** client/html/catalog/lists/name |
|
| 37 | - * Class name of the used catalog list client implementation |
|
| 38 | - * |
|
| 39 | - * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | - * To use this implementation, you have to set the last part of the class |
|
| 41 | - * name as configuration value so the client factory knows which class it |
|
| 42 | - * has to instantiate. |
|
| 43 | - * |
|
| 44 | - * For example, if the name of the default class is |
|
| 45 | - * |
|
| 46 | - * \Aimeos\Client\Html\Catalog\Lists\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Catalog\Lists\Mylist |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/catalog/lists/name = Mylist |
|
| 55 | - * |
|
| 56 | - * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | - * so take care that the configuration value is exactly named like the last |
|
| 58 | - * part of the class name. |
|
| 59 | - * |
|
| 60 | - * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | - * characters are possible! You should always start the last part of the class |
|
| 62 | - * name with an upper case character and continue only with lower case characters |
|
| 63 | - * or numbers. Avoid chamel case names like "MyList"! |
|
| 64 | - * |
|
| 65 | - * @param string Last part of the class name |
|
| 66 | - * @since 2014.03 |
|
| 67 | - * @category Developer |
|
| 68 | - */ |
|
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/lists/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a list client object. |
|
| 27 | + * |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | + * @param string|null $name Client name (default: "Standard") |
|
| 31 | + * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | + * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | + */ |
|
| 34 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | + { |
|
| 36 | + /** client/html/catalog/lists/name |
|
| 37 | + * Class name of the used catalog list client implementation |
|
| 38 | + * |
|
| 39 | + * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | + * To use this implementation, you have to set the last part of the class |
|
| 41 | + * name as configuration value so the client factory knows which class it |
|
| 42 | + * has to instantiate. |
|
| 43 | + * |
|
| 44 | + * For example, if the name of the default class is |
|
| 45 | + * |
|
| 46 | + * \Aimeos\Client\Html\Catalog\Lists\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Catalog\Lists\Mylist |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/catalog/lists/name = Mylist |
|
| 55 | + * |
|
| 56 | + * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | + * so take care that the configuration value is exactly named like the last |
|
| 58 | + * part of the class name. |
|
| 59 | + * |
|
| 60 | + * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | + * characters are possible! You should always start the last part of the class |
|
| 62 | + * name with an upper case character and continue only with lower case characters |
|
| 63 | + * or numbers. Avoid chamel case names like "MyList"! |
|
| 64 | + * |
|
| 65 | + * @param string Last part of the class name |
|
| 66 | + * @since 2014.03 |
|
| 67 | + * @category Developer |
|
| 68 | + */ |
|
| 69 | + if( $name === null ) { |
|
| 70 | + $name = $context->getConfig()->get( 'client/html/catalog/lists/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Lists\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | - } |
|
| 73 | + if( ctype_alnum( $name ) === false ) |
|
| 74 | + { |
|
| 75 | + $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Lists\\' . $name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Lists\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Lists\\' . $name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/lists' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/lists' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
| 32 | 32 | * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
| 33 | 33 | */ |
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 34 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
| 35 | 35 | { |
| 36 | 36 | /** client/html/catalog/lists/name |
| 37 | 37 | * Class name of the used catalog list client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/lists/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/catalog/lists/name', 'Standard'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 73 | + if (ctype_alnum($name) === false) |
|
| 74 | 74 | { |
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Lists\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 75 | + $classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Catalog\\Lists\\'.$name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $iface = '\\Aimeos\\Client\\Html\\Iface'; |
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Lists\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Lists\\'.$name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase($context, $classname, $iface, $templatePaths); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/lists' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'catalog/lists'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -19,587 +19,587 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/lists/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog list section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/lists/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/catalog/lists/head/name |
|
| 61 | - * Name of the head part used by the catalog list client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Head\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.03 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/catalog/lists/promo/name |
|
| 72 | - * Name of the promotion part used by the catalog list client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Promo\Myname". |
|
| 75 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | - * |
|
| 77 | - * @param string Last part of the client class name |
|
| 78 | - * @since 2014.03 |
|
| 79 | - * @category Developer |
|
| 80 | - */ |
|
| 81 | - |
|
| 82 | - /** client/html/catalog/lists/quote/name |
|
| 83 | - * Name of the quote part used by the catalog list client implementation |
|
| 84 | - * |
|
| 85 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Quote\Myname". |
|
| 86 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | - * |
|
| 88 | - * @param string Last part of the client class name |
|
| 89 | - * @since 2014.03 |
|
| 90 | - * @category Developer |
|
| 91 | - */ |
|
| 92 | - |
|
| 93 | - /** client/html/catalog/lists/pagination/name |
|
| 94 | - * Name of the pagination part used by the catalog list client implementation |
|
| 95 | - * |
|
| 96 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Pagination\Myname". |
|
| 97 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 98 | - * |
|
| 99 | - * @param string Last part of the client class name |
|
| 100 | - * @since 2014.03 |
|
| 101 | - * @category Developer |
|
| 102 | - */ |
|
| 103 | - |
|
| 104 | - /** client/html/catalog/lists/items/name |
|
| 105 | - * Name of the items part used by the catalog list client implementation |
|
| 106 | - * |
|
| 107 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Items\Myname". |
|
| 108 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 109 | - * |
|
| 110 | - * @param string Last part of the client class name |
|
| 111 | - * @since 2014.03 |
|
| 112 | - * @category Developer |
|
| 113 | - */ |
|
| 114 | - private $subPartNames = array( 'head', 'quote', 'promo', 'pagination', 'items', 'pagination' ); |
|
| 115 | - |
|
| 116 | - private $tags = array(); |
|
| 117 | - private $expire; |
|
| 118 | - private $cache; |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Returns the HTML code for insertion into the body. |
|
| 123 | - * |
|
| 124 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 125 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 126 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 127 | - * @return string HTML code |
|
| 128 | - */ |
|
| 129 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 130 | - { |
|
| 131 | - $prefixes = array( 'f', 'l' ); |
|
| 132 | - $context = $this->getContext(); |
|
| 133 | - |
|
| 134 | - /** client/html/catalog/list |
|
| 135 | - * All parameters defined for the catalog list component and its subparts |
|
| 136 | - * |
|
| 137 | - * This returns all settings related to the filter component. |
|
| 138 | - * Please refer to the single settings for details. |
|
| 139 | - * |
|
| 140 | - * @param array Associative list of name/value settings |
|
| 141 | - * @category Developer |
|
| 142 | - * @see client/html/catalog#list |
|
| 143 | - */ |
|
| 144 | - $confkey = 'client/html/catalog/list'; |
|
| 145 | - |
|
| 146 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 147 | - { |
|
| 148 | - $view = $this->getView(); |
|
| 149 | - |
|
| 150 | - try |
|
| 151 | - { |
|
| 152 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 153 | - |
|
| 154 | - $html = ''; |
|
| 155 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 156 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 157 | - } |
|
| 158 | - $view->listBody = $html; |
|
| 159 | - } |
|
| 160 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 161 | - { |
|
| 162 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 163 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 164 | - } |
|
| 165 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 166 | - { |
|
| 167 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 168 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 169 | - } |
|
| 170 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 171 | - { |
|
| 172 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 173 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 174 | - } |
|
| 175 | - catch( \Exception $e ) |
|
| 176 | - { |
|
| 177 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 178 | - |
|
| 179 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 180 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** client/html/catalog/lists/standard/template-body |
|
| 184 | - * Relative path to the HTML body template of the catalog list client. |
|
| 185 | - * |
|
| 186 | - * The template file contains the HTML code and processing instructions |
|
| 187 | - * to generate the result shown in the body of the frontend. The |
|
| 188 | - * configuration string is the path to the template file relative |
|
| 189 | - * to the templates directory (usually in client/html/templates). |
|
| 190 | - * |
|
| 191 | - * You can overwrite the template file configuration in extensions and |
|
| 192 | - * provide alternative templates. These alternative templates should be |
|
| 193 | - * named like the default one but with the string "standard" replaced by |
|
| 194 | - * an unique name. You may use the name of your project for this. If |
|
| 195 | - * you've implemented an alternative client class as well, "standard" |
|
| 196 | - * should be replaced by the name of the new class. |
|
| 197 | - * |
|
| 198 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 199 | - * @since 2014.03 |
|
| 200 | - * @category Developer |
|
| 201 | - * @see client/html/catalog/lists/standard/template-header |
|
| 202 | - */ |
|
| 203 | - $tplconf = 'client/html/catalog/lists/standard/template-body'; |
|
| 204 | - $default = 'catalog/lists/body-default.php'; |
|
| 205 | - |
|
| 206 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 207 | - |
|
| 208 | - $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 209 | - } |
|
| 210 | - else |
|
| 211 | - { |
|
| 212 | - $html = $this->modifyBody( $html, $uid ); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - return $html; |
|
| 216 | - } |
|
| 217 | - |
|
| 218 | - |
|
| 219 | - /** |
|
| 220 | - * Returns the HTML string for insertion into the header. |
|
| 221 | - * |
|
| 222 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 223 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 224 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 225 | - * @return string|null String including HTML tags for the header on error |
|
| 226 | - */ |
|
| 227 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 228 | - { |
|
| 229 | - $prefixes = array( 'f', 'l' ); |
|
| 230 | - $context = $this->getContext(); |
|
| 231 | - $confkey = 'client/html/catalog/list'; |
|
| 232 | - |
|
| 233 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 234 | - { |
|
| 235 | - $view = $this->getView(); |
|
| 236 | - |
|
| 237 | - try |
|
| 238 | - { |
|
| 239 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 240 | - |
|
| 241 | - $html = ''; |
|
| 242 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 243 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 244 | - } |
|
| 245 | - $view->listHeader = $html; |
|
| 246 | - } |
|
| 247 | - catch( \Exception $e ) |
|
| 248 | - { |
|
| 249 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - /** client/html/catalog/lists/standard/template-header |
|
| 253 | - * Relative path to the HTML header template of the catalog list client. |
|
| 254 | - * |
|
| 255 | - * The template file contains the HTML code and processing instructions |
|
| 256 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 257 | - * of the rendered page in the frontend. The configuration string is the |
|
| 258 | - * path to the template file relative to the templates directory (usually |
|
| 259 | - * in client/html/templates). |
|
| 260 | - * |
|
| 261 | - * You can overwrite the template file configuration in extensions and |
|
| 262 | - * provide alternative templates. These alternative templates should be |
|
| 263 | - * named like the default one but with the string "standard" replaced by |
|
| 264 | - * an unique name. You may use the name of your project for this. If |
|
| 265 | - * you've implemented an alternative client class as well, "standard" |
|
| 266 | - * should be replaced by the name of the new class. |
|
| 267 | - * |
|
| 268 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 269 | - * @since 2014.03 |
|
| 270 | - * @category Developer |
|
| 271 | - * @see client/html/catalog/lists/standard/template-body |
|
| 272 | - */ |
|
| 273 | - $tplconf = 'client/html/catalog/lists/standard/template-header'; |
|
| 274 | - $default = 'catalog/lists/header-default.php'; |
|
| 275 | - |
|
| 276 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 277 | - |
|
| 278 | - $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 279 | - } |
|
| 280 | - else |
|
| 281 | - { |
|
| 282 | - $html = $this->modifyHeader( $html, $uid ); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - return $html; |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * Returns the sub-client given by its name. |
|
| 291 | - * |
|
| 292 | - * @param string $type Name of the client type |
|
| 293 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 294 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 295 | - */ |
|
| 296 | - public function getSubClient( $type, $name = null ) |
|
| 297 | - { |
|
| 298 | - /** client/html/catalog/lists/decorators/excludes |
|
| 299 | - * Excludes decorators added by the "common" option from the catalog list html client |
|
| 300 | - * |
|
| 301 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 302 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 303 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 304 | - * modify what is returned to the caller. |
|
| 305 | - * |
|
| 306 | - * This option allows you to remove a decorator added via |
|
| 307 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 308 | - * around the html client. |
|
| 309 | - * |
|
| 310 | - * client/html/catalog/lists/decorators/excludes = array( 'decorator1' ) |
|
| 311 | - * |
|
| 312 | - * This would remove the decorator named "decorator1" from the list of |
|
| 313 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 314 | - * "client/html/common/decorators/default" to the html client. |
|
| 315 | - * |
|
| 316 | - * @param array List of decorator names |
|
| 317 | - * @since 2014.05 |
|
| 318 | - * @category Developer |
|
| 319 | - * @see client/html/common/decorators/default |
|
| 320 | - * @see client/html/catalog/lists/decorators/global |
|
| 321 | - * @see client/html/catalog/lists/decorators/local |
|
| 322 | - */ |
|
| 323 | - |
|
| 324 | - /** client/html/catalog/lists/decorators/global |
|
| 325 | - * Adds a list of globally available decorators only to the catalog list html client |
|
| 326 | - * |
|
| 327 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 328 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 329 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 330 | - * modify what is returned to the caller. |
|
| 331 | - * |
|
| 332 | - * This option allows you to wrap global decorators |
|
| 333 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 334 | - * |
|
| 335 | - * client/html/catalog/lists/decorators/global = array( 'decorator1' ) |
|
| 336 | - * |
|
| 337 | - * This would add the decorator named "decorator1" defined by |
|
| 338 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 339 | - * |
|
| 340 | - * @param array List of decorator names |
|
| 341 | - * @since 2014.05 |
|
| 342 | - * @category Developer |
|
| 343 | - * @see client/html/common/decorators/default |
|
| 344 | - * @see client/html/catalog/lists/decorators/excludes |
|
| 345 | - * @see client/html/catalog/lists/decorators/local |
|
| 346 | - */ |
|
| 347 | - |
|
| 348 | - /** client/html/catalog/lists/decorators/local |
|
| 349 | - * Adds a list of local decorators only to the catalog list html client |
|
| 350 | - * |
|
| 351 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 352 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 353 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 354 | - * modify what is returned to the caller. |
|
| 355 | - * |
|
| 356 | - * This option allows you to wrap local decorators |
|
| 357 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 358 | - * |
|
| 359 | - * client/html/catalog/lists/decorators/local = array( 'decorator2' ) |
|
| 360 | - * |
|
| 361 | - * This would add the decorator named "decorator2" defined by |
|
| 362 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 363 | - * |
|
| 364 | - * @param array List of decorator names |
|
| 365 | - * @since 2014.05 |
|
| 366 | - * @category Developer |
|
| 367 | - * @see client/html/common/decorators/default |
|
| 368 | - * @see client/html/catalog/lists/decorators/excludes |
|
| 369 | - * @see client/html/catalog/lists/decorators/global |
|
| 370 | - */ |
|
| 371 | - |
|
| 372 | - return $this->createSubClient( 'catalog/lists/' . $type, $name ); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - |
|
| 376 | - /** |
|
| 377 | - * Processes the input, e.g. store given values. |
|
| 378 | - * A view must be available and this method doesn't generate any output |
|
| 379 | - * besides setting view variables. |
|
| 380 | - */ |
|
| 381 | - public function process() |
|
| 382 | - { |
|
| 383 | - $context = $this->getContext(); |
|
| 384 | - $view = $this->getView(); |
|
| 385 | - |
|
| 386 | - try |
|
| 387 | - { |
|
| 388 | - $site = $context->getLocale()->getSite()->getCode(); |
|
| 389 | - $params = $this->getClientParams( $view->param() ); |
|
| 390 | - $context->getSession()->set( 'aimeos/catalog/lists/params/last/' . $site, $params ); |
|
| 391 | - |
|
| 392 | - parent::process(); |
|
| 393 | - } |
|
| 394 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 395 | - { |
|
| 396 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 397 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 398 | - } |
|
| 399 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 400 | - { |
|
| 401 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 402 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 403 | - } |
|
| 404 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 405 | - { |
|
| 406 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 407 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 408 | - } |
|
| 409 | - catch( \Exception $e ) |
|
| 410 | - { |
|
| 411 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 412 | - |
|
| 413 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 414 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - |
|
| 419 | - /** |
|
| 420 | - * Returns the list of sub-client names configured for the client. |
|
| 421 | - * |
|
| 422 | - * @return array List of HTML client names |
|
| 423 | - */ |
|
| 424 | - protected function getSubClientNames() |
|
| 425 | - { |
|
| 426 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - |
|
| 430 | - /** |
|
| 431 | - * Sets the necessary parameter values in the view. |
|
| 432 | - * |
|
| 433 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 434 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 435 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 436 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 437 | - */ |
|
| 438 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 439 | - { |
|
| 440 | - if( !isset( $this->cache ) ) |
|
| 441 | - { |
|
| 442 | - $context = $this->getContext(); |
|
| 443 | - $config = $context->getConfig(); |
|
| 444 | - |
|
| 445 | - $products = $this->getProductList( $view ); |
|
| 446 | - |
|
| 447 | - $text = (string) $view->param( 'f_search' ); |
|
| 448 | - $catid = (string) $view->param( 'f_catid' ); |
|
| 449 | - |
|
| 450 | - if( $catid == '' ) { |
|
| 451 | - $catid = $config->get( 'client/html/catalog/lists/catid-default', '' ); |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - if( $text === '' && $catid !== '' ) |
|
| 455 | - { |
|
| 456 | - $domains = $config->get( 'client/html/catalog/domains', array( 'media', 'text' ) ); |
|
| 457 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 458 | - |
|
| 459 | - $listCatPath = $controller->getCatalogPath( $catid, $domains ); |
|
| 460 | - |
|
| 461 | - if( ( $categoryItem = end( $listCatPath ) ) !== false ) { |
|
| 462 | - $view->listCurrentCatItem = $categoryItem; |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - $view->listCatPath = $listCatPath; |
|
| 466 | - |
|
| 467 | - $this->addMetaItem( $listCatPath, 'catalog', $this->expire, $this->tags ); |
|
| 468 | - $this->addMetaList( array_keys( $listCatPath ), 'catalog', $this->expire ); |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - /** client/html/catalog/lists/stock/enable |
|
| 472 | - * Enables or disables displaying product stock levels in product list views |
|
| 473 | - * |
|
| 474 | - * This configuration option allows shop owners to display product |
|
| 475 | - * stock levels for each product in list views or to disable |
|
| 476 | - * fetching product stock information. |
|
| 477 | - * |
|
| 478 | - * The stock information is fetched via AJAX and inserted via Javascript. |
|
| 479 | - * This allows to cache product items by leaving out such highly |
|
| 480 | - * dynamic content like stock levels which changes with each order. |
|
| 481 | - * |
|
| 482 | - * @param boolean Value of "1" to display stock levels, "0" to disable displaying them |
|
| 483 | - * @since 2014.03 |
|
| 484 | - * @category User |
|
| 485 | - * @category Developer |
|
| 486 | - * @see client/html/catalog/detail/stock/enable |
|
| 487 | - * @see client/html/catalog/stock/url/target |
|
| 488 | - * @see client/html/catalog/stock/url/controller |
|
| 489 | - * @see client/html/catalog/stock/url/action |
|
| 490 | - * @see client/html/catalog/stock/url/config |
|
| 491 | - */ |
|
| 492 | - if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) { |
|
| 493 | - $view->listStockUrl = $this->getStockUrl( $view, array_keys( $products ) ); |
|
| 494 | - } |
|
| 495 | - |
|
| 496 | - |
|
| 497 | - $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 498 | - $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 499 | - |
|
| 500 | - // Delete cache when products are added or deleted even when in "tag-all" mode |
|
| 501 | - $this->tags[] = 'product'; |
|
| 502 | - |
|
| 503 | - $view->listParams = $this->getClientParams( $view->param() ); |
|
| 504 | - $view->listPageCurr = $this->getProductListPage( $view ); |
|
| 505 | - $view->listPageSize = $this->getProductListSize( $view ); |
|
| 506 | - $view->listProductTotal = $this->getProductListTotal( $view ); |
|
| 507 | - $view->listProductSort = $view->param( 'f_sort', 'relevance' ); |
|
| 508 | - $view->listProductItems = $products; |
|
| 509 | - |
|
| 510 | - $this->cache = $view; |
|
| 511 | - } |
|
| 512 | - |
|
| 513 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 514 | - $tags = array_merge( $tags, $this->tags ); |
|
| 515 | - |
|
| 516 | - return $this->cache; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - |
|
| 520 | - /** |
|
| 521 | - * Returns the URL to fetch the stock level details of the given products |
|
| 522 | - * |
|
| 523 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 524 | - * @param array $productIds List of product IDs |
|
| 525 | - * @return string Generated stock level URL |
|
| 526 | - */ |
|
| 527 | - protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds ) |
|
| 528 | - { |
|
| 529 | - /** client/html/catalog/stock/url/target |
|
| 530 | - * Destination of the URL where the controller specified in the URL is known |
|
| 531 | - * |
|
| 532 | - * The destination can be a page ID like in a content management system or the |
|
| 533 | - * module of a software development framework. This "target" must contain or know |
|
| 534 | - * the controller that should be called by the generated URL. |
|
| 535 | - * |
|
| 536 | - * @param string Destination of the URL |
|
| 537 | - * @since 2014.03 |
|
| 538 | - * @category Developer |
|
| 539 | - * @see client/html/catalog/stock/url/controller |
|
| 540 | - * @see client/html/catalog/stock/url/action |
|
| 541 | - * @see client/html/catalog/stock/url/config |
|
| 542 | - */ |
|
| 543 | - $stockTarget = $view->config( 'client/html/catalog/stock/url/target' ); |
|
| 544 | - |
|
| 545 | - /** client/html/catalog/stock/url/controller |
|
| 546 | - * Name of the controller whose action should be called |
|
| 547 | - * |
|
| 548 | - * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 549 | - * that create parts of the output displayed in the generated HTML page. Controller |
|
| 550 | - * names are usually alpha-numeric. |
|
| 551 | - * |
|
| 552 | - * @param string Name of the controller |
|
| 553 | - * @since 2014.03 |
|
| 554 | - * @category Developer |
|
| 555 | - * @see client/html/catalog/stock/url/target |
|
| 556 | - * @see client/html/catalog/stock/url/action |
|
| 557 | - * @see client/html/catalog/stock/url/config |
|
| 558 | - */ |
|
| 559 | - $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 560 | - |
|
| 561 | - /** client/html/catalog/stock/url/action |
|
| 562 | - * Name of the action that should create the output |
|
| 563 | - * |
|
| 564 | - * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 565 | - * controller that create parts of the output displayed in the generated HTML page. |
|
| 566 | - * Action names are usually alpha-numeric. |
|
| 567 | - * |
|
| 568 | - * @param string Name of the action |
|
| 569 | - * @since 2014.03 |
|
| 570 | - * @category Developer |
|
| 571 | - * @see client/html/catalog/stock/url/target |
|
| 572 | - * @see client/html/catalog/stock/url/controller |
|
| 573 | - * @see client/html/catalog/stock/url/config |
|
| 574 | - */ |
|
| 575 | - $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 576 | - |
|
| 577 | - /** client/html/catalog/stock/url/config |
|
| 578 | - * Associative list of configuration options used for generating the URL |
|
| 579 | - * |
|
| 580 | - * You can specify additional options as key/value pairs used when generating |
|
| 581 | - * the URLs, like |
|
| 582 | - * |
|
| 583 | - * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 584 | - * |
|
| 585 | - * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 586 | - * framework. This is because the infrastructure of the application is used for |
|
| 587 | - * generating the URLs. The full list of available config options is referenced |
|
| 588 | - * in the "see also" section of this page. |
|
| 589 | - * |
|
| 590 | - * @param string Associative list of configuration options |
|
| 591 | - * @since 2014.03 |
|
| 592 | - * @category Developer |
|
| 593 | - * @see client/html/catalog/stock/url/target |
|
| 594 | - * @see client/html/catalog/stock/url/controller |
|
| 595 | - * @see client/html/catalog/stock/url/action |
|
| 596 | - * @see client/html/url/config |
|
| 597 | - */ |
|
| 598 | - $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() ); |
|
| 599 | - |
|
| 600 | - sort( $productIds ); |
|
| 601 | - |
|
| 602 | - $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 603 | - return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 604 | - } |
|
| 25 | + /** client/html/catalog/lists/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog list section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/lists/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/catalog/lists/head/name |
|
| 61 | + * Name of the head part used by the catalog list client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Head\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.03 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/catalog/lists/promo/name |
|
| 72 | + * Name of the promotion part used by the catalog list client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Promo\Myname". |
|
| 75 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | + * |
|
| 77 | + * @param string Last part of the client class name |
|
| 78 | + * @since 2014.03 |
|
| 79 | + * @category Developer |
|
| 80 | + */ |
|
| 81 | + |
|
| 82 | + /** client/html/catalog/lists/quote/name |
|
| 83 | + * Name of the quote part used by the catalog list client implementation |
|
| 84 | + * |
|
| 85 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Quote\Myname". |
|
| 86 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | + * |
|
| 88 | + * @param string Last part of the client class name |
|
| 89 | + * @since 2014.03 |
|
| 90 | + * @category Developer |
|
| 91 | + */ |
|
| 92 | + |
|
| 93 | + /** client/html/catalog/lists/pagination/name |
|
| 94 | + * Name of the pagination part used by the catalog list client implementation |
|
| 95 | + * |
|
| 96 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Pagination\Myname". |
|
| 97 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 98 | + * |
|
| 99 | + * @param string Last part of the client class name |
|
| 100 | + * @since 2014.03 |
|
| 101 | + * @category Developer |
|
| 102 | + */ |
|
| 103 | + |
|
| 104 | + /** client/html/catalog/lists/items/name |
|
| 105 | + * Name of the items part used by the catalog list client implementation |
|
| 106 | + * |
|
| 107 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Lists\Items\Myname". |
|
| 108 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 109 | + * |
|
| 110 | + * @param string Last part of the client class name |
|
| 111 | + * @since 2014.03 |
|
| 112 | + * @category Developer |
|
| 113 | + */ |
|
| 114 | + private $subPartNames = array( 'head', 'quote', 'promo', 'pagination', 'items', 'pagination' ); |
|
| 115 | + |
|
| 116 | + private $tags = array(); |
|
| 117 | + private $expire; |
|
| 118 | + private $cache; |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Returns the HTML code for insertion into the body. |
|
| 123 | + * |
|
| 124 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 125 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 126 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 127 | + * @return string HTML code |
|
| 128 | + */ |
|
| 129 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 130 | + { |
|
| 131 | + $prefixes = array( 'f', 'l' ); |
|
| 132 | + $context = $this->getContext(); |
|
| 133 | + |
|
| 134 | + /** client/html/catalog/list |
|
| 135 | + * All parameters defined for the catalog list component and its subparts |
|
| 136 | + * |
|
| 137 | + * This returns all settings related to the filter component. |
|
| 138 | + * Please refer to the single settings for details. |
|
| 139 | + * |
|
| 140 | + * @param array Associative list of name/value settings |
|
| 141 | + * @category Developer |
|
| 142 | + * @see client/html/catalog#list |
|
| 143 | + */ |
|
| 144 | + $confkey = 'client/html/catalog/list'; |
|
| 145 | + |
|
| 146 | + if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 147 | + { |
|
| 148 | + $view = $this->getView(); |
|
| 149 | + |
|
| 150 | + try |
|
| 151 | + { |
|
| 152 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 153 | + |
|
| 154 | + $html = ''; |
|
| 155 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 156 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 157 | + } |
|
| 158 | + $view->listBody = $html; |
|
| 159 | + } |
|
| 160 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 161 | + { |
|
| 162 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 163 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 164 | + } |
|
| 165 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 166 | + { |
|
| 167 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 168 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 169 | + } |
|
| 170 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 171 | + { |
|
| 172 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 173 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 174 | + } |
|
| 175 | + catch( \Exception $e ) |
|
| 176 | + { |
|
| 177 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 178 | + |
|
| 179 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 180 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** client/html/catalog/lists/standard/template-body |
|
| 184 | + * Relative path to the HTML body template of the catalog list client. |
|
| 185 | + * |
|
| 186 | + * The template file contains the HTML code and processing instructions |
|
| 187 | + * to generate the result shown in the body of the frontend. The |
|
| 188 | + * configuration string is the path to the template file relative |
|
| 189 | + * to the templates directory (usually in client/html/templates). |
|
| 190 | + * |
|
| 191 | + * You can overwrite the template file configuration in extensions and |
|
| 192 | + * provide alternative templates. These alternative templates should be |
|
| 193 | + * named like the default one but with the string "standard" replaced by |
|
| 194 | + * an unique name. You may use the name of your project for this. If |
|
| 195 | + * you've implemented an alternative client class as well, "standard" |
|
| 196 | + * should be replaced by the name of the new class. |
|
| 197 | + * |
|
| 198 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 199 | + * @since 2014.03 |
|
| 200 | + * @category Developer |
|
| 201 | + * @see client/html/catalog/lists/standard/template-header |
|
| 202 | + */ |
|
| 203 | + $tplconf = 'client/html/catalog/lists/standard/template-body'; |
|
| 204 | + $default = 'catalog/lists/body-default.php'; |
|
| 205 | + |
|
| 206 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 207 | + |
|
| 208 | + $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 209 | + } |
|
| 210 | + else |
|
| 211 | + { |
|
| 212 | + $html = $this->modifyBody( $html, $uid ); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + return $html; |
|
| 216 | + } |
|
| 217 | + |
|
| 218 | + |
|
| 219 | + /** |
|
| 220 | + * Returns the HTML string for insertion into the header. |
|
| 221 | + * |
|
| 222 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 223 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 224 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 225 | + * @return string|null String including HTML tags for the header on error |
|
| 226 | + */ |
|
| 227 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 228 | + { |
|
| 229 | + $prefixes = array( 'f', 'l' ); |
|
| 230 | + $context = $this->getContext(); |
|
| 231 | + $confkey = 'client/html/catalog/list'; |
|
| 232 | + |
|
| 233 | + if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 234 | + { |
|
| 235 | + $view = $this->getView(); |
|
| 236 | + |
|
| 237 | + try |
|
| 238 | + { |
|
| 239 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 240 | + |
|
| 241 | + $html = ''; |
|
| 242 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 243 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 244 | + } |
|
| 245 | + $view->listHeader = $html; |
|
| 246 | + } |
|
| 247 | + catch( \Exception $e ) |
|
| 248 | + { |
|
| 249 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + /** client/html/catalog/lists/standard/template-header |
|
| 253 | + * Relative path to the HTML header template of the catalog list client. |
|
| 254 | + * |
|
| 255 | + * The template file contains the HTML code and processing instructions |
|
| 256 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 257 | + * of the rendered page in the frontend. The configuration string is the |
|
| 258 | + * path to the template file relative to the templates directory (usually |
|
| 259 | + * in client/html/templates). |
|
| 260 | + * |
|
| 261 | + * You can overwrite the template file configuration in extensions and |
|
| 262 | + * provide alternative templates. These alternative templates should be |
|
| 263 | + * named like the default one but with the string "standard" replaced by |
|
| 264 | + * an unique name. You may use the name of your project for this. If |
|
| 265 | + * you've implemented an alternative client class as well, "standard" |
|
| 266 | + * should be replaced by the name of the new class. |
|
| 267 | + * |
|
| 268 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 269 | + * @since 2014.03 |
|
| 270 | + * @category Developer |
|
| 271 | + * @see client/html/catalog/lists/standard/template-body |
|
| 272 | + */ |
|
| 273 | + $tplconf = 'client/html/catalog/lists/standard/template-header'; |
|
| 274 | + $default = 'catalog/lists/header-default.php'; |
|
| 275 | + |
|
| 276 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 277 | + |
|
| 278 | + $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 279 | + } |
|
| 280 | + else |
|
| 281 | + { |
|
| 282 | + $html = $this->modifyHeader( $html, $uid ); |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + return $html; |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * Returns the sub-client given by its name. |
|
| 291 | + * |
|
| 292 | + * @param string $type Name of the client type |
|
| 293 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 294 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 295 | + */ |
|
| 296 | + public function getSubClient( $type, $name = null ) |
|
| 297 | + { |
|
| 298 | + /** client/html/catalog/lists/decorators/excludes |
|
| 299 | + * Excludes decorators added by the "common" option from the catalog list html client |
|
| 300 | + * |
|
| 301 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 302 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 303 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 304 | + * modify what is returned to the caller. |
|
| 305 | + * |
|
| 306 | + * This option allows you to remove a decorator added via |
|
| 307 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 308 | + * around the html client. |
|
| 309 | + * |
|
| 310 | + * client/html/catalog/lists/decorators/excludes = array( 'decorator1' ) |
|
| 311 | + * |
|
| 312 | + * This would remove the decorator named "decorator1" from the list of |
|
| 313 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 314 | + * "client/html/common/decorators/default" to the html client. |
|
| 315 | + * |
|
| 316 | + * @param array List of decorator names |
|
| 317 | + * @since 2014.05 |
|
| 318 | + * @category Developer |
|
| 319 | + * @see client/html/common/decorators/default |
|
| 320 | + * @see client/html/catalog/lists/decorators/global |
|
| 321 | + * @see client/html/catalog/lists/decorators/local |
|
| 322 | + */ |
|
| 323 | + |
|
| 324 | + /** client/html/catalog/lists/decorators/global |
|
| 325 | + * Adds a list of globally available decorators only to the catalog list html client |
|
| 326 | + * |
|
| 327 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 328 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 329 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 330 | + * modify what is returned to the caller. |
|
| 331 | + * |
|
| 332 | + * This option allows you to wrap global decorators |
|
| 333 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 334 | + * |
|
| 335 | + * client/html/catalog/lists/decorators/global = array( 'decorator1' ) |
|
| 336 | + * |
|
| 337 | + * This would add the decorator named "decorator1" defined by |
|
| 338 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 339 | + * |
|
| 340 | + * @param array List of decorator names |
|
| 341 | + * @since 2014.05 |
|
| 342 | + * @category Developer |
|
| 343 | + * @see client/html/common/decorators/default |
|
| 344 | + * @see client/html/catalog/lists/decorators/excludes |
|
| 345 | + * @see client/html/catalog/lists/decorators/local |
|
| 346 | + */ |
|
| 347 | + |
|
| 348 | + /** client/html/catalog/lists/decorators/local |
|
| 349 | + * Adds a list of local decorators only to the catalog list html client |
|
| 350 | + * |
|
| 351 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 352 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 353 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 354 | + * modify what is returned to the caller. |
|
| 355 | + * |
|
| 356 | + * This option allows you to wrap local decorators |
|
| 357 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 358 | + * |
|
| 359 | + * client/html/catalog/lists/decorators/local = array( 'decorator2' ) |
|
| 360 | + * |
|
| 361 | + * This would add the decorator named "decorator2" defined by |
|
| 362 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 363 | + * |
|
| 364 | + * @param array List of decorator names |
|
| 365 | + * @since 2014.05 |
|
| 366 | + * @category Developer |
|
| 367 | + * @see client/html/common/decorators/default |
|
| 368 | + * @see client/html/catalog/lists/decorators/excludes |
|
| 369 | + * @see client/html/catalog/lists/decorators/global |
|
| 370 | + */ |
|
| 371 | + |
|
| 372 | + return $this->createSubClient( 'catalog/lists/' . $type, $name ); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + |
|
| 376 | + /** |
|
| 377 | + * Processes the input, e.g. store given values. |
|
| 378 | + * A view must be available and this method doesn't generate any output |
|
| 379 | + * besides setting view variables. |
|
| 380 | + */ |
|
| 381 | + public function process() |
|
| 382 | + { |
|
| 383 | + $context = $this->getContext(); |
|
| 384 | + $view = $this->getView(); |
|
| 385 | + |
|
| 386 | + try |
|
| 387 | + { |
|
| 388 | + $site = $context->getLocale()->getSite()->getCode(); |
|
| 389 | + $params = $this->getClientParams( $view->param() ); |
|
| 390 | + $context->getSession()->set( 'aimeos/catalog/lists/params/last/' . $site, $params ); |
|
| 391 | + |
|
| 392 | + parent::process(); |
|
| 393 | + } |
|
| 394 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 395 | + { |
|
| 396 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 397 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 398 | + } |
|
| 399 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 400 | + { |
|
| 401 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 402 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 403 | + } |
|
| 404 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 405 | + { |
|
| 406 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 407 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 408 | + } |
|
| 409 | + catch( \Exception $e ) |
|
| 410 | + { |
|
| 411 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 412 | + |
|
| 413 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 414 | + $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + |
|
| 419 | + /** |
|
| 420 | + * Returns the list of sub-client names configured for the client. |
|
| 421 | + * |
|
| 422 | + * @return array List of HTML client names |
|
| 423 | + */ |
|
| 424 | + protected function getSubClientNames() |
|
| 425 | + { |
|
| 426 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + |
|
| 430 | + /** |
|
| 431 | + * Sets the necessary parameter values in the view. |
|
| 432 | + * |
|
| 433 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 434 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 435 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 436 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 437 | + */ |
|
| 438 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 439 | + { |
|
| 440 | + if( !isset( $this->cache ) ) |
|
| 441 | + { |
|
| 442 | + $context = $this->getContext(); |
|
| 443 | + $config = $context->getConfig(); |
|
| 444 | + |
|
| 445 | + $products = $this->getProductList( $view ); |
|
| 446 | + |
|
| 447 | + $text = (string) $view->param( 'f_search' ); |
|
| 448 | + $catid = (string) $view->param( 'f_catid' ); |
|
| 449 | + |
|
| 450 | + if( $catid == '' ) { |
|
| 451 | + $catid = $config->get( 'client/html/catalog/lists/catid-default', '' ); |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + if( $text === '' && $catid !== '' ) |
|
| 455 | + { |
|
| 456 | + $domains = $config->get( 'client/html/catalog/domains', array( 'media', 'text' ) ); |
|
| 457 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 458 | + |
|
| 459 | + $listCatPath = $controller->getCatalogPath( $catid, $domains ); |
|
| 460 | + |
|
| 461 | + if( ( $categoryItem = end( $listCatPath ) ) !== false ) { |
|
| 462 | + $view->listCurrentCatItem = $categoryItem; |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + $view->listCatPath = $listCatPath; |
|
| 466 | + |
|
| 467 | + $this->addMetaItem( $listCatPath, 'catalog', $this->expire, $this->tags ); |
|
| 468 | + $this->addMetaList( array_keys( $listCatPath ), 'catalog', $this->expire ); |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + /** client/html/catalog/lists/stock/enable |
|
| 472 | + * Enables or disables displaying product stock levels in product list views |
|
| 473 | + * |
|
| 474 | + * This configuration option allows shop owners to display product |
|
| 475 | + * stock levels for each product in list views or to disable |
|
| 476 | + * fetching product stock information. |
|
| 477 | + * |
|
| 478 | + * The stock information is fetched via AJAX and inserted via Javascript. |
|
| 479 | + * This allows to cache product items by leaving out such highly |
|
| 480 | + * dynamic content like stock levels which changes with each order. |
|
| 481 | + * |
|
| 482 | + * @param boolean Value of "1" to display stock levels, "0" to disable displaying them |
|
| 483 | + * @since 2014.03 |
|
| 484 | + * @category User |
|
| 485 | + * @category Developer |
|
| 486 | + * @see client/html/catalog/detail/stock/enable |
|
| 487 | + * @see client/html/catalog/stock/url/target |
|
| 488 | + * @see client/html/catalog/stock/url/controller |
|
| 489 | + * @see client/html/catalog/stock/url/action |
|
| 490 | + * @see client/html/catalog/stock/url/config |
|
| 491 | + */ |
|
| 492 | + if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) { |
|
| 493 | + $view->listStockUrl = $this->getStockUrl( $view, array_keys( $products ) ); |
|
| 494 | + } |
|
| 495 | + |
|
| 496 | + |
|
| 497 | + $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 498 | + $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 499 | + |
|
| 500 | + // Delete cache when products are added or deleted even when in "tag-all" mode |
|
| 501 | + $this->tags[] = 'product'; |
|
| 502 | + |
|
| 503 | + $view->listParams = $this->getClientParams( $view->param() ); |
|
| 504 | + $view->listPageCurr = $this->getProductListPage( $view ); |
|
| 505 | + $view->listPageSize = $this->getProductListSize( $view ); |
|
| 506 | + $view->listProductTotal = $this->getProductListTotal( $view ); |
|
| 507 | + $view->listProductSort = $view->param( 'f_sort', 'relevance' ); |
|
| 508 | + $view->listProductItems = $products; |
|
| 509 | + |
|
| 510 | + $this->cache = $view; |
|
| 511 | + } |
|
| 512 | + |
|
| 513 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 514 | + $tags = array_merge( $tags, $this->tags ); |
|
| 515 | + |
|
| 516 | + return $this->cache; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + |
|
| 520 | + /** |
|
| 521 | + * Returns the URL to fetch the stock level details of the given products |
|
| 522 | + * |
|
| 523 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 524 | + * @param array $productIds List of product IDs |
|
| 525 | + * @return string Generated stock level URL |
|
| 526 | + */ |
|
| 527 | + protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds ) |
|
| 528 | + { |
|
| 529 | + /** client/html/catalog/stock/url/target |
|
| 530 | + * Destination of the URL where the controller specified in the URL is known |
|
| 531 | + * |
|
| 532 | + * The destination can be a page ID like in a content management system or the |
|
| 533 | + * module of a software development framework. This "target" must contain or know |
|
| 534 | + * the controller that should be called by the generated URL. |
|
| 535 | + * |
|
| 536 | + * @param string Destination of the URL |
|
| 537 | + * @since 2014.03 |
|
| 538 | + * @category Developer |
|
| 539 | + * @see client/html/catalog/stock/url/controller |
|
| 540 | + * @see client/html/catalog/stock/url/action |
|
| 541 | + * @see client/html/catalog/stock/url/config |
|
| 542 | + */ |
|
| 543 | + $stockTarget = $view->config( 'client/html/catalog/stock/url/target' ); |
|
| 544 | + |
|
| 545 | + /** client/html/catalog/stock/url/controller |
|
| 546 | + * Name of the controller whose action should be called |
|
| 547 | + * |
|
| 548 | + * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 549 | + * that create parts of the output displayed in the generated HTML page. Controller |
|
| 550 | + * names are usually alpha-numeric. |
|
| 551 | + * |
|
| 552 | + * @param string Name of the controller |
|
| 553 | + * @since 2014.03 |
|
| 554 | + * @category Developer |
|
| 555 | + * @see client/html/catalog/stock/url/target |
|
| 556 | + * @see client/html/catalog/stock/url/action |
|
| 557 | + * @see client/html/catalog/stock/url/config |
|
| 558 | + */ |
|
| 559 | + $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 560 | + |
|
| 561 | + /** client/html/catalog/stock/url/action |
|
| 562 | + * Name of the action that should create the output |
|
| 563 | + * |
|
| 564 | + * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 565 | + * controller that create parts of the output displayed in the generated HTML page. |
|
| 566 | + * Action names are usually alpha-numeric. |
|
| 567 | + * |
|
| 568 | + * @param string Name of the action |
|
| 569 | + * @since 2014.03 |
|
| 570 | + * @category Developer |
|
| 571 | + * @see client/html/catalog/stock/url/target |
|
| 572 | + * @see client/html/catalog/stock/url/controller |
|
| 573 | + * @see client/html/catalog/stock/url/config |
|
| 574 | + */ |
|
| 575 | + $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 576 | + |
|
| 577 | + /** client/html/catalog/stock/url/config |
|
| 578 | + * Associative list of configuration options used for generating the URL |
|
| 579 | + * |
|
| 580 | + * You can specify additional options as key/value pairs used when generating |
|
| 581 | + * the URLs, like |
|
| 582 | + * |
|
| 583 | + * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 584 | + * |
|
| 585 | + * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 586 | + * framework. This is because the infrastructure of the application is used for |
|
| 587 | + * generating the URLs. The full list of available config options is referenced |
|
| 588 | + * in the "see also" section of this page. |
|
| 589 | + * |
|
| 590 | + * @param string Associative list of configuration options |
|
| 591 | + * @since 2014.03 |
|
| 592 | + * @category Developer |
|
| 593 | + * @see client/html/catalog/stock/url/target |
|
| 594 | + * @see client/html/catalog/stock/url/controller |
|
| 595 | + * @see client/html/catalog/stock/url/action |
|
| 596 | + * @see client/html/url/config |
|
| 597 | + */ |
|
| 598 | + $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() ); |
|
| 599 | + |
|
| 600 | + sort( $productIds ); |
|
| 601 | + |
|
| 602 | + $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 603 | + return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 604 | + } |
|
| 605 | 605 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @since 2014.03 |
| 112 | 112 | * @category Developer |
| 113 | 113 | */ |
| 114 | - private $subPartNames = array( 'head', 'quote', 'promo', 'pagination', 'items', 'pagination' ); |
|
| 114 | + private $subPartNames = array('head', 'quote', 'promo', 'pagination', 'items', 'pagination'); |
|
| 115 | 115 | |
| 116 | 116 | private $tags = array(); |
| 117 | 117 | private $expire; |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 127 | 127 | * @return string HTML code |
| 128 | 128 | */ |
| 129 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 129 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 130 | 130 | { |
| 131 | - $prefixes = array( 'f', 'l' ); |
|
| 131 | + $prefixes = array('f', 'l'); |
|
| 132 | 132 | $context = $this->getContext(); |
| 133 | 133 | |
| 134 | 134 | /** client/html/catalog/list |
@@ -143,41 +143,41 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | $confkey = 'client/html/catalog/list'; |
| 145 | 145 | |
| 146 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 146 | + if ($context->getUserId() != null || ($html = $this->getCached('body', $uid, $prefixes, $confkey)) === null) |
|
| 147 | 147 | { |
| 148 | 148 | $view = $this->getView(); |
| 149 | 149 | |
| 150 | 150 | try |
| 151 | 151 | { |
| 152 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 152 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 153 | 153 | |
| 154 | 154 | $html = ''; |
| 155 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 156 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 155 | + foreach ($this->getSubClients() as $subclient) { |
|
| 156 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 157 | 157 | } |
| 158 | 158 | $view->listBody = $html; |
| 159 | 159 | } |
| 160 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 160 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 161 | 161 | { |
| 162 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 163 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 162 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 163 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 164 | 164 | } |
| 165 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 165 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 166 | 166 | { |
| 167 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 168 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 167 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 168 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 169 | 169 | } |
| 170 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 170 | + catch (\Aimeos\MShop\Exception $e) |
|
| 171 | 171 | { |
| 172 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 173 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 172 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 173 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 174 | 174 | } |
| 175 | - catch( \Exception $e ) |
|
| 175 | + catch (\Exception $e) |
|
| 176 | 176 | { |
| 177 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 177 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 178 | 178 | |
| 179 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 180 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 179 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 180 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** client/html/catalog/lists/standard/template-body |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | $tplconf = 'client/html/catalog/lists/standard/template-body'; |
| 204 | 204 | $default = 'catalog/lists/body-default.php'; |
| 205 | 205 | |
| 206 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 206 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 207 | 207 | |
| 208 | - $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 208 | + $this->setCached('body', $uid, $prefixes, $confkey, $html, $tags, $expire); |
|
| 209 | 209 | } |
| 210 | 210 | else |
| 211 | 211 | { |
| 212 | - $html = $this->modifyBody( $html, $uid ); |
|
| 212 | + $html = $this->modifyBody($html, $uid); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | return $html; |
@@ -224,29 +224,29 @@ discard block |
||
| 224 | 224 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 225 | 225 | * @return string|null String including HTML tags for the header on error |
| 226 | 226 | */ |
| 227 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 227 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 228 | 228 | { |
| 229 | - $prefixes = array( 'f', 'l' ); |
|
| 229 | + $prefixes = array('f', 'l'); |
|
| 230 | 230 | $context = $this->getContext(); |
| 231 | 231 | $confkey = 'client/html/catalog/list'; |
| 232 | 232 | |
| 233 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 233 | + if ($context->getUserId() != null || ($html = $this->getCached('header', $uid, $prefixes, $confkey)) === null) |
|
| 234 | 234 | { |
| 235 | 235 | $view = $this->getView(); |
| 236 | 236 | |
| 237 | 237 | try |
| 238 | 238 | { |
| 239 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 239 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 240 | 240 | |
| 241 | 241 | $html = ''; |
| 242 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 243 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 242 | + foreach ($this->getSubClients() as $subclient) { |
|
| 243 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 244 | 244 | } |
| 245 | 245 | $view->listHeader = $html; |
| 246 | 246 | } |
| 247 | - catch( \Exception $e ) |
|
| 247 | + catch (\Exception $e) |
|
| 248 | 248 | { |
| 249 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 249 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | /** client/html/catalog/lists/standard/template-header |
@@ -273,13 +273,13 @@ discard block |
||
| 273 | 273 | $tplconf = 'client/html/catalog/lists/standard/template-header'; |
| 274 | 274 | $default = 'catalog/lists/header-default.php'; |
| 275 | 275 | |
| 276 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 276 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 277 | 277 | |
| 278 | - $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 278 | + $this->setCached('header', $uid, $prefixes, $confkey, $html, $tags, $expire); |
|
| 279 | 279 | } |
| 280 | 280 | else |
| 281 | 281 | { |
| 282 | - $html = $this->modifyHeader( $html, $uid ); |
|
| 282 | + $html = $this->modifyHeader($html, $uid); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | return $html; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * @param string|null $name Name of the sub-client (Default if null) |
| 294 | 294 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 295 | 295 | */ |
| 296 | - public function getSubClient( $type, $name = null ) |
|
| 296 | + public function getSubClient($type, $name = null) |
|
| 297 | 297 | { |
| 298 | 298 | /** client/html/catalog/lists/decorators/excludes |
| 299 | 299 | * Excludes decorators added by the "common" option from the catalog list html client |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | * @see client/html/catalog/lists/decorators/global |
| 370 | 370 | */ |
| 371 | 371 | |
| 372 | - return $this->createSubClient( 'catalog/lists/' . $type, $name ); |
|
| 372 | + return $this->createSubClient('catalog/lists/'.$type, $name); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | |
@@ -386,32 +386,32 @@ discard block |
||
| 386 | 386 | try |
| 387 | 387 | { |
| 388 | 388 | $site = $context->getLocale()->getSite()->getCode(); |
| 389 | - $params = $this->getClientParams( $view->param() ); |
|
| 390 | - $context->getSession()->set( 'aimeos/catalog/lists/params/last/' . $site, $params ); |
|
| 389 | + $params = $this->getClientParams($view->param()); |
|
| 390 | + $context->getSession()->set('aimeos/catalog/lists/params/last/'.$site, $params); |
|
| 391 | 391 | |
| 392 | 392 | parent::process(); |
| 393 | 393 | } |
| 394 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 394 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 395 | 395 | { |
| 396 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 397 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 396 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 397 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 398 | 398 | } |
| 399 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 399 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 400 | 400 | { |
| 401 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 402 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 401 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 402 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 403 | 403 | } |
| 404 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 404 | + catch (\Aimeos\MShop\Exception $e) |
|
| 405 | 405 | { |
| 406 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 407 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 406 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 407 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 408 | 408 | } |
| 409 | - catch( \Exception $e ) |
|
| 409 | + catch (\Exception $e) |
|
| 410 | 410 | { |
| 411 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 411 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 412 | 412 | |
| 413 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 414 | - $view->listErrorList = $view->get( 'listErrorList', array() ) + $error; |
|
| 413 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 414 | + $view->listErrorList = $view->get('listErrorList', array()) + $error; |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | protected function getSubClientNames() |
| 425 | 425 | { |
| 426 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 426 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | |
@@ -435,37 +435,37 @@ discard block |
||
| 435 | 435 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 436 | 436 | * @return \Aimeos\MW\View\Iface Modified view object |
| 437 | 437 | */ |
| 438 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 438 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 439 | 439 | { |
| 440 | - if( !isset( $this->cache ) ) |
|
| 440 | + if (!isset($this->cache)) |
|
| 441 | 441 | { |
| 442 | 442 | $context = $this->getContext(); |
| 443 | 443 | $config = $context->getConfig(); |
| 444 | 444 | |
| 445 | - $products = $this->getProductList( $view ); |
|
| 445 | + $products = $this->getProductList($view); |
|
| 446 | 446 | |
| 447 | - $text = (string) $view->param( 'f_search' ); |
|
| 448 | - $catid = (string) $view->param( 'f_catid' ); |
|
| 447 | + $text = (string) $view->param('f_search'); |
|
| 448 | + $catid = (string) $view->param('f_catid'); |
|
| 449 | 449 | |
| 450 | - if( $catid == '' ) { |
|
| 451 | - $catid = $config->get( 'client/html/catalog/lists/catid-default', '' ); |
|
| 450 | + if ($catid == '') { |
|
| 451 | + $catid = $config->get('client/html/catalog/lists/catid-default', ''); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if( $text === '' && $catid !== '' ) |
|
| 454 | + if ($text === '' && $catid !== '') |
|
| 455 | 455 | { |
| 456 | - $domains = $config->get( 'client/html/catalog/domains', array( 'media', 'text' ) ); |
|
| 457 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 456 | + $domains = $config->get('client/html/catalog/domains', array('media', 'text')); |
|
| 457 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 458 | 458 | |
| 459 | - $listCatPath = $controller->getCatalogPath( $catid, $domains ); |
|
| 459 | + $listCatPath = $controller->getCatalogPath($catid, $domains); |
|
| 460 | 460 | |
| 461 | - if( ( $categoryItem = end( $listCatPath ) ) !== false ) { |
|
| 461 | + if (($categoryItem = end($listCatPath)) !== false) { |
|
| 462 | 462 | $view->listCurrentCatItem = $categoryItem; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | $view->listCatPath = $listCatPath; |
| 466 | 466 | |
| 467 | - $this->addMetaItem( $listCatPath, 'catalog', $this->expire, $this->tags ); |
|
| 468 | - $this->addMetaList( array_keys( $listCatPath ), 'catalog', $this->expire ); |
|
| 467 | + $this->addMetaItem($listCatPath, 'catalog', $this->expire, $this->tags); |
|
| 468 | + $this->addMetaList(array_keys($listCatPath), 'catalog', $this->expire); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /** client/html/catalog/lists/stock/enable |
@@ -489,29 +489,29 @@ discard block |
||
| 489 | 489 | * @see client/html/catalog/stock/url/action |
| 490 | 490 | * @see client/html/catalog/stock/url/config |
| 491 | 491 | */ |
| 492 | - if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) { |
|
| 493 | - $view->listStockUrl = $this->getStockUrl( $view, array_keys( $products ) ); |
|
| 492 | + if (!empty($products) && $config->get('client/html/catalog/lists/stock/enable', true) === true) { |
|
| 493 | + $view->listStockUrl = $this->getStockUrl($view, array_keys($products)); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
| 497 | - $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 498 | - $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 497 | + $this->addMetaItem($products, 'product', $this->expire, $this->tags); |
|
| 498 | + $this->addMetaList(array_keys($products), 'product', $this->expire); |
|
| 499 | 499 | |
| 500 | 500 | // Delete cache when products are added or deleted even when in "tag-all" mode |
| 501 | 501 | $this->tags[] = 'product'; |
| 502 | 502 | |
| 503 | - $view->listParams = $this->getClientParams( $view->param() ); |
|
| 504 | - $view->listPageCurr = $this->getProductListPage( $view ); |
|
| 505 | - $view->listPageSize = $this->getProductListSize( $view ); |
|
| 506 | - $view->listProductTotal = $this->getProductListTotal( $view ); |
|
| 507 | - $view->listProductSort = $view->param( 'f_sort', 'relevance' ); |
|
| 503 | + $view->listParams = $this->getClientParams($view->param()); |
|
| 504 | + $view->listPageCurr = $this->getProductListPage($view); |
|
| 505 | + $view->listPageSize = $this->getProductListSize($view); |
|
| 506 | + $view->listProductTotal = $this->getProductListTotal($view); |
|
| 507 | + $view->listProductSort = $view->param('f_sort', 'relevance'); |
|
| 508 | 508 | $view->listProductItems = $products; |
| 509 | 509 | |
| 510 | 510 | $this->cache = $view; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 514 | - $tags = array_merge( $tags, $this->tags ); |
|
| 513 | + $expire = $this->expires($this->expire, $expire); |
|
| 514 | + $tags = array_merge($tags, $this->tags); |
|
| 515 | 515 | |
| 516 | 516 | return $this->cache; |
| 517 | 517 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | * @param array $productIds List of product IDs |
| 525 | 525 | * @return string Generated stock level URL |
| 526 | 526 | */ |
| 527 | - protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds ) |
|
| 527 | + protected function getStockUrl(\Aimeos\MW\View\Iface $view, array $productIds) |
|
| 528 | 528 | { |
| 529 | 529 | /** client/html/catalog/stock/url/target |
| 530 | 530 | * Destination of the URL where the controller specified in the URL is known |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * @see client/html/catalog/stock/url/action |
| 541 | 541 | * @see client/html/catalog/stock/url/config |
| 542 | 542 | */ |
| 543 | - $stockTarget = $view->config( 'client/html/catalog/stock/url/target' ); |
|
| 543 | + $stockTarget = $view->config('client/html/catalog/stock/url/target'); |
|
| 544 | 544 | |
| 545 | 545 | /** client/html/catalog/stock/url/controller |
| 546 | 546 | * Name of the controller whose action should be called |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | * @see client/html/catalog/stock/url/action |
| 557 | 557 | * @see client/html/catalog/stock/url/config |
| 558 | 558 | */ |
| 559 | - $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 559 | + $stockController = $view->config('client/html/catalog/stock/url/controller', 'catalog'); |
|
| 560 | 560 | |
| 561 | 561 | /** client/html/catalog/stock/url/action |
| 562 | 562 | * Name of the action that should create the output |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | * @see client/html/catalog/stock/url/controller |
| 573 | 573 | * @see client/html/catalog/stock/url/config |
| 574 | 574 | */ |
| 575 | - $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 575 | + $stockAction = $view->config('client/html/catalog/stock/url/action', 'stock'); |
|
| 576 | 576 | |
| 577 | 577 | /** client/html/catalog/stock/url/config |
| 578 | 578 | * Associative list of configuration options used for generating the URL |
@@ -595,11 +595,11 @@ discard block |
||
| 595 | 595 | * @see client/html/catalog/stock/url/action |
| 596 | 596 | * @see client/html/url/config |
| 597 | 597 | */ |
| 598 | - $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() ); |
|
| 598 | + $stockConfig = $view->config('client/html/catalog/stock/url/config', array()); |
|
| 599 | 599 | |
| 600 | - sort( $productIds ); |
|
| 600 | + sort($productIds); |
|
| 601 | 601 | |
| 602 | - $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 603 | - return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 602 | + $params = array('s_prodid' => implode(' ', $productIds)); |
|
| 603 | + return $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); |
|
| 604 | 604 | } |
| 605 | 605 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -211,23 +211,19 @@ discard block |
||
| 211 | 211 | $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 212 | 212 | } |
| 213 | 213 | $view->detailBody = $output; |
| 214 | - } |
|
| 215 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 214 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 216 | 215 | { |
| 217 | 216 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 218 | 217 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 219 | - } |
|
| 220 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 218 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 221 | 219 | { |
| 222 | 220 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 223 | 221 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 224 | - } |
|
| 225 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 222 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 226 | 223 | { |
| 227 | 224 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 228 | 225 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 229 | - } |
|
| 230 | - catch( \Exception $e ) |
|
| 226 | + } catch( \Exception $e ) |
|
| 231 | 227 | { |
| 232 | 228 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 233 | 229 | |
@@ -261,8 +257,7 @@ discard block |
||
| 261 | 257 | $html = $view->render( $view->config( $tplconf, $default ) ); |
| 262 | 258 | |
| 263 | 259 | $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
| 264 | - } |
|
| 265 | - else |
|
| 260 | + } else |
|
| 266 | 261 | { |
| 267 | 262 | $html = $this->modifyBody( $html, $uid ); |
| 268 | 263 | } |
@@ -299,8 +294,7 @@ discard block |
||
| 299 | 294 | $output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
| 300 | 295 | } |
| 301 | 296 | $view->detailHeader = $output; |
| 302 | - } |
|
| 303 | - catch( \Exception $e ) |
|
| 297 | + } catch( \Exception $e ) |
|
| 304 | 298 | { |
| 305 | 299 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 306 | 300 | } |
@@ -332,8 +326,7 @@ discard block |
||
| 332 | 326 | $html = $view->render( $view->config( $tplconf, $default ) ); |
| 333 | 327 | |
| 334 | 328 | $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
| 335 | - } |
|
| 336 | - else |
|
| 329 | + } else |
|
| 337 | 330 | { |
| 338 | 331 | $html = $this->modifyHeader( $html, $uid ); |
| 339 | 332 | } |
@@ -446,23 +439,19 @@ discard block |
||
| 446 | 439 | $context->getSession()->set( 'aimeos/catalog/detail/params/last' . $site, $params ); |
| 447 | 440 | |
| 448 | 441 | parent::process(); |
| 449 | - } |
|
| 450 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 442 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 451 | 443 | { |
| 452 | 444 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 453 | 445 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 454 | - } |
|
| 455 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 446 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 456 | 447 | { |
| 457 | 448 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 458 | 449 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 459 | - } |
|
| 460 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 450 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 461 | 451 | { |
| 462 | 452 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 463 | 453 | $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error; |
| 464 | - } |
|
| 465 | - catch( \Exception $e ) |
|
| 454 | + } catch( \Exception $e ) |
|
| 466 | 455 | { |
| 467 | 456 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 468 | 457 | |
@@ -19,315 +19,315 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/lists/promo/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog list promo section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/lists/promo/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $tags = array(); |
|
| 61 | - private $expire; |
|
| 62 | - private $cache; |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Returns the HTML code for insertion into the body. |
|
| 67 | - * |
|
| 68 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | - * @return string HTML code |
|
| 72 | - */ |
|
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | - { |
|
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | - |
|
| 77 | - $html = ''; |
|
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | - } |
|
| 81 | - $view->promoBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/lists/promo/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog list promotion client. |
|
| 85 | - * |
|
| 86 | - * The template file contains the HTML code and processing instructions |
|
| 87 | - * to generate the result shown in the body of the frontend. The |
|
| 88 | - * configuration string is the path to the template file relative |
|
| 89 | - * to the templates directory (usually in client/html/templates). |
|
| 90 | - * |
|
| 91 | - * You can overwrite the template file configuration in extensions and |
|
| 92 | - * provide alternative templates. These alternative templates should be |
|
| 93 | - * named like the default one but with the string "standard" replaced by |
|
| 94 | - * an unique name. You may use the name of your project for this. If |
|
| 95 | - * you've implemented an alternative client class as well, "standard" |
|
| 96 | - * should be replaced by the name of the new class. |
|
| 97 | - * |
|
| 98 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | - * @since 2014.03 |
|
| 100 | - * @category Developer |
|
| 101 | - * @see client/html/catalog/lists/promo/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/lists/promo/standard/template-body'; |
|
| 104 | - $default = 'catalog/lists/promo-body-default.php'; |
|
| 105 | - |
|
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Returns the HTML string for insertion into the header. |
|
| 112 | - * |
|
| 113 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 117 | - */ |
|
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | - { |
|
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | - |
|
| 122 | - $html = ''; |
|
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | - } |
|
| 126 | - $view->promoHeader = $html; |
|
| 127 | - |
|
| 128 | - /** client/html/catalog/lists/promo/standard/template-header |
|
| 129 | - * Relative path to the HTML header template of the catalog list promotion client. |
|
| 130 | - * |
|
| 131 | - * The template file contains the HTML code and processing instructions |
|
| 132 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | - * of the rendered page in the frontend. The configuration string is the |
|
| 134 | - * path to the template file relative to the templates directory (usually |
|
| 135 | - * in client/html/templates). |
|
| 136 | - * |
|
| 137 | - * You can overwrite the template file configuration in extensions and |
|
| 138 | - * provide alternative templates. These alternative templates should be |
|
| 139 | - * named like the default one but with the string "standard" replaced by |
|
| 140 | - * an unique name. You may use the name of your project for this. If |
|
| 141 | - * you've implemented an alternative client class as well, "standard" |
|
| 142 | - * should be replaced by the name of the new class. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2014.03 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/catalog/lists/promo/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/catalog/lists/promo/standard/template-header'; |
|
| 150 | - $default = 'catalog/lists/promo-header-default.php'; |
|
| 151 | - |
|
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/catalog/lists/promo/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the catalog list promo html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/catalog/lists/promo/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/catalog/lists/promo/decorators/global |
|
| 188 | - * @see client/html/catalog/lists/promo/decorators/local |
|
| 189 | - */ |
|
| 190 | - |
|
| 191 | - /** client/html/catalog/lists/promo/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the catalog list promo html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/catalog/lists/promo/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/lists/promo/decorators/excludes |
|
| 212 | - * @see client/html/catalog/lists/promo/decorators/local |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - /** client/html/catalog/lists/promo/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the catalog list promo html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/lists/promo/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/lists/promo/decorators/excludes |
|
| 236 | - * @see client/html/catalog/lists/promo/decorators/global |
|
| 237 | - */ |
|
| 238 | - |
|
| 239 | - return $this->createSubClient( 'catalog/lists/promo/' . $type, $name ); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Returns the list of sub-client names configured for the client. |
|
| 245 | - * |
|
| 246 | - * @return array List of HTML client names |
|
| 247 | - */ |
|
| 248 | - protected function getSubClientNames() |
|
| 249 | - { |
|
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Sets the necessary parameter values in the view. |
|
| 256 | - * |
|
| 257 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | - */ |
|
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | - { |
|
| 264 | - if( !isset( $this->cache ) ) |
|
| 265 | - { |
|
| 266 | - $products = array(); |
|
| 267 | - $context = $this->getContext(); |
|
| 268 | - $config = $context->getConfig(); |
|
| 269 | - |
|
| 270 | - if( isset( $view->listCurrentCatItem ) ) { |
|
| 271 | - $catId = $view->listCurrentCatItem->getId(); |
|
| 272 | - } else { |
|
| 273 | - $catId = $config->get( 'client/html/catalog/lists/catid-default', '' ); |
|
| 274 | - } |
|
| 275 | - |
|
| 276 | - if( $catId != '' ) |
|
| 277 | - { |
|
| 278 | - /** client/html/catalog/lists/promo/size |
|
| 279 | - * The maximum number of products that should be shown in the promotion section |
|
| 280 | - * |
|
| 281 | - * Each product list can render a list of promoted products on |
|
| 282 | - * top if there are any products associated to that category whose |
|
| 283 | - * list type is "promotion". This option limits the maximum number |
|
| 284 | - * of products that are displayed. It takes only effect if more |
|
| 285 | - * promotional products are added to this category than the set |
|
| 286 | - * value. |
|
| 287 | - * |
|
| 288 | - * @param integer Number of promotion products |
|
| 289 | - * @since 2014.03 |
|
| 290 | - * @category User |
|
| 291 | - * @category Developer |
|
| 292 | - */ |
|
| 293 | - $size = $config->get( 'client/html/catalog/lists/promo/size', 6 ); |
|
| 294 | - $domains = $config->get( 'client/html/catalog/lists/domains', array( 'media', 'price', 'text' ) ); |
|
| 295 | - |
|
| 296 | - $total = null; |
|
| 297 | - |
|
| 298 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 299 | - $filter = $controller->createIndexFilterCategory( $catId, 'relevance', '+', 0, $size, 'promotion' ); |
|
| 300 | - $products = $controller->getIndexItems( $filter, $domains, $total ); |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - |
|
| 304 | - if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) |
|
| 305 | - { |
|
| 306 | - $stockTarget = $config->get( 'client/html/catalog/stock/url/target' ); |
|
| 307 | - $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 308 | - $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 309 | - $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() ); |
|
| 310 | - |
|
| 311 | - $productIds = array_keys( $products ); |
|
| 312 | - sort( $productIds ); |
|
| 313 | - |
|
| 314 | - $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 315 | - $view->promoStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - |
|
| 319 | - $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 320 | - $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 321 | - |
|
| 322 | - |
|
| 323 | - $view->promoItems = $products; |
|
| 324 | - |
|
| 325 | - $this->cache = $view; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 329 | - $tags = array_merge( $tags, $this->tags ); |
|
| 330 | - |
|
| 331 | - return $this->cache; |
|
| 332 | - } |
|
| 25 | + /** client/html/catalog/lists/promo/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog list promo section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/lists/promo/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $tags = array(); |
|
| 61 | + private $expire; |
|
| 62 | + private $cache; |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Returns the HTML code for insertion into the body. |
|
| 67 | + * |
|
| 68 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | + * @return string HTML code |
|
| 72 | + */ |
|
| 73 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | + { |
|
| 75 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | + |
|
| 77 | + $html = ''; |
|
| 78 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | + } |
|
| 81 | + $view->promoBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/lists/promo/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog list promotion client. |
|
| 85 | + * |
|
| 86 | + * The template file contains the HTML code and processing instructions |
|
| 87 | + * to generate the result shown in the body of the frontend. The |
|
| 88 | + * configuration string is the path to the template file relative |
|
| 89 | + * to the templates directory (usually in client/html/templates). |
|
| 90 | + * |
|
| 91 | + * You can overwrite the template file configuration in extensions and |
|
| 92 | + * provide alternative templates. These alternative templates should be |
|
| 93 | + * named like the default one but with the string "standard" replaced by |
|
| 94 | + * an unique name. You may use the name of your project for this. If |
|
| 95 | + * you've implemented an alternative client class as well, "standard" |
|
| 96 | + * should be replaced by the name of the new class. |
|
| 97 | + * |
|
| 98 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | + * @since 2014.03 |
|
| 100 | + * @category Developer |
|
| 101 | + * @see client/html/catalog/lists/promo/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/lists/promo/standard/template-body'; |
|
| 104 | + $default = 'catalog/lists/promo-body-default.php'; |
|
| 105 | + |
|
| 106 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Returns the HTML string for insertion into the header. |
|
| 112 | + * |
|
| 113 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | + * @return string|null String including HTML tags for the header on error |
|
| 117 | + */ |
|
| 118 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | + { |
|
| 120 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | + |
|
| 122 | + $html = ''; |
|
| 123 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | + } |
|
| 126 | + $view->promoHeader = $html; |
|
| 127 | + |
|
| 128 | + /** client/html/catalog/lists/promo/standard/template-header |
|
| 129 | + * Relative path to the HTML header template of the catalog list promotion client. |
|
| 130 | + * |
|
| 131 | + * The template file contains the HTML code and processing instructions |
|
| 132 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | + * of the rendered page in the frontend. The configuration string is the |
|
| 134 | + * path to the template file relative to the templates directory (usually |
|
| 135 | + * in client/html/templates). |
|
| 136 | + * |
|
| 137 | + * You can overwrite the template file configuration in extensions and |
|
| 138 | + * provide alternative templates. These alternative templates should be |
|
| 139 | + * named like the default one but with the string "standard" replaced by |
|
| 140 | + * an unique name. You may use the name of your project for this. If |
|
| 141 | + * you've implemented an alternative client class as well, "standard" |
|
| 142 | + * should be replaced by the name of the new class. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2014.03 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/catalog/lists/promo/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/catalog/lists/promo/standard/template-header'; |
|
| 150 | + $default = 'catalog/lists/promo-header-default.php'; |
|
| 151 | + |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/catalog/lists/promo/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the catalog list promo html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/catalog/lists/promo/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/catalog/lists/promo/decorators/global |
|
| 188 | + * @see client/html/catalog/lists/promo/decorators/local |
|
| 189 | + */ |
|
| 190 | + |
|
| 191 | + /** client/html/catalog/lists/promo/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the catalog list promo html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/catalog/lists/promo/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/lists/promo/decorators/excludes |
|
| 212 | + * @see client/html/catalog/lists/promo/decorators/local |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + /** client/html/catalog/lists/promo/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the catalog list promo html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/lists/promo/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/lists/promo/decorators/excludes |
|
| 236 | + * @see client/html/catalog/lists/promo/decorators/global |
|
| 237 | + */ |
|
| 238 | + |
|
| 239 | + return $this->createSubClient( 'catalog/lists/promo/' . $type, $name ); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Returns the list of sub-client names configured for the client. |
|
| 245 | + * |
|
| 246 | + * @return array List of HTML client names |
|
| 247 | + */ |
|
| 248 | + protected function getSubClientNames() |
|
| 249 | + { |
|
| 250 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Sets the necessary parameter values in the view. |
|
| 256 | + * |
|
| 257 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | + */ |
|
| 262 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | + { |
|
| 264 | + if( !isset( $this->cache ) ) |
|
| 265 | + { |
|
| 266 | + $products = array(); |
|
| 267 | + $context = $this->getContext(); |
|
| 268 | + $config = $context->getConfig(); |
|
| 269 | + |
|
| 270 | + if( isset( $view->listCurrentCatItem ) ) { |
|
| 271 | + $catId = $view->listCurrentCatItem->getId(); |
|
| 272 | + } else { |
|
| 273 | + $catId = $config->get( 'client/html/catalog/lists/catid-default', '' ); |
|
| 274 | + } |
|
| 275 | + |
|
| 276 | + if( $catId != '' ) |
|
| 277 | + { |
|
| 278 | + /** client/html/catalog/lists/promo/size |
|
| 279 | + * The maximum number of products that should be shown in the promotion section |
|
| 280 | + * |
|
| 281 | + * Each product list can render a list of promoted products on |
|
| 282 | + * top if there are any products associated to that category whose |
|
| 283 | + * list type is "promotion". This option limits the maximum number |
|
| 284 | + * of products that are displayed. It takes only effect if more |
|
| 285 | + * promotional products are added to this category than the set |
|
| 286 | + * value. |
|
| 287 | + * |
|
| 288 | + * @param integer Number of promotion products |
|
| 289 | + * @since 2014.03 |
|
| 290 | + * @category User |
|
| 291 | + * @category Developer |
|
| 292 | + */ |
|
| 293 | + $size = $config->get( 'client/html/catalog/lists/promo/size', 6 ); |
|
| 294 | + $domains = $config->get( 'client/html/catalog/lists/domains', array( 'media', 'price', 'text' ) ); |
|
| 295 | + |
|
| 296 | + $total = null; |
|
| 297 | + |
|
| 298 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 299 | + $filter = $controller->createIndexFilterCategory( $catId, 'relevance', '+', 0, $size, 'promotion' ); |
|
| 300 | + $products = $controller->getIndexItems( $filter, $domains, $total ); |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + |
|
| 304 | + if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) |
|
| 305 | + { |
|
| 306 | + $stockTarget = $config->get( 'client/html/catalog/stock/url/target' ); |
|
| 307 | + $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 308 | + $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 309 | + $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() ); |
|
| 310 | + |
|
| 311 | + $productIds = array_keys( $products ); |
|
| 312 | + sort( $productIds ); |
|
| 313 | + |
|
| 314 | + $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 315 | + $view->promoStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + |
|
| 319 | + $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 320 | + $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 321 | + |
|
| 322 | + |
|
| 323 | + $view->promoItems = $products; |
|
| 324 | + |
|
| 325 | + $this->cache = $view; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 329 | + $tags = array_merge( $tags, $this->tags ); |
|
| 330 | + |
|
| 331 | + return $this->cache; |
|
| 332 | + } |
|
| 333 | 333 | } |
| 334 | 334 | \ No newline at end of file |
@@ -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->promoBody = $html; |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/lists/promo/standard/template-body'; |
| 104 | 104 | $default = 'catalog/lists/promo-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->promoHeader = $html; |
| 127 | 127 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/catalog/lists/promo/standard/template-header'; |
| 150 | 150 | $default = 'catalog/lists/promo-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/lists/promo/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the catalog list promo html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/catalog/lists/promo/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'catalog/lists/promo/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('catalog/lists/promo/'.$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,21 +259,21 @@ 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 | $products = array(); |
| 267 | 267 | $context = $this->getContext(); |
| 268 | 268 | $config = $context->getConfig(); |
| 269 | 269 | |
| 270 | - if( isset( $view->listCurrentCatItem ) ) { |
|
| 270 | + if (isset($view->listCurrentCatItem)) { |
|
| 271 | 271 | $catId = $view->listCurrentCatItem->getId(); |
| 272 | 272 | } else { |
| 273 | - $catId = $config->get( 'client/html/catalog/lists/catid-default', '' ); |
|
| 273 | + $catId = $config->get('client/html/catalog/lists/catid-default', ''); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if( $catId != '' ) |
|
| 276 | + if ($catId != '') |
|
| 277 | 277 | { |
| 278 | 278 | /** client/html/catalog/lists/promo/size |
| 279 | 279 | * The maximum number of products that should be shown in the promotion section |
@@ -290,34 +290,34 @@ discard block |
||
| 290 | 290 | * @category User |
| 291 | 291 | * @category Developer |
| 292 | 292 | */ |
| 293 | - $size = $config->get( 'client/html/catalog/lists/promo/size', 6 ); |
|
| 294 | - $domains = $config->get( 'client/html/catalog/lists/domains', array( 'media', 'price', 'text' ) ); |
|
| 293 | + $size = $config->get('client/html/catalog/lists/promo/size', 6); |
|
| 294 | + $domains = $config->get('client/html/catalog/lists/domains', array('media', 'price', 'text')); |
|
| 295 | 295 | |
| 296 | 296 | $total = null; |
| 297 | 297 | |
| 298 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 299 | - $filter = $controller->createIndexFilterCategory( $catId, 'relevance', '+', 0, $size, 'promotion' ); |
|
| 300 | - $products = $controller->getIndexItems( $filter, $domains, $total ); |
|
| 298 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 299 | + $filter = $controller->createIndexFilterCategory($catId, 'relevance', '+', 0, $size, 'promotion'); |
|
| 300 | + $products = $controller->getIndexItems($filter, $domains, $total); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
| 304 | - if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) |
|
| 304 | + if (!empty($products) && $config->get('client/html/catalog/lists/stock/enable', true) === true) |
|
| 305 | 305 | { |
| 306 | - $stockTarget = $config->get( 'client/html/catalog/stock/url/target' ); |
|
| 307 | - $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 308 | - $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 309 | - $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() ); |
|
| 306 | + $stockTarget = $config->get('client/html/catalog/stock/url/target'); |
|
| 307 | + $stockController = $config->get('client/html/catalog/stock/url/controller', 'catalog'); |
|
| 308 | + $stockAction = $config->get('client/html/catalog/stock/url/action', 'stock'); |
|
| 309 | + $stockConfig = $config->get('client/html/catalog/stock/url/config', array()); |
|
| 310 | 310 | |
| 311 | - $productIds = array_keys( $products ); |
|
| 312 | - sort( $productIds ); |
|
| 311 | + $productIds = array_keys($products); |
|
| 312 | + sort($productIds); |
|
| 313 | 313 | |
| 314 | - $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 315 | - $view->promoStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 314 | + $params = array('s_prodid' => implode(' ', $productIds)); |
|
| 315 | + $view->promoStockUrl = $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
| 319 | - $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 320 | - $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 319 | + $this->addMetaItem($products, 'product', $this->expire, $this->tags); |
|
| 320 | + $this->addMetaList(array_keys($products), 'product', $this->expire); |
|
| 321 | 321 | |
| 322 | 322 | |
| 323 | 323 | $view->promoItems = $products; |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | $this->cache = $view; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 329 | - $tags = array_merge( $tags, $this->tags ); |
|
| 328 | + $expire = $this->expires($this->expire, $expire); |
|
| 329 | + $tags = array_merge($tags, $this->tags); |
|
| 330 | 330 | |
| 331 | 331 | return $this->cache; |
| 332 | 332 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,267 +19,267 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/lists/pagination/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog list pagination section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/lists/pagination/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $header; |
|
| 61 | - private $cache; |
|
| 25 | + /** client/html/catalog/lists/pagination/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog list pagination section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/lists/pagination/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $header; |
|
| 61 | + private $cache; |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Returns the HTML code for insertion into the body. |
|
| 66 | - * |
|
| 67 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | - * @return string HTML code |
|
| 71 | - */ |
|
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | - { |
|
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 64 | + /** |
|
| 65 | + * Returns the HTML code for insertion into the body. |
|
| 66 | + * |
|
| 67 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | + * @return string HTML code |
|
| 71 | + */ |
|
| 72 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + { |
|
| 74 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | 75 | |
| 76 | - $html = ''; |
|
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | - } |
|
| 80 | - $view->pagiBody = $html; |
|
| 76 | + $html = ''; |
|
| 77 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | + } |
|
| 80 | + $view->pagiBody = $html; |
|
| 81 | 81 | |
| 82 | - /** client/html/catalog/lists/pagination/standard/template-body |
|
| 83 | - * Relative path to the HTML body template of the catalog list pagination client. |
|
| 84 | - * |
|
| 85 | - * The template file contains the HTML code and processing instructions |
|
| 86 | - * to generate the result shown in the body of the frontend. The |
|
| 87 | - * configuration string is the path to the template file relative |
|
| 88 | - * to the templates directory (usually in client/html/templates). |
|
| 89 | - * |
|
| 90 | - * You can overwrite the template file configuration in extensions and |
|
| 91 | - * provide alternative templates. These alternative templates should be |
|
| 92 | - * named like the default one but with the string "standard" replaced by |
|
| 93 | - * an unique name. You may use the name of your project for this. If |
|
| 94 | - * you've implemented an alternative client class as well, "standard" |
|
| 95 | - * should be replaced by the name of the new class. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2014.03 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/catalog/lists/pagination/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/catalog/lists/pagination/standard/template-body'; |
|
| 103 | - $default = 'catalog/lists/pagination-body-default.php'; |
|
| 82 | + /** client/html/catalog/lists/pagination/standard/template-body |
|
| 83 | + * Relative path to the HTML body template of the catalog list pagination client. |
|
| 84 | + * |
|
| 85 | + * The template file contains the HTML code and processing instructions |
|
| 86 | + * to generate the result shown in the body of the frontend. The |
|
| 87 | + * configuration string is the path to the template file relative |
|
| 88 | + * to the templates directory (usually in client/html/templates). |
|
| 89 | + * |
|
| 90 | + * You can overwrite the template file configuration in extensions and |
|
| 91 | + * provide alternative templates. These alternative templates should be |
|
| 92 | + * named like the default one but with the string "standard" replaced by |
|
| 93 | + * an unique name. You may use the name of your project for this. If |
|
| 94 | + * you've implemented an alternative client class as well, "standard" |
|
| 95 | + * should be replaced by the name of the new class. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2014.03 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/catalog/lists/pagination/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/catalog/lists/pagination/standard/template-body'; |
|
| 103 | + $default = 'catalog/lists/pagination-body-default.php'; |
|
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - // output header only once |
|
| 120 | - if( $this->header !== null ) { |
|
| 121 | - return ''; |
|
| 122 | - } |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + // output header only once |
|
| 120 | + if( $this->header !== null ) { |
|
| 121 | + return ''; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - $this->header = true; |
|
| 125 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 124 | + $this->header = true; |
|
| 125 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 126 | 126 | |
| 127 | - $html = ''; |
|
| 128 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 129 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 130 | - } |
|
| 131 | - $view->pagiHeader = $html; |
|
| 127 | + $html = ''; |
|
| 128 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 129 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 130 | + } |
|
| 131 | + $view->pagiHeader = $html; |
|
| 132 | 132 | |
| 133 | - /** client/html/catalog/lists/pagination/standard/template-header |
|
| 134 | - * Relative path to the HTML header template of the catalog list pagination client. |
|
| 135 | - * |
|
| 136 | - * The template file contains the HTML code and processing instructions |
|
| 137 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 138 | - * of the rendered page in the frontend. The configuration string is the |
|
| 139 | - * path to the template file relative to the templates directory (usually |
|
| 140 | - * in client/html/templates). |
|
| 141 | - * |
|
| 142 | - * You can overwrite the template file configuration in extensions and |
|
| 143 | - * provide alternative templates. These alternative templates should be |
|
| 144 | - * named like the default one but with the string "standard" replaced by |
|
| 145 | - * an unique name. You may use the name of your project for this. If |
|
| 146 | - * you've implemented an alternative client class as well, "standard" |
|
| 147 | - * should be replaced by the name of the new class. |
|
| 148 | - * |
|
| 149 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 150 | - * @since 2014.03 |
|
| 151 | - * @category Developer |
|
| 152 | - * @see client/html/catalog/lists/pagination/standard/template-body |
|
| 153 | - */ |
|
| 154 | - $tplconf = 'client/html/catalog/lists/pagination/standard/template-header'; |
|
| 155 | - $default = 'catalog/lists/pagination-header-default.php'; |
|
| 133 | + /** client/html/catalog/lists/pagination/standard/template-header |
|
| 134 | + * Relative path to the HTML header template of the catalog list pagination client. |
|
| 135 | + * |
|
| 136 | + * The template file contains the HTML code and processing instructions |
|
| 137 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 138 | + * of the rendered page in the frontend. The configuration string is the |
|
| 139 | + * path to the template file relative to the templates directory (usually |
|
| 140 | + * in client/html/templates). |
|
| 141 | + * |
|
| 142 | + * You can overwrite the template file configuration in extensions and |
|
| 143 | + * provide alternative templates. These alternative templates should be |
|
| 144 | + * named like the default one but with the string "standard" replaced by |
|
| 145 | + * an unique name. You may use the name of your project for this. If |
|
| 146 | + * you've implemented an alternative client class as well, "standard" |
|
| 147 | + * should be replaced by the name of the new class. |
|
| 148 | + * |
|
| 149 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 150 | + * @since 2014.03 |
|
| 151 | + * @category Developer |
|
| 152 | + * @see client/html/catalog/lists/pagination/standard/template-body |
|
| 153 | + */ |
|
| 154 | + $tplconf = 'client/html/catalog/lists/pagination/standard/template-header'; |
|
| 155 | + $default = 'catalog/lists/pagination-header-default.php'; |
|
| 156 | 156 | |
| 157 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 158 | - } |
|
| 157 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Returns the sub-client given by its name. |
|
| 163 | - * |
|
| 164 | - * @param string $type Name of the client type |
|
| 165 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 166 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 167 | - */ |
|
| 168 | - public function getSubClient( $type, $name = null ) |
|
| 169 | - { |
|
| 170 | - /** client/html/catalog/lists/pagination/decorators/excludes |
|
| 171 | - * Excludes decorators added by the "common" option from the catalog list pagination html client |
|
| 172 | - * |
|
| 173 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 174 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 175 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 176 | - * modify what is returned to the caller. |
|
| 177 | - * |
|
| 178 | - * This option allows you to remove a decorator added via |
|
| 179 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 180 | - * around the html client. |
|
| 181 | - * |
|
| 182 | - * client/html/catalog/lists/pagination/decorators/excludes = array( 'decorator1' ) |
|
| 183 | - * |
|
| 184 | - * This would remove the decorator named "decorator1" from the list of |
|
| 185 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 186 | - * "client/html/common/decorators/default" to the html client. |
|
| 187 | - * |
|
| 188 | - * @param array List of decorator names |
|
| 189 | - * @since 2015.08 |
|
| 190 | - * @category Developer |
|
| 191 | - * @see client/html/common/decorators/default |
|
| 192 | - * @see client/html/catalog/lists/pagination/decorators/global |
|
| 193 | - * @see client/html/catalog/lists/pagination/decorators/local |
|
| 194 | - */ |
|
| 161 | + /** |
|
| 162 | + * Returns the sub-client given by its name. |
|
| 163 | + * |
|
| 164 | + * @param string $type Name of the client type |
|
| 165 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 166 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 167 | + */ |
|
| 168 | + public function getSubClient( $type, $name = null ) |
|
| 169 | + { |
|
| 170 | + /** client/html/catalog/lists/pagination/decorators/excludes |
|
| 171 | + * Excludes decorators added by the "common" option from the catalog list pagination html client |
|
| 172 | + * |
|
| 173 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 174 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 175 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 176 | + * modify what is returned to the caller. |
|
| 177 | + * |
|
| 178 | + * This option allows you to remove a decorator added via |
|
| 179 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 180 | + * around the html client. |
|
| 181 | + * |
|
| 182 | + * client/html/catalog/lists/pagination/decorators/excludes = array( 'decorator1' ) |
|
| 183 | + * |
|
| 184 | + * This would remove the decorator named "decorator1" from the list of |
|
| 185 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 186 | + * "client/html/common/decorators/default" to the html client. |
|
| 187 | + * |
|
| 188 | + * @param array List of decorator names |
|
| 189 | + * @since 2015.08 |
|
| 190 | + * @category Developer |
|
| 191 | + * @see client/html/common/decorators/default |
|
| 192 | + * @see client/html/catalog/lists/pagination/decorators/global |
|
| 193 | + * @see client/html/catalog/lists/pagination/decorators/local |
|
| 194 | + */ |
|
| 195 | 195 | |
| 196 | - /** client/html/catalog/lists/pagination/decorators/global |
|
| 197 | - * Adds a list of globally available decorators only to the catalog list pagination html client |
|
| 198 | - * |
|
| 199 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 200 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 201 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 202 | - * modify what is returned to the caller. |
|
| 203 | - * |
|
| 204 | - * This option allows you to wrap global decorators |
|
| 205 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 206 | - * |
|
| 207 | - * client/html/catalog/lists/pagination/decorators/global = array( 'decorator1' ) |
|
| 208 | - * |
|
| 209 | - * This would add the decorator named "decorator1" defined by |
|
| 210 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 211 | - * |
|
| 212 | - * @param array List of decorator names |
|
| 213 | - * @since 2015.08 |
|
| 214 | - * @category Developer |
|
| 215 | - * @see client/html/common/decorators/default |
|
| 216 | - * @see client/html/catalog/lists/pagination/decorators/excludes |
|
| 217 | - * @see client/html/catalog/lists/pagination/decorators/local |
|
| 218 | - */ |
|
| 196 | + /** client/html/catalog/lists/pagination/decorators/global |
|
| 197 | + * Adds a list of globally available decorators only to the catalog list pagination html client |
|
| 198 | + * |
|
| 199 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 200 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 201 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 202 | + * modify what is returned to the caller. |
|
| 203 | + * |
|
| 204 | + * This option allows you to wrap global decorators |
|
| 205 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 206 | + * |
|
| 207 | + * client/html/catalog/lists/pagination/decorators/global = array( 'decorator1' ) |
|
| 208 | + * |
|
| 209 | + * This would add the decorator named "decorator1" defined by |
|
| 210 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 211 | + * |
|
| 212 | + * @param array List of decorator names |
|
| 213 | + * @since 2015.08 |
|
| 214 | + * @category Developer |
|
| 215 | + * @see client/html/common/decorators/default |
|
| 216 | + * @see client/html/catalog/lists/pagination/decorators/excludes |
|
| 217 | + * @see client/html/catalog/lists/pagination/decorators/local |
|
| 218 | + */ |
|
| 219 | 219 | |
| 220 | - /** client/html/catalog/lists/pagination/decorators/local |
|
| 221 | - * Adds a list of local decorators only to the catalog list pagination html client |
|
| 222 | - * |
|
| 223 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 224 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 225 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 226 | - * modify what is returned to the caller. |
|
| 227 | - * |
|
| 228 | - * This option allows you to wrap local decorators |
|
| 229 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 230 | - * |
|
| 231 | - * client/html/catalog/lists/pagination/decorators/local = array( 'decorator2' ) |
|
| 232 | - * |
|
| 233 | - * This would add the decorator named "decorator2" defined by |
|
| 234 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 235 | - * |
|
| 236 | - * @param array List of decorator names |
|
| 237 | - * @since 2015.08 |
|
| 238 | - * @category Developer |
|
| 239 | - * @see client/html/common/decorators/default |
|
| 240 | - * @see client/html/catalog/lists/pagination/decorators/excludes |
|
| 241 | - * @see client/html/catalog/lists/pagination/decorators/global |
|
| 242 | - */ |
|
| 220 | + /** client/html/catalog/lists/pagination/decorators/local |
|
| 221 | + * Adds a list of local decorators only to the catalog list pagination html client |
|
| 222 | + * |
|
| 223 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 224 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 225 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 226 | + * modify what is returned to the caller. |
|
| 227 | + * |
|
| 228 | + * This option allows you to wrap local decorators |
|
| 229 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 230 | + * |
|
| 231 | + * client/html/catalog/lists/pagination/decorators/local = array( 'decorator2' ) |
|
| 232 | + * |
|
| 233 | + * This would add the decorator named "decorator2" defined by |
|
| 234 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 235 | + * |
|
| 236 | + * @param array List of decorator names |
|
| 237 | + * @since 2015.08 |
|
| 238 | + * @category Developer |
|
| 239 | + * @see client/html/common/decorators/default |
|
| 240 | + * @see client/html/catalog/lists/pagination/decorators/excludes |
|
| 241 | + * @see client/html/catalog/lists/pagination/decorators/global |
|
| 242 | + */ |
|
| 243 | 243 | |
| 244 | - return $this->createSubClient( 'catalog/lists/pagination/' . $type, $name ); |
|
| 245 | - } |
|
| 244 | + return $this->createSubClient( 'catalog/lists/pagination/' . $type, $name ); |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | 247 | |
| 248 | - /** |
|
| 249 | - * Returns the list of sub-client names configured for the client. |
|
| 250 | - * |
|
| 251 | - * @return array List of HTML client names |
|
| 252 | - */ |
|
| 253 | - protected function getSubClientNames() |
|
| 254 | - { |
|
| 255 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 256 | - } |
|
| 248 | + /** |
|
| 249 | + * Returns the list of sub-client names configured for the client. |
|
| 250 | + * |
|
| 251 | + * @return array List of HTML client names |
|
| 252 | + */ |
|
| 253 | + protected function getSubClientNames() |
|
| 254 | + { |
|
| 255 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Sets the necessary parameter values in the view. |
|
| 261 | - * |
|
| 262 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 263 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 264 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 265 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 266 | - */ |
|
| 267 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 268 | - { |
|
| 269 | - if( !isset( $this->cache ) ) |
|
| 270 | - { |
|
| 271 | - $total = $view->listProductTotal; |
|
| 272 | - $current = $view->listPageCurr; |
|
| 273 | - $last = ( $total != 0 ? ceil( $total / $view->listPageSize ) : 1 ); |
|
| 259 | + /** |
|
| 260 | + * Sets the necessary parameter values in the view. |
|
| 261 | + * |
|
| 262 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 263 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 264 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 265 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 266 | + */ |
|
| 267 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 268 | + { |
|
| 269 | + if( !isset( $this->cache ) ) |
|
| 270 | + { |
|
| 271 | + $total = $view->listProductTotal; |
|
| 272 | + $current = $view->listPageCurr; |
|
| 273 | + $last = ( $total != 0 ? ceil( $total / $view->listPageSize ) : 1 ); |
|
| 274 | 274 | |
| 275 | - $view->pagiPageFirst = 1; |
|
| 276 | - $view->pagiPagePrev = ( $current > 1 ? $current - 1 : 1 ); |
|
| 277 | - $view->pagiPageNext = ( $current < $last ? $current + 1 : $last ); |
|
| 278 | - $view->pagiPageLast = $last; |
|
| 275 | + $view->pagiPageFirst = 1; |
|
| 276 | + $view->pagiPagePrev = ( $current > 1 ? $current - 1 : 1 ); |
|
| 277 | + $view->pagiPageNext = ( $current < $last ? $current + 1 : $last ); |
|
| 278 | + $view->pagiPageLast = $last; |
|
| 279 | 279 | |
| 280 | - $this->cache = $view; |
|
| 281 | - } |
|
| 280 | + $this->cache = $view; |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | - return $this->cache; |
|
| 284 | - } |
|
| 283 | + return $this->cache; |
|
| 284 | + } |
|
| 285 | 285 | } |
| 286 | 286 | \ No newline at end of file |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 70 | 70 | * @return string HTML code |
| 71 | 71 | */ |
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 73 | 73 | { |
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 75 | 75 | |
| 76 | 76 | $html = ''; |
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + foreach ($this->getSubClients() as $subclient) { |
|
| 78 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 79 | 79 | } |
| 80 | 80 | $view->pagiBody = $html; |
| 81 | 81 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/catalog/lists/pagination/standard/template-body'; |
| 103 | 103 | $default = 'catalog/lists/pagination-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | 119 | // output header only once |
| 120 | - if( $this->header !== null ) { |
|
| 120 | + if ($this->header !== null) { |
|
| 121 | 121 | return ''; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $this->header = true; |
| 125 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 125 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 126 | 126 | |
| 127 | 127 | $html = ''; |
| 128 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 129 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 128 | + foreach ($this->getSubClients() as $subclient) { |
|
| 129 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 130 | 130 | } |
| 131 | 131 | $view->pagiHeader = $html; |
| 132 | 132 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $tplconf = 'client/html/catalog/lists/pagination/standard/template-header'; |
| 155 | 155 | $default = 'catalog/lists/pagination-header-default.php'; |
| 156 | 156 | |
| 157 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 157 | + return $view->render($view->config($tplconf, $default)); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param string|null $name Name of the sub-client (Default if null) |
| 166 | 166 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 167 | 167 | */ |
| 168 | - public function getSubClient( $type, $name = null ) |
|
| 168 | + public function getSubClient($type, $name = null) |
|
| 169 | 169 | { |
| 170 | 170 | /** client/html/catalog/lists/pagination/decorators/excludes |
| 171 | 171 | * Excludes decorators added by the "common" option from the catalog list pagination html client |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @see client/html/catalog/lists/pagination/decorators/global |
| 242 | 242 | */ |
| 243 | 243 | |
| 244 | - return $this->createSubClient( 'catalog/lists/pagination/' . $type, $name ); |
|
| 244 | + return $this->createSubClient('catalog/lists/pagination/'.$type, $name); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | protected function getSubClientNames() |
| 254 | 254 | { |
| 255 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 255 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -264,17 +264,17 @@ discard block |
||
| 264 | 264 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 265 | 265 | * @return \Aimeos\MW\View\Iface Modified view object |
| 266 | 266 | */ |
| 267 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 267 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 268 | 268 | { |
| 269 | - if( !isset( $this->cache ) ) |
|
| 269 | + if (!isset($this->cache)) |
|
| 270 | 270 | { |
| 271 | 271 | $total = $view->listProductTotal; |
| 272 | 272 | $current = $view->listPageCurr; |
| 273 | - $last = ( $total != 0 ? ceil( $total / $view->listPageSize ) : 1 ); |
|
| 273 | + $last = ($total != 0 ? ceil($total / $view->listPageSize) : 1); |
|
| 274 | 274 | |
| 275 | 275 | $view->pagiPageFirst = 1; |
| 276 | - $view->pagiPagePrev = ( $current > 1 ? $current - 1 : 1 ); |
|
| 277 | - $view->pagiPageNext = ( $current < $last ? $current + 1 : $last ); |
|
| 276 | + $view->pagiPagePrev = ($current > 1 ? $current - 1 : 1); |
|
| 277 | + $view->pagiPageNext = ($current < $last ? $current + 1 : $last); |
|
| 278 | 278 | $view->pagiPageLast = $last; |
| 279 | 279 | |
| 280 | 280 | $this->cache = $view; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,462 +19,462 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/lists/items/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog list items section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/lists/items/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $tags = array(); |
|
| 61 | - private $expire; |
|
| 62 | - private $view; |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Returns the HTML code for insertion into the body. |
|
| 67 | - * |
|
| 68 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | - * @return string HTML code |
|
| 72 | - */ |
|
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | - { |
|
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | - |
|
| 77 | - $html = ''; |
|
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | - } |
|
| 81 | - $view->itemsBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/lists/items/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog list items client. |
|
| 85 | - * |
|
| 86 | - * The template file contains the HTML code and processing instructions |
|
| 87 | - * to generate the result shown in the body of the frontend. The |
|
| 88 | - * configuration string is the path to the template file relative |
|
| 89 | - * to the templates directory (usually in client/html/templates). |
|
| 90 | - * |
|
| 91 | - * You can overwrite the template file configuration in extensions and |
|
| 92 | - * provide alternative templates. These alternative templates should be |
|
| 93 | - * named like the default one but with the string "standard" replaced by |
|
| 94 | - * an unique name. You may use the name of your project for this. If |
|
| 95 | - * you've implemented an alternative client class as well, "standard" |
|
| 96 | - * should be replaced by the name of the new class. |
|
| 97 | - * |
|
| 98 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | - * @since 2014.03 |
|
| 100 | - * @category Developer |
|
| 101 | - * @see client/html/catalog/lists/items/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/lists/items/standard/template-body'; |
|
| 104 | - $default = 'catalog/lists/items-body-default.php'; |
|
| 105 | - |
|
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Returns the HTML string for insertion into the header. |
|
| 112 | - * |
|
| 113 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 117 | - */ |
|
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | - { |
|
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | - |
|
| 122 | - $html = ''; |
|
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | - } |
|
| 126 | - $view->itemsHeader = $html; |
|
| 127 | - |
|
| 128 | - /** client/html/catalog/lists/items/standard/template-header |
|
| 129 | - * Relative path to the HTML header template of the catalog list items client. |
|
| 130 | - * |
|
| 131 | - * The template file contains the HTML code and processing instructions |
|
| 132 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | - * of the rendered page in the frontend. The configuration string is the |
|
| 134 | - * path to the template file relative to the templates directory (usually |
|
| 135 | - * in client/html/templates). |
|
| 136 | - * |
|
| 137 | - * You can overwrite the template file configuration in extensions and |
|
| 138 | - * provide alternative templates. These alternative templates should be |
|
| 139 | - * named like the default one but with the string "standard" replaced by |
|
| 140 | - * an unique name. You may use the name of your project for this. If |
|
| 141 | - * you've implemented an alternative client class as well, "standard" |
|
| 142 | - * should be replaced by the name of the new class. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2014.03 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/catalog/lists/items/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/catalog/lists/items/standard/template-header'; |
|
| 150 | - $default = 'catalog/lists/items-header-default.php'; |
|
| 151 | - |
|
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/catalog/lists/items/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the catalog list items html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/catalog/lists/items/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/catalog/lists/items/decorators/global |
|
| 188 | - * @see client/html/catalog/lists/items/decorators/local |
|
| 189 | - */ |
|
| 190 | - |
|
| 191 | - /** client/html/catalog/lists/items/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the catalog list items html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/catalog/lists/items/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/lists/items/decorators/excludes |
|
| 212 | - * @see client/html/catalog/lists/items/decorators/local |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - /** client/html/catalog/lists/items/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the catalog list items html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/lists/items/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/lists/items/decorators/excludes |
|
| 236 | - * @see client/html/catalog/lists/items/decorators/global |
|
| 237 | - */ |
|
| 238 | - |
|
| 239 | - return $this->createSubClient( 'catalog/lists/items/' . $type, $name ); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Returns the list of sub-client names configured for the client. |
|
| 245 | - * |
|
| 246 | - * @return array List of HTML client names |
|
| 247 | - */ |
|
| 248 | - protected function getSubClientNames() |
|
| 249 | - { |
|
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 256 | - * |
|
| 257 | - * @param string $content Cached content |
|
| 258 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 259 | - * @return string Modified body content |
|
| 260 | - */ |
|
| 261 | - public function modifyBody( $content, $uid ) |
|
| 262 | - { |
|
| 263 | - $content = parent::modifyBody( $content, $uid ); |
|
| 264 | - |
|
| 265 | - return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf' ); |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - |
|
| 269 | - /** |
|
| 270 | - * Sets the necessary parameter values in the view. |
|
| 271 | - * |
|
| 272 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 273 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 274 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 275 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 276 | - */ |
|
| 277 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 278 | - { |
|
| 279 | - if( !isset( $this->view ) ) |
|
| 280 | - { |
|
| 281 | - $view->itemPosition = ( $this->getProductListPage( $view ) - 1 ) * $this->getProductListSize( $view ); |
|
| 282 | - |
|
| 283 | - if( $this->getContext()->getConfig()->get( 'client/html/catalog/lists/basket-add', false ) ) |
|
| 284 | - { |
|
| 285 | - $view = $this->addSelectionProducts( $view, $tags, $expire ); |
|
| 286 | - $view = $this->addConfigAttributes( $view, $tags, $expire ); |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - $this->view = $view; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - return $this->view; |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - |
|
| 296 | - /** |
|
| 297 | - * Adds the necessary view parameters for adding selection products to the basket |
|
| 298 | - * |
|
| 299 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 300 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 301 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 302 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 303 | - */ |
|
| 304 | - protected function addSelectionProducts( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 305 | - { |
|
| 306 | - $context = $this->getContext(); |
|
| 307 | - $config = $context->getConfig(); |
|
| 308 | - $subProdMap = $prodMap = $prodIds = array(); |
|
| 309 | - |
|
| 310 | - foreach( (array) $view->get( 'listProductItems', array() ) as $product ) |
|
| 311 | - { |
|
| 312 | - if( $product->getType() === 'select' ) |
|
| 313 | - { |
|
| 314 | - foreach( $product->getListItems( 'product', 'default' ) as $listItem ) |
|
| 315 | - { |
|
| 316 | - $prodMap[$listItem->getParentId()][] = $listItem->getRefId(); |
|
| 317 | - $prodIds[$listItem->getRefId()] = null; |
|
| 318 | - } |
|
| 319 | - } |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - $prodIds = array_keys( $prodIds ); |
|
| 323 | - |
|
| 324 | - |
|
| 325 | - $domains = array( 'text', 'price', 'media', 'attribute' ); |
|
| 326 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains ); |
|
| 327 | - |
|
| 328 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 329 | - $subproducts = $controller->getProductItems( $prodIds, $domains ); |
|
| 330 | - $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array(); |
|
| 331 | - |
|
| 332 | - foreach( $prodMap as $prodId => $list ) |
|
| 333 | - { |
|
| 334 | - foreach( $list as $subProdId ) |
|
| 335 | - { |
|
| 336 | - if( isset( $subproducts[$subProdId] ) ) |
|
| 337 | - { |
|
| 338 | - $subProduct = $subproducts[$subProdId]; |
|
| 339 | - $subProdMap[$prodId][$subProdId] = $subProduct; |
|
| 340 | - |
|
| 341 | - foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem ) |
|
| 342 | - { |
|
| 343 | - $attrTypeDeps[$prodId][$attrItem->getType()][$attrId] = $attrItem->getPosition(); |
|
| 344 | - $attrDeps[$prodId][$attrId][] = $subProdId; |
|
| 345 | - $prodDeps[$prodId][$subProdId][] = $attrId; |
|
| 346 | - $attrIds[$attrId] = null; |
|
| 347 | - } |
|
| 348 | - } |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - ksort( $attrTypeDeps[$prodId] ); |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags ); |
|
| 355 | - $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire ); |
|
| 356 | - |
|
| 357 | - |
|
| 358 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 359 | - |
|
| 360 | - $search = $attrManager->createSearch( true ); |
|
| 361 | - $expr = array( |
|
| 362 | - $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ), |
|
| 363 | - $search->getConditions(), |
|
| 364 | - ); |
|
| 365 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 366 | - |
|
| 367 | - $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) ); |
|
| 368 | - $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 369 | - |
|
| 370 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 371 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 372 | - |
|
| 373 | - |
|
| 374 | - if( !empty( $prodIds ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) { |
|
| 375 | - $view->itemsStockUrl = $this->getStockUrl( $view, $prodIds ); |
|
| 376 | - } |
|
| 377 | - |
|
| 378 | - $view->itemsSelectionProducts = $subProdMap; |
|
| 379 | - $view->itemsSelectionProductDependencies = $prodDeps; |
|
| 380 | - $view->itemsSelectionAttributeDependencies = $attrDeps; |
|
| 381 | - $view->itemsSelectionAttributeTypeDependencies = $attrTypeDeps; |
|
| 382 | - $view->itemsSelectionAttributeItems = $attributes; |
|
| 383 | - |
|
| 384 | - return $view; |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - |
|
| 388 | - /** |
|
| 389 | - * Adds the necessary view parameters for adding config attributes to the basket |
|
| 390 | - * |
|
| 391 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 392 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 393 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 394 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 395 | - */ |
|
| 396 | - protected function addConfigAttributes( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 397 | - { |
|
| 398 | - $context = $this->getContext(); |
|
| 399 | - $config = $context->getConfig(); |
|
| 400 | - $attrIds = $attributeTypes = array(); |
|
| 401 | - |
|
| 402 | - foreach( (array) $view->get( 'listProductItems', array() ) as $product ) |
|
| 403 | - { |
|
| 404 | - foreach( $product->getListItems( 'attribute' ) as $listItem ) { |
|
| 405 | - $attrIds[$listItem->getRefId()] = null; |
|
| 406 | - } |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - |
|
| 410 | - /** client/html/catalog/lists/items/domains-attributes |
|
| 411 | - * A list of domain names whose items should be available for the attributes |
|
| 412 | - * in the "items" part of the catalog list view templates |
|
| 413 | - * |
|
| 414 | - * The templates rendering attributes usually add images, texts and |
|
| 415 | - * maybe prices associated to each item. If you want to display |
|
| 416 | - * additional content like the attributes, you can configure your own |
|
| 417 | - * list of domains (attribute, media, price, product, text, etc. are |
|
| 418 | - * domains) whose items are fetched from the storage. |
|
| 419 | - * |
|
| 420 | - * Please keep in mind that the more domains you add to the |
|
| 421 | - * configuration, the more time is required for fetching the content! |
|
| 422 | - * |
|
| 423 | - * @param array List of domain names |
|
| 424 | - * @since 2016.01 |
|
| 425 | - * @category Developer |
|
| 426 | - */ |
|
| 427 | - $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) ); |
|
| 428 | - |
|
| 429 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 430 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 431 | - |
|
| 432 | - $search = $attrManager->createSearch( true ); |
|
| 433 | - $expr = array( |
|
| 434 | - $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ), |
|
| 435 | - $search->getConditions(), |
|
| 436 | - ); |
|
| 437 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 438 | - |
|
| 439 | - $attrItems = $attrManager->searchItems( $search, $domains ); |
|
| 440 | - |
|
| 441 | - $this->addMetaItem( $attrItems, 'attribute', $this->expire, $this->tags ); |
|
| 442 | - $this->addMetaList( array_keys( $attrItems ), 'attribute', $this->expire ); |
|
| 443 | - |
|
| 444 | - |
|
| 445 | - foreach( (array) $view->get( 'listProductItems', array() ) as $prodId => $product ) |
|
| 446 | - { |
|
| 447 | - foreach( $product->getRefItems( 'attribute', null, 'config' ) as $id => $attribute ) |
|
| 448 | - { |
|
| 449 | - if( isset( $attrItems[$id] ) ) { |
|
| 450 | - $attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id]; |
|
| 451 | - } |
|
| 452 | - } |
|
| 453 | - } |
|
| 454 | - |
|
| 455 | - $view->itemsAttributeConfigItems = $attributeTypes; |
|
| 456 | - |
|
| 457 | - return $view; |
|
| 458 | - } |
|
| 459 | - |
|
| 460 | - |
|
| 461 | - /** |
|
| 462 | - * Returns the URL to fetch the stock level details of the given products |
|
| 463 | - * |
|
| 464 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 465 | - * @param array $productIds List of product IDs |
|
| 466 | - * @return string Generated stock level URL |
|
| 467 | - */ |
|
| 468 | - protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds ) |
|
| 469 | - { |
|
| 470 | - $stockTarget = $view->config( 'client/html/catalog/stock/url/target' ); |
|
| 471 | - $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 472 | - $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 473 | - $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() ); |
|
| 474 | - |
|
| 475 | - sort( $productIds ); |
|
| 476 | - |
|
| 477 | - $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 478 | - return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 479 | - } |
|
| 25 | + /** client/html/catalog/lists/items/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog list items section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/lists/items/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $tags = array(); |
|
| 61 | + private $expire; |
|
| 62 | + private $view; |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Returns the HTML code for insertion into the body. |
|
| 67 | + * |
|
| 68 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | + * @return string HTML code |
|
| 72 | + */ |
|
| 73 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | + { |
|
| 75 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | + |
|
| 77 | + $html = ''; |
|
| 78 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | + } |
|
| 81 | + $view->itemsBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/lists/items/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog list items client. |
|
| 85 | + * |
|
| 86 | + * The template file contains the HTML code and processing instructions |
|
| 87 | + * to generate the result shown in the body of the frontend. The |
|
| 88 | + * configuration string is the path to the template file relative |
|
| 89 | + * to the templates directory (usually in client/html/templates). |
|
| 90 | + * |
|
| 91 | + * You can overwrite the template file configuration in extensions and |
|
| 92 | + * provide alternative templates. These alternative templates should be |
|
| 93 | + * named like the default one but with the string "standard" replaced by |
|
| 94 | + * an unique name. You may use the name of your project for this. If |
|
| 95 | + * you've implemented an alternative client class as well, "standard" |
|
| 96 | + * should be replaced by the name of the new class. |
|
| 97 | + * |
|
| 98 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | + * @since 2014.03 |
|
| 100 | + * @category Developer |
|
| 101 | + * @see client/html/catalog/lists/items/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/lists/items/standard/template-body'; |
|
| 104 | + $default = 'catalog/lists/items-body-default.php'; |
|
| 105 | + |
|
| 106 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Returns the HTML string for insertion into the header. |
|
| 112 | + * |
|
| 113 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | + * @return string|null String including HTML tags for the header on error |
|
| 117 | + */ |
|
| 118 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | + { |
|
| 120 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | + |
|
| 122 | + $html = ''; |
|
| 123 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | + } |
|
| 126 | + $view->itemsHeader = $html; |
|
| 127 | + |
|
| 128 | + /** client/html/catalog/lists/items/standard/template-header |
|
| 129 | + * Relative path to the HTML header template of the catalog list items client. |
|
| 130 | + * |
|
| 131 | + * The template file contains the HTML code and processing instructions |
|
| 132 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | + * of the rendered page in the frontend. The configuration string is the |
|
| 134 | + * path to the template file relative to the templates directory (usually |
|
| 135 | + * in client/html/templates). |
|
| 136 | + * |
|
| 137 | + * You can overwrite the template file configuration in extensions and |
|
| 138 | + * provide alternative templates. These alternative templates should be |
|
| 139 | + * named like the default one but with the string "standard" replaced by |
|
| 140 | + * an unique name. You may use the name of your project for this. If |
|
| 141 | + * you've implemented an alternative client class as well, "standard" |
|
| 142 | + * should be replaced by the name of the new class. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2014.03 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/catalog/lists/items/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/catalog/lists/items/standard/template-header'; |
|
| 150 | + $default = 'catalog/lists/items-header-default.php'; |
|
| 151 | + |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/catalog/lists/items/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the catalog list items html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/catalog/lists/items/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/catalog/lists/items/decorators/global |
|
| 188 | + * @see client/html/catalog/lists/items/decorators/local |
|
| 189 | + */ |
|
| 190 | + |
|
| 191 | + /** client/html/catalog/lists/items/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the catalog list items html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/catalog/lists/items/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/lists/items/decorators/excludes |
|
| 212 | + * @see client/html/catalog/lists/items/decorators/local |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + /** client/html/catalog/lists/items/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the catalog list items html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/lists/items/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/lists/items/decorators/excludes |
|
| 236 | + * @see client/html/catalog/lists/items/decorators/global |
|
| 237 | + */ |
|
| 238 | + |
|
| 239 | + return $this->createSubClient( 'catalog/lists/items/' . $type, $name ); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Returns the list of sub-client names configured for the client. |
|
| 245 | + * |
|
| 246 | + * @return array List of HTML client names |
|
| 247 | + */ |
|
| 248 | + protected function getSubClientNames() |
|
| 249 | + { |
|
| 250 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 256 | + * |
|
| 257 | + * @param string $content Cached content |
|
| 258 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 259 | + * @return string Modified body content |
|
| 260 | + */ |
|
| 261 | + public function modifyBody( $content, $uid ) |
|
| 262 | + { |
|
| 263 | + $content = parent::modifyBody( $content, $uid ); |
|
| 264 | + |
|
| 265 | + return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf' ); |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + |
|
| 269 | + /** |
|
| 270 | + * Sets the necessary parameter values in the view. |
|
| 271 | + * |
|
| 272 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 273 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 274 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 275 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 276 | + */ |
|
| 277 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 278 | + { |
|
| 279 | + if( !isset( $this->view ) ) |
|
| 280 | + { |
|
| 281 | + $view->itemPosition = ( $this->getProductListPage( $view ) - 1 ) * $this->getProductListSize( $view ); |
|
| 282 | + |
|
| 283 | + if( $this->getContext()->getConfig()->get( 'client/html/catalog/lists/basket-add', false ) ) |
|
| 284 | + { |
|
| 285 | + $view = $this->addSelectionProducts( $view, $tags, $expire ); |
|
| 286 | + $view = $this->addConfigAttributes( $view, $tags, $expire ); |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + $this->view = $view; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + return $this->view; |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + |
|
| 296 | + /** |
|
| 297 | + * Adds the necessary view parameters for adding selection products to the basket |
|
| 298 | + * |
|
| 299 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 300 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 301 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 302 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 303 | + */ |
|
| 304 | + protected function addSelectionProducts( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 305 | + { |
|
| 306 | + $context = $this->getContext(); |
|
| 307 | + $config = $context->getConfig(); |
|
| 308 | + $subProdMap = $prodMap = $prodIds = array(); |
|
| 309 | + |
|
| 310 | + foreach( (array) $view->get( 'listProductItems', array() ) as $product ) |
|
| 311 | + { |
|
| 312 | + if( $product->getType() === 'select' ) |
|
| 313 | + { |
|
| 314 | + foreach( $product->getListItems( 'product', 'default' ) as $listItem ) |
|
| 315 | + { |
|
| 316 | + $prodMap[$listItem->getParentId()][] = $listItem->getRefId(); |
|
| 317 | + $prodIds[$listItem->getRefId()] = null; |
|
| 318 | + } |
|
| 319 | + } |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + $prodIds = array_keys( $prodIds ); |
|
| 323 | + |
|
| 324 | + |
|
| 325 | + $domains = array( 'text', 'price', 'media', 'attribute' ); |
|
| 326 | + $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains ); |
|
| 327 | + |
|
| 328 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 329 | + $subproducts = $controller->getProductItems( $prodIds, $domains ); |
|
| 330 | + $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array(); |
|
| 331 | + |
|
| 332 | + foreach( $prodMap as $prodId => $list ) |
|
| 333 | + { |
|
| 334 | + foreach( $list as $subProdId ) |
|
| 335 | + { |
|
| 336 | + if( isset( $subproducts[$subProdId] ) ) |
|
| 337 | + { |
|
| 338 | + $subProduct = $subproducts[$subProdId]; |
|
| 339 | + $subProdMap[$prodId][$subProdId] = $subProduct; |
|
| 340 | + |
|
| 341 | + foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem ) |
|
| 342 | + { |
|
| 343 | + $attrTypeDeps[$prodId][$attrItem->getType()][$attrId] = $attrItem->getPosition(); |
|
| 344 | + $attrDeps[$prodId][$attrId][] = $subProdId; |
|
| 345 | + $prodDeps[$prodId][$subProdId][] = $attrId; |
|
| 346 | + $attrIds[$attrId] = null; |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + ksort( $attrTypeDeps[$prodId] ); |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags ); |
|
| 355 | + $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire ); |
|
| 356 | + |
|
| 357 | + |
|
| 358 | + $attrManager = $controller->createManager( 'attribute' ); |
|
| 359 | + |
|
| 360 | + $search = $attrManager->createSearch( true ); |
|
| 361 | + $expr = array( |
|
| 362 | + $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ), |
|
| 363 | + $search->getConditions(), |
|
| 364 | + ); |
|
| 365 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 366 | + |
|
| 367 | + $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) ); |
|
| 368 | + $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 369 | + |
|
| 370 | + $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 371 | + $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 372 | + |
|
| 373 | + |
|
| 374 | + if( !empty( $prodIds ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) { |
|
| 375 | + $view->itemsStockUrl = $this->getStockUrl( $view, $prodIds ); |
|
| 376 | + } |
|
| 377 | + |
|
| 378 | + $view->itemsSelectionProducts = $subProdMap; |
|
| 379 | + $view->itemsSelectionProductDependencies = $prodDeps; |
|
| 380 | + $view->itemsSelectionAttributeDependencies = $attrDeps; |
|
| 381 | + $view->itemsSelectionAttributeTypeDependencies = $attrTypeDeps; |
|
| 382 | + $view->itemsSelectionAttributeItems = $attributes; |
|
| 383 | + |
|
| 384 | + return $view; |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + |
|
| 388 | + /** |
|
| 389 | + * Adds the necessary view parameters for adding config attributes to the basket |
|
| 390 | + * |
|
| 391 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 392 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 393 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 394 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 395 | + */ |
|
| 396 | + protected function addConfigAttributes( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 397 | + { |
|
| 398 | + $context = $this->getContext(); |
|
| 399 | + $config = $context->getConfig(); |
|
| 400 | + $attrIds = $attributeTypes = array(); |
|
| 401 | + |
|
| 402 | + foreach( (array) $view->get( 'listProductItems', array() ) as $product ) |
|
| 403 | + { |
|
| 404 | + foreach( $product->getListItems( 'attribute' ) as $listItem ) { |
|
| 405 | + $attrIds[$listItem->getRefId()] = null; |
|
| 406 | + } |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + |
|
| 410 | + /** client/html/catalog/lists/items/domains-attributes |
|
| 411 | + * A list of domain names whose items should be available for the attributes |
|
| 412 | + * in the "items" part of the catalog list view templates |
|
| 413 | + * |
|
| 414 | + * The templates rendering attributes usually add images, texts and |
|
| 415 | + * maybe prices associated to each item. If you want to display |
|
| 416 | + * additional content like the attributes, you can configure your own |
|
| 417 | + * list of domains (attribute, media, price, product, text, etc. are |
|
| 418 | + * domains) whose items are fetched from the storage. |
|
| 419 | + * |
|
| 420 | + * Please keep in mind that the more domains you add to the |
|
| 421 | + * configuration, the more time is required for fetching the content! |
|
| 422 | + * |
|
| 423 | + * @param array List of domain names |
|
| 424 | + * @since 2016.01 |
|
| 425 | + * @category Developer |
|
| 426 | + */ |
|
| 427 | + $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) ); |
|
| 428 | + |
|
| 429 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 430 | + $attrManager = $controller->createManager( 'attribute' ); |
|
| 431 | + |
|
| 432 | + $search = $attrManager->createSearch( true ); |
|
| 433 | + $expr = array( |
|
| 434 | + $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ), |
|
| 435 | + $search->getConditions(), |
|
| 436 | + ); |
|
| 437 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 438 | + |
|
| 439 | + $attrItems = $attrManager->searchItems( $search, $domains ); |
|
| 440 | + |
|
| 441 | + $this->addMetaItem( $attrItems, 'attribute', $this->expire, $this->tags ); |
|
| 442 | + $this->addMetaList( array_keys( $attrItems ), 'attribute', $this->expire ); |
|
| 443 | + |
|
| 444 | + |
|
| 445 | + foreach( (array) $view->get( 'listProductItems', array() ) as $prodId => $product ) |
|
| 446 | + { |
|
| 447 | + foreach( $product->getRefItems( 'attribute', null, 'config' ) as $id => $attribute ) |
|
| 448 | + { |
|
| 449 | + if( isset( $attrItems[$id] ) ) { |
|
| 450 | + $attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id]; |
|
| 451 | + } |
|
| 452 | + } |
|
| 453 | + } |
|
| 454 | + |
|
| 455 | + $view->itemsAttributeConfigItems = $attributeTypes; |
|
| 456 | + |
|
| 457 | + return $view; |
|
| 458 | + } |
|
| 459 | + |
|
| 460 | + |
|
| 461 | + /** |
|
| 462 | + * Returns the URL to fetch the stock level details of the given products |
|
| 463 | + * |
|
| 464 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 465 | + * @param array $productIds List of product IDs |
|
| 466 | + * @return string Generated stock level URL |
|
| 467 | + */ |
|
| 468 | + protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds ) |
|
| 469 | + { |
|
| 470 | + $stockTarget = $view->config( 'client/html/catalog/stock/url/target' ); |
|
| 471 | + $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 472 | + $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 473 | + $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() ); |
|
| 474 | + |
|
| 475 | + sort( $productIds ); |
|
| 476 | + |
|
| 477 | + $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 478 | + return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 479 | + } |
|
| 480 | 480 | } |
| 481 | 481 | \ No newline at end of file |
@@ -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->itemsBody = $html; |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/lists/items/standard/template-body'; |
| 104 | 104 | $default = 'catalog/lists/items-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->itemsHeader = $html; |
| 127 | 127 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/catalog/lists/items/standard/template-header'; |
| 150 | 150 | $default = 'catalog/lists/items-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/lists/items/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the catalog list items html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/catalog/lists/items/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'catalog/lists/items/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('catalog/lists/items/'.$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 | |
@@ -258,11 +258,11 @@ discard block |
||
| 258 | 258 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 259 | 259 | * @return string Modified body content |
| 260 | 260 | */ |
| 261 | - public function modifyBody( $content, $uid ) |
|
| 261 | + public function modifyBody($content, $uid) |
|
| 262 | 262 | { |
| 263 | - $content = parent::modifyBody( $content, $uid ); |
|
| 263 | + $content = parent::modifyBody($content, $uid); |
|
| 264 | 264 | |
| 265 | - return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf' ); |
|
| 265 | + return $this->replaceSection($content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf'); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
@@ -274,16 +274,16 @@ discard block |
||
| 274 | 274 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 275 | 275 | * @return \Aimeos\MW\View\Iface Modified view object |
| 276 | 276 | */ |
| 277 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 277 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 278 | 278 | { |
| 279 | - if( !isset( $this->view ) ) |
|
| 279 | + if (!isset($this->view)) |
|
| 280 | 280 | { |
| 281 | - $view->itemPosition = ( $this->getProductListPage( $view ) - 1 ) * $this->getProductListSize( $view ); |
|
| 281 | + $view->itemPosition = ($this->getProductListPage($view) - 1) * $this->getProductListSize($view); |
|
| 282 | 282 | |
| 283 | - if( $this->getContext()->getConfig()->get( 'client/html/catalog/lists/basket-add', false ) ) |
|
| 283 | + if ($this->getContext()->getConfig()->get('client/html/catalog/lists/basket-add', false)) |
|
| 284 | 284 | { |
| 285 | - $view = $this->addSelectionProducts( $view, $tags, $expire ); |
|
| 286 | - $view = $this->addConfigAttributes( $view, $tags, $expire ); |
|
| 285 | + $view = $this->addSelectionProducts($view, $tags, $expire); |
|
| 286 | + $view = $this->addConfigAttributes($view, $tags, $expire); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | $this->view = $view; |
@@ -301,17 +301,17 @@ discard block |
||
| 301 | 301 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 302 | 302 | * @return \Aimeos\MW\View\Iface Modified view object |
| 303 | 303 | */ |
| 304 | - protected function addSelectionProducts( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 304 | + protected function addSelectionProducts(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 305 | 305 | { |
| 306 | 306 | $context = $this->getContext(); |
| 307 | 307 | $config = $context->getConfig(); |
| 308 | 308 | $subProdMap = $prodMap = $prodIds = array(); |
| 309 | 309 | |
| 310 | - foreach( (array) $view->get( 'listProductItems', array() ) as $product ) |
|
| 310 | + foreach ((array) $view->get('listProductItems', array()) as $product) |
|
| 311 | 311 | { |
| 312 | - if( $product->getType() === 'select' ) |
|
| 312 | + if ($product->getType() === 'select') |
|
| 313 | 313 | { |
| 314 | - foreach( $product->getListItems( 'product', 'default' ) as $listItem ) |
|
| 314 | + foreach ($product->getListItems('product', 'default') as $listItem) |
|
| 315 | 315 | { |
| 316 | 316 | $prodMap[$listItem->getParentId()][] = $listItem->getRefId(); |
| 317 | 317 | $prodIds[$listItem->getRefId()] = null; |
@@ -319,26 +319,26 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - $prodIds = array_keys( $prodIds ); |
|
| 322 | + $prodIds = array_keys($prodIds); |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | - $domains = array( 'text', 'price', 'media', 'attribute' ); |
|
| 326 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains ); |
|
| 325 | + $domains = array('text', 'price', 'media', 'attribute'); |
|
| 326 | + $domains = $config->get('client/html/catalog/detail/basket/selection/domains', $domains); |
|
| 327 | 327 | |
| 328 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 329 | - $subproducts = $controller->getProductItems( $prodIds, $domains ); |
|
| 328 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 329 | + $subproducts = $controller->getProductItems($prodIds, $domains); |
|
| 330 | 330 | $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array(); |
| 331 | 331 | |
| 332 | - foreach( $prodMap as $prodId => $list ) |
|
| 332 | + foreach ($prodMap as $prodId => $list) |
|
| 333 | 333 | { |
| 334 | - foreach( $list as $subProdId ) |
|
| 334 | + foreach ($list as $subProdId) |
|
| 335 | 335 | { |
| 336 | - if( isset( $subproducts[$subProdId] ) ) |
|
| 336 | + if (isset($subproducts[$subProdId])) |
|
| 337 | 337 | { |
| 338 | 338 | $subProduct = $subproducts[$subProdId]; |
| 339 | 339 | $subProdMap[$prodId][$subProdId] = $subProduct; |
| 340 | 340 | |
| 341 | - foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem ) |
|
| 341 | + foreach ($subProduct->getRefItems('attribute', null, 'variant') as $attrId => $attrItem) |
|
| 342 | 342 | { |
| 343 | 343 | $attrTypeDeps[$prodId][$attrItem->getType()][$attrId] = $attrItem->getPosition(); |
| 344 | 344 | $attrDeps[$prodId][$attrId][] = $subProdId; |
@@ -348,31 +348,31 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - ksort( $attrTypeDeps[$prodId] ); |
|
| 351 | + ksort($attrTypeDeps[$prodId]); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags ); |
|
| 355 | - $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire ); |
|
| 354 | + $this->addMetaItem($subproducts, 'product', $this->expire, $this->tags); |
|
| 355 | + $this->addMetaList(array_keys($subproducts), 'product', $this->expire); |
|
| 356 | 356 | |
| 357 | 357 | |
| 358 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 358 | + $attrManager = $controller->createManager('attribute'); |
|
| 359 | 359 | |
| 360 | - $search = $attrManager->createSearch( true ); |
|
| 360 | + $search = $attrManager->createSearch(true); |
|
| 361 | 361 | $expr = array( |
| 362 | - $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ), |
|
| 362 | + $search->compare('==', 'attribute.id', array_keys($attrIds)), |
|
| 363 | 363 | $search->getConditions(), |
| 364 | 364 | ); |
| 365 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 365 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 366 | 366 | |
| 367 | - $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) ); |
|
| 368 | - $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 367 | + $domains = $config->get('client/html/catalog/lists/items/domains-attributes', array('text', 'price', 'media')); |
|
| 368 | + $attributes = $attrManager->searchItems($search, $domains); |
|
| 369 | 369 | |
| 370 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 371 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 370 | + $this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags); |
|
| 371 | + $this->addMetaList(array_keys($attributes), 'attribute', $this->expire); |
|
| 372 | 372 | |
| 373 | 373 | |
| 374 | - if( !empty( $prodIds ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) { |
|
| 375 | - $view->itemsStockUrl = $this->getStockUrl( $view, $prodIds ); |
|
| 374 | + if (!empty($prodIds) && $config->get('client/html/catalog/lists/stock/enable', true) === true) { |
|
| 375 | + $view->itemsStockUrl = $this->getStockUrl($view, $prodIds); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | $view->itemsSelectionProducts = $subProdMap; |
@@ -393,15 +393,15 @@ discard block |
||
| 393 | 393 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 394 | 394 | * @return \Aimeos\MW\View\Iface Modified view object |
| 395 | 395 | */ |
| 396 | - protected function addConfigAttributes( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 396 | + protected function addConfigAttributes(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 397 | 397 | { |
| 398 | 398 | $context = $this->getContext(); |
| 399 | 399 | $config = $context->getConfig(); |
| 400 | 400 | $attrIds = $attributeTypes = array(); |
| 401 | 401 | |
| 402 | - foreach( (array) $view->get( 'listProductItems', array() ) as $product ) |
|
| 402 | + foreach ((array) $view->get('listProductItems', array()) as $product) |
|
| 403 | 403 | { |
| 404 | - foreach( $product->getListItems( 'attribute' ) as $listItem ) { |
|
| 404 | + foreach ($product->getListItems('attribute') as $listItem) { |
|
| 405 | 405 | $attrIds[$listItem->getRefId()] = null; |
| 406 | 406 | } |
| 407 | 407 | } |
@@ -424,29 +424,29 @@ discard block |
||
| 424 | 424 | * @since 2016.01 |
| 425 | 425 | * @category Developer |
| 426 | 426 | */ |
| 427 | - $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) ); |
|
| 427 | + $domains = $config->get('client/html/catalog/lists/items/domains-attributes', array('text', 'price', 'media')); |
|
| 428 | 428 | |
| 429 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 430 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 429 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 430 | + $attrManager = $controller->createManager('attribute'); |
|
| 431 | 431 | |
| 432 | - $search = $attrManager->createSearch( true ); |
|
| 432 | + $search = $attrManager->createSearch(true); |
|
| 433 | 433 | $expr = array( |
| 434 | - $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ), |
|
| 434 | + $search->compare('==', 'attribute.id', array_keys($attrIds)), |
|
| 435 | 435 | $search->getConditions(), |
| 436 | 436 | ); |
| 437 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 437 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 438 | 438 | |
| 439 | - $attrItems = $attrManager->searchItems( $search, $domains ); |
|
| 439 | + $attrItems = $attrManager->searchItems($search, $domains); |
|
| 440 | 440 | |
| 441 | - $this->addMetaItem( $attrItems, 'attribute', $this->expire, $this->tags ); |
|
| 442 | - $this->addMetaList( array_keys( $attrItems ), 'attribute', $this->expire ); |
|
| 441 | + $this->addMetaItem($attrItems, 'attribute', $this->expire, $this->tags); |
|
| 442 | + $this->addMetaList(array_keys($attrItems), 'attribute', $this->expire); |
|
| 443 | 443 | |
| 444 | 444 | |
| 445 | - foreach( (array) $view->get( 'listProductItems', array() ) as $prodId => $product ) |
|
| 445 | + foreach ((array) $view->get('listProductItems', array()) as $prodId => $product) |
|
| 446 | 446 | { |
| 447 | - foreach( $product->getRefItems( 'attribute', null, 'config' ) as $id => $attribute ) |
|
| 447 | + foreach ($product->getRefItems('attribute', null, 'config') as $id => $attribute) |
|
| 448 | 448 | { |
| 449 | - if( isset( $attrItems[$id] ) ) { |
|
| 449 | + if (isset($attrItems[$id])) { |
|
| 450 | 450 | $attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id]; |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -465,16 +465,16 @@ discard block |
||
| 465 | 465 | * @param array $productIds List of product IDs |
| 466 | 466 | * @return string Generated stock level URL |
| 467 | 467 | */ |
| 468 | - protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds ) |
|
| 468 | + protected function getStockUrl(\Aimeos\MW\View\Iface $view, array $productIds) |
|
| 469 | 469 | { |
| 470 | - $stockTarget = $view->config( 'client/html/catalog/stock/url/target' ); |
|
| 471 | - $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 472 | - $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 473 | - $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() ); |
|
| 470 | + $stockTarget = $view->config('client/html/catalog/stock/url/target'); |
|
| 471 | + $stockController = $view->config('client/html/catalog/stock/url/controller', 'catalog'); |
|
| 472 | + $stockAction = $view->config('client/html/catalog/stock/url/action', 'stock'); |
|
| 473 | + $stockConfig = $view->config('client/html/catalog/stock/url/config', array()); |
|
| 474 | 474 | |
| 475 | - sort( $productIds ); |
|
| 475 | + sort($productIds); |
|
| 476 | 476 | |
| 477 | - $params = array( 's_prodid' => implode( ' ', $productIds ) ); |
|
| 478 | - return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 477 | + $params = array('s_prodid' => implode(' ', $productIds)); |
|
| 478 | + return $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,260 +19,260 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/lists/quote/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog list quote section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/lists/quote/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/catalog/lists/quote/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog list quote section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/lists/quote/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->quoteBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->quoteBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/catalog/lists/quote/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the catalog list quote client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * should be replaced by the name of the new class. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2014.03 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/catalog/lists/quote/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/catalog/lists/quote/standard/template-body'; |
|
| 102 | - $default = 'catalog/lists/quote-body-default.php'; |
|
| 81 | + /** client/html/catalog/lists/quote/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the catalog list quote client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * should be replaced by the name of the new class. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2014.03 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/catalog/lists/quote/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/catalog/lists/quote/standard/template-body'; |
|
| 102 | + $default = 'catalog/lists/quote-body-default.php'; |
|
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns the HTML string for insertion into the header. |
|
| 110 | - * |
|
| 111 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | - */ |
|
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML string for insertion into the header. |
|
| 110 | + * |
|
| 111 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | + * @return string|null String including HTML tags for the header on error |
|
| 115 | + */ |
|
| 116 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | 119 | |
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->quoteHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->quoteHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/catalog/lists/quote/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the catalog list quote client. |
|
| 128 | - * |
|
| 129 | - * The template file contains the HTML code and processing instructions |
|
| 130 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | - * of the rendered page in the frontend. The configuration string is the |
|
| 132 | - * path to the template file relative to the templates directory (usually |
|
| 133 | - * in client/html/templates). |
|
| 134 | - * |
|
| 135 | - * You can overwrite the template file configuration in extensions and |
|
| 136 | - * provide alternative templates. These alternative templates should be |
|
| 137 | - * named like the default one but with the string "standard" replaced by |
|
| 138 | - * an unique name. You may use the name of your project for this. If |
|
| 139 | - * you've implemented an alternative client class as well, "standard" |
|
| 140 | - * should be replaced by the name of the new class. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2014.03 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/catalog/lists/quote/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/catalog/lists/quote/standard/template-header'; |
|
| 148 | - $default = 'catalog/lists/quote-header-default.php'; |
|
| 126 | + /** client/html/catalog/lists/quote/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the catalog list quote client. |
|
| 128 | + * |
|
| 129 | + * The template file contains the HTML code and processing instructions |
|
| 130 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | + * of the rendered page in the frontend. The configuration string is the |
|
| 132 | + * path to the template file relative to the templates directory (usually |
|
| 133 | + * in client/html/templates). |
|
| 134 | + * |
|
| 135 | + * You can overwrite the template file configuration in extensions and |
|
| 136 | + * provide alternative templates. These alternative templates should be |
|
| 137 | + * named like the default one but with the string "standard" replaced by |
|
| 138 | + * an unique name. You may use the name of your project for this. If |
|
| 139 | + * you've implemented an alternative client class as well, "standard" |
|
| 140 | + * should be replaced by the name of the new class. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2014.03 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/catalog/lists/quote/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/catalog/lists/quote/standard/template-header'; |
|
| 148 | + $default = 'catalog/lists/quote-header-default.php'; |
|
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Returns the sub-client given by its name. |
|
| 156 | - * |
|
| 157 | - * @param string $type Name of the client type |
|
| 158 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | - */ |
|
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 162 | - { |
|
| 163 | - /** client/html/catalog/lists/quote/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the catalog list quote html client |
|
| 165 | - * |
|
| 166 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | - * modify what is returned to the caller. |
|
| 170 | - * |
|
| 171 | - * This option allows you to remove a decorator added via |
|
| 172 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | - * around the html client. |
|
| 174 | - * |
|
| 175 | - * client/html/catalog/lists/quote/decorators/excludes = array( 'decorator1' ) |
|
| 176 | - * |
|
| 177 | - * This would remove the decorator named "decorator1" from the list of |
|
| 178 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | - * "client/html/common/decorators/default" to the html client. |
|
| 180 | - * |
|
| 181 | - * @param array List of decorator names |
|
| 182 | - * @since 2015.08 |
|
| 183 | - * @category Developer |
|
| 184 | - * @see client/html/common/decorators/default |
|
| 185 | - * @see client/html/catalog/lists/quote/decorators/global |
|
| 186 | - * @see client/html/catalog/lists/quote/decorators/local |
|
| 187 | - */ |
|
| 154 | + /** |
|
| 155 | + * Returns the sub-client given by its name. |
|
| 156 | + * |
|
| 157 | + * @param string $type Name of the client type |
|
| 158 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | + */ |
|
| 161 | + public function getSubClient( $type, $name = null ) |
|
| 162 | + { |
|
| 163 | + /** client/html/catalog/lists/quote/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the catalog list quote html client |
|
| 165 | + * |
|
| 166 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | + * modify what is returned to the caller. |
|
| 170 | + * |
|
| 171 | + * This option allows you to remove a decorator added via |
|
| 172 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | + * around the html client. |
|
| 174 | + * |
|
| 175 | + * client/html/catalog/lists/quote/decorators/excludes = array( 'decorator1' ) |
|
| 176 | + * |
|
| 177 | + * This would remove the decorator named "decorator1" from the list of |
|
| 178 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | + * "client/html/common/decorators/default" to the html client. |
|
| 180 | + * |
|
| 181 | + * @param array List of decorator names |
|
| 182 | + * @since 2015.08 |
|
| 183 | + * @category Developer |
|
| 184 | + * @see client/html/common/decorators/default |
|
| 185 | + * @see client/html/catalog/lists/quote/decorators/global |
|
| 186 | + * @see client/html/catalog/lists/quote/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/catalog/lists/quote/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the catalog list quote html client |
|
| 191 | - * |
|
| 192 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | - * modify what is returned to the caller. |
|
| 196 | - * |
|
| 197 | - * This option allows you to wrap global decorators |
|
| 198 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | - * |
|
| 200 | - * client/html/catalog/lists/quote/decorators/global = array( 'decorator1' ) |
|
| 201 | - * |
|
| 202 | - * This would add the decorator named "decorator1" defined by |
|
| 203 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | - * |
|
| 205 | - * @param array List of decorator names |
|
| 206 | - * @since 2015.08 |
|
| 207 | - * @category Developer |
|
| 208 | - * @see client/html/common/decorators/default |
|
| 209 | - * @see client/html/catalog/lists/quote/decorators/excludes |
|
| 210 | - * @see client/html/catalog/lists/quote/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/catalog/lists/quote/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the catalog list quote html client |
|
| 191 | + * |
|
| 192 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | + * modify what is returned to the caller. |
|
| 196 | + * |
|
| 197 | + * This option allows you to wrap global decorators |
|
| 198 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | + * |
|
| 200 | + * client/html/catalog/lists/quote/decorators/global = array( 'decorator1' ) |
|
| 201 | + * |
|
| 202 | + * This would add the decorator named "decorator1" defined by |
|
| 203 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | + * |
|
| 205 | + * @param array List of decorator names |
|
| 206 | + * @since 2015.08 |
|
| 207 | + * @category Developer |
|
| 208 | + * @see client/html/common/decorators/default |
|
| 209 | + * @see client/html/catalog/lists/quote/decorators/excludes |
|
| 210 | + * @see client/html/catalog/lists/quote/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/catalog/lists/quote/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the catalog list quote html client |
|
| 215 | - * |
|
| 216 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | - * modify what is returned to the caller. |
|
| 220 | - * |
|
| 221 | - * This option allows you to wrap local decorators |
|
| 222 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/catalog/lists/quote/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | - * |
|
| 229 | - * @param array List of decorator names |
|
| 230 | - * @since 2015.08 |
|
| 231 | - * @category Developer |
|
| 232 | - * @see client/html/common/decorators/default |
|
| 233 | - * @see client/html/catalog/lists/quote/decorators/excludes |
|
| 234 | - * @see client/html/catalog/lists/quote/decorators/global |
|
| 235 | - */ |
|
| 213 | + /** client/html/catalog/lists/quote/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the catalog list quote html client |
|
| 215 | + * |
|
| 216 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | + * modify what is returned to the caller. |
|
| 220 | + * |
|
| 221 | + * This option allows you to wrap local decorators |
|
| 222 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/catalog/lists/quote/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | + * |
|
| 229 | + * @param array List of decorator names |
|
| 230 | + * @since 2015.08 |
|
| 231 | + * @category Developer |
|
| 232 | + * @see client/html/common/decorators/default |
|
| 233 | + * @see client/html/catalog/lists/quote/decorators/excludes |
|
| 234 | + * @see client/html/catalog/lists/quote/decorators/global |
|
| 235 | + */ |
|
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/lists/quote/' . $type, $name ); |
|
| 238 | - } |
|
| 237 | + return $this->createSubClient( 'catalog/lists/quote/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns the list of sub-client names configured for the client. |
|
| 243 | - * |
|
| 244 | - * @return array List of HTML client names |
|
| 245 | - */ |
|
| 246 | - protected function getSubClientNames() |
|
| 247 | - { |
|
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns the list of sub-client names configured for the client. |
|
| 243 | + * |
|
| 244 | + * @return array List of HTML client names |
|
| 245 | + */ |
|
| 246 | + protected function getSubClientNames() |
|
| 247 | + { |
|
| 248 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Sets the necessary parameter values in the view. |
|
| 254 | - * |
|
| 255 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | - */ |
|
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | - { |
|
| 262 | - if( !isset( $this->cache ) ) |
|
| 263 | - { |
|
| 264 | - $view->quoteItems = array(); |
|
| 265 | - if( isset( $view->listCatPath ) ) |
|
| 266 | - { |
|
| 267 | - $catPath = $view->listCatPath; |
|
| 268 | - if( ( $catItem = end( $catPath ) ) !== false ) { |
|
| 269 | - $view->quoteItems = $catItem->getRefItems( 'text', 'quote', 'default' ); |
|
| 270 | - } |
|
| 271 | - } |
|
| 252 | + /** |
|
| 253 | + * Sets the necessary parameter values in the view. |
|
| 254 | + * |
|
| 255 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | + */ |
|
| 260 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + { |
|
| 262 | + if( !isset( $this->cache ) ) |
|
| 263 | + { |
|
| 264 | + $view->quoteItems = array(); |
|
| 265 | + if( isset( $view->listCatPath ) ) |
|
| 266 | + { |
|
| 267 | + $catPath = $view->listCatPath; |
|
| 268 | + if( ( $catItem = end( $catPath ) ) !== false ) { |
|
| 269 | + $view->quoteItems = $catItem->getRefItems( 'text', 'quote', 'default' ); |
|
| 270 | + } |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | - $this->cache = $view; |
|
| 274 | - } |
|
| 273 | + $this->cache = $view; |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - return $this->cache; |
|
| 277 | - } |
|
| 276 | + return $this->cache; |
|
| 277 | + } |
|
| 278 | 278 | } |
| 279 | 279 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->quoteBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/catalog/lists/quote/standard/template-body'; |
| 102 | 102 | $default = 'catalog/lists/quote-body-default.php'; |
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + return $view->render($view->config($tplconf, $default)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | 114 | * @return string|null String including HTML tags for the header on error |
| 115 | 115 | */ |
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 119 | 119 | |
| 120 | 120 | $html = ''; |
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + foreach ($this->getSubClients() as $subclient) { |
|
| 122 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 123 | 123 | } |
| 124 | 124 | $view->quoteHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/catalog/lists/quote/standard/template-header'; |
| 148 | 148 | $default = 'catalog/lists/quote-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/catalog/lists/quote/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the catalog list quote html client |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see client/html/catalog/lists/quote/decorators/global |
| 235 | 235 | */ |
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/lists/quote/' . $type, $name ); |
|
| 237 | + return $this->createSubClient('catalog/lists/quote/'.$type, $name); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | protected function getSubClientNames() |
| 247 | 247 | { |
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
@@ -257,16 +257,16 @@ discard block |
||
| 257 | 257 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 258 | 258 | * @return \Aimeos\MW\View\Iface Modified view object |
| 259 | 259 | */ |
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 261 | 261 | { |
| 262 | - if( !isset( $this->cache ) ) |
|
| 262 | + if (!isset($this->cache)) |
|
| 263 | 263 | { |
| 264 | 264 | $view->quoteItems = array(); |
| 265 | - if( isset( $view->listCatPath ) ) |
|
| 265 | + if (isset($view->listCatPath)) |
|
| 266 | 266 | { |
| 267 | 267 | $catPath = $view->listCatPath; |
| 268 | - if( ( $catItem = end( $catPath ) ) !== false ) { |
|
| 269 | - $view->quoteItems = $catItem->getRefItems( 'text', 'quote', 'default' ); |
|
| 268 | + if (($catItem = end($catPath)) !== false) { |
|
| 269 | + $view->quoteItems = $catItem->getRefItems('text', 'quote', 'default'); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |