@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 201 | 201 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 202 | 202 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 203 | - * @return string|null String including HTML tags for the header on error |
|
| 203 | + * @return string String including HTML tags for the header on error |
|
| 204 | 204 | */ |
| 205 | 205 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 206 | 206 | { |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | * Returns the parameters used by the html client. |
| 394 | 394 | * |
| 395 | 395 | * @param array $params Associative list of all parameters |
| 396 | - * @param array $prefixes List of prefixes the parameters must start with |
|
| 396 | + * @param string[] $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 | 399 | protected function getClientParams( array $params, array $prefixes = array( 'f', 'l', 'd', 'a' ) ) |
@@ -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|null 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 array $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|null 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 array $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 | } |
@@ -27,7 +27,6 @@ |
||
| 27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
| 28 | 28 | * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
| 29 | 29 | * and a list of relative paths inside the core or the extension as values |
| 30 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 31 | 30 | */ |
| 32 | 31 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
| 33 | 32 | { |
@@ -18,19 +18,19 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | abstract class Base |
| 21 | - extends \Aimeos\Client\Html\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Initializes the object instance |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 28 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | - * and a list of relative paths inside the core or the extension as values |
|
| 30 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 31 | - */ |
|
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 33 | - { |
|
| 34 | - parent::__construct( $context, $templatePaths ); |
|
| 35 | - } |
|
| 24 | + /** |
|
| 25 | + * Initializes the object instance |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 28 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | + * and a list of relative paths inside the core or the extension as values |
|
| 30 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 31 | + */ |
|
| 32 | + public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 33 | + { |
|
| 34 | + parent::__construct( $context, $templatePaths ); |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | \ 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,253 +19,253 @@ |
||
| 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/locale/select/language/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the locale select language 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.09 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/locale/select/language/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 25 | + /** client/html/locale/select/language/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the locale select language 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.09 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/locale/select/language/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | 60 | |
| 61 | 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 ); |
|
| 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 | 73 | |
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->languageBody = $html; |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->languageBody = $html; |
|
| 79 | 79 | |
| 80 | - /** client/html/locale/select/language/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the locale select language 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.09 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/locale/select/language/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/locale/select/language/standard/template-body'; |
|
| 101 | - $default = 'locale/select/language-body-default.php'; |
|
| 80 | + /** client/html/locale/select/language/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the locale select language 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.09 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/locale/select/language/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/locale/select/language/standard/template-body'; |
|
| 101 | + $default = 'locale/select/language-body-default.php'; |
|
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 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 ); |
|
| 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 | 118 | |
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->languageHeader = $html; |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->languageHeader = $html; |
|
| 124 | 124 | |
| 125 | - /** client/html/locale/select/language/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the locale select language 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.09 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/locale/select/language/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/locale/select/language/standard/template-header'; |
|
| 147 | - $default = 'locale/select/language-header-default.php'; |
|
| 125 | + /** client/html/locale/select/language/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the locale select language 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.09 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/locale/select/language/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/locale/select/language/standard/template-header'; |
|
| 147 | + $default = 'locale/select/language-header-default.php'; |
|
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | 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/locale/select/language/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the locale select language 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/locale/select/language/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/locale/select/language/decorators/global |
|
| 185 | - * @see client/html/locale/select/language/decorators/local |
|
| 186 | - */ |
|
| 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/locale/select/language/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the locale select language 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/locale/select/language/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/locale/select/language/decorators/global |
|
| 185 | + * @see client/html/locale/select/language/decorators/local |
|
| 186 | + */ |
|
| 187 | 187 | |
| 188 | - /** client/html/locale/select/language/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the locale select language 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/locale/select/language/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/locale/select/language/decorators/excludes |
|
| 209 | - * @see client/html/locale/select/language/decorators/local |
|
| 210 | - */ |
|
| 188 | + /** client/html/locale/select/language/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the locale select language 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/locale/select/language/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/locale/select/language/decorators/excludes |
|
| 209 | + * @see client/html/locale/select/language/decorators/local |
|
| 210 | + */ |
|
| 211 | 211 | |
| 212 | - /** client/html/locale/select/language/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the locale select language 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\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/locale/select/language/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\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/locale/select/language/decorators/excludes |
|
| 233 | - * @see client/html/locale/select/language/decorators/global |
|
| 234 | - */ |
|
| 212 | + /** client/html/locale/select/language/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the locale select language 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\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/locale/select/language/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\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/locale/select/language/decorators/excludes |
|
| 233 | + * @see client/html/locale/select/language/decorators/global |
|
| 234 | + */ |
|
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'locale/select/language/' . $type, $name ); |
|
| 237 | - } |
|
| 236 | + return $this->createSubClient( 'locale/select/language/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Processes the input, e.g. store given values. |
|
| 242 | - * A view must be available and this method doesn't generate any output |
|
| 243 | - * besides setting view variables. |
|
| 244 | - */ |
|
| 245 | - public function process() |
|
| 246 | - { |
|
| 247 | - $view = $this->getView(); |
|
| 248 | - $context = $this->getContext(); |
|
| 249 | - $config = $context->getConfig(); |
|
| 250 | - $session = $context->getSession(); |
|
| 240 | + /** |
|
| 241 | + * Processes the input, e.g. store given values. |
|
| 242 | + * A view must be available and this method doesn't generate any output |
|
| 243 | + * besides setting view variables. |
|
| 244 | + */ |
|
| 245 | + public function process() |
|
| 246 | + { |
|
| 247 | + $view = $this->getView(); |
|
| 248 | + $context = $this->getContext(); |
|
| 249 | + $config = $context->getConfig(); |
|
| 250 | + $session = $context->getSession(); |
|
| 251 | 251 | |
| 252 | - $name = $config->get( 'client/html/locale/select/language/param-name', 'loc_languageid' ); |
|
| 252 | + $name = $config->get( 'client/html/locale/select/language/param-name', 'loc_languageid' ); |
|
| 253 | 253 | |
| 254 | - if( ( $languageId = $view->param( $name ) ) !== null ) { |
|
| 255 | - $session->set( 'aimeos/locale/languageid', $languageId ); |
|
| 256 | - } |
|
| 254 | + if( ( $languageId = $view->param( $name ) ) !== null ) { |
|
| 255 | + $session->set( 'aimeos/locale/languageid', $languageId ); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - parent::process(); |
|
| 259 | - } |
|
| 258 | + parent::process(); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Returns the list of sub-client names configured for the client. |
|
| 264 | - * |
|
| 265 | - * @return array List of HTML client names |
|
| 266 | - */ |
|
| 267 | - protected function getSubClientNames() |
|
| 268 | - { |
|
| 269 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 270 | - } |
|
| 262 | + /** |
|
| 263 | + * Returns the list of sub-client names configured for the client. |
|
| 264 | + * |
|
| 265 | + * @return array List of HTML client names |
|
| 266 | + */ |
|
| 267 | + protected function getSubClientNames() |
|
| 268 | + { |
|
| 269 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 270 | + } |
|
| 271 | 271 | } |
@@ -19,88 +19,88 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Returns a list of tax rates and values for the given basket. |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. |
|
| 28 | - * @return array Associative list of tax rates as key and corresponding amounts as value |
|
| 29 | - */ |
|
| 30 | - protected function getTaxRates( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 31 | - { |
|
| 32 | - $taxrates = array(); |
|
| 24 | + /** |
|
| 25 | + * Returns a list of tax rates and values for the given basket. |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket containing the products, services, etc. |
|
| 28 | + * @return array Associative list of tax rates as key and corresponding amounts as value |
|
| 29 | + */ |
|
| 30 | + protected function getTaxRates( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 31 | + { |
|
| 32 | + $taxrates = array(); |
|
| 33 | 33 | |
| 34 | - foreach( $basket->getProducts() as $product ) |
|
| 35 | - { |
|
| 36 | - $price = clone $product->getPrice(); |
|
| 37 | - $taxrate = $price->getTaxrate(); |
|
| 34 | + foreach( $basket->getProducts() as $product ) |
|
| 35 | + { |
|
| 36 | + $price = clone $product->getPrice(); |
|
| 37 | + $taxrate = $price->getTaxrate(); |
|
| 38 | 38 | |
| 39 | - if( isset( $taxrates[$taxrate] ) ) { |
|
| 40 | - $taxrates[$taxrate]->addItem( $price, $product->getQuantity() ); |
|
| 41 | - } else { |
|
| 42 | - $taxrates[$taxrate] = $price->addItem( $price, $product->getQuantity() - 1 ); |
|
| 43 | - } |
|
| 44 | - } |
|
| 39 | + if( isset( $taxrates[$taxrate] ) ) { |
|
| 40 | + $taxrates[$taxrate]->addItem( $price, $product->getQuantity() ); |
|
| 41 | + } else { |
|
| 42 | + $taxrates[$taxrate] = $price->addItem( $price, $product->getQuantity() - 1 ); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - try |
|
| 47 | - { |
|
| 48 | - $price = clone $basket->getService( 'delivery' )->getPrice(); |
|
| 49 | - $taxrate = $price->getTaxrate(); |
|
| 46 | + try |
|
| 47 | + { |
|
| 48 | + $price = clone $basket->getService( 'delivery' )->getPrice(); |
|
| 49 | + $taxrate = $price->getTaxrate(); |
|
| 50 | 50 | |
| 51 | - if( isset( $taxrates[$taxrate] ) ) { |
|
| 52 | - $taxrates[$taxrate]->addItem( $price ); |
|
| 53 | - } else { |
|
| 54 | - $taxrates[$taxrate] = $price; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - catch( \Exception $e ) { ; } // if delivery service isn't available |
|
| 51 | + if( isset( $taxrates[$taxrate] ) ) { |
|
| 52 | + $taxrates[$taxrate]->addItem( $price ); |
|
| 53 | + } else { |
|
| 54 | + $taxrates[$taxrate] = $price; |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | + catch( \Exception $e ) { ; } // if delivery service isn't available |
|
| 58 | 58 | |
| 59 | - try |
|
| 60 | - { |
|
| 61 | - $price = clone $basket->getService( 'payment' )->getPrice(); |
|
| 62 | - $taxrate = $price->getTaxrate(); |
|
| 59 | + try |
|
| 60 | + { |
|
| 61 | + $price = clone $basket->getService( 'payment' )->getPrice(); |
|
| 62 | + $taxrate = $price->getTaxrate(); |
|
| 63 | 63 | |
| 64 | - if( isset( $taxrates[$taxrate] ) ) { |
|
| 65 | - $taxrates[$taxrate]->addItem( $price ); |
|
| 66 | - } else { |
|
| 67 | - $taxrates[$taxrate] = $price; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - catch( \Exception $e ) { ; } // if payment service isn't available |
|
| 64 | + if( isset( $taxrates[$taxrate] ) ) { |
|
| 65 | + $taxrates[$taxrate]->addItem( $price ); |
|
| 66 | + } else { |
|
| 67 | + $taxrates[$taxrate] = $price; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + catch( \Exception $e ) { ; } // if payment service isn't available |
|
| 71 | 71 | |
| 72 | - return $taxrates; |
|
| 73 | - } |
|
| 72 | + return $taxrates; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Returns the payment status at which download files are shown |
|
| 78 | - * |
|
| 79 | - * @return integer Payment status from \Aimeos\MShop\Order\Item\Base |
|
| 80 | - */ |
|
| 81 | - protected function getDownloadPaymentStatus() |
|
| 82 | - { |
|
| 83 | - $config = $this->getContext()->getConfig(); |
|
| 84 | - $default = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED; |
|
| 76 | + /** |
|
| 77 | + * Returns the payment status at which download files are shown |
|
| 78 | + * |
|
| 79 | + * @return integer Payment status from \Aimeos\MShop\Order\Item\Base |
|
| 80 | + */ |
|
| 81 | + protected function getDownloadPaymentStatus() |
|
| 82 | + { |
|
| 83 | + $config = $this->getContext()->getConfig(); |
|
| 84 | + $default = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED; |
|
| 85 | 85 | |
| 86 | - /** client/html/common/summary/detail/download/payment-status |
|
| 87 | - * Minium payment status value for product download files |
|
| 88 | - * |
|
| 89 | - * This setting specifies the payment status value of an order for which |
|
| 90 | - * links to bought product download files are shown on the "thank you" |
|
| 91 | - * page, in the "MyAccount" and in the e-mails sent to the customers. |
|
| 92 | - * |
|
| 93 | - * The value is one of the payment constant values from |
|
| 94 | - * {@link https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Order/Item/Base.php#L105}. |
|
| 95 | - * Most of the time, only two values are of interest: |
|
| 96 | - * * 5: payment authorized |
|
| 97 | - * * 6: payment received |
|
| 98 | - * |
|
| 99 | - * @param integer Order payment constant value |
|
| 100 | - * @since 2016.3 |
|
| 101 | - * @category User |
|
| 102 | - * @category Developer |
|
| 103 | - */ |
|
| 104 | - return $config->get( 'client/html/common/summary/detail/download/payment-status', $default ); |
|
| 105 | - } |
|
| 86 | + /** client/html/common/summary/detail/download/payment-status |
|
| 87 | + * Minium payment status value for product download files |
|
| 88 | + * |
|
| 89 | + * This setting specifies the payment status value of an order for which |
|
| 90 | + * links to bought product download files are shown on the "thank you" |
|
| 91 | + * page, in the "MyAccount" and in the e-mails sent to the customers. |
|
| 92 | + * |
|
| 93 | + * The value is one of the payment constant values from |
|
| 94 | + * {@link https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Order/Item/Base.php#L105}. |
|
| 95 | + * Most of the time, only two values are of interest: |
|
| 96 | + * * 5: payment authorized |
|
| 97 | + * * 6: payment received |
|
| 98 | + * |
|
| 99 | + * @param integer Order payment constant value |
|
| 100 | + * @since 2016.3 |
|
| 101 | + * @category User |
|
| 102 | + * @category Developer |
|
| 103 | + */ |
|
| 104 | + return $config->get( 'client/html/common/summary/detail/download/payment-status', $default ); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | \ No newline at end of file |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | 23 | { |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -19,15 +19,15 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | - extends \Aimeos\Client\Html\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Iface |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Initializes the class instance. |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
|
| 28 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | - * and a list of relative paths inside the core or the extension as values |
|
| 30 | - * @return void |
|
| 31 | - */ |
|
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 24 | + /** |
|
| 25 | + * Initializes the class instance. |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
|
| 28 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 29 | + * and a list of relative paths inside the core or the extension as values |
|
| 30 | + * @return void |
|
| 31 | + */ |
|
| 32 | + public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 33 | 33 | } |
@@ -19,16 +19,16 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | - extends \Aimeos\Client\Html\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Iface |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Initializes a new client decorator object. |
|
| 26 | - * |
|
| 27 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 29 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 30 | - * and a list of relative paths inside the core or the extension as values |
|
| 31 | - */ |
|
| 32 | - public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 33 | - \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 24 | + /** |
|
| 25 | + * Initializes a new client decorator object. |
|
| 26 | + * |
|
| 27 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 29 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 30 | + * and a list of relative paths inside the core or the extension as values |
|
| 31 | + */ |
|
| 32 | + public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 33 | + \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -19,167 +19,167 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Decorator\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Decorator\Iface |
|
| 24 | 24 | { |
| 25 | - private $client; |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Initializes a new client decorator object. |
|
| 30 | - * |
|
| 31 | - * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 32 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 33 | - * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 34 | - * and a list of relative paths inside the core or the extension as values |
|
| 35 | - */ |
|
| 36 | - public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 37 | - \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 38 | - { |
|
| 39 | - parent::__construct( $context, $templatePaths ); |
|
| 40 | - |
|
| 41 | - $this->client = $client; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Passes unknown methods to wrapped objects. |
|
| 47 | - * |
|
| 48 | - * @param string $name Name of the method |
|
| 49 | - * @param array $param List of method parameter |
|
| 50 | - * @return mixed Returns the value of the called method |
|
| 51 | - * @throws \Aimeos\Client\Html\Exception If method call failed |
|
| 52 | - */ |
|
| 53 | - public function __call( $name, array $param ) |
|
| 54 | - { |
|
| 55 | - if( ( $result = call_user_func_array( array( $this->client, $name ), $param ) ) === false ) { |
|
| 56 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - return $result; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Returns the sub-client given by its name. |
|
| 65 | - * |
|
| 66 | - * @param string $type Name of the client type |
|
| 67 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 68 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 69 | - */ |
|
| 70 | - public function getSubClient( $type, $name = null ) |
|
| 71 | - { |
|
| 72 | - return $this->client->getSubClient( $type, $name ); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Returns the HTML string for insertion into the header. |
|
| 78 | - * |
|
| 79 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 80 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 81 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 82 | - * @return string|null String including HTML tags for the header on error |
|
| 83 | - */ |
|
| 84 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 85 | - { |
|
| 86 | - return $this->client->getHeader( $uid, $tags, $expire ); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Returns the HTML code for insertion into the body. |
|
| 92 | - * |
|
| 93 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 94 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 95 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 96 | - * @return string HTML code |
|
| 97 | - */ |
|
| 98 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 99 | - { |
|
| 100 | - return $this->client->getBody( $uid, $tags, $expire ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * Returns the view object that will generate the HTML output. |
|
| 106 | - * |
|
| 107 | - * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 108 | - */ |
|
| 109 | - public function getView() |
|
| 110 | - { |
|
| 111 | - return $this->client->getView(); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Sets the view object that will generate the HTML output. |
|
| 117 | - * |
|
| 118 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 119 | - * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 120 | - */ |
|
| 121 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
| 122 | - { |
|
| 123 | - $this->client->setView( $view ); |
|
| 124 | - return $this; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 130 | - * |
|
| 131 | - * @param string $content Cached content |
|
| 132 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 133 | - * @return string Modified body content |
|
| 134 | - */ |
|
| 135 | - public function modifyBody( $content, $uid ) |
|
| 136 | - { |
|
| 137 | - return $this->client->modifyBody( $content, $uid ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 143 | - * |
|
| 144 | - * @param string $content Cached content |
|
| 145 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 146 | - * @return string Modified header content |
|
| 147 | - */ |
|
| 148 | - public function modifyHeader( $content, $uid ) |
|
| 149 | - { |
|
| 150 | - return $this->client->modifyHeader( $content, $uid ); |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Processes the input, e.g. store given values. |
|
| 156 | - * A view must be available and this method doesn't generate any output |
|
| 157 | - * besides setting view variables. |
|
| 158 | - */ |
|
| 159 | - public function process() |
|
| 160 | - { |
|
| 161 | - $this->client->process(); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Returns the inner client object |
|
| 167 | - * |
|
| 168 | - * @return \Aimeos\Client\Html\Iface HTML client |
|
| 169 | - */ |
|
| 170 | - protected function getClient() |
|
| 171 | - { |
|
| 172 | - return $this->client; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Returns the list of sub-client names configured for the client. |
|
| 178 | - * |
|
| 179 | - * @return array List of HTML client names |
|
| 180 | - */ |
|
| 181 | - protected function getSubClientNames() |
|
| 182 | - { |
|
| 183 | - return array(); |
|
| 184 | - } |
|
| 25 | + private $client; |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Initializes a new client decorator object. |
|
| 30 | + * |
|
| 31 | + * @param \Aimeos\Client\Html\Iface $client Client object |
|
| 32 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
|
| 33 | + * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
|
| 34 | + * and a list of relative paths inside the core or the extension as values |
|
| 35 | + */ |
|
| 36 | + public function __construct( \Aimeos\Client\Html\Iface $client, |
|
| 37 | + \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 38 | + { |
|
| 39 | + parent::__construct( $context, $templatePaths ); |
|
| 40 | + |
|
| 41 | + $this->client = $client; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Passes unknown methods to wrapped objects. |
|
| 47 | + * |
|
| 48 | + * @param string $name Name of the method |
|
| 49 | + * @param array $param List of method parameter |
|
| 50 | + * @return mixed Returns the value of the called method |
|
| 51 | + * @throws \Aimeos\Client\Html\Exception If method call failed |
|
| 52 | + */ |
|
| 53 | + public function __call( $name, array $param ) |
|
| 54 | + { |
|
| 55 | + if( ( $result = call_user_func_array( array( $this->client, $name ), $param ) ) === false ) { |
|
| 56 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + return $result; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Returns the sub-client given by its name. |
|
| 65 | + * |
|
| 66 | + * @param string $type Name of the client type |
|
| 67 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 68 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 69 | + */ |
|
| 70 | + public function getSubClient( $type, $name = null ) |
|
| 71 | + { |
|
| 72 | + return $this->client->getSubClient( $type, $name ); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Returns the HTML string for insertion into the header. |
|
| 78 | + * |
|
| 79 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 80 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 81 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 82 | + * @return string|null String including HTML tags for the header on error |
|
| 83 | + */ |
|
| 84 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 85 | + { |
|
| 86 | + return $this->client->getHeader( $uid, $tags, $expire ); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Returns the HTML code for insertion into the body. |
|
| 92 | + * |
|
| 93 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 94 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 95 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 96 | + * @return string HTML code |
|
| 97 | + */ |
|
| 98 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 99 | + { |
|
| 100 | + return $this->client->getBody( $uid, $tags, $expire ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * Returns the view object that will generate the HTML output. |
|
| 106 | + * |
|
| 107 | + * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 108 | + */ |
|
| 109 | + public function getView() |
|
| 110 | + { |
|
| 111 | + return $this->client->getView(); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Sets the view object that will generate the HTML output. |
|
| 117 | + * |
|
| 118 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 119 | + * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 120 | + */ |
|
| 121 | + public function setView( \Aimeos\MW\View\Iface $view ) |
|
| 122 | + { |
|
| 123 | + $this->client->setView( $view ); |
|
| 124 | + return $this; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 130 | + * |
|
| 131 | + * @param string $content Cached content |
|
| 132 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 133 | + * @return string Modified body content |
|
| 134 | + */ |
|
| 135 | + public function modifyBody( $content, $uid ) |
|
| 136 | + { |
|
| 137 | + return $this->client->modifyBody( $content, $uid ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 143 | + * |
|
| 144 | + * @param string $content Cached content |
|
| 145 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 146 | + * @return string Modified header content |
|
| 147 | + */ |
|
| 148 | + public function modifyHeader( $content, $uid ) |
|
| 149 | + { |
|
| 150 | + return $this->client->modifyHeader( $content, $uid ); |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Processes the input, e.g. store given values. |
|
| 156 | + * A view must be available and this method doesn't generate any output |
|
| 157 | + * besides setting view variables. |
|
| 158 | + */ |
|
| 159 | + public function process() |
|
| 160 | + { |
|
| 161 | + $this->client->process(); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Returns the inner client object |
|
| 167 | + * |
|
| 168 | + * @return \Aimeos\Client\Html\Iface HTML client |
|
| 169 | + */ |
|
| 170 | + protected function getClient() |
|
| 171 | + { |
|
| 172 | + return $this->client; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Returns the list of sub-client names configured for the client. |
|
| 178 | + * |
|
| 179 | + * @return array List of HTML client names |
|
| 180 | + */ |
|
| 181 | + protected function getSubClientNames() |
|
| 182 | + { |
|
| 183 | + return array(); |
|
| 184 | + } |
|
| 185 | 185 | } |
| 186 | 186 | \ No newline at end of file |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * Creates a client object. |
|
| 25 | - * |
|
| 26 | - * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 27 | - * @param array List of file system paths where the templates are stored |
|
| 28 | - * @param string $name Client name (from configuration or "Standard" if null) |
|
| 29 | - * @return \Aimeos\Client\Html\Iface New client object |
|
| 30 | - */ |
|
| 31 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ); |
|
| 23 | + /** |
|
| 24 | + * Creates a client object. |
|
| 25 | + * |
|
| 26 | + * @param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects |
|
| 27 | + * @param array List of file system paths where the templates are stored |
|
| 28 | + * @param string $name Client name (from configuration or "Standard" if null) |
|
| 29 | + * @return \Aimeos\Client\Html\Iface New client object |
|
| 30 | + */ |
|
| 31 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ); |
|
| 32 | 32 | } |