@@ -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,292 +19,292 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Basket\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Basket\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/basket/standard/coupon/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the basket standard coupon 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/basket/standard/coupon/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | - |
|
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->couponBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/basket/standard/coupon/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the basket standard coupon client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/basket/standard/coupon/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/basket/standard/coupon/standard/template-body'; |
|
| 101 | - $default = 'basket/standard/coupon-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->couponHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/basket/standard/coupon/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the basket standard coupon client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/basket/standard/coupon/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/basket/standard/coupon/standard/template-header'; |
|
| 147 | - $default = 'basket/standard/coupon-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/basket/standard/coupon/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the basket standard coupon 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/basket/standard/coupon/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/basket/standard/coupon/decorators/global |
|
| 185 | - * @see client/html/basket/standard/coupon/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/basket/standard/coupon/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the basket standard coupon 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/basket/standard/coupon/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/basket/standard/coupon/decorators/excludes |
|
| 209 | - * @see client/html/basket/standard/coupon/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/basket/standard/coupon/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the basket standard coupon 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\Basket\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/basket/standard/coupon/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Basket\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/basket/standard/coupon/decorators/excludes |
|
| 233 | - * @see client/html/basket/standard/coupon/decorators/global |
|
| 234 | - */ |
|
| 235 | - return $this->createSubClient( 'basket/standard/coupon/' . $type, $name ); |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * Processes the input, e.g. store given values. |
|
| 241 | - * A view must be available and this method doesn't generate any output |
|
| 242 | - * besides setting view variables. |
|
| 243 | - */ |
|
| 244 | - public function process() |
|
| 245 | - { |
|
| 246 | - $view = $this->getView(); |
|
| 247 | - $context = $this->getContext(); |
|
| 248 | - |
|
| 249 | - switch( $view->param( 'b_action' ) ) |
|
| 250 | - { |
|
| 251 | - case 'coupon-delete': |
|
| 252 | - |
|
| 253 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 254 | - { |
|
| 255 | - $this->clearCached(); |
|
| 256 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 257 | - $cntl->deleteCoupon( $coupon ); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - break; |
|
| 261 | - |
|
| 262 | - default: |
|
| 263 | - |
|
| 264 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 265 | - { |
|
| 266 | - $this->clearCached(); |
|
| 267 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 268 | - |
|
| 269 | - /** client/html/basket/standard/coupon/allowed |
|
| 270 | - * Number of coupon codes a customer is allowed to enter |
|
| 271 | - * |
|
| 272 | - * This configuration option enables shop owners to limit the number of coupon |
|
| 273 | - * codes that can be added by a customer to his current basket. By default, only |
|
| 274 | - * one coupon code is allowed per order. |
|
| 275 | - * |
|
| 276 | - * Coupon codes are valid until a payed order is placed by the customer. The |
|
| 277 | - * "count" of the codes is decreased afterwards. If codes are not personalized |
|
| 278 | - * the codes can be reused in the next order until their "count" reaches zero. |
|
| 279 | - * |
|
| 280 | - * @param integer Positive number of coupon codes including zero |
|
| 281 | - * @since 2014.05 |
|
| 282 | - * @category User |
|
| 283 | - * @category Developer |
|
| 284 | - */ |
|
| 285 | - $allowed = $context->getConfig()->get( 'client/html/basket/standard/coupon/allowed', 1 ); |
|
| 286 | - |
|
| 287 | - if( $allowed <= count( $cntl->get()->getCoupons() ) ) { |
|
| 288 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Number of coupon codes exceeds the limit' ) ); |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - $cntl->addCoupon( $coupon ); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - break; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - parent::process(); |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - |
|
| 301 | - /** |
|
| 302 | - * Returns the list of sub-client names configured for the client. |
|
| 303 | - * |
|
| 304 | - * @return array List of HTML client names |
|
| 305 | - */ |
|
| 306 | - protected function getSubClientNames() |
|
| 307 | - { |
|
| 308 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 309 | - } |
|
| 25 | + /** client/html/basket/standard/coupon/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the basket standard coupon 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/basket/standard/coupon/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->couponBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/basket/standard/coupon/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the basket standard coupon client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/basket/standard/coupon/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/basket/standard/coupon/standard/template-body'; |
|
| 101 | + $default = 'basket/standard/coupon-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->couponHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/basket/standard/coupon/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the basket standard coupon client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/basket/standard/coupon/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/basket/standard/coupon/standard/template-header'; |
|
| 147 | + $default = 'basket/standard/coupon-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/basket/standard/coupon/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the basket standard coupon 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/basket/standard/coupon/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/basket/standard/coupon/decorators/global |
|
| 185 | + * @see client/html/basket/standard/coupon/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/basket/standard/coupon/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the basket standard coupon 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/basket/standard/coupon/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/basket/standard/coupon/decorators/excludes |
|
| 209 | + * @see client/html/basket/standard/coupon/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/basket/standard/coupon/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the basket standard coupon 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\Basket\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/basket/standard/coupon/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Basket\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/basket/standard/coupon/decorators/excludes |
|
| 233 | + * @see client/html/basket/standard/coupon/decorators/global |
|
| 234 | + */ |
|
| 235 | + return $this->createSubClient( 'basket/standard/coupon/' . $type, $name ); |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * Processes the input, e.g. store given values. |
|
| 241 | + * A view must be available and this method doesn't generate any output |
|
| 242 | + * besides setting view variables. |
|
| 243 | + */ |
|
| 244 | + public function process() |
|
| 245 | + { |
|
| 246 | + $view = $this->getView(); |
|
| 247 | + $context = $this->getContext(); |
|
| 248 | + |
|
| 249 | + switch( $view->param( 'b_action' ) ) |
|
| 250 | + { |
|
| 251 | + case 'coupon-delete': |
|
| 252 | + |
|
| 253 | + if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 254 | + { |
|
| 255 | + $this->clearCached(); |
|
| 256 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 257 | + $cntl->deleteCoupon( $coupon ); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + break; |
|
| 261 | + |
|
| 262 | + default: |
|
| 263 | + |
|
| 264 | + if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 265 | + { |
|
| 266 | + $this->clearCached(); |
|
| 267 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 268 | + |
|
| 269 | + /** client/html/basket/standard/coupon/allowed |
|
| 270 | + * Number of coupon codes a customer is allowed to enter |
|
| 271 | + * |
|
| 272 | + * This configuration option enables shop owners to limit the number of coupon |
|
| 273 | + * codes that can be added by a customer to his current basket. By default, only |
|
| 274 | + * one coupon code is allowed per order. |
|
| 275 | + * |
|
| 276 | + * Coupon codes are valid until a payed order is placed by the customer. The |
|
| 277 | + * "count" of the codes is decreased afterwards. If codes are not personalized |
|
| 278 | + * the codes can be reused in the next order until their "count" reaches zero. |
|
| 279 | + * |
|
| 280 | + * @param integer Positive number of coupon codes including zero |
|
| 281 | + * @since 2014.05 |
|
| 282 | + * @category User |
|
| 283 | + * @category Developer |
|
| 284 | + */ |
|
| 285 | + $allowed = $context->getConfig()->get( 'client/html/basket/standard/coupon/allowed', 1 ); |
|
| 286 | + |
|
| 287 | + if( $allowed <= count( $cntl->get()->getCoupons() ) ) { |
|
| 288 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Number of coupon codes exceeds the limit' ) ); |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + $cntl->addCoupon( $coupon ); |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + break; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + parent::process(); |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + |
|
| 301 | + /** |
|
| 302 | + * Returns the list of sub-client names configured for the client. |
|
| 303 | + * |
|
| 304 | + * @return array List of HTML client names |
|
| 305 | + */ |
|
| 306 | + protected function getSubClientNames() |
|
| 307 | + { |
|
| 308 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 309 | + } |
|
| 310 | 310 | } |
| 311 | 311 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->couponBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/basket/standard/coupon/standard/template-body'; |
| 101 | 101 | $default = 'basket/standard/coupon-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->couponHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/basket/standard/coupon/standard/template-header'; |
| 147 | 147 | $default = 'basket/standard/coupon-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/basket/standard/coupon/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the basket standard coupon html client |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @see client/html/basket/standard/coupon/decorators/excludes |
| 233 | 233 | * @see client/html/basket/standard/coupon/decorators/global |
| 234 | 234 | */ |
| 235 | - return $this->createSubClient( 'basket/standard/coupon/' . $type, $name ); |
|
| 235 | + return $this->createSubClient('basket/standard/coupon/'.$type, $name); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -246,25 +246,25 @@ discard block |
||
| 246 | 246 | $view = $this->getView(); |
| 247 | 247 | $context = $this->getContext(); |
| 248 | 248 | |
| 249 | - switch( $view->param( 'b_action' ) ) |
|
| 249 | + switch ($view->param('b_action')) |
|
| 250 | 250 | { |
| 251 | 251 | case 'coupon-delete': |
| 252 | 252 | |
| 253 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 253 | + if (($coupon = $view->param('b_coupon')) != '') |
|
| 254 | 254 | { |
| 255 | 255 | $this->clearCached(); |
| 256 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 257 | - $cntl->deleteCoupon( $coupon ); |
|
| 256 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 257 | + $cntl->deleteCoupon($coupon); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | break; |
| 261 | 261 | |
| 262 | 262 | default: |
| 263 | 263 | |
| 264 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 264 | + if (($coupon = $view->param('b_coupon')) != '') |
|
| 265 | 265 | { |
| 266 | 266 | $this->clearCached(); |
| 267 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 267 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 268 | 268 | |
| 269 | 269 | /** client/html/basket/standard/coupon/allowed |
| 270 | 270 | * Number of coupon codes a customer is allowed to enter |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | * @category User |
| 283 | 283 | * @category Developer |
| 284 | 284 | */ |
| 285 | - $allowed = $context->getConfig()->get( 'client/html/basket/standard/coupon/allowed', 1 ); |
|
| 285 | + $allowed = $context->getConfig()->get('client/html/basket/standard/coupon/allowed', 1); |
|
| 286 | 286 | |
| 287 | - if( $allowed <= count( $cntl->get()->getCoupons() ) ) { |
|
| 288 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Number of coupon codes exceeds the limit' ) ); |
|
| 287 | + if ($allowed <= count($cntl->get()->getCoupons())) { |
|
| 288 | + throw new \Aimeos\Client\Html\Exception(sprintf('Number of coupon codes exceeds the limit')); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $cntl->addCoupon( $coupon ); |
|
| 291 | + $cntl->addCoupon($coupon); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | break; |
@@ -305,6 +305,6 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | protected function getSubClientNames() |
| 307 | 307 | { |
| 308 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 308 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | \ No newline at end of file |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 113 | 113 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | + * @return string String including HTML tags for the header on error |
|
| 116 | 116 | */ |
| 117 | 117 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 118 | 118 | { |
@@ -19,268 +19,268 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/basket/standard/detail/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the basket standard detail 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 2015.11 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/basket/standard/detail/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/basket/standard/detail/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the basket standard detail 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 2015.11 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/basket/standard/detail/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->detailBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->detailBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/basket/standard/detail/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the basket standard detail client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * (second one) should be replaced by the name of the new class in lower |
|
| 95 | - * case. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2015.11 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/basket/standard/detail/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/basket/standard/detail/standard/template-body'; |
|
| 103 | - $default = 'common/summary/detail-body-default.php'; |
|
| 81 | + /** client/html/basket/standard/detail/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the basket standard detail client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * (second one) should be replaced by the name of the new class in lower |
|
| 95 | + * case. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2015.11 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/basket/standard/detail/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/basket/standard/detail/standard/template-body'; |
|
| 103 | + $default = 'common/summary/detail-body-default.php'; |
|
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | 120 | |
| 121 | - $html = ''; |
|
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | - } |
|
| 125 | - $view->detailHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->detailHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/basket/standard/detail/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the basket standard detail client. |
|
| 129 | - * |
|
| 130 | - * The template file contains the HTML code and processing instructions |
|
| 131 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | - * of the rendered page in the frontend. The configuration string is the |
|
| 133 | - * path to the template file relative to the templates directory (usually |
|
| 134 | - * in client/html/templates). |
|
| 135 | - * |
|
| 136 | - * You can overwrite the template file configuration in extensions and |
|
| 137 | - * provide alternative templates. These alternative templates should be |
|
| 138 | - * named like the default one but with the string "standard" replaced by |
|
| 139 | - * an unique name. You may use the name of your project for this. If |
|
| 140 | - * you've implemented an alternative client class as well, "standard" |
|
| 141 | - * (second one) should be replaced by the name of the new class in lower |
|
| 142 | - * case. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2015.11 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/basket/standard/detail/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/basket/standard/detail/standard/template-header'; |
|
| 150 | - $default = 'common/summary/detail-header-default.php'; |
|
| 127 | + /** client/html/basket/standard/detail/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the basket standard detail client. |
|
| 129 | + * |
|
| 130 | + * The template file contains the HTML code and processing instructions |
|
| 131 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | + * of the rendered page in the frontend. The configuration string is the |
|
| 133 | + * path to the template file relative to the templates directory (usually |
|
| 134 | + * in client/html/templates). |
|
| 135 | + * |
|
| 136 | + * You can overwrite the template file configuration in extensions and |
|
| 137 | + * provide alternative templates. These alternative templates should be |
|
| 138 | + * named like the default one but with the string "standard" replaced by |
|
| 139 | + * an unique name. You may use the name of your project for this. If |
|
| 140 | + * you've implemented an alternative client class as well, "standard" |
|
| 141 | + * (second one) should be replaced by the name of the new class in lower |
|
| 142 | + * case. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2015.11 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/basket/standard/detail/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/basket/standard/detail/standard/template-header'; |
|
| 150 | + $default = 'common/summary/detail-header-default.php'; |
|
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/basket/standard/detail/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the basket standard detail html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/basket/standard/detail/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/basket/standard/detail/decorators/global |
|
| 188 | - * @see client/html/basket/standard/detail/decorators/local |
|
| 189 | - */ |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/basket/standard/detail/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the basket standard detail html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/basket/standard/detail/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/basket/standard/detail/decorators/global |
|
| 188 | + * @see client/html/basket/standard/detail/decorators/local |
|
| 189 | + */ |
|
| 190 | 190 | |
| 191 | - /** client/html/basket/standard/detail/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the basket standard detail html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/basket/standard/detail/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/basket/standard/detail/decorators/excludes |
|
| 212 | - * @see client/html/basket/standard/detail/decorators/local |
|
| 213 | - */ |
|
| 191 | + /** client/html/basket/standard/detail/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the basket standard detail html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/basket/standard/detail/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/basket/standard/detail/decorators/excludes |
|
| 212 | + * @see client/html/basket/standard/detail/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/basket/standard/detail/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the basket standard detail html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/basket/standard/detail/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/basket/standard/detail/decorators/excludes |
|
| 236 | - * @see client/html/basket/standard/detail/decorators/global |
|
| 237 | - */ |
|
| 238 | - return $this->createSubClient( 'basket/standard/detail/' . $type, $name ); |
|
| 239 | - } |
|
| 215 | + /** client/html/basket/standard/detail/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the basket standard detail html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/basket/standard/detail/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/basket/standard/detail/decorators/excludes |
|
| 236 | + * @see client/html/basket/standard/detail/decorators/global |
|
| 237 | + */ |
|
| 238 | + return $this->createSubClient( 'basket/standard/detail/' . $type, $name ); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Returns the list of sub-client names configured for the client. |
|
| 244 | - * |
|
| 245 | - * @return array List of HTML client names |
|
| 246 | - */ |
|
| 247 | - protected function getSubClientNames() |
|
| 248 | - { |
|
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | - } |
|
| 242 | + /** |
|
| 243 | + * Returns the list of sub-client names configured for the client. |
|
| 244 | + * |
|
| 245 | + * @return array List of HTML client names |
|
| 246 | + */ |
|
| 247 | + protected function getSubClientNames() |
|
| 248 | + { |
|
| 249 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | - /** |
|
| 254 | - * Sets the necessary parameter values in the view. |
|
| 255 | - * |
|
| 256 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | - */ |
|
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | - { |
|
| 263 | - $view = parent::setViewParams( $view ); |
|
| 253 | + /** |
|
| 254 | + * Sets the necessary parameter values in the view. |
|
| 255 | + * |
|
| 256 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | + */ |
|
| 261 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + { |
|
| 263 | + $view = parent::setViewParams( $view ); |
|
| 264 | 264 | |
| 265 | - if( !isset( $this->cache ) ) |
|
| 266 | - { |
|
| 267 | - $basket = $view->standardBasket; |
|
| 265 | + if( !isset( $this->cache ) ) |
|
| 266 | + { |
|
| 267 | + $basket = $view->standardBasket; |
|
| 268 | 268 | |
| 269 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 270 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 271 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 272 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 269 | + $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 270 | + $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 271 | + $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 272 | + $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 273 | 273 | |
| 274 | - $view->summaryParams = $view->get( 'standardParams', array() ); |
|
| 275 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 276 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 277 | - $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 278 | - $view->summaryEnableModify = true; |
|
| 279 | - $view->summaryBasket = $basket; |
|
| 274 | + $view->summaryParams = $view->get( 'standardParams', array() ); |
|
| 275 | + $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 276 | + $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 277 | + $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 278 | + $view->summaryEnableModify = true; |
|
| 279 | + $view->summaryBasket = $basket; |
|
| 280 | 280 | |
| 281 | - $this->cache = $view; |
|
| 282 | - } |
|
| 281 | + $this->cache = $view; |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - return $this->cache; |
|
| 285 | - } |
|
| 284 | + return $this->cache; |
|
| 285 | + } |
|
| 286 | 286 | } |
| 287 | 287 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->detailBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/basket/standard/detail/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/detail-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->detailHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/basket/standard/detail/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/detail-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/basket/standard/detail/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the basket standard detail html client |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @see client/html/basket/standard/detail/decorators/excludes |
| 236 | 236 | * @see client/html/basket/standard/detail/decorators/global |
| 237 | 237 | */ |
| 238 | - return $this->createSubClient( 'basket/standard/detail/' . $type, $name ); |
|
| 238 | + return $this->createSubClient('basket/standard/detail/'.$type, $name); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function getSubClientNames() |
| 248 | 248 | { |
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,23 +258,23 @@ discard block |
||
| 258 | 258 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 259 | 259 | * @return \Aimeos\MW\View\Iface Modified view object |
| 260 | 260 | */ |
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 262 | 262 | { |
| 263 | - $view = parent::setViewParams( $view ); |
|
| 263 | + $view = parent::setViewParams($view); |
|
| 264 | 264 | |
| 265 | - if( !isset( $this->cache ) ) |
|
| 265 | + if (!isset($this->cache)) |
|
| 266 | 266 | { |
| 267 | 267 | $basket = $view->standardBasket; |
| 268 | 268 | |
| 269 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 270 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 271 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 272 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 269 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 270 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 271 | + $action = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 272 | + $config = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 273 | 273 | |
| 274 | - $view->summaryParams = $view->get( 'standardParams', array() ); |
|
| 275 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 276 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 277 | - $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 274 | + $view->summaryParams = $view->get('standardParams', array()); |
|
| 275 | + $view->summaryUrlServicePayment = $view->url($target, $cntl, $action, array('c_step' => 'payment'), array(), $config); |
|
| 276 | + $view->summaryUrlServiceDelivery = $view->url($target, $cntl, $action, array('c_step' => 'delivery'), array(), $config); |
|
| 277 | + $view->summaryTaxRates = $this->getTaxRates($basket); |
|
| 278 | 278 | $view->summaryEnableModify = true; |
| 279 | 279 | $view->summaryBasket = $basket; |
| 280 | 280 | |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 162 | 162 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 163 | 163 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 164 | - * @return string|null String including HTML tags for the header on error |
|
| 164 | + * @return string String including HTML tags for the header on error |
|
| 165 | 165 | */ |
| 166 | 166 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 167 | 167 | { |
@@ -19,536 +19,536 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Basket\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Basket\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/basket/standard/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the basket standard 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/basket/standard/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/basket/standard/detail/name |
|
| 61 | - * Name of the detail part used by the basket standard detail client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Basket\Standard\Detail\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/basket/standard/coupon/name |
|
| 72 | - * Name of the detail part used by the basket standard coupon client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Basket\Standard\Detail\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 | - private $subPartNames = array( 'detail', 'coupon' ); |
|
| 82 | - private $cache; |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Returns the HTML code for insertion into the body. |
|
| 87 | - * |
|
| 88 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 89 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 90 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 91 | - * @return string HTML code |
|
| 92 | - */ |
|
| 93 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 94 | - { |
|
| 95 | - $context = $this->getContext(); |
|
| 96 | - $view = $this->getView(); |
|
| 97 | - |
|
| 98 | - try |
|
| 99 | - { |
|
| 100 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 101 | - |
|
| 102 | - $html = ''; |
|
| 103 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 104 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 105 | - } |
|
| 106 | - $view->standardBody = $html; |
|
| 107 | - } |
|
| 108 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 109 | - { |
|
| 110 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 111 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 112 | - } |
|
| 113 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 114 | - { |
|
| 115 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 116 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 117 | - } |
|
| 118 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 119 | - { |
|
| 120 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 121 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 122 | - } |
|
| 123 | - catch( \Exception $e ) |
|
| 124 | - { |
|
| 125 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 126 | - |
|
| 127 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 128 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** client/html/basket/standard/standard/template-body |
|
| 132 | - * Relative path to the HTML body template of the basket standard client. |
|
| 133 | - * |
|
| 134 | - * The template file contains the HTML code and processing instructions |
|
| 135 | - * to generate the result shown in the body of the frontend. The |
|
| 136 | - * configuration string is the path to the template file relative |
|
| 137 | - * to the templates directory (usually in client/html/templates). |
|
| 138 | - * |
|
| 139 | - * You can overwrite the template file configuration in extensions and |
|
| 140 | - * provide alternative templates. These alternative templates should be |
|
| 141 | - * named like the default one but with the string "standard" replaced by |
|
| 142 | - * an unique name. You may use the name of your project for this. If |
|
| 143 | - * you've implemented an alternative client class as well, "standard" |
|
| 144 | - * should be replaced by the name of the new class. |
|
| 145 | - * |
|
| 146 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 147 | - * @since 2014.03 |
|
| 148 | - * @category Developer |
|
| 149 | - * @see client/html/basket/standard/standard/template-header |
|
| 150 | - */ |
|
| 151 | - $tplconf = 'client/html/basket/standard/standard/template-body'; |
|
| 152 | - $default = 'basket/standard/body-default.php'; |
|
| 153 | - |
|
| 154 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * Returns the HTML string for insertion into the header. |
|
| 160 | - * |
|
| 161 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 162 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 163 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 164 | - * @return string|null String including HTML tags for the header on error |
|
| 165 | - */ |
|
| 166 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 167 | - { |
|
| 168 | - try |
|
| 169 | - { |
|
| 170 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 171 | - |
|
| 172 | - $html = ''; |
|
| 173 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 174 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 175 | - } |
|
| 176 | - $view->standardHeader = $html; |
|
| 177 | - } |
|
| 178 | - catch( \Exception $e ) |
|
| 179 | - { |
|
| 180 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 181 | - return ''; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** client/html/basket/standard/standard/template-header |
|
| 185 | - * Relative path to the HTML header template of the basket standard client. |
|
| 186 | - * |
|
| 187 | - * The template file contains the HTML code and processing instructions |
|
| 188 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 189 | - * of the rendered page in the frontend. The configuration string is the |
|
| 190 | - * path to the template file relative to the templates directory (usually |
|
| 191 | - * in client/html/templates). |
|
| 192 | - * |
|
| 193 | - * You can overwrite the template file configuration in extensions and |
|
| 194 | - * provide alternative templates. These alternative templates should be |
|
| 195 | - * named like the default one but with the string "standard" replaced by |
|
| 196 | - * an unique name. You may use the name of your project for this. If |
|
| 197 | - * you've implemented an alternative client class as well, "standard" |
|
| 198 | - * should be replaced by the name of the new class. |
|
| 199 | - * |
|
| 200 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 201 | - * @since 2014.03 |
|
| 202 | - * @category Developer |
|
| 203 | - * @see client/html/basket/standard/standard/template-body |
|
| 204 | - */ |
|
| 205 | - $tplconf = 'client/html/basket/standard/standard/template-header'; |
|
| 206 | - $default = 'basket/standard/header-default.php'; |
|
| 207 | - |
|
| 208 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Returns the sub-client given by its name. |
|
| 214 | - * |
|
| 215 | - * @param string $type Name of the client type |
|
| 216 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 217 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 218 | - */ |
|
| 219 | - public function getSubClient( $type, $name = null ) |
|
| 220 | - { |
|
| 221 | - /** client/html/basket/standard/decorators/excludes |
|
| 222 | - * Excludes decorators added by the "common" option from the basket standard html client |
|
| 223 | - * |
|
| 224 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 225 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 226 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 227 | - * modify what is returned to the caller. |
|
| 228 | - * |
|
| 229 | - * This option allows you to remove a decorator added via |
|
| 230 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 231 | - * around the html client. |
|
| 232 | - * |
|
| 233 | - * client/html/basket/standard/decorators/excludes = array( 'decorator1' ) |
|
| 234 | - * |
|
| 235 | - * This would remove the decorator named "decorator1" from the list of |
|
| 236 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 237 | - * "client/html/common/decorators/default" to the html client. |
|
| 238 | - * |
|
| 239 | - * @param array List of decorator names |
|
| 240 | - * @since 2014.05 |
|
| 241 | - * @category Developer |
|
| 242 | - * @see client/html/common/decorators/default |
|
| 243 | - * @see client/html/basket/standard/decorators/global |
|
| 244 | - * @see client/html/basket/standard/decorators/local |
|
| 245 | - */ |
|
| 246 | - |
|
| 247 | - /** client/html/basket/standard/decorators/global |
|
| 248 | - * Adds a list of globally available decorators only to the basket standard html client |
|
| 249 | - * |
|
| 250 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 251 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 252 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 253 | - * modify what is returned to the caller. |
|
| 254 | - * |
|
| 255 | - * This option allows you to wrap global decorators |
|
| 256 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 257 | - * |
|
| 258 | - * client/html/basket/standard/decorators/global = array( 'decorator1' ) |
|
| 259 | - * |
|
| 260 | - * This would add the decorator named "decorator1" defined by |
|
| 261 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 262 | - * |
|
| 263 | - * @param array List of decorator names |
|
| 264 | - * @since 2014.05 |
|
| 265 | - * @category Developer |
|
| 266 | - * @see client/html/common/decorators/default |
|
| 267 | - * @see client/html/basket/standard/decorators/excludes |
|
| 268 | - * @see client/html/basket/standard/decorators/local |
|
| 269 | - */ |
|
| 270 | - |
|
| 271 | - /** client/html/basket/standard/decorators/local |
|
| 272 | - * Adds a list of local decorators only to the basket standard html client |
|
| 273 | - * |
|
| 274 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 275 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 276 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 277 | - * modify what is returned to the caller. |
|
| 278 | - * |
|
| 279 | - * This option allows you to wrap local decorators |
|
| 280 | - * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 281 | - * |
|
| 282 | - * client/html/basket/standard/decorators/local = array( 'decorator2' ) |
|
| 283 | - * |
|
| 284 | - * This would add the decorator named "decorator2" defined by |
|
| 285 | - * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 286 | - * |
|
| 287 | - * @param array List of decorator names |
|
| 288 | - * @since 2014.05 |
|
| 289 | - * @category Developer |
|
| 290 | - * @see client/html/common/decorators/default |
|
| 291 | - * @see client/html/basket/standard/decorators/excludes |
|
| 292 | - * @see client/html/basket/standard/decorators/global |
|
| 293 | - */ |
|
| 294 | - |
|
| 295 | - return $this->createSubClient( 'basket/standard/' . $type, $name ); |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * Sets the necessary parameter values in the view. |
|
| 301 | - */ |
|
| 302 | - public function process() |
|
| 303 | - { |
|
| 304 | - $view = $this->getView(); |
|
| 305 | - $context = $this->getContext(); |
|
| 306 | - |
|
| 307 | - try |
|
| 308 | - { |
|
| 309 | - $options = array( |
|
| 310 | - |
|
| 311 | - /** client/html/basket/require-stock |
|
| 312 | - * Customers can order products only if there are enough products in stock |
|
| 313 | - * |
|
| 314 | - * Checks that the requested product quantity is in stock before |
|
| 315 | - * the customer can add them to his basket and order them. If there |
|
| 316 | - * are not enough products available, the customer will get a notice. |
|
| 317 | - * |
|
| 318 | - * @param boolean True if products must be in stock, false if products can be sold without stock |
|
| 319 | - * @since 2014.03 |
|
| 320 | - * @category Developer |
|
| 321 | - * @category User |
|
| 322 | - */ |
|
| 323 | - 'stock' => $view->config( 'client/html/basket/require-stock', true ), |
|
| 324 | - |
|
| 325 | - /** client/html/basket/require-variant |
|
| 326 | - * A variant of a selection product must be chosen |
|
| 327 | - * |
|
| 328 | - * Selection products normally consist of several article variants and by default |
|
| 329 | - * exactly one article variant of a selection product can be put into the basket. |
|
| 330 | - * |
|
| 331 | - * By setting this option to false, the selection product including the chosen |
|
| 332 | - * attributes (if any attribute values were selected) can be put into the basket |
|
| 333 | - * as well. This makes it possible to get all articles or a subset of articles |
|
| 334 | - * (e.g. all of a color) at once. |
|
| 335 | - * |
|
| 336 | - * @param boolean True if a variant must be chosen, false if also the selection product with attributes can be added |
|
| 337 | - * @since 2014.03 |
|
| 338 | - * @category Developer |
|
| 339 | - * @category User |
|
| 340 | - */ |
|
| 341 | - 'variant' => $view->config( 'client/html/basket/require-variant', true ), |
|
| 342 | - ); |
|
| 343 | - |
|
| 344 | - switch( $view->param( 'b_action' ) ) |
|
| 345 | - { |
|
| 346 | - case 'add': |
|
| 347 | - $this->addProducts( $view, $options ); |
|
| 348 | - break; |
|
| 349 | - case 'delete': |
|
| 350 | - $this->deleteProducts( $view ); |
|
| 351 | - break; |
|
| 352 | - default: |
|
| 353 | - $this->editProducts( $view, $options ); |
|
| 354 | - } |
|
| 355 | - |
|
| 356 | - parent::process(); |
|
| 357 | - |
|
| 358 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 359 | - $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT ); |
|
| 360 | - } |
|
| 361 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 362 | - { |
|
| 363 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 364 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 365 | - } |
|
| 366 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 367 | - { |
|
| 368 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 369 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 370 | - } |
|
| 371 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 372 | - { |
|
| 373 | - $errors = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 374 | - $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
|
| 375 | - |
|
| 376 | - $view->summaryErrorCodes = $e->getErrorCodes(); |
|
| 377 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
|
| 378 | - } |
|
| 379 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 380 | - { |
|
| 381 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 382 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 383 | - } |
|
| 384 | - catch( \Exception $e ) |
|
| 385 | - { |
|
| 386 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 387 | - |
|
| 388 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 389 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 390 | - } |
|
| 391 | - } |
|
| 392 | - |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * Returns the list of sub-client names configured for the client. |
|
| 396 | - * |
|
| 397 | - * @return array List of HTML client names |
|
| 398 | - */ |
|
| 399 | - protected function getSubClientNames() |
|
| 400 | - { |
|
| 401 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 402 | - } |
|
| 403 | - |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * Sets the necessary parameter values in the view. |
|
| 407 | - * |
|
| 408 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 409 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 410 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 411 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 412 | - */ |
|
| 413 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 414 | - { |
|
| 415 | - if( !isset( $this->cache ) ) |
|
| 416 | - { |
|
| 417 | - $context = $this->getContext(); |
|
| 418 | - $site = $context->getLocale()->getSite()->getCode(); |
|
| 419 | - |
|
| 420 | - if( ( $params = $context->getSession()->get( 'aimeos/catalog/detail/params/last' . $site ) ) !== null ) |
|
| 421 | - { |
|
| 422 | - $target = $view->config( 'client/html/catalog/detail/url/target' ); |
|
| 423 | - $controller = $view->config( 'client/html/catalog/detail/url/controller', 'catalog' ); |
|
| 424 | - $action = $view->config( 'client/html/catalog/detail/url/action', 'detail' ); |
|
| 425 | - $config = $view->config( 'client/html/catalog/detail/url/config', array() ); |
|
| 426 | - } |
|
| 427 | - else |
|
| 428 | - { |
|
| 429 | - $params = $context->getSession()->get( 'aimeos/catalog/lists/params/last' . $site, array() ); |
|
| 430 | - |
|
| 431 | - $target = $view->config( 'client/html/catalog/lists/url/target' ); |
|
| 432 | - $controller = $view->config( 'client/html/catalog/lists/url/controller', 'catalog' ); |
|
| 433 | - $action = $view->config( 'client/html/catalog/lists/url/action', 'list' ); |
|
| 434 | - $config = $view->config( 'client/html/catalog/lists/url/config', array() ); |
|
| 435 | - |
|
| 436 | - } |
|
| 437 | - |
|
| 438 | - if( empty( $params ) === false ) |
|
| 439 | - { |
|
| 440 | - $view->standardParams = $this->getClientParams( $view->param() ); |
|
| 441 | - $view->standardBackUrl = $view->url( $target, $controller, $action, $params, array(), $config ); |
|
| 442 | - } |
|
| 443 | - |
|
| 444 | - $view->standardBasket = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->get(); |
|
| 445 | - |
|
| 446 | - $this->cache = $view; |
|
| 447 | - } |
|
| 448 | - |
|
| 449 | - return $this->cache; |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - |
|
| 453 | - /** |
|
| 454 | - * Adds the products specified by the view parameters to the basket. |
|
| 455 | - * |
|
| 456 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 457 | - * @param array $options List of options for addProducts() in basket controller |
|
| 458 | - */ |
|
| 459 | - protected function addProducts( \Aimeos\MW\View\Iface $view, array $options ) |
|
| 460 | - { |
|
| 461 | - $this->clearCached(); |
|
| 462 | - $products = (array) $view->param( 'b_prod', array() ); |
|
| 463 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 464 | - |
|
| 465 | - if( ( $prodid = $view->param( 'b_prodid', '' ) ) !== '' ) |
|
| 466 | - { |
|
| 467 | - $products[] = array( |
|
| 468 | - 'prodid' => $prodid, |
|
| 469 | - 'quantity' => $view->param( 'b_quantity', 1 ), |
|
| 470 | - 'attrvarid' => array_filter( (array) $view->param( 'b_attrvarid', array() ) ), |
|
| 471 | - 'attrconfid' => array_filter( (array) $view->param( 'b_attrconfid', array() ) ), |
|
| 472 | - 'attrhideid' => array_filter( (array) $view->param( 'b_attrhideid', array() ) ), |
|
| 473 | - 'attrcustid' => array_filter( (array) $view->param( 'b_attrcustid', array() ) ), |
|
| 474 | - 'warehouse' => $view->param( 'b_warehouse', 'default' ), |
|
| 475 | - ); |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - foreach( $products as $values ) { |
|
| 479 | - $this->addProduct( $controller, $values, $options ); |
|
| 480 | - } |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - |
|
| 484 | - /** |
|
| 485 | - * Adds a single product specified by its values to the basket. |
|
| 486 | - * |
|
| 487 | - * @param \Aimeos\Controller\Frontend\Iface $controller Basket frontend controller |
|
| 488 | - * @param array $values Associative list of key/value pairs from the view specifying the product |
|
| 489 | - * @param array $options List of options for addProducts() in basket frontend controller |
|
| 490 | - */ |
|
| 491 | - protected function addProduct( \Aimeos\Controller\Frontend\Iface $controller, array $values, array $options ) |
|
| 492 | - { |
|
| 493 | - $controller->addProduct( |
|
| 494 | - ( isset( $values['prodid'] ) ? (string) $values['prodid'] : '' ), |
|
| 495 | - ( isset( $values['quantity'] ) ? (int) $values['quantity'] : 1 ), |
|
| 496 | - $options, |
|
| 497 | - ( isset( $values['attrvarid'] ) ? array_filter( (array) $values['attrvarid'] ) : array() ), |
|
| 498 | - ( isset( $values['attrconfid'] ) ? array_filter( (array) $values['attrconfid'] ) : array() ), |
|
| 499 | - ( isset( $values['attrhideid'] ) ? array_filter( (array) $values['attrhideid'] ) : array() ), |
|
| 500 | - ( isset( $values['attrcustid'] ) ? array_filter( (array) $values['attrcustid'] ) : array() ), |
|
| 501 | - ( isset( $values['warehouse'] ) ? (string) $values['warehouse'] : 'default' ) |
|
| 502 | - ); |
|
| 503 | - } |
|
| 504 | - |
|
| 505 | - |
|
| 506 | - /** |
|
| 507 | - * Removes the products specified by the view parameters from the basket. |
|
| 508 | - * |
|
| 509 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 510 | - */ |
|
| 511 | - protected function deleteProducts( \Aimeos\MW\View\Iface $view ) |
|
| 512 | - { |
|
| 513 | - $this->clearCached(); |
|
| 514 | - $products = (array) $view->param( 'b_position', array() ); |
|
| 515 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 516 | - |
|
| 517 | - foreach( $products as $position ) { |
|
| 518 | - $controller->deleteProduct( $position ); |
|
| 519 | - } |
|
| 520 | - } |
|
| 521 | - |
|
| 522 | - |
|
| 523 | - /** |
|
| 524 | - * Edits the products specified by the view parameters to the basket. |
|
| 525 | - * |
|
| 526 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 527 | - * @param array $options List of options for editProducts() in basket controller |
|
| 528 | - */ |
|
| 529 | - protected function editProducts( \Aimeos\MW\View\Iface $view, array $options ) |
|
| 530 | - { |
|
| 531 | - $this->clearCached(); |
|
| 532 | - $products = (array) $view->param( 'b_prod', array() ); |
|
| 533 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 534 | - |
|
| 535 | - if( ( $position = $view->param( 'b_position', '' ) ) !== '' ) |
|
| 536 | - { |
|
| 537 | - $products[] = array( |
|
| 538 | - 'position' => $position, |
|
| 539 | - 'quantity' => $view->param( 'b_quantity', 1 ), |
|
| 540 | - 'attrconf-code' => array_filter( (array) $view->param( 'b_attrconfcode', array() ) ) |
|
| 541 | - ); |
|
| 542 | - } |
|
| 543 | - |
|
| 544 | - foreach( $products as $values ) |
|
| 545 | - { |
|
| 546 | - $controller->editProduct( |
|
| 547 | - ( isset( $values['position'] ) ? (int) $values['position'] : 0 ), |
|
| 548 | - ( isset( $values['quantity'] ) ? (int) $values['quantity'] : 1 ), |
|
| 549 | - $options, |
|
| 550 | - ( isset( $values['attrconf-code'] ) ? array_filter( (array) $values['attrconf-code'] ) : array() ) |
|
| 551 | - ); |
|
| 552 | - } |
|
| 553 | - } |
|
| 25 | + /** client/html/basket/standard/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the basket standard 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/basket/standard/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/basket/standard/detail/name |
|
| 61 | + * Name of the detail part used by the basket standard detail client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Basket\Standard\Detail\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/basket/standard/coupon/name |
|
| 72 | + * Name of the detail part used by the basket standard coupon client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Basket\Standard\Detail\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 | + private $subPartNames = array( 'detail', 'coupon' ); |
|
| 82 | + private $cache; |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Returns the HTML code for insertion into the body. |
|
| 87 | + * |
|
| 88 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 89 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 90 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 91 | + * @return string HTML code |
|
| 92 | + */ |
|
| 93 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 94 | + { |
|
| 95 | + $context = $this->getContext(); |
|
| 96 | + $view = $this->getView(); |
|
| 97 | + |
|
| 98 | + try |
|
| 99 | + { |
|
| 100 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 101 | + |
|
| 102 | + $html = ''; |
|
| 103 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 104 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 105 | + } |
|
| 106 | + $view->standardBody = $html; |
|
| 107 | + } |
|
| 108 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 109 | + { |
|
| 110 | + $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 111 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 112 | + } |
|
| 113 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 114 | + { |
|
| 115 | + $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 116 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 117 | + } |
|
| 118 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 119 | + { |
|
| 120 | + $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 121 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 122 | + } |
|
| 123 | + catch( \Exception $e ) |
|
| 124 | + { |
|
| 125 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 126 | + |
|
| 127 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 128 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** client/html/basket/standard/standard/template-body |
|
| 132 | + * Relative path to the HTML body template of the basket standard client. |
|
| 133 | + * |
|
| 134 | + * The template file contains the HTML code and processing instructions |
|
| 135 | + * to generate the result shown in the body of the frontend. The |
|
| 136 | + * configuration string is the path to the template file relative |
|
| 137 | + * to the templates directory (usually in client/html/templates). |
|
| 138 | + * |
|
| 139 | + * You can overwrite the template file configuration in extensions and |
|
| 140 | + * provide alternative templates. These alternative templates should be |
|
| 141 | + * named like the default one but with the string "standard" replaced by |
|
| 142 | + * an unique name. You may use the name of your project for this. If |
|
| 143 | + * you've implemented an alternative client class as well, "standard" |
|
| 144 | + * should be replaced by the name of the new class. |
|
| 145 | + * |
|
| 146 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 147 | + * @since 2014.03 |
|
| 148 | + * @category Developer |
|
| 149 | + * @see client/html/basket/standard/standard/template-header |
|
| 150 | + */ |
|
| 151 | + $tplconf = 'client/html/basket/standard/standard/template-body'; |
|
| 152 | + $default = 'basket/standard/body-default.php'; |
|
| 153 | + |
|
| 154 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * Returns the HTML string for insertion into the header. |
|
| 160 | + * |
|
| 161 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 162 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 163 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 164 | + * @return string|null String including HTML tags for the header on error |
|
| 165 | + */ |
|
| 166 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 167 | + { |
|
| 168 | + try |
|
| 169 | + { |
|
| 170 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 171 | + |
|
| 172 | + $html = ''; |
|
| 173 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 174 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 175 | + } |
|
| 176 | + $view->standardHeader = $html; |
|
| 177 | + } |
|
| 178 | + catch( \Exception $e ) |
|
| 179 | + { |
|
| 180 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 181 | + return ''; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** client/html/basket/standard/standard/template-header |
|
| 185 | + * Relative path to the HTML header template of the basket standard client. |
|
| 186 | + * |
|
| 187 | + * The template file contains the HTML code and processing instructions |
|
| 188 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 189 | + * of the rendered page in the frontend. The configuration string is the |
|
| 190 | + * path to the template file relative to the templates directory (usually |
|
| 191 | + * in client/html/templates). |
|
| 192 | + * |
|
| 193 | + * You can overwrite the template file configuration in extensions and |
|
| 194 | + * provide alternative templates. These alternative templates should be |
|
| 195 | + * named like the default one but with the string "standard" replaced by |
|
| 196 | + * an unique name. You may use the name of your project for this. If |
|
| 197 | + * you've implemented an alternative client class as well, "standard" |
|
| 198 | + * should be replaced by the name of the new class. |
|
| 199 | + * |
|
| 200 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 201 | + * @since 2014.03 |
|
| 202 | + * @category Developer |
|
| 203 | + * @see client/html/basket/standard/standard/template-body |
|
| 204 | + */ |
|
| 205 | + $tplconf = 'client/html/basket/standard/standard/template-header'; |
|
| 206 | + $default = 'basket/standard/header-default.php'; |
|
| 207 | + |
|
| 208 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Returns the sub-client given by its name. |
|
| 214 | + * |
|
| 215 | + * @param string $type Name of the client type |
|
| 216 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 217 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 218 | + */ |
|
| 219 | + public function getSubClient( $type, $name = null ) |
|
| 220 | + { |
|
| 221 | + /** client/html/basket/standard/decorators/excludes |
|
| 222 | + * Excludes decorators added by the "common" option from the basket standard html client |
|
| 223 | + * |
|
| 224 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 225 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 226 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 227 | + * modify what is returned to the caller. |
|
| 228 | + * |
|
| 229 | + * This option allows you to remove a decorator added via |
|
| 230 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 231 | + * around the html client. |
|
| 232 | + * |
|
| 233 | + * client/html/basket/standard/decorators/excludes = array( 'decorator1' ) |
|
| 234 | + * |
|
| 235 | + * This would remove the decorator named "decorator1" from the list of |
|
| 236 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 237 | + * "client/html/common/decorators/default" to the html client. |
|
| 238 | + * |
|
| 239 | + * @param array List of decorator names |
|
| 240 | + * @since 2014.05 |
|
| 241 | + * @category Developer |
|
| 242 | + * @see client/html/common/decorators/default |
|
| 243 | + * @see client/html/basket/standard/decorators/global |
|
| 244 | + * @see client/html/basket/standard/decorators/local |
|
| 245 | + */ |
|
| 246 | + |
|
| 247 | + /** client/html/basket/standard/decorators/global |
|
| 248 | + * Adds a list of globally available decorators only to the basket standard html client |
|
| 249 | + * |
|
| 250 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 251 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 252 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 253 | + * modify what is returned to the caller. |
|
| 254 | + * |
|
| 255 | + * This option allows you to wrap global decorators |
|
| 256 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 257 | + * |
|
| 258 | + * client/html/basket/standard/decorators/global = array( 'decorator1' ) |
|
| 259 | + * |
|
| 260 | + * This would add the decorator named "decorator1" defined by |
|
| 261 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 262 | + * |
|
| 263 | + * @param array List of decorator names |
|
| 264 | + * @since 2014.05 |
|
| 265 | + * @category Developer |
|
| 266 | + * @see client/html/common/decorators/default |
|
| 267 | + * @see client/html/basket/standard/decorators/excludes |
|
| 268 | + * @see client/html/basket/standard/decorators/local |
|
| 269 | + */ |
|
| 270 | + |
|
| 271 | + /** client/html/basket/standard/decorators/local |
|
| 272 | + * Adds a list of local decorators only to the basket standard html client |
|
| 273 | + * |
|
| 274 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 275 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 276 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 277 | + * modify what is returned to the caller. |
|
| 278 | + * |
|
| 279 | + * This option allows you to wrap local decorators |
|
| 280 | + * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 281 | + * |
|
| 282 | + * client/html/basket/standard/decorators/local = array( 'decorator2' ) |
|
| 283 | + * |
|
| 284 | + * This would add the decorator named "decorator2" defined by |
|
| 285 | + * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 286 | + * |
|
| 287 | + * @param array List of decorator names |
|
| 288 | + * @since 2014.05 |
|
| 289 | + * @category Developer |
|
| 290 | + * @see client/html/common/decorators/default |
|
| 291 | + * @see client/html/basket/standard/decorators/excludes |
|
| 292 | + * @see client/html/basket/standard/decorators/global |
|
| 293 | + */ |
|
| 294 | + |
|
| 295 | + return $this->createSubClient( 'basket/standard/' . $type, $name ); |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * Sets the necessary parameter values in the view. |
|
| 301 | + */ |
|
| 302 | + public function process() |
|
| 303 | + { |
|
| 304 | + $view = $this->getView(); |
|
| 305 | + $context = $this->getContext(); |
|
| 306 | + |
|
| 307 | + try |
|
| 308 | + { |
|
| 309 | + $options = array( |
|
| 310 | + |
|
| 311 | + /** client/html/basket/require-stock |
|
| 312 | + * Customers can order products only if there are enough products in stock |
|
| 313 | + * |
|
| 314 | + * Checks that the requested product quantity is in stock before |
|
| 315 | + * the customer can add them to his basket and order them. If there |
|
| 316 | + * are not enough products available, the customer will get a notice. |
|
| 317 | + * |
|
| 318 | + * @param boolean True if products must be in stock, false if products can be sold without stock |
|
| 319 | + * @since 2014.03 |
|
| 320 | + * @category Developer |
|
| 321 | + * @category User |
|
| 322 | + */ |
|
| 323 | + 'stock' => $view->config( 'client/html/basket/require-stock', true ), |
|
| 324 | + |
|
| 325 | + /** client/html/basket/require-variant |
|
| 326 | + * A variant of a selection product must be chosen |
|
| 327 | + * |
|
| 328 | + * Selection products normally consist of several article variants and by default |
|
| 329 | + * exactly one article variant of a selection product can be put into the basket. |
|
| 330 | + * |
|
| 331 | + * By setting this option to false, the selection product including the chosen |
|
| 332 | + * attributes (if any attribute values were selected) can be put into the basket |
|
| 333 | + * as well. This makes it possible to get all articles or a subset of articles |
|
| 334 | + * (e.g. all of a color) at once. |
|
| 335 | + * |
|
| 336 | + * @param boolean True if a variant must be chosen, false if also the selection product with attributes can be added |
|
| 337 | + * @since 2014.03 |
|
| 338 | + * @category Developer |
|
| 339 | + * @category User |
|
| 340 | + */ |
|
| 341 | + 'variant' => $view->config( 'client/html/basket/require-variant', true ), |
|
| 342 | + ); |
|
| 343 | + |
|
| 344 | + switch( $view->param( 'b_action' ) ) |
|
| 345 | + { |
|
| 346 | + case 'add': |
|
| 347 | + $this->addProducts( $view, $options ); |
|
| 348 | + break; |
|
| 349 | + case 'delete': |
|
| 350 | + $this->deleteProducts( $view ); |
|
| 351 | + break; |
|
| 352 | + default: |
|
| 353 | + $this->editProducts( $view, $options ); |
|
| 354 | + } |
|
| 355 | + |
|
| 356 | + parent::process(); |
|
| 357 | + |
|
| 358 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 359 | + $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT ); |
|
| 360 | + } |
|
| 361 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 362 | + { |
|
| 363 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 364 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 365 | + } |
|
| 366 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 367 | + { |
|
| 368 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 369 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 370 | + } |
|
| 371 | + catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 372 | + { |
|
| 373 | + $errors = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 374 | + $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
|
| 375 | + |
|
| 376 | + $view->summaryErrorCodes = $e->getErrorCodes(); |
|
| 377 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
|
| 378 | + } |
|
| 379 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 380 | + { |
|
| 381 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 382 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 383 | + } |
|
| 384 | + catch( \Exception $e ) |
|
| 385 | + { |
|
| 386 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 387 | + |
|
| 388 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 389 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 390 | + } |
|
| 391 | + } |
|
| 392 | + |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * Returns the list of sub-client names configured for the client. |
|
| 396 | + * |
|
| 397 | + * @return array List of HTML client names |
|
| 398 | + */ |
|
| 399 | + protected function getSubClientNames() |
|
| 400 | + { |
|
| 401 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 402 | + } |
|
| 403 | + |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * Sets the necessary parameter values in the view. |
|
| 407 | + * |
|
| 408 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 409 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 410 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 411 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 412 | + */ |
|
| 413 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 414 | + { |
|
| 415 | + if( !isset( $this->cache ) ) |
|
| 416 | + { |
|
| 417 | + $context = $this->getContext(); |
|
| 418 | + $site = $context->getLocale()->getSite()->getCode(); |
|
| 419 | + |
|
| 420 | + if( ( $params = $context->getSession()->get( 'aimeos/catalog/detail/params/last' . $site ) ) !== null ) |
|
| 421 | + { |
|
| 422 | + $target = $view->config( 'client/html/catalog/detail/url/target' ); |
|
| 423 | + $controller = $view->config( 'client/html/catalog/detail/url/controller', 'catalog' ); |
|
| 424 | + $action = $view->config( 'client/html/catalog/detail/url/action', 'detail' ); |
|
| 425 | + $config = $view->config( 'client/html/catalog/detail/url/config', array() ); |
|
| 426 | + } |
|
| 427 | + else |
|
| 428 | + { |
|
| 429 | + $params = $context->getSession()->get( 'aimeos/catalog/lists/params/last' . $site, array() ); |
|
| 430 | + |
|
| 431 | + $target = $view->config( 'client/html/catalog/lists/url/target' ); |
|
| 432 | + $controller = $view->config( 'client/html/catalog/lists/url/controller', 'catalog' ); |
|
| 433 | + $action = $view->config( 'client/html/catalog/lists/url/action', 'list' ); |
|
| 434 | + $config = $view->config( 'client/html/catalog/lists/url/config', array() ); |
|
| 435 | + |
|
| 436 | + } |
|
| 437 | + |
|
| 438 | + if( empty( $params ) === false ) |
|
| 439 | + { |
|
| 440 | + $view->standardParams = $this->getClientParams( $view->param() ); |
|
| 441 | + $view->standardBackUrl = $view->url( $target, $controller, $action, $params, array(), $config ); |
|
| 442 | + } |
|
| 443 | + |
|
| 444 | + $view->standardBasket = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->get(); |
|
| 445 | + |
|
| 446 | + $this->cache = $view; |
|
| 447 | + } |
|
| 448 | + |
|
| 449 | + return $this->cache; |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + |
|
| 453 | + /** |
|
| 454 | + * Adds the products specified by the view parameters to the basket. |
|
| 455 | + * |
|
| 456 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 457 | + * @param array $options List of options for addProducts() in basket controller |
|
| 458 | + */ |
|
| 459 | + protected function addProducts( \Aimeos\MW\View\Iface $view, array $options ) |
|
| 460 | + { |
|
| 461 | + $this->clearCached(); |
|
| 462 | + $products = (array) $view->param( 'b_prod', array() ); |
|
| 463 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 464 | + |
|
| 465 | + if( ( $prodid = $view->param( 'b_prodid', '' ) ) !== '' ) |
|
| 466 | + { |
|
| 467 | + $products[] = array( |
|
| 468 | + 'prodid' => $prodid, |
|
| 469 | + 'quantity' => $view->param( 'b_quantity', 1 ), |
|
| 470 | + 'attrvarid' => array_filter( (array) $view->param( 'b_attrvarid', array() ) ), |
|
| 471 | + 'attrconfid' => array_filter( (array) $view->param( 'b_attrconfid', array() ) ), |
|
| 472 | + 'attrhideid' => array_filter( (array) $view->param( 'b_attrhideid', array() ) ), |
|
| 473 | + 'attrcustid' => array_filter( (array) $view->param( 'b_attrcustid', array() ) ), |
|
| 474 | + 'warehouse' => $view->param( 'b_warehouse', 'default' ), |
|
| 475 | + ); |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + foreach( $products as $values ) { |
|
| 479 | + $this->addProduct( $controller, $values, $options ); |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + |
|
| 484 | + /** |
|
| 485 | + * Adds a single product specified by its values to the basket. |
|
| 486 | + * |
|
| 487 | + * @param \Aimeos\Controller\Frontend\Iface $controller Basket frontend controller |
|
| 488 | + * @param array $values Associative list of key/value pairs from the view specifying the product |
|
| 489 | + * @param array $options List of options for addProducts() in basket frontend controller |
|
| 490 | + */ |
|
| 491 | + protected function addProduct( \Aimeos\Controller\Frontend\Iface $controller, array $values, array $options ) |
|
| 492 | + { |
|
| 493 | + $controller->addProduct( |
|
| 494 | + ( isset( $values['prodid'] ) ? (string) $values['prodid'] : '' ), |
|
| 495 | + ( isset( $values['quantity'] ) ? (int) $values['quantity'] : 1 ), |
|
| 496 | + $options, |
|
| 497 | + ( isset( $values['attrvarid'] ) ? array_filter( (array) $values['attrvarid'] ) : array() ), |
|
| 498 | + ( isset( $values['attrconfid'] ) ? array_filter( (array) $values['attrconfid'] ) : array() ), |
|
| 499 | + ( isset( $values['attrhideid'] ) ? array_filter( (array) $values['attrhideid'] ) : array() ), |
|
| 500 | + ( isset( $values['attrcustid'] ) ? array_filter( (array) $values['attrcustid'] ) : array() ), |
|
| 501 | + ( isset( $values['warehouse'] ) ? (string) $values['warehouse'] : 'default' ) |
|
| 502 | + ); |
|
| 503 | + } |
|
| 504 | + |
|
| 505 | + |
|
| 506 | + /** |
|
| 507 | + * Removes the products specified by the view parameters from the basket. |
|
| 508 | + * |
|
| 509 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 510 | + */ |
|
| 511 | + protected function deleteProducts( \Aimeos\MW\View\Iface $view ) |
|
| 512 | + { |
|
| 513 | + $this->clearCached(); |
|
| 514 | + $products = (array) $view->param( 'b_position', array() ); |
|
| 515 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 516 | + |
|
| 517 | + foreach( $products as $position ) { |
|
| 518 | + $controller->deleteProduct( $position ); |
|
| 519 | + } |
|
| 520 | + } |
|
| 521 | + |
|
| 522 | + |
|
| 523 | + /** |
|
| 524 | + * Edits the products specified by the view parameters to the basket. |
|
| 525 | + * |
|
| 526 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 527 | + * @param array $options List of options for editProducts() in basket controller |
|
| 528 | + */ |
|
| 529 | + protected function editProducts( \Aimeos\MW\View\Iface $view, array $options ) |
|
| 530 | + { |
|
| 531 | + $this->clearCached(); |
|
| 532 | + $products = (array) $view->param( 'b_prod', array() ); |
|
| 533 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 534 | + |
|
| 535 | + if( ( $position = $view->param( 'b_position', '' ) ) !== '' ) |
|
| 536 | + { |
|
| 537 | + $products[] = array( |
|
| 538 | + 'position' => $position, |
|
| 539 | + 'quantity' => $view->param( 'b_quantity', 1 ), |
|
| 540 | + 'attrconf-code' => array_filter( (array) $view->param( 'b_attrconfcode', array() ) ) |
|
| 541 | + ); |
|
| 542 | + } |
|
| 543 | + |
|
| 544 | + foreach( $products as $values ) |
|
| 545 | + { |
|
| 546 | + $controller->editProduct( |
|
| 547 | + ( isset( $values['position'] ) ? (int) $values['position'] : 0 ), |
|
| 548 | + ( isset( $values['quantity'] ) ? (int) $values['quantity'] : 1 ), |
|
| 549 | + $options, |
|
| 550 | + ( isset( $values['attrconf-code'] ) ? array_filter( (array) $values['attrconf-code'] ) : array() ) |
|
| 551 | + ); |
|
| 552 | + } |
|
| 553 | + } |
|
| 554 | 554 | } |
| 555 | 555 | \ No newline at end of file |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @since 2014.03 |
| 79 | 79 | * @category Developer |
| 80 | 80 | */ |
| 81 | - private $subPartNames = array( 'detail', 'coupon' ); |
|
| 81 | + private $subPartNames = array('detail', 'coupon'); |
|
| 82 | 82 | private $cache; |
| 83 | 83 | |
| 84 | 84 | |
@@ -90,42 +90,42 @@ discard block |
||
| 90 | 90 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 91 | 91 | * @return string HTML code |
| 92 | 92 | */ |
| 93 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 93 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 94 | 94 | { |
| 95 | 95 | $context = $this->getContext(); |
| 96 | 96 | $view = $this->getView(); |
| 97 | 97 | |
| 98 | 98 | try |
| 99 | 99 | { |
| 100 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 100 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 101 | 101 | |
| 102 | 102 | $html = ''; |
| 103 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 104 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 103 | + foreach ($this->getSubClients() as $subclient) { |
|
| 104 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 105 | 105 | } |
| 106 | 106 | $view->standardBody = $html; |
| 107 | 107 | } |
| 108 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 108 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 109 | 109 | { |
| 110 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 111 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 110 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 111 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 112 | 112 | } |
| 113 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 113 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 114 | 114 | { |
| 115 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 116 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 115 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 116 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 117 | 117 | } |
| 118 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 118 | + catch (\Aimeos\MShop\Exception $e) |
|
| 119 | 119 | { |
| 120 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 121 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 120 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 121 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 122 | 122 | } |
| 123 | - catch( \Exception $e ) |
|
| 123 | + catch (\Exception $e) |
|
| 124 | 124 | { |
| 125 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 125 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 126 | 126 | |
| 127 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 128 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 127 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 128 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** client/html/basket/standard/standard/template-body |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $tplconf = 'client/html/basket/standard/standard/template-body'; |
| 152 | 152 | $default = 'basket/standard/body-default.php'; |
| 153 | 153 | |
| 154 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 154 | + return $view->render($view->config($tplconf, $default)); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
@@ -163,21 +163,21 @@ discard block |
||
| 163 | 163 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 164 | 164 | * @return string|null String including HTML tags for the header on error |
| 165 | 165 | */ |
| 166 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 166 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 167 | 167 | { |
| 168 | 168 | try |
| 169 | 169 | { |
| 170 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 170 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 171 | 171 | |
| 172 | 172 | $html = ''; |
| 173 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 174 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 173 | + foreach ($this->getSubClients() as $subclient) { |
|
| 174 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 175 | 175 | } |
| 176 | 176 | $view->standardHeader = $html; |
| 177 | 177 | } |
| 178 | - catch( \Exception $e ) |
|
| 178 | + catch (\Exception $e) |
|
| 179 | 179 | { |
| 180 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 180 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 181 | 181 | return ''; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $tplconf = 'client/html/basket/standard/standard/template-header'; |
| 206 | 206 | $default = 'basket/standard/header-default.php'; |
| 207 | 207 | |
| 208 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 208 | + return $view->render($view->config($tplconf, $default)); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @param string|null $name Name of the sub-client (Default if null) |
| 217 | 217 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 218 | 218 | */ |
| 219 | - public function getSubClient( $type, $name = null ) |
|
| 219 | + public function getSubClient($type, $name = null) |
|
| 220 | 220 | { |
| 221 | 221 | /** client/html/basket/standard/decorators/excludes |
| 222 | 222 | * Excludes decorators added by the "common" option from the basket standard html client |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @see client/html/basket/standard/decorators/global |
| 293 | 293 | */ |
| 294 | 294 | |
| 295 | - return $this->createSubClient( 'basket/standard/' . $type, $name ); |
|
| 295 | + return $this->createSubClient('basket/standard/'.$type, $name); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * @category Developer |
| 321 | 321 | * @category User |
| 322 | 322 | */ |
| 323 | - 'stock' => $view->config( 'client/html/basket/require-stock', true ), |
|
| 323 | + 'stock' => $view->config('client/html/basket/require-stock', true), |
|
| 324 | 324 | |
| 325 | 325 | /** client/html/basket/require-variant |
| 326 | 326 | * A variant of a selection product must be chosen |
@@ -338,55 +338,55 @@ discard block |
||
| 338 | 338 | * @category Developer |
| 339 | 339 | * @category User |
| 340 | 340 | */ |
| 341 | - 'variant' => $view->config( 'client/html/basket/require-variant', true ), |
|
| 341 | + 'variant' => $view->config('client/html/basket/require-variant', true), |
|
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | - switch( $view->param( 'b_action' ) ) |
|
| 344 | + switch ($view->param('b_action')) |
|
| 345 | 345 | { |
| 346 | 346 | case 'add': |
| 347 | - $this->addProducts( $view, $options ); |
|
| 347 | + $this->addProducts($view, $options); |
|
| 348 | 348 | break; |
| 349 | 349 | case 'delete': |
| 350 | - $this->deleteProducts( $view ); |
|
| 350 | + $this->deleteProducts($view); |
|
| 351 | 351 | break; |
| 352 | 352 | default: |
| 353 | - $this->editProducts( $view, $options ); |
|
| 353 | + $this->editProducts($view, $options); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | parent::process(); |
| 357 | 357 | |
| 358 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 359 | - $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT ); |
|
| 358 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 359 | + $controller->get()->check(\Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT); |
|
| 360 | 360 | } |
| 361 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 361 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 362 | 362 | { |
| 363 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 364 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 363 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 364 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 365 | 365 | } |
| 366 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 366 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 367 | 367 | { |
| 368 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 369 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 368 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 369 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 370 | 370 | } |
| 371 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 371 | + catch (\Aimeos\MShop\Plugin\Provider\Exception $e) |
|
| 372 | 372 | { |
| 373 | - $errors = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 374 | - $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
|
| 373 | + $errors = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 374 | + $errors = array_merge($errors, $this->translatePluginErrorCodes($e->getErrorCodes())); |
|
| 375 | 375 | |
| 376 | 376 | $view->summaryErrorCodes = $e->getErrorCodes(); |
| 377 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
|
| 377 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $errors; |
|
| 378 | 378 | } |
| 379 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 379 | + catch (\Aimeos\MShop\Exception $e) |
|
| 380 | 380 | { |
| 381 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 382 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 381 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 382 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 383 | 383 | } |
| 384 | - catch( \Exception $e ) |
|
| 384 | + catch (\Exception $e) |
|
| 385 | 385 | { |
| 386 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 386 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 387 | 387 | |
| 388 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 389 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 388 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 389 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | protected function getSubClientNames() |
| 400 | 400 | { |
| 401 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 401 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -410,38 +410,38 @@ discard block |
||
| 410 | 410 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 411 | 411 | * @return \Aimeos\MW\View\Iface Modified view object |
| 412 | 412 | */ |
| 413 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 413 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 414 | 414 | { |
| 415 | - if( !isset( $this->cache ) ) |
|
| 415 | + if (!isset($this->cache)) |
|
| 416 | 416 | { |
| 417 | 417 | $context = $this->getContext(); |
| 418 | 418 | $site = $context->getLocale()->getSite()->getCode(); |
| 419 | 419 | |
| 420 | - if( ( $params = $context->getSession()->get( 'aimeos/catalog/detail/params/last' . $site ) ) !== null ) |
|
| 420 | + if (($params = $context->getSession()->get('aimeos/catalog/detail/params/last'.$site)) !== null) |
|
| 421 | 421 | { |
| 422 | - $target = $view->config( 'client/html/catalog/detail/url/target' ); |
|
| 423 | - $controller = $view->config( 'client/html/catalog/detail/url/controller', 'catalog' ); |
|
| 424 | - $action = $view->config( 'client/html/catalog/detail/url/action', 'detail' ); |
|
| 425 | - $config = $view->config( 'client/html/catalog/detail/url/config', array() ); |
|
| 422 | + $target = $view->config('client/html/catalog/detail/url/target'); |
|
| 423 | + $controller = $view->config('client/html/catalog/detail/url/controller', 'catalog'); |
|
| 424 | + $action = $view->config('client/html/catalog/detail/url/action', 'detail'); |
|
| 425 | + $config = $view->config('client/html/catalog/detail/url/config', array()); |
|
| 426 | 426 | } |
| 427 | 427 | else |
| 428 | 428 | { |
| 429 | - $params = $context->getSession()->get( 'aimeos/catalog/lists/params/last' . $site, array() ); |
|
| 429 | + $params = $context->getSession()->get('aimeos/catalog/lists/params/last'.$site, array()); |
|
| 430 | 430 | |
| 431 | - $target = $view->config( 'client/html/catalog/lists/url/target' ); |
|
| 432 | - $controller = $view->config( 'client/html/catalog/lists/url/controller', 'catalog' ); |
|
| 433 | - $action = $view->config( 'client/html/catalog/lists/url/action', 'list' ); |
|
| 434 | - $config = $view->config( 'client/html/catalog/lists/url/config', array() ); |
|
| 431 | + $target = $view->config('client/html/catalog/lists/url/target'); |
|
| 432 | + $controller = $view->config('client/html/catalog/lists/url/controller', 'catalog'); |
|
| 433 | + $action = $view->config('client/html/catalog/lists/url/action', 'list'); |
|
| 434 | + $config = $view->config('client/html/catalog/lists/url/config', array()); |
|
| 435 | 435 | |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - if( empty( $params ) === false ) |
|
| 438 | + if (empty($params) === false) |
|
| 439 | 439 | { |
| 440 | - $view->standardParams = $this->getClientParams( $view->param() ); |
|
| 441 | - $view->standardBackUrl = $view->url( $target, $controller, $action, $params, array(), $config ); |
|
| 440 | + $view->standardParams = $this->getClientParams($view->param()); |
|
| 441 | + $view->standardBackUrl = $view->url($target, $controller, $action, $params, array(), $config); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - $view->standardBasket = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->get(); |
|
| 444 | + $view->standardBasket = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket')->get(); |
|
| 445 | 445 | |
| 446 | 446 | $this->cache = $view; |
| 447 | 447 | } |
@@ -456,27 +456,27 @@ discard block |
||
| 456 | 456 | * @param \Aimeos\MW\View\Iface $view View object |
| 457 | 457 | * @param array $options List of options for addProducts() in basket controller |
| 458 | 458 | */ |
| 459 | - protected function addProducts( \Aimeos\MW\View\Iface $view, array $options ) |
|
| 459 | + protected function addProducts(\Aimeos\MW\View\Iface $view, array $options) |
|
| 460 | 460 | { |
| 461 | 461 | $this->clearCached(); |
| 462 | - $products = (array) $view->param( 'b_prod', array() ); |
|
| 463 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 462 | + $products = (array) $view->param('b_prod', array()); |
|
| 463 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket'); |
|
| 464 | 464 | |
| 465 | - if( ( $prodid = $view->param( 'b_prodid', '' ) ) !== '' ) |
|
| 465 | + if (($prodid = $view->param('b_prodid', '')) !== '') |
|
| 466 | 466 | { |
| 467 | 467 | $products[] = array( |
| 468 | 468 | 'prodid' => $prodid, |
| 469 | - 'quantity' => $view->param( 'b_quantity', 1 ), |
|
| 470 | - 'attrvarid' => array_filter( (array) $view->param( 'b_attrvarid', array() ) ), |
|
| 471 | - 'attrconfid' => array_filter( (array) $view->param( 'b_attrconfid', array() ) ), |
|
| 472 | - 'attrhideid' => array_filter( (array) $view->param( 'b_attrhideid', array() ) ), |
|
| 473 | - 'attrcustid' => array_filter( (array) $view->param( 'b_attrcustid', array() ) ), |
|
| 474 | - 'warehouse' => $view->param( 'b_warehouse', 'default' ), |
|
| 469 | + 'quantity' => $view->param('b_quantity', 1), |
|
| 470 | + 'attrvarid' => array_filter((array) $view->param('b_attrvarid', array())), |
|
| 471 | + 'attrconfid' => array_filter((array) $view->param('b_attrconfid', array())), |
|
| 472 | + 'attrhideid' => array_filter((array) $view->param('b_attrhideid', array())), |
|
| 473 | + 'attrcustid' => array_filter((array) $view->param('b_attrcustid', array())), |
|
| 474 | + 'warehouse' => $view->param('b_warehouse', 'default'), |
|
| 475 | 475 | ); |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - foreach( $products as $values ) { |
|
| 479 | - $this->addProduct( $controller, $values, $options ); |
|
| 478 | + foreach ($products as $values) { |
|
| 479 | + $this->addProduct($controller, $values, $options); |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | |
@@ -488,17 +488,17 @@ discard block |
||
| 488 | 488 | * @param array $values Associative list of key/value pairs from the view specifying the product |
| 489 | 489 | * @param array $options List of options for addProducts() in basket frontend controller |
| 490 | 490 | */ |
| 491 | - protected function addProduct( \Aimeos\Controller\Frontend\Iface $controller, array $values, array $options ) |
|
| 491 | + protected function addProduct(\Aimeos\Controller\Frontend\Iface $controller, array $values, array $options) |
|
| 492 | 492 | { |
| 493 | 493 | $controller->addProduct( |
| 494 | - ( isset( $values['prodid'] ) ? (string) $values['prodid'] : '' ), |
|
| 495 | - ( isset( $values['quantity'] ) ? (int) $values['quantity'] : 1 ), |
|
| 494 | + (isset($values['prodid']) ? (string) $values['prodid'] : ''), |
|
| 495 | + (isset($values['quantity']) ? (int) $values['quantity'] : 1), |
|
| 496 | 496 | $options, |
| 497 | - ( isset( $values['attrvarid'] ) ? array_filter( (array) $values['attrvarid'] ) : array() ), |
|
| 498 | - ( isset( $values['attrconfid'] ) ? array_filter( (array) $values['attrconfid'] ) : array() ), |
|
| 499 | - ( isset( $values['attrhideid'] ) ? array_filter( (array) $values['attrhideid'] ) : array() ), |
|
| 500 | - ( isset( $values['attrcustid'] ) ? array_filter( (array) $values['attrcustid'] ) : array() ), |
|
| 501 | - ( isset( $values['warehouse'] ) ? (string) $values['warehouse'] : 'default' ) |
|
| 497 | + (isset($values['attrvarid']) ? array_filter((array) $values['attrvarid']) : array()), |
|
| 498 | + (isset($values['attrconfid']) ? array_filter((array) $values['attrconfid']) : array()), |
|
| 499 | + (isset($values['attrhideid']) ? array_filter((array) $values['attrhideid']) : array()), |
|
| 500 | + (isset($values['attrcustid']) ? array_filter((array) $values['attrcustid']) : array()), |
|
| 501 | + (isset($values['warehouse']) ? (string) $values['warehouse'] : 'default') |
|
| 502 | 502 | ); |
| 503 | 503 | } |
| 504 | 504 | |
@@ -508,14 +508,14 @@ discard block |
||
| 508 | 508 | * |
| 509 | 509 | * @param \Aimeos\MW\View\Iface $view View object |
| 510 | 510 | */ |
| 511 | - protected function deleteProducts( \Aimeos\MW\View\Iface $view ) |
|
| 511 | + protected function deleteProducts(\Aimeos\MW\View\Iface $view) |
|
| 512 | 512 | { |
| 513 | 513 | $this->clearCached(); |
| 514 | - $products = (array) $view->param( 'b_position', array() ); |
|
| 515 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 514 | + $products = (array) $view->param('b_position', array()); |
|
| 515 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket'); |
|
| 516 | 516 | |
| 517 | - foreach( $products as $position ) { |
|
| 518 | - $controller->deleteProduct( $position ); |
|
| 517 | + foreach ($products as $position) { |
|
| 518 | + $controller->deleteProduct($position); |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
@@ -526,28 +526,28 @@ discard block |
||
| 526 | 526 | * @param \Aimeos\MW\View\Iface $view View object |
| 527 | 527 | * @param array $options List of options for editProducts() in basket controller |
| 528 | 528 | */ |
| 529 | - protected function editProducts( \Aimeos\MW\View\Iface $view, array $options ) |
|
| 529 | + protected function editProducts(\Aimeos\MW\View\Iface $view, array $options) |
|
| 530 | 530 | { |
| 531 | 531 | $this->clearCached(); |
| 532 | - $products = (array) $view->param( 'b_prod', array() ); |
|
| 533 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 532 | + $products = (array) $view->param('b_prod', array()); |
|
| 533 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket'); |
|
| 534 | 534 | |
| 535 | - if( ( $position = $view->param( 'b_position', '' ) ) !== '' ) |
|
| 535 | + if (($position = $view->param('b_position', '')) !== '') |
|
| 536 | 536 | { |
| 537 | 537 | $products[] = array( |
| 538 | 538 | 'position' => $position, |
| 539 | - 'quantity' => $view->param( 'b_quantity', 1 ), |
|
| 540 | - 'attrconf-code' => array_filter( (array) $view->param( 'b_attrconfcode', array() ) ) |
|
| 539 | + 'quantity' => $view->param('b_quantity', 1), |
|
| 540 | + 'attrconf-code' => array_filter((array) $view->param('b_attrconfcode', array())) |
|
| 541 | 541 | ); |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - foreach( $products as $values ) |
|
| 544 | + foreach ($products as $values) |
|
| 545 | 545 | { |
| 546 | 546 | $controller->editProduct( |
| 547 | - ( isset( $values['position'] ) ? (int) $values['position'] : 0 ), |
|
| 548 | - ( isset( $values['quantity'] ) ? (int) $values['quantity'] : 1 ), |
|
| 547 | + (isset($values['position']) ? (int) $values['position'] : 0), |
|
| 548 | + (isset($values['quantity']) ? (int) $values['quantity'] : 1), |
|
| 549 | 549 | $options, |
| 550 | - ( isset( $values['attrconf-code'] ) ? array_filter( (array) $values['attrconf-code'] ) : array() ) |
|
| 550 | + (isset($values['attrconf-code']) ? array_filter((array) $values['attrconf-code']) : array()) |
|
| 551 | 551 | ); |
| 552 | 552 | } |
| 553 | 553 | } |
@@ -104,23 +104,19 @@ discard block |
||
| 104 | 104 | $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 105 | 105 | } |
| 106 | 106 | $view->standardBody = $html; |
| 107 | - } |
|
| 108 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 107 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 109 | 108 | { |
| 110 | 109 | $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 111 | 110 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 112 | - } |
|
| 113 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 111 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 114 | 112 | { |
| 115 | 113 | $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 116 | 114 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 117 | - } |
|
| 118 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 115 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 119 | 116 | { |
| 120 | 117 | $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 121 | 118 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 122 | - } |
|
| 123 | - catch( \Exception $e ) |
|
| 119 | + } catch( \Exception $e ) |
|
| 124 | 120 | { |
| 125 | 121 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 126 | 122 | |
@@ -174,8 +170,7 @@ discard block |
||
| 174 | 170 | $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
| 175 | 171 | } |
| 176 | 172 | $view->standardHeader = $html; |
| 177 | - } |
|
| 178 | - catch( \Exception $e ) |
|
| 173 | + } catch( \Exception $e ) |
|
| 179 | 174 | { |
| 180 | 175 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 181 | 176 | return ''; |
@@ -357,31 +352,26 @@ discard block |
||
| 357 | 352 | |
| 358 | 353 | $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
| 359 | 354 | $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT ); |
| 360 | - } |
|
| 361 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 355 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 362 | 356 | { |
| 363 | 357 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 364 | 358 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 365 | - } |
|
| 366 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 359 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 367 | 360 | { |
| 368 | 361 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 369 | 362 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 370 | - } |
|
| 371 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 363 | + } catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 372 | 364 | { |
| 373 | 365 | $errors = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 374 | 366 | $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
| 375 | 367 | |
| 376 | 368 | $view->summaryErrorCodes = $e->getErrorCodes(); |
| 377 | 369 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
| 378 | - } |
|
| 379 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 370 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 380 | 371 | { |
| 381 | 372 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 382 | 373 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 383 | - } |
|
| 384 | - catch( \Exception $e ) |
|
| 374 | + } catch( \Exception $e ) |
|
| 385 | 375 | { |
| 386 | 376 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 387 | 377 | |
@@ -423,8 +413,7 @@ discard block |
||
| 423 | 413 | $controller = $view->config( 'client/html/catalog/detail/url/controller', 'catalog' ); |
| 424 | 414 | $action = $view->config( 'client/html/catalog/detail/url/action', 'detail' ); |
| 425 | 415 | $config = $view->config( 'client/html/catalog/detail/url/config', array() ); |
| 426 | - } |
|
| 427 | - else |
|
| 416 | + } else |
|
| 428 | 417 | { |
| 429 | 418 | $params = $context->getSession()->get( 'aimeos/catalog/lists/params/last' . $site, array() ); |
| 430 | 419 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 112 | 112 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | + * @return string String including HTML tags for the header on error |
|
| 115 | 115 | */ |
| 116 | 116 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 117 | 117 | { |
@@ -19,299 +19,299 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/count/attribute/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog count attribute 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/count/attribute/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/catalog/count/attribute/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog count attribute 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/count/attribute/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->attributeBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->attributeBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/catalog/count/attribute/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the catalog count attribute client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * should be replaced by the name of the new class. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2014.03 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/catalog/count/attribute/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/catalog/count/attribute/standard/template-body'; |
|
| 102 | - $default = 'catalog/count/attribute-body-default.php'; |
|
| 81 | + /** client/html/catalog/count/attribute/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the catalog count attribute client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * should be replaced by the name of the new class. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2014.03 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/catalog/count/attribute/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/catalog/count/attribute/standard/template-body'; |
|
| 102 | + $default = 'catalog/count/attribute-body-default.php'; |
|
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns the HTML string for insertion into the header. |
|
| 110 | - * |
|
| 111 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | - */ |
|
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML string for insertion into the header. |
|
| 110 | + * |
|
| 111 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | + * @return string|null String including HTML tags for the header on error |
|
| 115 | + */ |
|
| 116 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | 119 | |
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->attributeHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->attributeHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/catalog/count/attribute/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the catalog count attribute client. |
|
| 128 | - * |
|
| 129 | - * The template file contains the HTML code and processing instructions |
|
| 130 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | - * of the rendered page in the frontend. The configuration string is the |
|
| 132 | - * path to the template file relative to the templates directory (usually |
|
| 133 | - * in client/html/templates). |
|
| 134 | - * |
|
| 135 | - * You can overwrite the template file configuration in extensions and |
|
| 136 | - * provide alternative templates. These alternative templates should be |
|
| 137 | - * named like the default one but with the string "standard" replaced by |
|
| 138 | - * an unique name. You may use the name of your project for this. If |
|
| 139 | - * you've implemented an alternative client class as well, "standard" |
|
| 140 | - * should be replaced by the name of the new class. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2014.03 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/catalog/count/attribute/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/catalog/count/attribute/standard/template-header'; |
|
| 148 | - $default = 'catalog/count/attribute-header-default.php'; |
|
| 126 | + /** client/html/catalog/count/attribute/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the catalog count attribute client. |
|
| 128 | + * |
|
| 129 | + * The template file contains the HTML code and processing instructions |
|
| 130 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | + * of the rendered page in the frontend. The configuration string is the |
|
| 132 | + * path to the template file relative to the templates directory (usually |
|
| 133 | + * in client/html/templates). |
|
| 134 | + * |
|
| 135 | + * You can overwrite the template file configuration in extensions and |
|
| 136 | + * provide alternative templates. These alternative templates should be |
|
| 137 | + * named like the default one but with the string "standard" replaced by |
|
| 138 | + * an unique name. You may use the name of your project for this. If |
|
| 139 | + * you've implemented an alternative client class as well, "standard" |
|
| 140 | + * should be replaced by the name of the new class. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2014.03 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/catalog/count/attribute/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/catalog/count/attribute/standard/template-header'; |
|
| 148 | + $default = 'catalog/count/attribute-header-default.php'; |
|
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Returns the sub-client given by its name. |
|
| 156 | - * |
|
| 157 | - * @param string $type Name of the client type |
|
| 158 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | - */ |
|
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 162 | - { |
|
| 163 | - /** client/html/catalog/count/attribute/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the catalog count attribute html client |
|
| 165 | - * |
|
| 166 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | - * modify what is returned to the caller. |
|
| 170 | - * |
|
| 171 | - * This option allows you to remove a decorator added via |
|
| 172 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | - * around the html client. |
|
| 174 | - * |
|
| 175 | - * client/html/catalog/count/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 176 | - * |
|
| 177 | - * This would remove the decorator named "decorator1" from the list of |
|
| 178 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | - * "client/html/common/decorators/default" to the html client. |
|
| 180 | - * |
|
| 181 | - * @param array List of decorator names |
|
| 182 | - * @since 2015.08 |
|
| 183 | - * @category Developer |
|
| 184 | - * @see client/html/common/decorators/default |
|
| 185 | - * @see client/html/catalog/count/attribute/decorators/global |
|
| 186 | - * @see client/html/catalog/count/attribute/decorators/local |
|
| 187 | - */ |
|
| 154 | + /** |
|
| 155 | + * Returns the sub-client given by its name. |
|
| 156 | + * |
|
| 157 | + * @param string $type Name of the client type |
|
| 158 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | + */ |
|
| 161 | + public function getSubClient( $type, $name = null ) |
|
| 162 | + { |
|
| 163 | + /** client/html/catalog/count/attribute/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the catalog count attribute html client |
|
| 165 | + * |
|
| 166 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | + * modify what is returned to the caller. |
|
| 170 | + * |
|
| 171 | + * This option allows you to remove a decorator added via |
|
| 172 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | + * around the html client. |
|
| 174 | + * |
|
| 175 | + * client/html/catalog/count/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 176 | + * |
|
| 177 | + * This would remove the decorator named "decorator1" from the list of |
|
| 178 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | + * "client/html/common/decorators/default" to the html client. |
|
| 180 | + * |
|
| 181 | + * @param array List of decorator names |
|
| 182 | + * @since 2015.08 |
|
| 183 | + * @category Developer |
|
| 184 | + * @see client/html/common/decorators/default |
|
| 185 | + * @see client/html/catalog/count/attribute/decorators/global |
|
| 186 | + * @see client/html/catalog/count/attribute/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/catalog/count/attribute/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the catalog count attribute html client |
|
| 191 | - * |
|
| 192 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | - * modify what is returned to the caller. |
|
| 196 | - * |
|
| 197 | - * This option allows you to wrap global decorators |
|
| 198 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | - * |
|
| 200 | - * client/html/catalog/count/attribute/decorators/global = array( 'decorator1' ) |
|
| 201 | - * |
|
| 202 | - * This would add the decorator named "decorator1" defined by |
|
| 203 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | - * |
|
| 205 | - * @param array List of decorator names |
|
| 206 | - * @since 2015.08 |
|
| 207 | - * @category Developer |
|
| 208 | - * @see client/html/common/decorators/default |
|
| 209 | - * @see client/html/catalog/count/attribute/decorators/excludes |
|
| 210 | - * @see client/html/catalog/count/attribute/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/catalog/count/attribute/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the catalog count attribute html client |
|
| 191 | + * |
|
| 192 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | + * modify what is returned to the caller. |
|
| 196 | + * |
|
| 197 | + * This option allows you to wrap global decorators |
|
| 198 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | + * |
|
| 200 | + * client/html/catalog/count/attribute/decorators/global = array( 'decorator1' ) |
|
| 201 | + * |
|
| 202 | + * This would add the decorator named "decorator1" defined by |
|
| 203 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | + * |
|
| 205 | + * @param array List of decorator names |
|
| 206 | + * @since 2015.08 |
|
| 207 | + * @category Developer |
|
| 208 | + * @see client/html/common/decorators/default |
|
| 209 | + * @see client/html/catalog/count/attribute/decorators/excludes |
|
| 210 | + * @see client/html/catalog/count/attribute/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/catalog/count/attribute/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the catalog count attribute html client |
|
| 215 | - * |
|
| 216 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | - * modify what is returned to the caller. |
|
| 220 | - * |
|
| 221 | - * This option allows you to wrap local decorators |
|
| 222 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/catalog/count/attribute/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | - * |
|
| 229 | - * @param array List of decorator names |
|
| 230 | - * @since 2015.08 |
|
| 231 | - * @category Developer |
|
| 232 | - * @see client/html/common/decorators/default |
|
| 233 | - * @see client/html/catalog/count/attribute/decorators/excludes |
|
| 234 | - * @see client/html/catalog/count/attribute/decorators/global |
|
| 235 | - */ |
|
| 213 | + /** client/html/catalog/count/attribute/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the catalog count attribute html client |
|
| 215 | + * |
|
| 216 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | + * modify what is returned to the caller. |
|
| 220 | + * |
|
| 221 | + * This option allows you to wrap local decorators |
|
| 222 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/catalog/count/attribute/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | + * |
|
| 229 | + * @param array List of decorator names |
|
| 230 | + * @since 2015.08 |
|
| 231 | + * @category Developer |
|
| 232 | + * @see client/html/common/decorators/default |
|
| 233 | + * @see client/html/catalog/count/attribute/decorators/excludes |
|
| 234 | + * @see client/html/catalog/count/attribute/decorators/global |
|
| 235 | + */ |
|
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/count/attribute/' . $type, $name ); |
|
| 238 | - } |
|
| 237 | + return $this->createSubClient( 'catalog/count/attribute/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns the list of sub-client names configured for the client. |
|
| 243 | - * |
|
| 244 | - * @return array List of HTML client names |
|
| 245 | - */ |
|
| 246 | - protected function getSubClientNames() |
|
| 247 | - { |
|
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns the list of sub-client names configured for the client. |
|
| 243 | + * |
|
| 244 | + * @return array List of HTML client names |
|
| 245 | + */ |
|
| 246 | + protected function getSubClientNames() |
|
| 247 | + { |
|
| 248 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Sets the necessary parameter values in the view. |
|
| 254 | - * |
|
| 255 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | - */ |
|
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | - { |
|
| 262 | - if( !isset( $this->cache ) ) |
|
| 263 | - { |
|
| 264 | - $context = $this->getContext(); |
|
| 265 | - $config = $context->getConfig(); |
|
| 252 | + /** |
|
| 253 | + * Sets the necessary parameter values in the view. |
|
| 254 | + * |
|
| 255 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | + */ |
|
| 260 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + { |
|
| 262 | + if( !isset( $this->cache ) ) |
|
| 263 | + { |
|
| 264 | + $context = $this->getContext(); |
|
| 265 | + $config = $context->getConfig(); |
|
| 266 | 266 | |
| 267 | - /** client/html/catalog/count/attribute/aggregate |
|
| 268 | - * Enables or disables generating product counts for the attribute catalog filter |
|
| 269 | - * |
|
| 270 | - * This configuration option allows shop owners to enable or disable product counts |
|
| 271 | - * for the attribute section of the catalog filter HTML client. |
|
| 272 | - * |
|
| 273 | - * @param boolean Disabled if "0", enabled if "1" |
|
| 274 | - * @since 2014.03 |
|
| 275 | - * @see client/html/catalog/count/limit |
|
| 276 | - * @category Developer |
|
| 277 | - * @category User |
|
| 278 | - */ |
|
| 279 | - if( $config->get( 'client/html/catalog/count/attribute/aggregate', true ) == true ) |
|
| 280 | - { |
|
| 281 | - /** client/html/catalog/count/limit |
|
| 282 | - * Limits the number of records that are used for product counts in the catalog filter |
|
| 283 | - * |
|
| 284 | - * The product counts in the catalog filter are generated by searching for all |
|
| 285 | - * products that match the criteria and then counting the number of products |
|
| 286 | - * that are available for each attribute or category. |
|
| 287 | - * |
|
| 288 | - * As counting huge amount of records (several 10 000 records) takes a long time, |
|
| 289 | - * the limit can cut down response times so the counts are available more quickly |
|
| 290 | - * in the front-end and the server load is reduced. |
|
| 291 | - * |
|
| 292 | - * Using a low limit can lead to incorrect numbers if the amount of found products |
|
| 293 | - * is very high. Approximate product counts are normally not a problem but it can |
|
| 294 | - * lead to the situation that visitors see that no products are available for |
|
| 295 | - * an attribute or in a category despite the fact that there would be at least |
|
| 296 | - * one. |
|
| 297 | - * |
|
| 298 | - * @param integer Number of records |
|
| 299 | - * @since 2014.03 |
|
| 300 | - * @see client/html/catalog/count/attribute/aggregate |
|
| 301 | - * @category Developer |
|
| 302 | - * @category User |
|
| 303 | - */ |
|
| 304 | - $filter = $this->getProductListFilter( $view ); |
|
| 305 | - $filter->setSlice( 0, $config->get( 'client/html/catalog/count/limit', 10000 ) ); |
|
| 306 | - $filter->setSortations( array() ); // it's not necessary and slows down the query |
|
| 267 | + /** client/html/catalog/count/attribute/aggregate |
|
| 268 | + * Enables or disables generating product counts for the attribute catalog filter |
|
| 269 | + * |
|
| 270 | + * This configuration option allows shop owners to enable or disable product counts |
|
| 271 | + * for the attribute section of the catalog filter HTML client. |
|
| 272 | + * |
|
| 273 | + * @param boolean Disabled if "0", enabled if "1" |
|
| 274 | + * @since 2014.03 |
|
| 275 | + * @see client/html/catalog/count/limit |
|
| 276 | + * @category Developer |
|
| 277 | + * @category User |
|
| 278 | + */ |
|
| 279 | + if( $config->get( 'client/html/catalog/count/attribute/aggregate', true ) == true ) |
|
| 280 | + { |
|
| 281 | + /** client/html/catalog/count/limit |
|
| 282 | + * Limits the number of records that are used for product counts in the catalog filter |
|
| 283 | + * |
|
| 284 | + * The product counts in the catalog filter are generated by searching for all |
|
| 285 | + * products that match the criteria and then counting the number of products |
|
| 286 | + * that are available for each attribute or category. |
|
| 287 | + * |
|
| 288 | + * As counting huge amount of records (several 10 000 records) takes a long time, |
|
| 289 | + * the limit can cut down response times so the counts are available more quickly |
|
| 290 | + * in the front-end and the server load is reduced. |
|
| 291 | + * |
|
| 292 | + * Using a low limit can lead to incorrect numbers if the amount of found products |
|
| 293 | + * is very high. Approximate product counts are normally not a problem but it can |
|
| 294 | + * lead to the situation that visitors see that no products are available for |
|
| 295 | + * an attribute or in a category despite the fact that there would be at least |
|
| 296 | + * one. |
|
| 297 | + * |
|
| 298 | + * @param integer Number of records |
|
| 299 | + * @since 2014.03 |
|
| 300 | + * @see client/html/catalog/count/attribute/aggregate |
|
| 301 | + * @category Developer |
|
| 302 | + * @category User |
|
| 303 | + */ |
|
| 304 | + $filter = $this->getProductListFilter( $view ); |
|
| 305 | + $filter->setSlice( 0, $config->get( 'client/html/catalog/count/limit', 10000 ) ); |
|
| 306 | + $filter->setSortations( array() ); // it's not necessary and slows down the query |
|
| 307 | 307 | |
| 308 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 309 | - $view->attributeCountList = $controller->aggregateIndex( $filter, 'index.attribute.id' ); |
|
| 310 | - } |
|
| 308 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 309 | + $view->attributeCountList = $controller->aggregateIndex( $filter, 'index.attribute.id' ); |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - $this->cache = $view; |
|
| 313 | - } |
|
| 312 | + $this->cache = $view; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - return $this->cache; |
|
| 316 | - } |
|
| 315 | + return $this->cache; |
|
| 316 | + } |
|
| 317 | 317 | } |
| 318 | 318 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->attributeBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/catalog/count/attribute/standard/template-body'; |
| 102 | 102 | $default = 'catalog/count/attribute-body-default.php'; |
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + return $view->render($view->config($tplconf, $default)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | 114 | * @return string|null String including HTML tags for the header on error |
| 115 | 115 | */ |
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 119 | 119 | |
| 120 | 120 | $html = ''; |
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + foreach ($this->getSubClients() as $subclient) { |
|
| 122 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 123 | 123 | } |
| 124 | 124 | $view->attributeHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/catalog/count/attribute/standard/template-header'; |
| 148 | 148 | $default = 'catalog/count/attribute-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/catalog/count/attribute/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the catalog count attribute html client |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see client/html/catalog/count/attribute/decorators/global |
| 235 | 235 | */ |
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/count/attribute/' . $type, $name ); |
|
| 237 | + return $this->createSubClient('catalog/count/attribute/'.$type, $name); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | protected function getSubClientNames() |
| 247 | 247 | { |
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 258 | 258 | * @return \Aimeos\MW\View\Iface Modified view object |
| 259 | 259 | */ |
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 261 | 261 | { |
| 262 | - if( !isset( $this->cache ) ) |
|
| 262 | + if (!isset($this->cache)) |
|
| 263 | 263 | { |
| 264 | 264 | $context = $this->getContext(); |
| 265 | 265 | $config = $context->getConfig(); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @category Developer |
| 277 | 277 | * @category User |
| 278 | 278 | */ |
| 279 | - if( $config->get( 'client/html/catalog/count/attribute/aggregate', true ) == true ) |
|
| 279 | + if ($config->get('client/html/catalog/count/attribute/aggregate', true) == true) |
|
| 280 | 280 | { |
| 281 | 281 | /** client/html/catalog/count/limit |
| 282 | 282 | * Limits the number of records that are used for product counts in the catalog filter |
@@ -301,12 +301,12 @@ discard block |
||
| 301 | 301 | * @category Developer |
| 302 | 302 | * @category User |
| 303 | 303 | */ |
| 304 | - $filter = $this->getProductListFilter( $view ); |
|
| 305 | - $filter->setSlice( 0, $config->get( 'client/html/catalog/count/limit', 10000 ) ); |
|
| 306 | - $filter->setSortations( array() ); // it's not necessary and slows down the query |
|
| 304 | + $filter = $this->getProductListFilter($view); |
|
| 305 | + $filter->setSlice(0, $config->get('client/html/catalog/count/limit', 10000)); |
|
| 306 | + $filter->setSortations(array()); // it's not necessary and slows down the query |
|
| 307 | 307 | |
| 308 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 309 | - $view->attributeCountList = $controller->aggregateIndex( $filter, 'index.attribute.id' ); |
|
| 308 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 309 | + $view->attributeCountList = $controller->aggregateIndex($filter, 'index.attribute.id'); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $this->cache = $view; |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 112 | 112 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | + * @return string String including HTML tags for the header on error |
|
| 115 | 115 | */ |
| 116 | 116 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 117 | 117 | { |
@@ -19,277 +19,277 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Catalog\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/count/tree/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog count tree 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/count/tree/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/catalog/count/tree/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog count tree 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/count/tree/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->treeBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->treeBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/catalog/count/tree/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the catalog count tree client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * should be replaced by the name of the new class. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2014.03 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/catalog/count/tree/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/catalog/count/tree/standard/template-body'; |
|
| 102 | - $default = 'catalog/count/tree-body-default.php'; |
|
| 81 | + /** client/html/catalog/count/tree/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the catalog count tree client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * should be replaced by the name of the new class. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2014.03 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/catalog/count/tree/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/catalog/count/tree/standard/template-body'; |
|
| 102 | + $default = 'catalog/count/tree-body-default.php'; |
|
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns the HTML string for insertion into the header. |
|
| 110 | - * |
|
| 111 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | - */ |
|
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML string for insertion into the header. |
|
| 110 | + * |
|
| 111 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | + * @return string|null String including HTML tags for the header on error |
|
| 115 | + */ |
|
| 116 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | 119 | |
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->treeHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->treeHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/catalog/count/tree/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the catalog count tree client. |
|
| 128 | - * |
|
| 129 | - * The template file contains the HTML code and processing instructions |
|
| 130 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | - * of the rendered page in the frontend. The configuration string is the |
|
| 132 | - * path to the template file relative to the templates directory (usually |
|
| 133 | - * in client/html/templates). |
|
| 134 | - * |
|
| 135 | - * You can overwrite the template file configuration in extensions and |
|
| 136 | - * provide alternative templates. These alternative templates should be |
|
| 137 | - * named like the default one but with the string "standard" replaced by |
|
| 138 | - * an unique name. You may use the name of your project for this. If |
|
| 139 | - * you've implemented an alternative client class as well, "standard" |
|
| 140 | - * should be replaced by the name of the new class. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2014.03 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/catalog/count/tree/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/catalog/count/tree/standard/template-header'; |
|
| 148 | - $default = 'catalog/count/tree-header-default.php'; |
|
| 126 | + /** client/html/catalog/count/tree/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the catalog count tree client. |
|
| 128 | + * |
|
| 129 | + * The template file contains the HTML code and processing instructions |
|
| 130 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | + * of the rendered page in the frontend. The configuration string is the |
|
| 132 | + * path to the template file relative to the templates directory (usually |
|
| 133 | + * in client/html/templates). |
|
| 134 | + * |
|
| 135 | + * You can overwrite the template file configuration in extensions and |
|
| 136 | + * provide alternative templates. These alternative templates should be |
|
| 137 | + * named like the default one but with the string "standard" replaced by |
|
| 138 | + * an unique name. You may use the name of your project for this. If |
|
| 139 | + * you've implemented an alternative client class as well, "standard" |
|
| 140 | + * should be replaced by the name of the new class. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2014.03 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/catalog/count/tree/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/catalog/count/tree/standard/template-header'; |
|
| 148 | + $default = 'catalog/count/tree-header-default.php'; |
|
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Returns the sub-client given by its name. |
|
| 156 | - * |
|
| 157 | - * @param string $type Name of the client type |
|
| 158 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | - */ |
|
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 162 | - { |
|
| 163 | - /** client/html/catalog/count/tree/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the catalog count tree html client |
|
| 165 | - * |
|
| 166 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | - * modify what is returned to the caller. |
|
| 170 | - * |
|
| 171 | - * This option allows you to remove a decorator added via |
|
| 172 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | - * around the html client. |
|
| 174 | - * |
|
| 175 | - * client/html/catalog/count/tree/decorators/excludes = array( 'decorator1' ) |
|
| 176 | - * |
|
| 177 | - * This would remove the decorator named "decorator1" from the list of |
|
| 178 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | - * "client/html/common/decorators/default" to the html client. |
|
| 180 | - * |
|
| 181 | - * @param array List of decorator names |
|
| 182 | - * @since 2015.08 |
|
| 183 | - * @category Developer |
|
| 184 | - * @see client/html/common/decorators/default |
|
| 185 | - * @see client/html/catalog/count/tree/decorators/global |
|
| 186 | - * @see client/html/catalog/count/tree/decorators/local |
|
| 187 | - */ |
|
| 154 | + /** |
|
| 155 | + * Returns the sub-client given by its name. |
|
| 156 | + * |
|
| 157 | + * @param string $type Name of the client type |
|
| 158 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | + */ |
|
| 161 | + public function getSubClient( $type, $name = null ) |
|
| 162 | + { |
|
| 163 | + /** client/html/catalog/count/tree/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the catalog count tree html client |
|
| 165 | + * |
|
| 166 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | + * modify what is returned to the caller. |
|
| 170 | + * |
|
| 171 | + * This option allows you to remove a decorator added via |
|
| 172 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | + * around the html client. |
|
| 174 | + * |
|
| 175 | + * client/html/catalog/count/tree/decorators/excludes = array( 'decorator1' ) |
|
| 176 | + * |
|
| 177 | + * This would remove the decorator named "decorator1" from the list of |
|
| 178 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | + * "client/html/common/decorators/default" to the html client. |
|
| 180 | + * |
|
| 181 | + * @param array List of decorator names |
|
| 182 | + * @since 2015.08 |
|
| 183 | + * @category Developer |
|
| 184 | + * @see client/html/common/decorators/default |
|
| 185 | + * @see client/html/catalog/count/tree/decorators/global |
|
| 186 | + * @see client/html/catalog/count/tree/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/catalog/count/tree/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the catalog count tree html client |
|
| 191 | - * |
|
| 192 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | - * modify what is returned to the caller. |
|
| 196 | - * |
|
| 197 | - * This option allows you to wrap global decorators |
|
| 198 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | - * |
|
| 200 | - * client/html/catalog/count/tree/decorators/global = array( 'decorator1' ) |
|
| 201 | - * |
|
| 202 | - * This would add the decorator named "decorator1" defined by |
|
| 203 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | - * |
|
| 205 | - * @param array List of decorator names |
|
| 206 | - * @since 2015.08 |
|
| 207 | - * @category Developer |
|
| 208 | - * @see client/html/common/decorators/default |
|
| 209 | - * @see client/html/catalog/count/tree/decorators/excludes |
|
| 210 | - * @see client/html/catalog/count/tree/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/catalog/count/tree/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the catalog count tree html client |
|
| 191 | + * |
|
| 192 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | + * modify what is returned to the caller. |
|
| 196 | + * |
|
| 197 | + * This option allows you to wrap global decorators |
|
| 198 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | + * |
|
| 200 | + * client/html/catalog/count/tree/decorators/global = array( 'decorator1' ) |
|
| 201 | + * |
|
| 202 | + * This would add the decorator named "decorator1" defined by |
|
| 203 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | + * |
|
| 205 | + * @param array List of decorator names |
|
| 206 | + * @since 2015.08 |
|
| 207 | + * @category Developer |
|
| 208 | + * @see client/html/common/decorators/default |
|
| 209 | + * @see client/html/catalog/count/tree/decorators/excludes |
|
| 210 | + * @see client/html/catalog/count/tree/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/catalog/count/tree/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the catalog count tree html client |
|
| 215 | - * |
|
| 216 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | - * modify what is returned to the caller. |
|
| 220 | - * |
|
| 221 | - * This option allows you to wrap local decorators |
|
| 222 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/catalog/count/tree/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | - * |
|
| 229 | - * @param array List of decorator names |
|
| 230 | - * @since 2015.08 |
|
| 231 | - * @category Developer |
|
| 232 | - * @see client/html/common/decorators/default |
|
| 233 | - * @see client/html/catalog/count/tree/decorators/excludes |
|
| 234 | - * @see client/html/catalog/count/tree/decorators/global |
|
| 235 | - */ |
|
| 213 | + /** client/html/catalog/count/tree/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the catalog count tree html client |
|
| 215 | + * |
|
| 216 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | + * modify what is returned to the caller. |
|
| 220 | + * |
|
| 221 | + * This option allows you to wrap local decorators |
|
| 222 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/catalog/count/tree/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | + * |
|
| 229 | + * @param array List of decorator names |
|
| 230 | + * @since 2015.08 |
|
| 231 | + * @category Developer |
|
| 232 | + * @see client/html/common/decorators/default |
|
| 233 | + * @see client/html/catalog/count/tree/decorators/excludes |
|
| 234 | + * @see client/html/catalog/count/tree/decorators/global |
|
| 235 | + */ |
|
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/count/tree/' . $type, $name ); |
|
| 238 | - } |
|
| 237 | + return $this->createSubClient( 'catalog/count/tree/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns the list of sub-client names configured for the client. |
|
| 243 | - * |
|
| 244 | - * @return array List of HTML client names |
|
| 245 | - */ |
|
| 246 | - protected function getSubClientNames() |
|
| 247 | - { |
|
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns the list of sub-client names configured for the client. |
|
| 243 | + * |
|
| 244 | + * @return array List of HTML client names |
|
| 245 | + */ |
|
| 246 | + protected function getSubClientNames() |
|
| 247 | + { |
|
| 248 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Sets the necessary parameter values in the view. |
|
| 254 | - * |
|
| 255 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | - */ |
|
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | - { |
|
| 262 | - if( !isset( $this->cache ) ) |
|
| 263 | - { |
|
| 264 | - $context = $this->getContext(); |
|
| 265 | - $config = $context->getConfig(); |
|
| 252 | + /** |
|
| 253 | + * Sets the necessary parameter values in the view. |
|
| 254 | + * |
|
| 255 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | + */ |
|
| 260 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + { |
|
| 262 | + if( !isset( $this->cache ) ) |
|
| 263 | + { |
|
| 264 | + $context = $this->getContext(); |
|
| 265 | + $config = $context->getConfig(); |
|
| 266 | 266 | |
| 267 | - /** client/html/catalog/count/tree/aggregate |
|
| 268 | - * Enables or disables generating product counts for the category catalog filter |
|
| 269 | - * |
|
| 270 | - * This configuration option allows shop owners to enable or disable product counts |
|
| 271 | - * for the tree section of the catalog filter HTML client. |
|
| 272 | - * |
|
| 273 | - * @param boolean Disabled if "0", enabled if "1" |
|
| 274 | - * @since 2014.03 |
|
| 275 | - * @see client/html/catalog/count/limit |
|
| 276 | - */ |
|
| 277 | - if( $config->get( 'client/html/catalog/count/tree/aggregate', true ) == true ) |
|
| 278 | - { |
|
| 279 | - /** client/html/catalog/count/limit |
|
| 280 | - * @see client/html/catalog/count/tree/aggregate |
|
| 281 | - */ |
|
| 282 | - $filter = $this->getProductListFilter( $view, false ); |
|
| 283 | - $filter->setSlice( 0, $config->get( 'client/html/catalog/count/limit', 10000 ) ); |
|
| 284 | - $filter->setSortations( array() ); // it's not necessary and slows down the query |
|
| 267 | + /** client/html/catalog/count/tree/aggregate |
|
| 268 | + * Enables or disables generating product counts for the category catalog filter |
|
| 269 | + * |
|
| 270 | + * This configuration option allows shop owners to enable or disable product counts |
|
| 271 | + * for the tree section of the catalog filter HTML client. |
|
| 272 | + * |
|
| 273 | + * @param boolean Disabled if "0", enabled if "1" |
|
| 274 | + * @since 2014.03 |
|
| 275 | + * @see client/html/catalog/count/limit |
|
| 276 | + */ |
|
| 277 | + if( $config->get( 'client/html/catalog/count/tree/aggregate', true ) == true ) |
|
| 278 | + { |
|
| 279 | + /** client/html/catalog/count/limit |
|
| 280 | + * @see client/html/catalog/count/tree/aggregate |
|
| 281 | + */ |
|
| 282 | + $filter = $this->getProductListFilter( $view, false ); |
|
| 283 | + $filter->setSlice( 0, $config->get( 'client/html/catalog/count/limit', 10000 ) ); |
|
| 284 | + $filter->setSortations( array() ); // it's not necessary and slows down the query |
|
| 285 | 285 | |
| 286 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 287 | - $view->treeCountList = $controller->aggregateIndex( $filter, 'index.catalog.id' ); |
|
| 288 | - } |
|
| 286 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 287 | + $view->treeCountList = $controller->aggregateIndex( $filter, 'index.catalog.id' ); |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - $this->cache = $view; |
|
| 291 | - } |
|
| 290 | + $this->cache = $view; |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - return $this->cache; |
|
| 294 | - } |
|
| 293 | + return $this->cache; |
|
| 294 | + } |
|
| 295 | 295 | } |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->treeBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/catalog/count/tree/standard/template-body'; |
| 102 | 102 | $default = 'catalog/count/tree-body-default.php'; |
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + return $view->render($view->config($tplconf, $default)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | 114 | * @return string|null String including HTML tags for the header on error |
| 115 | 115 | */ |
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 119 | 119 | |
| 120 | 120 | $html = ''; |
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + foreach ($this->getSubClients() as $subclient) { |
|
| 122 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 123 | 123 | } |
| 124 | 124 | $view->treeHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/catalog/count/tree/standard/template-header'; |
| 148 | 148 | $default = 'catalog/count/tree-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/catalog/count/tree/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the catalog count tree html client |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see client/html/catalog/count/tree/decorators/global |
| 235 | 235 | */ |
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/count/tree/' . $type, $name ); |
|
| 237 | + return $this->createSubClient('catalog/count/tree/'.$type, $name); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | protected function getSubClientNames() |
| 247 | 247 | { |
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 258 | 258 | * @return \Aimeos\MW\View\Iface Modified view object |
| 259 | 259 | */ |
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 261 | 261 | { |
| 262 | - if( !isset( $this->cache ) ) |
|
| 262 | + if (!isset($this->cache)) |
|
| 263 | 263 | { |
| 264 | 264 | $context = $this->getContext(); |
| 265 | 265 | $config = $context->getConfig(); |
@@ -274,17 +274,17 @@ discard block |
||
| 274 | 274 | * @since 2014.03 |
| 275 | 275 | * @see client/html/catalog/count/limit |
| 276 | 276 | */ |
| 277 | - if( $config->get( 'client/html/catalog/count/tree/aggregate', true ) == true ) |
|
| 277 | + if ($config->get('client/html/catalog/count/tree/aggregate', true) == true) |
|
| 278 | 278 | { |
| 279 | 279 | /** client/html/catalog/count/limit |
| 280 | 280 | * @see client/html/catalog/count/tree/aggregate |
| 281 | 281 | */ |
| 282 | - $filter = $this->getProductListFilter( $view, false ); |
|
| 283 | - $filter->setSlice( 0, $config->get( 'client/html/catalog/count/limit', 10000 ) ); |
|
| 284 | - $filter->setSortations( array() ); // it's not necessary and slows down the query |
|
| 282 | + $filter = $this->getProductListFilter($view, false); |
|
| 283 | + $filter->setSlice(0, $config->get('client/html/catalog/count/limit', 10000)); |
|
| 284 | + $filter->setSortations(array()); // it's not necessary and slows down the query |
|
| 285 | 285 | |
| 286 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 287 | - $view->treeCountList = $controller->aggregateIndex( $filter, 'index.catalog.id' ); |
|
| 286 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 287 | + $view->treeCountList = $controller->aggregateIndex($filter, 'index.catalog.id'); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | $this->cache = $view; |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 112 | 112 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | + * @return string String including HTML tags for the header on error |
|
| 115 | 115 | */ |
| 116 | 116 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 117 | 117 | { |
@@ -19,267 +19,267 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/actions/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail actions 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/catalog/detail/actions/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/catalog/detail/actions/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail actions 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/catalog/detail/actions/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->actionsBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->actionsBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/catalog/detail/actions/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the catalog detail actions client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * should be replaced by the name of the new class. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2014.09 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/catalog/detail/actions/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/catalog/detail/actions/standard/template-body'; |
|
| 102 | - $default = 'catalog/detail/actions-body-default.php'; |
|
| 81 | + /** client/html/catalog/detail/actions/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the catalog detail actions client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * should be replaced by the name of the new class. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2014.09 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/catalog/detail/actions/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/catalog/detail/actions/standard/template-body'; |
|
| 102 | + $default = 'catalog/detail/actions-body-default.php'; |
|
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns the HTML string for insertion into the header. |
|
| 110 | - * |
|
| 111 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | - */ |
|
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML string for insertion into the header. |
|
| 110 | + * |
|
| 111 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | + * @return string|null String including HTML tags for the header on error |
|
| 115 | + */ |
|
| 116 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | 119 | |
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->actionsHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->actionsHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/catalog/detail/actions/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the catalog detail actions client. |
|
| 128 | - * |
|
| 129 | - * The template file contains the HTML code and processing instructions |
|
| 130 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | - * of the rendered page in the frontend. The configuration string is the |
|
| 132 | - * path to the template file relative to the templates directory (usually |
|
| 133 | - * in client/html/templates). |
|
| 134 | - * |
|
| 135 | - * You can overwrite the template file configuration in extensions and |
|
| 136 | - * provide alternative templates. These alternative templates should be |
|
| 137 | - * named like the default one but with the string "standard" replaced by |
|
| 138 | - * an unique name. You may use the name of your project for this. If |
|
| 139 | - * you've implemented an alternative client class as well, "standard" |
|
| 140 | - * should be replaced by the name of the new class. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2014.09 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/catalog/detail/actions/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/catalog/detail/actions/standard/template-header'; |
|
| 148 | - $default = 'catalog/detail/actions-header-default.php'; |
|
| 126 | + /** client/html/catalog/detail/actions/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the catalog detail actions client. |
|
| 128 | + * |
|
| 129 | + * The template file contains the HTML code and processing instructions |
|
| 130 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | + * of the rendered page in the frontend. The configuration string is the |
|
| 132 | + * path to the template file relative to the templates directory (usually |
|
| 133 | + * in client/html/templates). |
|
| 134 | + * |
|
| 135 | + * You can overwrite the template file configuration in extensions and |
|
| 136 | + * provide alternative templates. These alternative templates should be |
|
| 137 | + * named like the default one but with the string "standard" replaced by |
|
| 138 | + * an unique name. You may use the name of your project for this. If |
|
| 139 | + * you've implemented an alternative client class as well, "standard" |
|
| 140 | + * should be replaced by the name of the new class. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2014.09 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/catalog/detail/actions/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/catalog/detail/actions/standard/template-header'; |
|
| 148 | + $default = 'catalog/detail/actions-header-default.php'; |
|
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 156 | - * |
|
| 157 | - * @param string $content Cached content |
|
| 158 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 159 | - * @return string Modified body content |
|
| 160 | - */ |
|
| 161 | - public function modifyBody( $content, $uid ) |
|
| 162 | - { |
|
| 163 | - return $this->replaceSection( $content, $this->getBody( $uid ), 'catalog.detail.actions' ); |
|
| 164 | - } |
|
| 154 | + /** |
|
| 155 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 156 | + * |
|
| 157 | + * @param string $content Cached content |
|
| 158 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 159 | + * @return string Modified body content |
|
| 160 | + */ |
|
| 161 | + public function modifyBody( $content, $uid ) |
|
| 162 | + { |
|
| 163 | + return $this->replaceSection( $content, $this->getBody( $uid ), 'catalog.detail.actions' ); |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Returns the sub-client given by its name. |
|
| 169 | - * |
|
| 170 | - * @param string $type Name of the client type |
|
| 171 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 172 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 173 | - */ |
|
| 174 | - public function getSubClient( $type, $name = null ) |
|
| 175 | - { |
|
| 176 | - /** client/html/catalog/detail/actions/decorators/excludes |
|
| 177 | - * Excludes decorators added by the "common" option from the catalog detail actions html client |
|
| 178 | - * |
|
| 179 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 180 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 181 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 182 | - * modify what is returned to the caller. |
|
| 183 | - * |
|
| 184 | - * This option allows you to remove a decorator added via |
|
| 185 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 186 | - * around the html client. |
|
| 187 | - * |
|
| 188 | - * client/html/catalog/detail/actions/decorators/excludes = array( 'decorator1' ) |
|
| 189 | - * |
|
| 190 | - * This would remove the decorator named "decorator1" from the list of |
|
| 191 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 192 | - * "client/html/common/decorators/default" to the html client. |
|
| 193 | - * |
|
| 194 | - * @param array List of decorator names |
|
| 195 | - * @since 2015.08 |
|
| 196 | - * @category Developer |
|
| 197 | - * @see client/html/common/decorators/default |
|
| 198 | - * @see client/html/catalog/detail/actions/decorators/global |
|
| 199 | - * @see client/html/catalog/detail/actions/decorators/local |
|
| 200 | - */ |
|
| 167 | + /** |
|
| 168 | + * Returns the sub-client given by its name. |
|
| 169 | + * |
|
| 170 | + * @param string $type Name of the client type |
|
| 171 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 172 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 173 | + */ |
|
| 174 | + public function getSubClient( $type, $name = null ) |
|
| 175 | + { |
|
| 176 | + /** client/html/catalog/detail/actions/decorators/excludes |
|
| 177 | + * Excludes decorators added by the "common" option from the catalog detail actions html client |
|
| 178 | + * |
|
| 179 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 180 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 181 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 182 | + * modify what is returned to the caller. |
|
| 183 | + * |
|
| 184 | + * This option allows you to remove a decorator added via |
|
| 185 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 186 | + * around the html client. |
|
| 187 | + * |
|
| 188 | + * client/html/catalog/detail/actions/decorators/excludes = array( 'decorator1' ) |
|
| 189 | + * |
|
| 190 | + * This would remove the decorator named "decorator1" from the list of |
|
| 191 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 192 | + * "client/html/common/decorators/default" to the html client. |
|
| 193 | + * |
|
| 194 | + * @param array List of decorator names |
|
| 195 | + * @since 2015.08 |
|
| 196 | + * @category Developer |
|
| 197 | + * @see client/html/common/decorators/default |
|
| 198 | + * @see client/html/catalog/detail/actions/decorators/global |
|
| 199 | + * @see client/html/catalog/detail/actions/decorators/local |
|
| 200 | + */ |
|
| 201 | 201 | |
| 202 | - /** client/html/catalog/detail/actions/decorators/global |
|
| 203 | - * Adds a list of globally available decorators only to the catalog detail actions html client |
|
| 204 | - * |
|
| 205 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 206 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 207 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 208 | - * modify what is returned to the caller. |
|
| 209 | - * |
|
| 210 | - * This option allows you to wrap global decorators |
|
| 211 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 212 | - * |
|
| 213 | - * client/html/catalog/detail/actions/decorators/global = array( 'decorator1' ) |
|
| 214 | - * |
|
| 215 | - * This would add the decorator named "decorator1" defined by |
|
| 216 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 217 | - * |
|
| 218 | - * @param array List of decorator names |
|
| 219 | - * @since 2015.08 |
|
| 220 | - * @category Developer |
|
| 221 | - * @see client/html/common/decorators/default |
|
| 222 | - * @see client/html/catalog/detail/actions/decorators/excludes |
|
| 223 | - * @see client/html/catalog/detail/actions/decorators/local |
|
| 224 | - */ |
|
| 202 | + /** client/html/catalog/detail/actions/decorators/global |
|
| 203 | + * Adds a list of globally available decorators only to the catalog detail actions html client |
|
| 204 | + * |
|
| 205 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 206 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 207 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 208 | + * modify what is returned to the caller. |
|
| 209 | + * |
|
| 210 | + * This option allows you to wrap global decorators |
|
| 211 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 212 | + * |
|
| 213 | + * client/html/catalog/detail/actions/decorators/global = array( 'decorator1' ) |
|
| 214 | + * |
|
| 215 | + * This would add the decorator named "decorator1" defined by |
|
| 216 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 217 | + * |
|
| 218 | + * @param array List of decorator names |
|
| 219 | + * @since 2015.08 |
|
| 220 | + * @category Developer |
|
| 221 | + * @see client/html/common/decorators/default |
|
| 222 | + * @see client/html/catalog/detail/actions/decorators/excludes |
|
| 223 | + * @see client/html/catalog/detail/actions/decorators/local |
|
| 224 | + */ |
|
| 225 | 225 | |
| 226 | - /** client/html/catalog/detail/actions/decorators/local |
|
| 227 | - * Adds a list of local decorators only to the catalog detail actions html client |
|
| 228 | - * |
|
| 229 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 230 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 231 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 232 | - * modify what is returned to the caller. |
|
| 233 | - * |
|
| 234 | - * This option allows you to wrap local decorators |
|
| 235 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 236 | - * |
|
| 237 | - * client/html/catalog/detail/actions/decorators/local = array( 'decorator2' ) |
|
| 238 | - * |
|
| 239 | - * This would add the decorator named "decorator2" defined by |
|
| 240 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 241 | - * |
|
| 242 | - * @param array List of decorator names |
|
| 243 | - * @since 2015.08 |
|
| 244 | - * @category Developer |
|
| 245 | - * @see client/html/common/decorators/default |
|
| 246 | - * @see client/html/catalog/detail/actions/decorators/excludes |
|
| 247 | - * @see client/html/catalog/detail/actions/decorators/global |
|
| 248 | - */ |
|
| 226 | + /** client/html/catalog/detail/actions/decorators/local |
|
| 227 | + * Adds a list of local decorators only to the catalog detail actions html client |
|
| 228 | + * |
|
| 229 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 230 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 231 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 232 | + * modify what is returned to the caller. |
|
| 233 | + * |
|
| 234 | + * This option allows you to wrap local decorators |
|
| 235 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 236 | + * |
|
| 237 | + * client/html/catalog/detail/actions/decorators/local = array( 'decorator2' ) |
|
| 238 | + * |
|
| 239 | + * This would add the decorator named "decorator2" defined by |
|
| 240 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 241 | + * |
|
| 242 | + * @param array List of decorator names |
|
| 243 | + * @since 2015.08 |
|
| 244 | + * @category Developer |
|
| 245 | + * @see client/html/common/decorators/default |
|
| 246 | + * @see client/html/catalog/detail/actions/decorators/excludes |
|
| 247 | + * @see client/html/catalog/detail/actions/decorators/global |
|
| 248 | + */ |
|
| 249 | 249 | |
| 250 | - return $this->createSubClient( 'catalog/detail/actions/' . $type, $name ); |
|
| 251 | - } |
|
| 250 | + return $this->createSubClient( 'catalog/detail/actions/' . $type, $name ); |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * Returns the list of sub-client names configured for the client. |
|
| 256 | - * |
|
| 257 | - * @return array List of HTML client names |
|
| 258 | - */ |
|
| 259 | - protected function getSubClientNames() |
|
| 260 | - { |
|
| 261 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 262 | - } |
|
| 254 | + /** |
|
| 255 | + * Returns the list of sub-client names configured for the client. |
|
| 256 | + * |
|
| 257 | + * @return array List of HTML client names |
|
| 258 | + */ |
|
| 259 | + protected function getSubClientNames() |
|
| 260 | + { |
|
| 261 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * Sets the necessary parameter values in the view. |
|
| 267 | - * |
|
| 268 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 269 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 270 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 271 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 272 | - */ |
|
| 273 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 274 | - { |
|
| 275 | - if( !isset( $this->cache ) ) |
|
| 276 | - { |
|
| 277 | - $view->actionsParams = $this->getClientParams( $view->param() ); |
|
| 278 | - $view->actionsUserId = $this->getContext()->getUserId(); |
|
| 265 | + /** |
|
| 266 | + * Sets the necessary parameter values in the view. |
|
| 267 | + * |
|
| 268 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 269 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 270 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 271 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 272 | + */ |
|
| 273 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 274 | + { |
|
| 275 | + if( !isset( $this->cache ) ) |
|
| 276 | + { |
|
| 277 | + $view->actionsParams = $this->getClientParams( $view->param() ); |
|
| 278 | + $view->actionsUserId = $this->getContext()->getUserId(); |
|
| 279 | 279 | |
| 280 | - $this->cache = $view; |
|
| 281 | - } |
|
| 280 | + $this->cache = $view; |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | - return $this->cache; |
|
| 284 | - } |
|
| 283 | + return $this->cache; |
|
| 284 | + } |
|
| 285 | 285 | } |
| 286 | 286 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->actionsBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/catalog/detail/actions/standard/template-body'; |
| 102 | 102 | $default = 'catalog/detail/actions-body-default.php'; |
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + return $view->render($view->config($tplconf, $default)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | 114 | * @return string|null String including HTML tags for the header on error |
| 115 | 115 | */ |
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 119 | 119 | |
| 120 | 120 | $html = ''; |
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + foreach ($this->getSubClients() as $subclient) { |
|
| 122 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 123 | 123 | } |
| 124 | 124 | $view->actionsHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/catalog/detail/actions/standard/template-header'; |
| 148 | 148 | $default = 'catalog/detail/actions-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 159 | 159 | * @return string Modified body content |
| 160 | 160 | */ |
| 161 | - public function modifyBody( $content, $uid ) |
|
| 161 | + public function modifyBody($content, $uid) |
|
| 162 | 162 | { |
| 163 | - return $this->replaceSection( $content, $this->getBody( $uid ), 'catalog.detail.actions' ); |
|
| 163 | + return $this->replaceSection($content, $this->getBody($uid), 'catalog.detail.actions'); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string|null $name Name of the sub-client (Default if null) |
| 172 | 172 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 173 | 173 | */ |
| 174 | - public function getSubClient( $type, $name = null ) |
|
| 174 | + public function getSubClient($type, $name = null) |
|
| 175 | 175 | { |
| 176 | 176 | /** client/html/catalog/detail/actions/decorators/excludes |
| 177 | 177 | * Excludes decorators added by the "common" option from the catalog detail actions html client |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @see client/html/catalog/detail/actions/decorators/global |
| 248 | 248 | */ |
| 249 | 249 | |
| 250 | - return $this->createSubClient( 'catalog/detail/actions/' . $type, $name ); |
|
| 250 | + return $this->createSubClient('catalog/detail/actions/'.$type, $name); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | */ |
| 259 | 259 | protected function getSubClientNames() |
| 260 | 260 | { |
| 261 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 261 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 271 | 271 | * @return \Aimeos\MW\View\Iface Modified view object |
| 272 | 272 | */ |
| 273 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 273 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 274 | 274 | { |
| 275 | - if( !isset( $this->cache ) ) |
|
| 275 | + if (!isset($this->cache)) |
|
| 276 | 276 | { |
| 277 | - $view->actionsParams = $this->getClientParams( $view->param() ); |
|
| 277 | + $view->actionsParams = $this->getClientParams($view->param()); |
|
| 278 | 278 | $view->actionsUserId = $this->getContext()->getUserId(); |
| 279 | 279 | |
| 280 | 280 | $this->cache = $view; |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 114 | 114 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | + * @return string String including HTML tags for the header on error |
|
| 117 | 117 | */ |
| 118 | 118 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 119 | 119 | { |
@@ -19,373 +19,373 @@ |
||
| 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/detail/additional/attribute/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail additional attribute 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/detail/additional/attribute/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $tags = array(); |
|
| 61 | - private $expire; |
|
| 62 | - private $cache; |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Returns the HTML code for insertion into the body. |
|
| 67 | - * |
|
| 68 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | - * @return string HTML code |
|
| 72 | - */ |
|
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | - { |
|
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | - |
|
| 77 | - $html = ''; |
|
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | - } |
|
| 81 | - $view->attributeBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/detail/additional/attribute/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog detail additional attribute client. |
|
| 85 | - * |
|
| 86 | - * The template file contains the HTML code and processing instructions |
|
| 87 | - * to generate the result shown in the body of the frontend. The |
|
| 88 | - * configuration string is the path to the template file relative |
|
| 89 | - * to the templates directory (usually in client/html/templates). |
|
| 90 | - * |
|
| 91 | - * You can overwrite the template file configuration in extensions and |
|
| 92 | - * provide alternative templates. These alternative templates should be |
|
| 93 | - * named like the default one but with the string "standard" replaced by |
|
| 94 | - * an unique name. You may use the name of your project for this. If |
|
| 95 | - * you've implemented an alternative client class as well, "standard" |
|
| 96 | - * should be replaced by the name of the new class. |
|
| 97 | - * |
|
| 98 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | - * @since 2014.03 |
|
| 100 | - * @category Developer |
|
| 101 | - * @see client/html/catalog/detail/additional/attribute/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-body'; |
|
| 104 | - $default = 'catalog/detail/additional-attribute-body-default.php'; |
|
| 105 | - |
|
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Returns the HTML string for insertion into the header. |
|
| 112 | - * |
|
| 113 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 117 | - */ |
|
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | - { |
|
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | - |
|
| 122 | - $html = ''; |
|
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | - } |
|
| 126 | - $view->attributeHeader = $html; |
|
| 127 | - |
|
| 128 | - /** client/html/catalog/detail/additional/attribute/standard/template-header |
|
| 129 | - * Relative path to the HTML header template of the catalog detail additional attribute client. |
|
| 130 | - * |
|
| 131 | - * The template file contains the HTML code and processing instructions |
|
| 132 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | - * of the rendered page in the frontend. The configuration string is the |
|
| 134 | - * path to the template file relative to the templates directory (usually |
|
| 135 | - * in client/html/templates). |
|
| 136 | - * |
|
| 137 | - * You can overwrite the template file configuration in extensions and |
|
| 138 | - * provide alternative templates. These alternative templates should be |
|
| 139 | - * named like the default one but with the string "standard" replaced by |
|
| 140 | - * an unique name. You may use the name of your project for this. If |
|
| 141 | - * you've implemented an alternative client class as well, "standard" |
|
| 142 | - * should be replaced by the name of the new class. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2014.03 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/catalog/detail/additional/attribute/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-header'; |
|
| 150 | - $default = 'catalog/detail/additional-attribute-header-default.php'; |
|
| 151 | - |
|
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/catalog/detail/additional/attribute/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the catalog detail additional attribute html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/catalog/detail/additional/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/catalog/detail/additional/attribute/decorators/global |
|
| 188 | - * @see client/html/catalog/detail/additional/attribute/decorators/local |
|
| 189 | - */ |
|
| 190 | - |
|
| 191 | - /** client/html/catalog/detail/additional/attribute/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the catalog detail additional attribute html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/catalog/detail/additional/attribute/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/detail/additional/attribute/decorators/excludes |
|
| 212 | - * @see client/html/catalog/detail/additional/attribute/decorators/local |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - /** client/html/catalog/detail/additional/attribute/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the catalog detail additional attribute html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/detail/additional/attribute/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/detail/additional/attribute/decorators/excludes |
|
| 236 | - * @see client/html/catalog/detail/additional/attribute/decorators/global |
|
| 237 | - */ |
|
| 238 | - |
|
| 239 | - return $this->createSubClient( 'catalog/detail/additional/attribute/' . $type, $name ); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Returns the list of sub-client names configured for the client. |
|
| 245 | - * |
|
| 246 | - * @return array List of HTML client names |
|
| 247 | - */ |
|
| 248 | - protected function getSubClientNames() |
|
| 249 | - { |
|
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Sets the necessary parameter values in the view. |
|
| 256 | - * |
|
| 257 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | - */ |
|
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | - { |
|
| 264 | - if( !isset( $this->cache ) ) |
|
| 265 | - { |
|
| 266 | - $context = $this->getContext(); |
|
| 267 | - $config = $context->getConfig(); |
|
| 268 | - $attrIds = $attributeMap = $subAttrDeps = array(); |
|
| 269 | - |
|
| 270 | - /** client/html/catalog/detail/additional/attribute/variants |
|
| 271 | - * If variant attributes should be displayed in the additional section too |
|
| 272 | - * |
|
| 273 | - * The additional attribute section of the catalog details views contains |
|
| 274 | - * all attributes of type "default" that have been assigned to the product. |
|
| 275 | - * By default, this also includes variant attributes assigned to the article |
|
| 276 | - * of selection products and the ones for the selected variant are displayed |
|
| 277 | - * as well. |
|
| 278 | - * |
|
| 279 | - * This setting can disable displaying them in the additional attribute |
|
| 280 | - * section. |
|
| 281 | - * |
|
| 282 | - * @param boolean True to also display variant attibutes, false to hide them |
|
| 283 | - * @since 2016.05 |
|
| 284 | - * @category Developer |
|
| 285 | - */ |
|
| 286 | - $variants = (bool) $config->get( 'client/html/catalog/detail/additional/attribute/variants', true ); |
|
| 287 | - |
|
| 288 | - if( isset( $view->detailProductItem ) ) |
|
| 289 | - { |
|
| 290 | - $attrIds = array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'default' ) ); |
|
| 291 | - |
|
| 292 | - if( $variants === true ) { |
|
| 293 | - $attrIds += array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'variant' ) ); |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - |
|
| 298 | - $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' ); |
|
| 299 | - |
|
| 300 | - /** client/html/catalog/detail/additional/attribute/domains |
|
| 301 | - * A list of domain names whose items should be available in the additional attribute part of the catalog detail view templates |
|
| 302 | - * |
|
| 303 | - * The templates rendering additional attribute related data usually add |
|
| 304 | - * the images and texts associated to each item. If you want to |
|
| 305 | - * display additional content like the attributes, you can configure |
|
| 306 | - * your own list of domains (attribute, media, price, product, text, |
|
| 307 | - * etc. are domains) whose items are fetched from the storage. |
|
| 308 | - * Please keep in mind that the more domains you add to the |
|
| 309 | - * configuration, the more time is required for fetching the content! |
|
| 310 | - * |
|
| 311 | - * @param array List of domain names |
|
| 312 | - * @since 2015.09 |
|
| 313 | - * @category Developer |
|
| 314 | - * @see client/html/catalog/detail/basket/selection/domains-attributes |
|
| 315 | - */ |
|
| 316 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', array( 'attribute' ) ); |
|
| 317 | - |
|
| 318 | - // find regular attributes from sub-products |
|
| 319 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 320 | - $products = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 321 | - |
|
| 322 | - foreach( $products as $subProdId => $subProduct ) |
|
| 323 | - { |
|
| 324 | - $subItems = $subProduct->getRefItems( 'attribute', null, 'default' ); |
|
| 325 | - |
|
| 326 | - if( $variants === true ) { |
|
| 327 | - $subItems += $subProduct->getRefItems( 'attribute', null, 'variant' ); |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - foreach( $subItems as $attrId => $attrItem ) |
|
| 331 | - { |
|
| 332 | - $subAttrDeps[$attrId][] = $subProdId; |
|
| 333 | - $attrIds[] = $attrId; |
|
| 334 | - } |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 338 | - $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 339 | - |
|
| 340 | - |
|
| 341 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 342 | - |
|
| 343 | - $search = $attrManager->createSearch( true ); |
|
| 344 | - $expr = array( |
|
| 345 | - $search->compare( '==', 'attribute.id', $attrIds ), |
|
| 346 | - $search->getConditions(), |
|
| 347 | - ); |
|
| 348 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 349 | - |
|
| 350 | - |
|
| 351 | - /** client/html/catalog/detail/basket/selection/domains-attributes |
|
| 352 | - * A list of domain names whose items should be available for the attributes in the |
|
| 353 | - * additional attribute part of the catalog detail view templates |
|
| 354 | - * |
|
| 355 | - * The templates rendering additional attribute related data usually add |
|
| 356 | - * the images and texts associated to each item. If you want to |
|
| 357 | - * display additional content like the attributes, you can configure |
|
| 358 | - * your own list of domains (attribute, media, price, product, text, |
|
| 359 | - * etc. are domains) whose items are fetched from the storage. |
|
| 360 | - * Please keep in mind that the more domains you add to the |
|
| 361 | - * configuration, the more time is required for fetching the content! |
|
| 362 | - * |
|
| 363 | - * @param array List of domain names |
|
| 364 | - * @since 2015.09 |
|
| 365 | - * @category Developer |
|
| 366 | - * @see client/html/catalog/detail/basket/selection/domains |
|
| 367 | - */ |
|
| 368 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', array( 'text', 'media' ) ); |
|
| 369 | - |
|
| 370 | - $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 371 | - |
|
| 372 | - foreach( $attributes as $id => $item ) { |
|
| 373 | - $attributeMap[$item->getType()][$id] = $item; |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 377 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - $view->attributeMap = $attributeMap; |
|
| 381 | - $view->subAttributeDependencies = $subAttrDeps; |
|
| 382 | - |
|
| 383 | - $this->cache = $view; |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 387 | - $tags = array_merge( $tags, $this->tags ); |
|
| 388 | - |
|
| 389 | - return $this->cache; |
|
| 390 | - } |
|
| 25 | + /** client/html/catalog/detail/additional/attribute/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail additional attribute 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/detail/additional/attribute/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $tags = array(); |
|
| 61 | + private $expire; |
|
| 62 | + private $cache; |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Returns the HTML code for insertion into the body. |
|
| 67 | + * |
|
| 68 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | + * @return string HTML code |
|
| 72 | + */ |
|
| 73 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | + { |
|
| 75 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | + |
|
| 77 | + $html = ''; |
|
| 78 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | + } |
|
| 81 | + $view->attributeBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/detail/additional/attribute/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog detail additional attribute client. |
|
| 85 | + * |
|
| 86 | + * The template file contains the HTML code and processing instructions |
|
| 87 | + * to generate the result shown in the body of the frontend. The |
|
| 88 | + * configuration string is the path to the template file relative |
|
| 89 | + * to the templates directory (usually in client/html/templates). |
|
| 90 | + * |
|
| 91 | + * You can overwrite the template file configuration in extensions and |
|
| 92 | + * provide alternative templates. These alternative templates should be |
|
| 93 | + * named like the default one but with the string "standard" replaced by |
|
| 94 | + * an unique name. You may use the name of your project for this. If |
|
| 95 | + * you've implemented an alternative client class as well, "standard" |
|
| 96 | + * should be replaced by the name of the new class. |
|
| 97 | + * |
|
| 98 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | + * @since 2014.03 |
|
| 100 | + * @category Developer |
|
| 101 | + * @see client/html/catalog/detail/additional/attribute/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-body'; |
|
| 104 | + $default = 'catalog/detail/additional-attribute-body-default.php'; |
|
| 105 | + |
|
| 106 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Returns the HTML string for insertion into the header. |
|
| 112 | + * |
|
| 113 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | + * @return string|null String including HTML tags for the header on error |
|
| 117 | + */ |
|
| 118 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | + { |
|
| 120 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | + |
|
| 122 | + $html = ''; |
|
| 123 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | + } |
|
| 126 | + $view->attributeHeader = $html; |
|
| 127 | + |
|
| 128 | + /** client/html/catalog/detail/additional/attribute/standard/template-header |
|
| 129 | + * Relative path to the HTML header template of the catalog detail additional attribute client. |
|
| 130 | + * |
|
| 131 | + * The template file contains the HTML code and processing instructions |
|
| 132 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | + * of the rendered page in the frontend. The configuration string is the |
|
| 134 | + * path to the template file relative to the templates directory (usually |
|
| 135 | + * in client/html/templates). |
|
| 136 | + * |
|
| 137 | + * You can overwrite the template file configuration in extensions and |
|
| 138 | + * provide alternative templates. These alternative templates should be |
|
| 139 | + * named like the default one but with the string "standard" replaced by |
|
| 140 | + * an unique name. You may use the name of your project for this. If |
|
| 141 | + * you've implemented an alternative client class as well, "standard" |
|
| 142 | + * should be replaced by the name of the new class. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2014.03 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/catalog/detail/additional/attribute/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-header'; |
|
| 150 | + $default = 'catalog/detail/additional-attribute-header-default.php'; |
|
| 151 | + |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/catalog/detail/additional/attribute/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the catalog detail additional attribute html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/catalog/detail/additional/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/catalog/detail/additional/attribute/decorators/global |
|
| 188 | + * @see client/html/catalog/detail/additional/attribute/decorators/local |
|
| 189 | + */ |
|
| 190 | + |
|
| 191 | + /** client/html/catalog/detail/additional/attribute/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the catalog detail additional attribute html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/catalog/detail/additional/attribute/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/detail/additional/attribute/decorators/excludes |
|
| 212 | + * @see client/html/catalog/detail/additional/attribute/decorators/local |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + /** client/html/catalog/detail/additional/attribute/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the catalog detail additional attribute html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/detail/additional/attribute/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/detail/additional/attribute/decorators/excludes |
|
| 236 | + * @see client/html/catalog/detail/additional/attribute/decorators/global |
|
| 237 | + */ |
|
| 238 | + |
|
| 239 | + return $this->createSubClient( 'catalog/detail/additional/attribute/' . $type, $name ); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Returns the list of sub-client names configured for the client. |
|
| 245 | + * |
|
| 246 | + * @return array List of HTML client names |
|
| 247 | + */ |
|
| 248 | + protected function getSubClientNames() |
|
| 249 | + { |
|
| 250 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Sets the necessary parameter values in the view. |
|
| 256 | + * |
|
| 257 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | + */ |
|
| 262 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | + { |
|
| 264 | + if( !isset( $this->cache ) ) |
|
| 265 | + { |
|
| 266 | + $context = $this->getContext(); |
|
| 267 | + $config = $context->getConfig(); |
|
| 268 | + $attrIds = $attributeMap = $subAttrDeps = array(); |
|
| 269 | + |
|
| 270 | + /** client/html/catalog/detail/additional/attribute/variants |
|
| 271 | + * If variant attributes should be displayed in the additional section too |
|
| 272 | + * |
|
| 273 | + * The additional attribute section of the catalog details views contains |
|
| 274 | + * all attributes of type "default" that have been assigned to the product. |
|
| 275 | + * By default, this also includes variant attributes assigned to the article |
|
| 276 | + * of selection products and the ones for the selected variant are displayed |
|
| 277 | + * as well. |
|
| 278 | + * |
|
| 279 | + * This setting can disable displaying them in the additional attribute |
|
| 280 | + * section. |
|
| 281 | + * |
|
| 282 | + * @param boolean True to also display variant attibutes, false to hide them |
|
| 283 | + * @since 2016.05 |
|
| 284 | + * @category Developer |
|
| 285 | + */ |
|
| 286 | + $variants = (bool) $config->get( 'client/html/catalog/detail/additional/attribute/variants', true ); |
|
| 287 | + |
|
| 288 | + if( isset( $view->detailProductItem ) ) |
|
| 289 | + { |
|
| 290 | + $attrIds = array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'default' ) ); |
|
| 291 | + |
|
| 292 | + if( $variants === true ) { |
|
| 293 | + $attrIds += array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'variant' ) ); |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + |
|
| 298 | + $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' ); |
|
| 299 | + |
|
| 300 | + /** client/html/catalog/detail/additional/attribute/domains |
|
| 301 | + * A list of domain names whose items should be available in the additional attribute part of the catalog detail view templates |
|
| 302 | + * |
|
| 303 | + * The templates rendering additional attribute related data usually add |
|
| 304 | + * the images and texts associated to each item. If you want to |
|
| 305 | + * display additional content like the attributes, you can configure |
|
| 306 | + * your own list of domains (attribute, media, price, product, text, |
|
| 307 | + * etc. are domains) whose items are fetched from the storage. |
|
| 308 | + * Please keep in mind that the more domains you add to the |
|
| 309 | + * configuration, the more time is required for fetching the content! |
|
| 310 | + * |
|
| 311 | + * @param array List of domain names |
|
| 312 | + * @since 2015.09 |
|
| 313 | + * @category Developer |
|
| 314 | + * @see client/html/catalog/detail/basket/selection/domains-attributes |
|
| 315 | + */ |
|
| 316 | + $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', array( 'attribute' ) ); |
|
| 317 | + |
|
| 318 | + // find regular attributes from sub-products |
|
| 319 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 320 | + $products = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 321 | + |
|
| 322 | + foreach( $products as $subProdId => $subProduct ) |
|
| 323 | + { |
|
| 324 | + $subItems = $subProduct->getRefItems( 'attribute', null, 'default' ); |
|
| 325 | + |
|
| 326 | + if( $variants === true ) { |
|
| 327 | + $subItems += $subProduct->getRefItems( 'attribute', null, 'variant' ); |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + foreach( $subItems as $attrId => $attrItem ) |
|
| 331 | + { |
|
| 332 | + $subAttrDeps[$attrId][] = $subProdId; |
|
| 333 | + $attrIds[] = $attrId; |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 338 | + $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 339 | + |
|
| 340 | + |
|
| 341 | + $attrManager = $controller->createManager( 'attribute' ); |
|
| 342 | + |
|
| 343 | + $search = $attrManager->createSearch( true ); |
|
| 344 | + $expr = array( |
|
| 345 | + $search->compare( '==', 'attribute.id', $attrIds ), |
|
| 346 | + $search->getConditions(), |
|
| 347 | + ); |
|
| 348 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 349 | + |
|
| 350 | + |
|
| 351 | + /** client/html/catalog/detail/basket/selection/domains-attributes |
|
| 352 | + * A list of domain names whose items should be available for the attributes in the |
|
| 353 | + * additional attribute part of the catalog detail view templates |
|
| 354 | + * |
|
| 355 | + * The templates rendering additional attribute related data usually add |
|
| 356 | + * the images and texts associated to each item. If you want to |
|
| 357 | + * display additional content like the attributes, you can configure |
|
| 358 | + * your own list of domains (attribute, media, price, product, text, |
|
| 359 | + * etc. are domains) whose items are fetched from the storage. |
|
| 360 | + * Please keep in mind that the more domains you add to the |
|
| 361 | + * configuration, the more time is required for fetching the content! |
|
| 362 | + * |
|
| 363 | + * @param array List of domain names |
|
| 364 | + * @since 2015.09 |
|
| 365 | + * @category Developer |
|
| 366 | + * @see client/html/catalog/detail/basket/selection/domains |
|
| 367 | + */ |
|
| 368 | + $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', array( 'text', 'media' ) ); |
|
| 369 | + |
|
| 370 | + $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 371 | + |
|
| 372 | + foreach( $attributes as $id => $item ) { |
|
| 373 | + $attributeMap[$item->getType()][$id] = $item; |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 377 | + $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + $view->attributeMap = $attributeMap; |
|
| 381 | + $view->subAttributeDependencies = $subAttrDeps; |
|
| 382 | + |
|
| 383 | + $this->cache = $view; |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 387 | + $tags = array_merge( $tags, $this->tags ); |
|
| 388 | + |
|
| 389 | + return $this->cache; |
|
| 390 | + } |
|
| 391 | 391 | } |
| 392 | 392 | \ No newline at end of file |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 71 | 71 | * @return string HTML code |
| 72 | 72 | */ |
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 74 | 74 | { |
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 76 | 76 | |
| 77 | 77 | $html = ''; |
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + foreach ($this->getSubClients() as $subclient) { |
|
| 79 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 80 | 80 | } |
| 81 | 81 | $view->attributeBody = $html; |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-body'; |
| 104 | 104 | $default = 'catalog/detail/additional-attribute-body-default.php'; |
| 105 | 105 | |
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + return $view->render($view->config($tplconf, $default)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | 116 | * @return string|null String including HTML tags for the header on error |
| 117 | 117 | */ |
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 119 | 119 | { |
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 121 | 121 | |
| 122 | 122 | $html = ''; |
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + foreach ($this->getSubClients() as $subclient) { |
|
| 124 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 125 | 125 | } |
| 126 | 126 | $view->attributeHeader = $html; |
| 127 | 127 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-header'; |
| 150 | 150 | $default = 'catalog/detail/additional-attribute-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/catalog/detail/additional/attribute/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the catalog detail additional attribute html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/catalog/detail/additional/attribute/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'catalog/detail/additional/attribute/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('catalog/detail/additional/attribute/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - if( !isset( $this->cache ) ) |
|
| 264 | + if (!isset($this->cache)) |
|
| 265 | 265 | { |
| 266 | 266 | $context = $this->getContext(); |
| 267 | 267 | $config = $context->getConfig(); |
@@ -283,19 +283,19 @@ discard block |
||
| 283 | 283 | * @since 2016.05 |
| 284 | 284 | * @category Developer |
| 285 | 285 | */ |
| 286 | - $variants = (bool) $config->get( 'client/html/catalog/detail/additional/attribute/variants', true ); |
|
| 286 | + $variants = (bool) $config->get('client/html/catalog/detail/additional/attribute/variants', true); |
|
| 287 | 287 | |
| 288 | - if( isset( $view->detailProductItem ) ) |
|
| 288 | + if (isset($view->detailProductItem)) |
|
| 289 | 289 | { |
| 290 | - $attrIds = array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'default' ) ); |
|
| 290 | + $attrIds = array_keys($view->detailProductItem->getRefItems('attribute', null, 'default')); |
|
| 291 | 291 | |
| 292 | - if( $variants === true ) { |
|
| 293 | - $attrIds += array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'variant' ) ); |
|
| 292 | + if ($variants === true) { |
|
| 293 | + $attrIds += array_keys($view->detailProductItem->getRefItems('attribute', null, 'variant')); |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
| 298 | - $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' ); |
|
| 298 | + $products = $view->detailProductItem->getRefItems('product', 'default', 'default'); |
|
| 299 | 299 | |
| 300 | 300 | /** client/html/catalog/detail/additional/attribute/domains |
| 301 | 301 | * A list of domain names whose items should be available in the additional attribute part of the catalog detail view templates |
@@ -313,39 +313,39 @@ discard block |
||
| 313 | 313 | * @category Developer |
| 314 | 314 | * @see client/html/catalog/detail/basket/selection/domains-attributes |
| 315 | 315 | */ |
| 316 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', array( 'attribute' ) ); |
|
| 316 | + $domains = $config->get('client/html/catalog/detail/basket/selection/domains', array('attribute')); |
|
| 317 | 317 | |
| 318 | 318 | // find regular attributes from sub-products |
| 319 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 320 | - $products = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 319 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 320 | + $products = $controller->getProductItems(array_keys($products), $domains); |
|
| 321 | 321 | |
| 322 | - foreach( $products as $subProdId => $subProduct ) |
|
| 322 | + foreach ($products as $subProdId => $subProduct) |
|
| 323 | 323 | { |
| 324 | - $subItems = $subProduct->getRefItems( 'attribute', null, 'default' ); |
|
| 324 | + $subItems = $subProduct->getRefItems('attribute', null, 'default'); |
|
| 325 | 325 | |
| 326 | - if( $variants === true ) { |
|
| 327 | - $subItems += $subProduct->getRefItems( 'attribute', null, 'variant' ); |
|
| 326 | + if ($variants === true) { |
|
| 327 | + $subItems += $subProduct->getRefItems('attribute', null, 'variant'); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - foreach( $subItems as $attrId => $attrItem ) |
|
| 330 | + foreach ($subItems as $attrId => $attrItem) |
|
| 331 | 331 | { |
| 332 | 332 | $subAttrDeps[$attrId][] = $subProdId; |
| 333 | 333 | $attrIds[] = $attrId; |
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - $this->addMetaItem( $products, 'product', $this->expire, $this->tags ); |
|
| 338 | - $this->addMetaList( array_keys( $products ), 'product', $this->expire ); |
|
| 337 | + $this->addMetaItem($products, 'product', $this->expire, $this->tags); |
|
| 338 | + $this->addMetaList(array_keys($products), 'product', $this->expire); |
|
| 339 | 339 | |
| 340 | 340 | |
| 341 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 341 | + $attrManager = $controller->createManager('attribute'); |
|
| 342 | 342 | |
| 343 | - $search = $attrManager->createSearch( true ); |
|
| 343 | + $search = $attrManager->createSearch(true); |
|
| 344 | 344 | $expr = array( |
| 345 | - $search->compare( '==', 'attribute.id', $attrIds ), |
|
| 345 | + $search->compare('==', 'attribute.id', $attrIds), |
|
| 346 | 346 | $search->getConditions(), |
| 347 | 347 | ); |
| 348 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 348 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 349 | 349 | |
| 350 | 350 | |
| 351 | 351 | /** client/html/catalog/detail/basket/selection/domains-attributes |
@@ -365,16 +365,16 @@ discard block |
||
| 365 | 365 | * @category Developer |
| 366 | 366 | * @see client/html/catalog/detail/basket/selection/domains |
| 367 | 367 | */ |
| 368 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', array( 'text', 'media' ) ); |
|
| 368 | + $domains = $config->get('client/html/catalog/detail/basket/selection/domains-attributes', array('text', 'media')); |
|
| 369 | 369 | |
| 370 | - $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 370 | + $attributes = $attrManager->searchItems($search, $domains); |
|
| 371 | 371 | |
| 372 | - foreach( $attributes as $id => $item ) { |
|
| 372 | + foreach ($attributes as $id => $item) { |
|
| 373 | 373 | $attributeMap[$item->getType()][$id] = $item; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 377 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 376 | + $this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags); |
|
| 377 | + $this->addMetaList(array_keys($attributes), 'attribute', $this->expire); |
|
| 378 | 378 | |
| 379 | 379 | |
| 380 | 380 | $view->attributeMap = $attributeMap; |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | $this->cache = $view; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 387 | - $tags = array_merge( $tags, $this->tags ); |
|
| 386 | + $expire = $this->expires($this->expire, $expire); |
|
| 387 | + $tags = array_merge($tags, $this->tags); |
|
| 388 | 388 | |
| 389 | 389 | return $this->cache; |
| 390 | 390 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/additional/download/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail additional download 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/detail/additional/download/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | - |
|
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->downloadBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/catalog/detail/additional/download/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the catalog detail additional download client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/catalog/detail/additional/download/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/catalog/detail/additional/download/standard/template-body'; |
|
| 101 | - $default = 'catalog/detail/additional-download-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->downloadHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/catalog/detail/additional/download/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the catalog detail additional download client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/catalog/detail/additional/download/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/catalog/detail/additional/download/standard/template-header'; |
|
| 147 | - $default = 'catalog/detail/additional-download-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/catalog/detail/additional/download/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the catalog detail additional download html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/catalog/detail/additional/download/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/catalog/detail/additional/download/decorators/global |
|
| 185 | - * @see client/html/catalog/detail/additional/download/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/catalog/detail/additional/download/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the catalog detail additional download html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/catalog/detail/additional/download/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/catalog/detail/additional/download/decorators/excludes |
|
| 209 | - * @see client/html/catalog/detail/additional/download/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/catalog/detail/additional/download/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the catalog detail additional download html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/catalog/detail/additional/download/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/catalog/detail/additional/download/decorators/excludes |
|
| 233 | - * @see client/html/catalog/detail/additional/download/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'catalog/detail/additional/download/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/catalog/detail/additional/download/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail additional download 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/detail/additional/download/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->downloadBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/catalog/detail/additional/download/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the catalog detail additional download client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/catalog/detail/additional/download/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/catalog/detail/additional/download/standard/template-body'; |
|
| 101 | + $default = 'catalog/detail/additional-download-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->downloadHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/catalog/detail/additional/download/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the catalog detail additional download client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/catalog/detail/additional/download/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/catalog/detail/additional/download/standard/template-header'; |
|
| 147 | + $default = 'catalog/detail/additional-download-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/catalog/detail/additional/download/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the catalog detail additional download html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/catalog/detail/additional/download/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/catalog/detail/additional/download/decorators/global |
|
| 185 | + * @see client/html/catalog/detail/additional/download/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/catalog/detail/additional/download/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the catalog detail additional download html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/catalog/detail/additional/download/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/catalog/detail/additional/download/decorators/excludes |
|
| 209 | + * @see client/html/catalog/detail/additional/download/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/catalog/detail/additional/download/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the catalog detail additional download html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/catalog/detail/additional/download/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/catalog/detail/additional/download/decorators/excludes |
|
| 233 | + * @see client/html/catalog/detail/additional/download/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'catalog/detail/additional/download/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->downloadBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/catalog/detail/additional/download/standard/template-body'; |
| 101 | 101 | $default = 'catalog/detail/additional-download-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->downloadHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/catalog/detail/additional/download/standard/template-header'; |
| 147 | 147 | $default = 'catalog/detail/additional-download-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/catalog/detail/additional/download/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the catalog detail additional download html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/catalog/detail/additional/download/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'catalog/detail/additional/download/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('catalog/detail/additional/download/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 113 | 113 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | + * @return string String including HTML tags for the header on error |
|
| 116 | 116 | */ |
| 117 | 117 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 118 | 118 | { |
@@ -18,269 +18,269 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** client/html/catalog/detail/additional/property/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the catalog detail additional property section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2015.01 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/catalog/detail/additional/property/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - private $tags = array(); |
|
| 60 | - private $expire; |
|
| 61 | - private $cache; |
|
| 24 | + /** client/html/catalog/detail/additional/property/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the catalog detail additional property section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2015.01 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/catalog/detail/additional/property/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + private $tags = array(); |
|
| 60 | + private $expire; |
|
| 61 | + private $cache; |
|
| 62 | 62 | |
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Returns the HTML code for insertion into the body. |
|
| 66 | - * |
|
| 67 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | - * @return string HTML code |
|
| 71 | - */ |
|
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | - { |
|
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 64 | + /** |
|
| 65 | + * Returns the HTML code for insertion into the body. |
|
| 66 | + * |
|
| 67 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | + * @return string HTML code |
|
| 71 | + */ |
|
| 72 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + { |
|
| 74 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | 75 | |
| 76 | - $html = ''; |
|
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | - } |
|
| 80 | - $view->propertyBody = $html; |
|
| 76 | + $html = ''; |
|
| 77 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | + } |
|
| 80 | + $view->propertyBody = $html; |
|
| 81 | 81 | |
| 82 | - /** client/html/catalog/detail/additional/property/standard/template-body |
|
| 83 | - * Relative path to the HTML body template of the catalog detail additional property client. |
|
| 84 | - * |
|
| 85 | - * The template file contains the HTML code and processing instructions |
|
| 86 | - * to generate the result shown in the body of the frontend. The |
|
| 87 | - * configuration string is the path to the template file relative |
|
| 88 | - * to the templates directory (usually in client/html/templates). |
|
| 89 | - * |
|
| 90 | - * You can overwrite the template file configuration in extensions and |
|
| 91 | - * provide alternative templates. These alternative templates should be |
|
| 92 | - * named like the default one but with the string "standard" replaced by |
|
| 93 | - * an unique name. You may use the name of your project for this. If |
|
| 94 | - * you've implemented an alternative client class as well, "standard" |
|
| 95 | - * should be replaced by the name of the new class. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2015.01 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/catalog/detail/additional/property/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/catalog/detail/additional/property/standard/template-body'; |
|
| 103 | - $default = 'catalog/detail/additional-property-body-default.php'; |
|
| 82 | + /** client/html/catalog/detail/additional/property/standard/template-body |
|
| 83 | + * Relative path to the HTML body template of the catalog detail additional property client. |
|
| 84 | + * |
|
| 85 | + * The template file contains the HTML code and processing instructions |
|
| 86 | + * to generate the result shown in the body of the frontend. The |
|
| 87 | + * configuration string is the path to the template file relative |
|
| 88 | + * to the templates directory (usually in client/html/templates). |
|
| 89 | + * |
|
| 90 | + * You can overwrite the template file configuration in extensions and |
|
| 91 | + * provide alternative templates. These alternative templates should be |
|
| 92 | + * named like the default one but with the string "standard" replaced by |
|
| 93 | + * an unique name. You may use the name of your project for this. If |
|
| 94 | + * you've implemented an alternative client class as well, "standard" |
|
| 95 | + * should be replaced by the name of the new class. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2015.01 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/catalog/detail/additional/property/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/catalog/detail/additional/property/standard/template-body'; |
|
| 103 | + $default = 'catalog/detail/additional-property-body-default.php'; |
|
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | 120 | |
| 121 | - $html = ''; |
|
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | - } |
|
| 125 | - $view->propertyHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->propertyHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/catalog/detail/additional/property/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the catalog detail additional property client. |
|
| 129 | - * |
|
| 130 | - * The template file contains the HTML code and processing instructions |
|
| 131 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | - * of the rendered page in the frontend. The configuration string is the |
|
| 133 | - * path to the template file relative to the templates directory (usually |
|
| 134 | - * in client/html/templates). |
|
| 135 | - * |
|
| 136 | - * You can overwrite the template file configuration in extensions and |
|
| 137 | - * provide alternative templates. These alternative templates should be |
|
| 138 | - * named like the default one but with the string "standard" replaced by |
|
| 139 | - * an unique name. You may use the name of your project for this. If |
|
| 140 | - * you've implemented an alternative client class as well, "standard" |
|
| 141 | - * should be replaced by the name of the new class. |
|
| 142 | - * |
|
| 143 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | - * @since 2015.01 |
|
| 145 | - * @category Developer |
|
| 146 | - * @see client/html/catalog/detail/additional/property/standard/template-body |
|
| 147 | - */ |
|
| 148 | - $tplconf = 'client/html/catalog/detail/additional/property/standard/template-header'; |
|
| 149 | - $default = 'catalog/detail/additional-property-header-default.php'; |
|
| 127 | + /** client/html/catalog/detail/additional/property/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the catalog detail additional property client. |
|
| 129 | + * |
|
| 130 | + * The template file contains the HTML code and processing instructions |
|
| 131 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | + * of the rendered page in the frontend. The configuration string is the |
|
| 133 | + * path to the template file relative to the templates directory (usually |
|
| 134 | + * in client/html/templates). |
|
| 135 | + * |
|
| 136 | + * You can overwrite the template file configuration in extensions and |
|
| 137 | + * provide alternative templates. These alternative templates should be |
|
| 138 | + * named like the default one but with the string "standard" replaced by |
|
| 139 | + * an unique name. You may use the name of your project for this. If |
|
| 140 | + * you've implemented an alternative client class as well, "standard" |
|
| 141 | + * should be replaced by the name of the new class. |
|
| 142 | + * |
|
| 143 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | + * @since 2015.01 |
|
| 145 | + * @category Developer |
|
| 146 | + * @see client/html/catalog/detail/additional/property/standard/template-body |
|
| 147 | + */ |
|
| 148 | + $tplconf = 'client/html/catalog/detail/additional/property/standard/template-header'; |
|
| 149 | + $default = 'catalog/detail/additional-property-header-default.php'; |
|
| 150 | 150 | |
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | - } |
|
| 151 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Returns the sub-client given by its name. |
|
| 157 | - * |
|
| 158 | - * @param string $type Name of the client type |
|
| 159 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | - */ |
|
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 163 | - { |
|
| 164 | - /** client/html/catalog/detail/additional/property/decorators/excludes |
|
| 165 | - * Excludes decorators added by the "common" option from the catalog detail additional property html client |
|
| 166 | - * |
|
| 167 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 168 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 169 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 170 | - * modify what is returned to the caller. |
|
| 171 | - * |
|
| 172 | - * This option allows you to remove a decorator added via |
|
| 173 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 174 | - * around the html client. |
|
| 175 | - * |
|
| 176 | - * client/html/catalog/detail/additional/property/decorators/excludes = array( 'decorator1' ) |
|
| 177 | - * |
|
| 178 | - * This would remove the decorator named "decorator1" from the list of |
|
| 179 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 180 | - * "client/html/common/decorators/default" to the html client. |
|
| 181 | - * |
|
| 182 | - * @param array List of decorator names |
|
| 183 | - * @since 2015.08 |
|
| 184 | - * @category Developer |
|
| 185 | - * @see client/html/common/decorators/default |
|
| 186 | - * @see client/html/catalog/detail/additional/property/decorators/global |
|
| 187 | - * @see client/html/catalog/detail/additional/property/decorators/local |
|
| 188 | - */ |
|
| 155 | + /** |
|
| 156 | + * Returns the sub-client given by its name. |
|
| 157 | + * |
|
| 158 | + * @param string $type Name of the client type |
|
| 159 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | + */ |
|
| 162 | + public function getSubClient( $type, $name = null ) |
|
| 163 | + { |
|
| 164 | + /** client/html/catalog/detail/additional/property/decorators/excludes |
|
| 165 | + * Excludes decorators added by the "common" option from the catalog detail additional property html client |
|
| 166 | + * |
|
| 167 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 168 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 169 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 170 | + * modify what is returned to the caller. |
|
| 171 | + * |
|
| 172 | + * This option allows you to remove a decorator added via |
|
| 173 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 174 | + * around the html client. |
|
| 175 | + * |
|
| 176 | + * client/html/catalog/detail/additional/property/decorators/excludes = array( 'decorator1' ) |
|
| 177 | + * |
|
| 178 | + * This would remove the decorator named "decorator1" from the list of |
|
| 179 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 180 | + * "client/html/common/decorators/default" to the html client. |
|
| 181 | + * |
|
| 182 | + * @param array List of decorator names |
|
| 183 | + * @since 2015.08 |
|
| 184 | + * @category Developer |
|
| 185 | + * @see client/html/common/decorators/default |
|
| 186 | + * @see client/html/catalog/detail/additional/property/decorators/global |
|
| 187 | + * @see client/html/catalog/detail/additional/property/decorators/local |
|
| 188 | + */ |
|
| 189 | 189 | |
| 190 | - /** client/html/catalog/detail/additional/property/decorators/global |
|
| 191 | - * Adds a list of globally available decorators only to the catalog detail additional property html client |
|
| 192 | - * |
|
| 193 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 194 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 195 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 196 | - * modify what is returned to the caller. |
|
| 197 | - * |
|
| 198 | - * This option allows you to wrap global decorators |
|
| 199 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 200 | - * |
|
| 201 | - * client/html/catalog/detail/additional/property/decorators/global = array( 'decorator1' ) |
|
| 202 | - * |
|
| 203 | - * This would add the decorator named "decorator1" defined by |
|
| 204 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 205 | - * |
|
| 206 | - * @param array List of decorator names |
|
| 207 | - * @since 2015.08 |
|
| 208 | - * @category Developer |
|
| 209 | - * @see client/html/common/decorators/default |
|
| 210 | - * @see client/html/catalog/detail/additional/property/decorators/excludes |
|
| 211 | - * @see client/html/catalog/detail/additional/property/decorators/local |
|
| 212 | - */ |
|
| 190 | + /** client/html/catalog/detail/additional/property/decorators/global |
|
| 191 | + * Adds a list of globally available decorators only to the catalog detail additional property html client |
|
| 192 | + * |
|
| 193 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 194 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 195 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 196 | + * modify what is returned to the caller. |
|
| 197 | + * |
|
| 198 | + * This option allows you to wrap global decorators |
|
| 199 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 200 | + * |
|
| 201 | + * client/html/catalog/detail/additional/property/decorators/global = array( 'decorator1' ) |
|
| 202 | + * |
|
| 203 | + * This would add the decorator named "decorator1" defined by |
|
| 204 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 205 | + * |
|
| 206 | + * @param array List of decorator names |
|
| 207 | + * @since 2015.08 |
|
| 208 | + * @category Developer |
|
| 209 | + * @see client/html/common/decorators/default |
|
| 210 | + * @see client/html/catalog/detail/additional/property/decorators/excludes |
|
| 211 | + * @see client/html/catalog/detail/additional/property/decorators/local |
|
| 212 | + */ |
|
| 213 | 213 | |
| 214 | - /** client/html/catalog/detail/additional/property/decorators/local |
|
| 215 | - * Adds a list of local decorators only to the catalog detail additional property html client |
|
| 216 | - * |
|
| 217 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 218 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 219 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 220 | - * modify what is returned to the caller. |
|
| 221 | - * |
|
| 222 | - * This option allows you to wrap local decorators |
|
| 223 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 224 | - * |
|
| 225 | - * client/html/catalog/detail/additional/property/decorators/local = array( 'decorator2' ) |
|
| 226 | - * |
|
| 227 | - * This would add the decorator named "decorator2" defined by |
|
| 228 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 229 | - * |
|
| 230 | - * @param array List of decorator names |
|
| 231 | - * @since 2015.08 |
|
| 232 | - * @category Developer |
|
| 233 | - * @see client/html/common/decorators/default |
|
| 234 | - * @see client/html/catalog/detail/additional/property/decorators/excludes |
|
| 235 | - * @see client/html/catalog/detail/additional/property/decorators/global |
|
| 236 | - */ |
|
| 214 | + /** client/html/catalog/detail/additional/property/decorators/local |
|
| 215 | + * Adds a list of local decorators only to the catalog detail additional property html client |
|
| 216 | + * |
|
| 217 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 218 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 219 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 220 | + * modify what is returned to the caller. |
|
| 221 | + * |
|
| 222 | + * This option allows you to wrap local decorators |
|
| 223 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 224 | + * |
|
| 225 | + * client/html/catalog/detail/additional/property/decorators/local = array( 'decorator2' ) |
|
| 226 | + * |
|
| 227 | + * This would add the decorator named "decorator2" defined by |
|
| 228 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 229 | + * |
|
| 230 | + * @param array List of decorator names |
|
| 231 | + * @since 2015.08 |
|
| 232 | + * @category Developer |
|
| 233 | + * @see client/html/common/decorators/default |
|
| 234 | + * @see client/html/catalog/detail/additional/property/decorators/excludes |
|
| 235 | + * @see client/html/catalog/detail/additional/property/decorators/global |
|
| 236 | + */ |
|
| 237 | 237 | |
| 238 | - return $this->createSubClient( 'catalog/detail/additional/property/' . $type, $name ); |
|
| 239 | - } |
|
| 238 | + return $this->createSubClient( 'catalog/detail/additional/property/' . $type, $name ); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Returns the list of sub-client names configured for the client. |
|
| 244 | - * |
|
| 245 | - * @return array List of HTML client names |
|
| 246 | - */ |
|
| 247 | - protected function getSubClientNames() |
|
| 248 | - { |
|
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | - } |
|
| 242 | + /** |
|
| 243 | + * Returns the list of sub-client names configured for the client. |
|
| 244 | + * |
|
| 245 | + * @return array List of HTML client names |
|
| 246 | + */ |
|
| 247 | + protected function getSubClientNames() |
|
| 248 | + { |
|
| 249 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | 252 | |
| 253 | - /** |
|
| 254 | - * Sets the necessary parameter values in the view. |
|
| 255 | - * |
|
| 256 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | - */ |
|
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | - { |
|
| 263 | - if( !isset( $this->cache ) ) |
|
| 264 | - { |
|
| 265 | - if( isset( $view->detailProductItem ) ) |
|
| 266 | - { |
|
| 267 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
| 253 | + /** |
|
| 254 | + * Sets the necessary parameter values in the view. |
|
| 255 | + * |
|
| 256 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | + */ |
|
| 261 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + { |
|
| 263 | + if( !isset( $this->cache ) ) |
|
| 264 | + { |
|
| 265 | + if( isset( $view->detailProductItem ) ) |
|
| 266 | + { |
|
| 267 | + $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
| 268 | 268 | |
| 269 | - $search = $manager->createSearch( true ); |
|
| 270 | - $expr = array( |
|
| 271 | - $search->compare( '==', 'product.property.parentid', $view->detailProductItem->getId() ), |
|
| 272 | - $search->getConditions(), |
|
| 273 | - ); |
|
| 274 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 269 | + $search = $manager->createSearch( true ); |
|
| 270 | + $expr = array( |
|
| 271 | + $search->compare( '==', 'product.property.parentid', $view->detailProductItem->getId() ), |
|
| 272 | + $search->getConditions(), |
|
| 273 | + ); |
|
| 274 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 275 | 275 | |
| 276 | - $properties = $manager->searchItems( $search ); |
|
| 276 | + $properties = $manager->searchItems( $search ); |
|
| 277 | 277 | |
| 278 | - $view->propertyItems = $properties; |
|
| 279 | - } |
|
| 278 | + $view->propertyItems = $properties; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - $this->cache = $view; |
|
| 282 | - } |
|
| 281 | + $this->cache = $view; |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - return $this->cache; |
|
| 285 | - } |
|
| 284 | + return $this->cache; |
|
| 285 | + } |
|
| 286 | 286 | } |
| 287 | 287 | \ No newline at end of file |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 70 | 70 | * @return string HTML code |
| 71 | 71 | */ |
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 73 | 73 | { |
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 75 | 75 | |
| 76 | 76 | $html = ''; |
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + foreach ($this->getSubClients() as $subclient) { |
|
| 78 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 79 | 79 | } |
| 80 | 80 | $view->propertyBody = $html; |
| 81 | 81 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/catalog/detail/additional/property/standard/template-body'; |
| 103 | 103 | $default = 'catalog/detail/additional-property-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->propertyHeader = $html; |
| 126 | 126 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $tplconf = 'client/html/catalog/detail/additional/property/standard/template-header'; |
| 149 | 149 | $default = 'catalog/detail/additional-property-header-default.php'; |
| 150 | 150 | |
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + return $view->render($view->config($tplconf, $default)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string|null $name Name of the sub-client (Default if null) |
| 160 | 160 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 161 | 161 | */ |
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 162 | + public function getSubClient($type, $name = null) |
|
| 163 | 163 | { |
| 164 | 164 | /** client/html/catalog/detail/additional/property/decorators/excludes |
| 165 | 165 | * Excludes decorators added by the "common" option from the catalog detail additional property html client |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @see client/html/catalog/detail/additional/property/decorators/global |
| 236 | 236 | */ |
| 237 | 237 | |
| 238 | - return $this->createSubClient( 'catalog/detail/additional/property/' . $type, $name ); |
|
| 238 | + return $this->createSubClient('catalog/detail/additional/property/'.$type, $name); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function getSubClientNames() |
| 248 | 248 | { |
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,22 +258,22 @@ discard block |
||
| 258 | 258 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 259 | 259 | * @return \Aimeos\MW\View\Iface Modified view object |
| 260 | 260 | */ |
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 262 | 262 | { |
| 263 | - if( !isset( $this->cache ) ) |
|
| 263 | + if (!isset($this->cache)) |
|
| 264 | 264 | { |
| 265 | - if( isset( $view->detailProductItem ) ) |
|
| 265 | + if (isset($view->detailProductItem)) |
|
| 266 | 266 | { |
| 267 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
| 267 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
| 268 | 268 | |
| 269 | - $search = $manager->createSearch( true ); |
|
| 269 | + $search = $manager->createSearch(true); |
|
| 270 | 270 | $expr = array( |
| 271 | - $search->compare( '==', 'product.property.parentid', $view->detailProductItem->getId() ), |
|
| 271 | + $search->compare('==', 'product.property.parentid', $view->detailProductItem->getId()), |
|
| 272 | 272 | $search->getConditions(), |
| 273 | 273 | ); |
| 274 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 274 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 275 | 275 | |
| 276 | - $properties = $manager->searchItems( $search ); |
|
| 276 | + $properties = $manager->searchItems($search); |
|
| 277 | 277 | |
| 278 | 278 | $view->propertyItems = $properties; |
| 279 | 279 | } |