@@ -19,296 +19,296 @@ |
||
| 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/session/seen/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog session seen 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/session/seen/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 61 | - |
|
| 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 | - $context = $this->getContext(); |
|
| 74 | - $session = $context->getSession(); |
|
| 75 | - |
|
| 76 | - /** client/html/catalog/session/seen |
|
| 77 | - * All parameters defined for the catalog session seen subpart |
|
| 78 | - * |
|
| 79 | - * This returns all settings related to the catalog session seen subpart. |
|
| 80 | - * Please refer to the single settings for details. |
|
| 81 | - * |
|
| 82 | - * @param array Associative list of name/value settings |
|
| 83 | - * @category Developer |
|
| 84 | - * @see client/html/catalog#session |
|
| 85 | - */ |
|
| 86 | - $config = $context->getConfig()->get( 'client/html/catalog/session/seen', array() ); |
|
| 87 | - $key = $this->getParamHash( array(), $uid . ':catalog:session-seen-body', $config ); |
|
| 88 | - |
|
| 89 | - if( ( $html = $session->get( $key ) ) === null ) |
|
| 90 | - { |
|
| 91 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 92 | - |
|
| 93 | - $output = ''; |
|
| 94 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 95 | - $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 96 | - } |
|
| 97 | - $view->seenBody = $output; |
|
| 98 | - |
|
| 99 | - /** client/html/catalog/session/seen/standard/template-body |
|
| 100 | - * Relative path to the HTML body template of the catalog session seen client. |
|
| 101 | - * |
|
| 102 | - * The template file contains the HTML code and processing instructions |
|
| 103 | - * to generate the result shown in the body of the frontend. The |
|
| 104 | - * configuration string is the path to the template file relative |
|
| 105 | - * to the templates directory (usually in client/html/templates). |
|
| 106 | - * |
|
| 107 | - * You can overwrite the template file configuration in extensions and |
|
| 108 | - * provide alternative templates. These alternative templates should be |
|
| 109 | - * named like the default one but with the string "standard" replaced by |
|
| 110 | - * an unique name. You may use the name of your project for this. If |
|
| 111 | - * you've implemented an alternative client class as well, "standard" |
|
| 112 | - * should be replaced by the name of the new class. |
|
| 113 | - * |
|
| 114 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 115 | - * @since 2014.03 |
|
| 116 | - * @category Developer |
|
| 117 | - * @see client/html/catalog/session/seen/standard/template-header |
|
| 118 | - */ |
|
| 119 | - $tplconf = 'client/html/catalog/session/seen/standard/template-body'; |
|
| 120 | - $default = 'catalog/session/seen-body-default.php'; |
|
| 121 | - |
|
| 122 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 123 | - |
|
| 124 | - $cached = $session->get( 'aimeos/catalog/session/seen/cache', array() ) + array( $key => true ); |
|
| 125 | - $session->set( 'aimeos/catalog/session/seen/cache', $cached ); |
|
| 126 | - $session->set( $key, $html ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - return $html; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * Returns the HTML string for insertion into the header. |
|
| 135 | - * |
|
| 136 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 137 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 138 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 139 | - * @return string|null String including HTML tags for the header on error |
|
| 140 | - */ |
|
| 141 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 142 | - { |
|
| 143 | - $context = $this->getContext(); |
|
| 144 | - $session = $context->getSession(); |
|
| 145 | - |
|
| 146 | - $config = $context->getConfig()->get( 'client/html/catalog/session/seen', array() ); |
|
| 147 | - $key = $this->getParamHash( array(), $uid . ':catalog:session-seen-header', $config ); |
|
| 148 | - |
|
| 149 | - if( ( $html = $session->get( $key ) ) === null ) |
|
| 150 | - { |
|
| 151 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 152 | - |
|
| 153 | - $output = ''; |
|
| 154 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 155 | - $output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 156 | - } |
|
| 157 | - $view->seenHeader = $output; |
|
| 158 | - |
|
| 159 | - /** client/html/catalog/session/seen/standard/template-header |
|
| 160 | - * Relative path to the HTML header template of the catalog session seen client. |
|
| 161 | - * |
|
| 162 | - * The template file contains the HTML code and processing instructions |
|
| 163 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 164 | - * of the rendered page in the frontend. The configuration string is the |
|
| 165 | - * path to the template file relative to the templates directory (usually |
|
| 166 | - * in client/html/templates). |
|
| 167 | - * |
|
| 168 | - * You can overwrite the template file configuration in extensions and |
|
| 169 | - * provide alternative templates. These alternative templates should be |
|
| 170 | - * named like the default one but with the string "standard" replaced by |
|
| 171 | - * an unique name. You may use the name of your project for this. If |
|
| 172 | - * you've implemented an alternative client class as well, "standard" |
|
| 173 | - * should be replaced by the name of the new class. |
|
| 174 | - * |
|
| 175 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 176 | - * @since 2014.03 |
|
| 177 | - * @category Developer |
|
| 178 | - * @see client/html/catalog/session/seen/standard/template-body |
|
| 179 | - */ |
|
| 180 | - $tplconf = 'client/html/catalog/session/seen/standard/template-header'; |
|
| 181 | - $default = 'catalog/session/seen-header-default.php'; |
|
| 182 | - |
|
| 183 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 184 | - |
|
| 185 | - $cached = $session->get( 'aimeos/catalog/session/seen/cache', array() ) + array( $key => true ); |
|
| 186 | - $session->set( 'aimeos/catalog/session/seen/cache', $cached ); |
|
| 187 | - $session->set( $key, $html ); |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - return $html; |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Returns the sub-client given by its name. |
|
| 196 | - * |
|
| 197 | - * @param string $type Name of the client type |
|
| 198 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 199 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 200 | - */ |
|
| 201 | - public function getSubClient( $type, $name = null ) |
|
| 202 | - { |
|
| 203 | - /** client/html/catalog/session/seen/decorators/excludes |
|
| 204 | - * Excludes decorators added by the "common" option from the catalog session seen html client |
|
| 205 | - * |
|
| 206 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 207 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 208 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 209 | - * modify what is returned to the caller. |
|
| 210 | - * |
|
| 211 | - * This option allows you to remove a decorator added via |
|
| 212 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 213 | - * around the html client. |
|
| 214 | - * |
|
| 215 | - * client/html/catalog/session/seen/decorators/excludes = array( 'decorator1' ) |
|
| 216 | - * |
|
| 217 | - * This would remove the decorator named "decorator1" from the list of |
|
| 218 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 219 | - * "client/html/common/decorators/default" to the html client. |
|
| 220 | - * |
|
| 221 | - * @param array List of decorator names |
|
| 222 | - * @since 2015.08 |
|
| 223 | - * @category Developer |
|
| 224 | - * @see client/html/common/decorators/default |
|
| 225 | - * @see client/html/catalog/session/seen/decorators/global |
|
| 226 | - * @see client/html/catalog/session/seen/decorators/local |
|
| 227 | - */ |
|
| 228 | - |
|
| 229 | - /** client/html/catalog/session/seen/decorators/global |
|
| 230 | - * Adds a list of globally available decorators only to the catalog session seen html client |
|
| 231 | - * |
|
| 232 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 233 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 234 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 235 | - * modify what is returned to the caller. |
|
| 236 | - * |
|
| 237 | - * This option allows you to wrap global decorators |
|
| 238 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 239 | - * |
|
| 240 | - * client/html/catalog/session/seen/decorators/global = array( 'decorator1' ) |
|
| 241 | - * |
|
| 242 | - * This would add the decorator named "decorator1" defined by |
|
| 243 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 244 | - * |
|
| 245 | - * @param array List of decorator names |
|
| 246 | - * @since 2015.08 |
|
| 247 | - * @category Developer |
|
| 248 | - * @see client/html/common/decorators/default |
|
| 249 | - * @see client/html/catalog/session/seen/decorators/excludes |
|
| 250 | - * @see client/html/catalog/session/seen/decorators/local |
|
| 251 | - */ |
|
| 252 | - |
|
| 253 | - /** client/html/catalog/session/seen/decorators/local |
|
| 254 | - * Adds a list of local decorators only to the catalog session seen html client |
|
| 255 | - * |
|
| 256 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 257 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 258 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 259 | - * modify what is returned to the caller. |
|
| 260 | - * |
|
| 261 | - * This option allows you to wrap local decorators |
|
| 262 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 263 | - * |
|
| 264 | - * client/html/catalog/session/seen/decorators/local = array( 'decorator2' ) |
|
| 265 | - * |
|
| 266 | - * This would add the decorator named "decorator2" defined by |
|
| 267 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 268 | - * |
|
| 269 | - * @param array List of decorator names |
|
| 270 | - * @since 2015.08 |
|
| 271 | - * @category Developer |
|
| 272 | - * @see client/html/common/decorators/default |
|
| 273 | - * @see client/html/catalog/session/seen/decorators/excludes |
|
| 274 | - * @see client/html/catalog/session/seen/decorators/global |
|
| 275 | - */ |
|
| 276 | - |
|
| 277 | - return $this->createSubClient( 'catalog/session/seen/' . $type, $name ); |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - |
|
| 281 | - /** |
|
| 282 | - * Returns the list of sub-client names configured for the client. |
|
| 283 | - * |
|
| 284 | - * @return array List of HTML client names |
|
| 285 | - */ |
|
| 286 | - protected function getSubClientNames() |
|
| 287 | - { |
|
| 288 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * Sets the necessary parameter values in the view. |
|
| 294 | - * |
|
| 295 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 296 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 297 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 298 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 299 | - */ |
|
| 300 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 301 | - { |
|
| 302 | - if( !isset( $this->cache ) ) |
|
| 303 | - { |
|
| 304 | - $session = $this->getContext()->getSession(); |
|
| 305 | - $lastSeen = $session->get( 'aimeos/catalog/session/seen/list', array() ); |
|
| 306 | - |
|
| 307 | - $view->seenItems = array_reverse( $lastSeen ); |
|
| 308 | - |
|
| 309 | - $this->cache = $view; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - return $this->cache; |
|
| 313 | - } |
|
| 25 | + /** client/html/catalog/session/seen/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog session seen 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/session/seen/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | + |
|
| 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 | + $context = $this->getContext(); |
|
| 74 | + $session = $context->getSession(); |
|
| 75 | + |
|
| 76 | + /** client/html/catalog/session/seen |
|
| 77 | + * All parameters defined for the catalog session seen subpart |
|
| 78 | + * |
|
| 79 | + * This returns all settings related to the catalog session seen subpart. |
|
| 80 | + * Please refer to the single settings for details. |
|
| 81 | + * |
|
| 82 | + * @param array Associative list of name/value settings |
|
| 83 | + * @category Developer |
|
| 84 | + * @see client/html/catalog#session |
|
| 85 | + */ |
|
| 86 | + $config = $context->getConfig()->get( 'client/html/catalog/session/seen', array() ); |
|
| 87 | + $key = $this->getParamHash( array(), $uid . ':catalog:session-seen-body', $config ); |
|
| 88 | + |
|
| 89 | + if( ( $html = $session->get( $key ) ) === null ) |
|
| 90 | + { |
|
| 91 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 92 | + |
|
| 93 | + $output = ''; |
|
| 94 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 95 | + $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 96 | + } |
|
| 97 | + $view->seenBody = $output; |
|
| 98 | + |
|
| 99 | + /** client/html/catalog/session/seen/standard/template-body |
|
| 100 | + * Relative path to the HTML body template of the catalog session seen client. |
|
| 101 | + * |
|
| 102 | + * The template file contains the HTML code and processing instructions |
|
| 103 | + * to generate the result shown in the body of the frontend. The |
|
| 104 | + * configuration string is the path to the template file relative |
|
| 105 | + * to the templates directory (usually in client/html/templates). |
|
| 106 | + * |
|
| 107 | + * You can overwrite the template file configuration in extensions and |
|
| 108 | + * provide alternative templates. These alternative templates should be |
|
| 109 | + * named like the default one but with the string "standard" replaced by |
|
| 110 | + * an unique name. You may use the name of your project for this. If |
|
| 111 | + * you've implemented an alternative client class as well, "standard" |
|
| 112 | + * should be replaced by the name of the new class. |
|
| 113 | + * |
|
| 114 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 115 | + * @since 2014.03 |
|
| 116 | + * @category Developer |
|
| 117 | + * @see client/html/catalog/session/seen/standard/template-header |
|
| 118 | + */ |
|
| 119 | + $tplconf = 'client/html/catalog/session/seen/standard/template-body'; |
|
| 120 | + $default = 'catalog/session/seen-body-default.php'; |
|
| 121 | + |
|
| 122 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 123 | + |
|
| 124 | + $cached = $session->get( 'aimeos/catalog/session/seen/cache', array() ) + array( $key => true ); |
|
| 125 | + $session->set( 'aimeos/catalog/session/seen/cache', $cached ); |
|
| 126 | + $session->set( $key, $html ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + return $html; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * Returns the HTML string for insertion into the header. |
|
| 135 | + * |
|
| 136 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 137 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 138 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 139 | + * @return string|null String including HTML tags for the header on error |
|
| 140 | + */ |
|
| 141 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 142 | + { |
|
| 143 | + $context = $this->getContext(); |
|
| 144 | + $session = $context->getSession(); |
|
| 145 | + |
|
| 146 | + $config = $context->getConfig()->get( 'client/html/catalog/session/seen', array() ); |
|
| 147 | + $key = $this->getParamHash( array(), $uid . ':catalog:session-seen-header', $config ); |
|
| 148 | + |
|
| 149 | + if( ( $html = $session->get( $key ) ) === null ) |
|
| 150 | + { |
|
| 151 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 152 | + |
|
| 153 | + $output = ''; |
|
| 154 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 155 | + $output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 156 | + } |
|
| 157 | + $view->seenHeader = $output; |
|
| 158 | + |
|
| 159 | + /** client/html/catalog/session/seen/standard/template-header |
|
| 160 | + * Relative path to the HTML header template of the catalog session seen client. |
|
| 161 | + * |
|
| 162 | + * The template file contains the HTML code and processing instructions |
|
| 163 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 164 | + * of the rendered page in the frontend. The configuration string is the |
|
| 165 | + * path to the template file relative to the templates directory (usually |
|
| 166 | + * in client/html/templates). |
|
| 167 | + * |
|
| 168 | + * You can overwrite the template file configuration in extensions and |
|
| 169 | + * provide alternative templates. These alternative templates should be |
|
| 170 | + * named like the default one but with the string "standard" replaced by |
|
| 171 | + * an unique name. You may use the name of your project for this. If |
|
| 172 | + * you've implemented an alternative client class as well, "standard" |
|
| 173 | + * should be replaced by the name of the new class. |
|
| 174 | + * |
|
| 175 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 176 | + * @since 2014.03 |
|
| 177 | + * @category Developer |
|
| 178 | + * @see client/html/catalog/session/seen/standard/template-body |
|
| 179 | + */ |
|
| 180 | + $tplconf = 'client/html/catalog/session/seen/standard/template-header'; |
|
| 181 | + $default = 'catalog/session/seen-header-default.php'; |
|
| 182 | + |
|
| 183 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 184 | + |
|
| 185 | + $cached = $session->get( 'aimeos/catalog/session/seen/cache', array() ) + array( $key => true ); |
|
| 186 | + $session->set( 'aimeos/catalog/session/seen/cache', $cached ); |
|
| 187 | + $session->set( $key, $html ); |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + return $html; |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Returns the sub-client given by its name. |
|
| 196 | + * |
|
| 197 | + * @param string $type Name of the client type |
|
| 198 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 199 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 200 | + */ |
|
| 201 | + public function getSubClient( $type, $name = null ) |
|
| 202 | + { |
|
| 203 | + /** client/html/catalog/session/seen/decorators/excludes |
|
| 204 | + * Excludes decorators added by the "common" option from the catalog session seen html client |
|
| 205 | + * |
|
| 206 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 207 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 208 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 209 | + * modify what is returned to the caller. |
|
| 210 | + * |
|
| 211 | + * This option allows you to remove a decorator added via |
|
| 212 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 213 | + * around the html client. |
|
| 214 | + * |
|
| 215 | + * client/html/catalog/session/seen/decorators/excludes = array( 'decorator1' ) |
|
| 216 | + * |
|
| 217 | + * This would remove the decorator named "decorator1" from the list of |
|
| 218 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 219 | + * "client/html/common/decorators/default" to the html client. |
|
| 220 | + * |
|
| 221 | + * @param array List of decorator names |
|
| 222 | + * @since 2015.08 |
|
| 223 | + * @category Developer |
|
| 224 | + * @see client/html/common/decorators/default |
|
| 225 | + * @see client/html/catalog/session/seen/decorators/global |
|
| 226 | + * @see client/html/catalog/session/seen/decorators/local |
|
| 227 | + */ |
|
| 228 | + |
|
| 229 | + /** client/html/catalog/session/seen/decorators/global |
|
| 230 | + * Adds a list of globally available decorators only to the catalog session seen html client |
|
| 231 | + * |
|
| 232 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 233 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 234 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 235 | + * modify what is returned to the caller. |
|
| 236 | + * |
|
| 237 | + * This option allows you to wrap global decorators |
|
| 238 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 239 | + * |
|
| 240 | + * client/html/catalog/session/seen/decorators/global = array( 'decorator1' ) |
|
| 241 | + * |
|
| 242 | + * This would add the decorator named "decorator1" defined by |
|
| 243 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 244 | + * |
|
| 245 | + * @param array List of decorator names |
|
| 246 | + * @since 2015.08 |
|
| 247 | + * @category Developer |
|
| 248 | + * @see client/html/common/decorators/default |
|
| 249 | + * @see client/html/catalog/session/seen/decorators/excludes |
|
| 250 | + * @see client/html/catalog/session/seen/decorators/local |
|
| 251 | + */ |
|
| 252 | + |
|
| 253 | + /** client/html/catalog/session/seen/decorators/local |
|
| 254 | + * Adds a list of local decorators only to the catalog session seen html client |
|
| 255 | + * |
|
| 256 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 257 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 258 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 259 | + * modify what is returned to the caller. |
|
| 260 | + * |
|
| 261 | + * This option allows you to wrap local decorators |
|
| 262 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 263 | + * |
|
| 264 | + * client/html/catalog/session/seen/decorators/local = array( 'decorator2' ) |
|
| 265 | + * |
|
| 266 | + * This would add the decorator named "decorator2" defined by |
|
| 267 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 268 | + * |
|
| 269 | + * @param array List of decorator names |
|
| 270 | + * @since 2015.08 |
|
| 271 | + * @category Developer |
|
| 272 | + * @see client/html/common/decorators/default |
|
| 273 | + * @see client/html/catalog/session/seen/decorators/excludes |
|
| 274 | + * @see client/html/catalog/session/seen/decorators/global |
|
| 275 | + */ |
|
| 276 | + |
|
| 277 | + return $this->createSubClient( 'catalog/session/seen/' . $type, $name ); |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + |
|
| 281 | + /** |
|
| 282 | + * Returns the list of sub-client names configured for the client. |
|
| 283 | + * |
|
| 284 | + * @return array List of HTML client names |
|
| 285 | + */ |
|
| 286 | + protected function getSubClientNames() |
|
| 287 | + { |
|
| 288 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * Sets the necessary parameter values in the view. |
|
| 294 | + * |
|
| 295 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 296 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 297 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 298 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 299 | + */ |
|
| 300 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 301 | + { |
|
| 302 | + if( !isset( $this->cache ) ) |
|
| 303 | + { |
|
| 304 | + $session = $this->getContext()->getSession(); |
|
| 305 | + $lastSeen = $session->get( 'aimeos/catalog/session/seen/list', array() ); |
|
| 306 | + |
|
| 307 | + $view->seenItems = array_reverse( $lastSeen ); |
|
| 308 | + |
|
| 309 | + $this->cache = $view; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + return $this->cache; |
|
| 313 | + } |
|
| 314 | 314 | } |
| 315 | 315 | \ No newline at end of file |
@@ -68,7 +68,7 @@ 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 | 73 | $context = $this->getContext(); |
| 74 | 74 | $session = $context->getSession(); |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | * @category Developer |
| 84 | 84 | * @see client/html/catalog#session |
| 85 | 85 | */ |
| 86 | - $config = $context->getConfig()->get( 'client/html/catalog/session/seen', array() ); |
|
| 87 | - $key = $this->getParamHash( array(), $uid . ':catalog:session-seen-body', $config ); |
|
| 86 | + $config = $context->getConfig()->get('client/html/catalog/session/seen', array()); |
|
| 87 | + $key = $this->getParamHash(array(), $uid.':catalog:session-seen-body', $config); |
|
| 88 | 88 | |
| 89 | - if( ( $html = $session->get( $key ) ) === null ) |
|
| 89 | + if (($html = $session->get($key)) === null) |
|
| 90 | 90 | { |
| 91 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 91 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 92 | 92 | |
| 93 | 93 | $output = ''; |
| 94 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 95 | - $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 94 | + foreach ($this->getSubClients() as $subclient) { |
|
| 95 | + $output .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 96 | 96 | } |
| 97 | 97 | $view->seenBody = $output; |
| 98 | 98 | |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | $tplconf = 'client/html/catalog/session/seen/standard/template-body'; |
| 120 | 120 | $default = 'catalog/session/seen-body-default.php'; |
| 121 | 121 | |
| 122 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 122 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 123 | 123 | |
| 124 | - $cached = $session->get( 'aimeos/catalog/session/seen/cache', array() ) + array( $key => true ); |
|
| 125 | - $session->set( 'aimeos/catalog/session/seen/cache', $cached ); |
|
| 126 | - $session->set( $key, $html ); |
|
| 124 | + $cached = $session->get('aimeos/catalog/session/seen/cache', array()) + array($key => true); |
|
| 125 | + $session->set('aimeos/catalog/session/seen/cache', $cached); |
|
| 126 | + $session->set($key, $html); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $html; |
@@ -138,21 +138,21 @@ discard block |
||
| 138 | 138 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 139 | 139 | * @return string|null String including HTML tags for the header on error |
| 140 | 140 | */ |
| 141 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 141 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 142 | 142 | { |
| 143 | 143 | $context = $this->getContext(); |
| 144 | 144 | $session = $context->getSession(); |
| 145 | 145 | |
| 146 | - $config = $context->getConfig()->get( 'client/html/catalog/session/seen', array() ); |
|
| 147 | - $key = $this->getParamHash( array(), $uid . ':catalog:session-seen-header', $config ); |
|
| 146 | + $config = $context->getConfig()->get('client/html/catalog/session/seen', array()); |
|
| 147 | + $key = $this->getParamHash(array(), $uid.':catalog:session-seen-header', $config); |
|
| 148 | 148 | |
| 149 | - if( ( $html = $session->get( $key ) ) === null ) |
|
| 149 | + if (($html = $session->get($key)) === null) |
|
| 150 | 150 | { |
| 151 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 151 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 152 | 152 | |
| 153 | 153 | $output = ''; |
| 154 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 155 | - $output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 154 | + foreach ($this->getSubClients() as $subclient) { |
|
| 155 | + $output .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 156 | 156 | } |
| 157 | 157 | $view->seenHeader = $output; |
| 158 | 158 | |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | $tplconf = 'client/html/catalog/session/seen/standard/template-header'; |
| 181 | 181 | $default = 'catalog/session/seen-header-default.php'; |
| 182 | 182 | |
| 183 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 183 | + $html = $view->render($view->config($tplconf, $default)); |
|
| 184 | 184 | |
| 185 | - $cached = $session->get( 'aimeos/catalog/session/seen/cache', array() ) + array( $key => true ); |
|
| 186 | - $session->set( 'aimeos/catalog/session/seen/cache', $cached ); |
|
| 187 | - $session->set( $key, $html ); |
|
| 185 | + $cached = $session->get('aimeos/catalog/session/seen/cache', array()) + array($key => true); |
|
| 186 | + $session->set('aimeos/catalog/session/seen/cache', $cached); |
|
| 187 | + $session->set($key, $html); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | return $html; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param string|null $name Name of the sub-client (Default if null) |
| 199 | 199 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 200 | 200 | */ |
| 201 | - public function getSubClient( $type, $name = null ) |
|
| 201 | + public function getSubClient($type, $name = null) |
|
| 202 | 202 | { |
| 203 | 203 | /** client/html/catalog/session/seen/decorators/excludes |
| 204 | 204 | * Excludes decorators added by the "common" option from the catalog session seen html client |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * @see client/html/catalog/session/seen/decorators/global |
| 275 | 275 | */ |
| 276 | 276 | |
| 277 | - return $this->createSubClient( 'catalog/session/seen/' . $type, $name ); |
|
| 277 | + return $this->createSubClient('catalog/session/seen/'.$type, $name); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | protected function getSubClientNames() |
| 287 | 287 | { |
| 288 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 288 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 298 | 298 | * @return \Aimeos\MW\View\Iface Modified view object |
| 299 | 299 | */ |
| 300 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 300 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 301 | 301 | { |
| 302 | - if( !isset( $this->cache ) ) |
|
| 302 | + if (!isset($this->cache)) |
|
| 303 | 303 | { |
| 304 | 304 | $session = $this->getContext()->getSession(); |
| 305 | - $lastSeen = $session->get( 'aimeos/catalog/session/seen/list', array() ); |
|
| 305 | + $lastSeen = $session->get('aimeos/catalog/session/seen/list', array()); |
|
| 306 | 306 | |
| 307 | - $view->seenItems = array_reverse( $lastSeen ); |
|
| 307 | + $view->seenItems = array_reverse($lastSeen); |
|
| 308 | 308 | |
| 309 | 309 | $this->cache = $view; |
| 310 | 310 | } |
@@ -19,69 +19,69 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Factory |
| 22 | - extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Creates a stock client object. |
|
| 27 | - * |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | - * @param array $templatePaths Stock of file system paths where the templates are stored |
|
| 30 | - * @param string|null $name Client name (default: "Standard") |
|
| 31 | - * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | - * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | - */ |
|
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | - { |
|
| 36 | - /** client/html/catalog/stock/name |
|
| 37 | - * Class name of the used catalog stock client implementation |
|
| 38 | - * |
|
| 39 | - * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | - * To use this implementation, you have to set the last part of the class |
|
| 41 | - * name as configuration value so the client factory knows which class it |
|
| 42 | - * has to instantiate. |
|
| 43 | - * |
|
| 44 | - * For example, if the name of the default class is |
|
| 45 | - * |
|
| 46 | - * \Aimeos\Client\Html\Catalog\Stock\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Catalog\Stock\Mystock |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/catalog/stock/name = Mystock |
|
| 55 | - * |
|
| 56 | - * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | - * so take care that the configuration value is exactly named like the last |
|
| 58 | - * part of the class name. |
|
| 59 | - * |
|
| 60 | - * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | - * characters are possible! You should always start the last part of the class |
|
| 62 | - * name with an upper case character and continue only with lower case characters |
|
| 63 | - * or numbers. Avoid chamel case names like "MyStock"! |
|
| 64 | - * |
|
| 65 | - * @param string Last part of the class name |
|
| 66 | - * @since 2014.03 |
|
| 67 | - * @category Developer |
|
| 68 | - */ |
|
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/stock/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a stock client object. |
|
| 27 | + * |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | + * @param array $templatePaths Stock of file system paths where the templates are stored |
|
| 30 | + * @param string|null $name Client name (default: "Standard") |
|
| 31 | + * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | + * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | + */ |
|
| 34 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | + { |
|
| 36 | + /** client/html/catalog/stock/name |
|
| 37 | + * Class name of the used catalog stock client implementation |
|
| 38 | + * |
|
| 39 | + * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | + * To use this implementation, you have to set the last part of the class |
|
| 41 | + * name as configuration value so the client factory knows which class it |
|
| 42 | + * has to instantiate. |
|
| 43 | + * |
|
| 44 | + * For example, if the name of the default class is |
|
| 45 | + * |
|
| 46 | + * \Aimeos\Client\Html\Catalog\Stock\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Catalog\Stock\Mystock |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/catalog/stock/name = Mystock |
|
| 55 | + * |
|
| 56 | + * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | + * so take care that the configuration value is exactly named like the last |
|
| 58 | + * part of the class name. |
|
| 59 | + * |
|
| 60 | + * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | + * characters are possible! You should always start the last part of the class |
|
| 62 | + * name with an upper case character and continue only with lower case characters |
|
| 63 | + * or numbers. Avoid chamel case names like "MyStock"! |
|
| 64 | + * |
|
| 65 | + * @param string Last part of the class name |
|
| 66 | + * @since 2014.03 |
|
| 67 | + * @category Developer |
|
| 68 | + */ |
|
| 69 | + if( $name === null ) { |
|
| 70 | + $name = $context->getConfig()->get( 'client/html/catalog/stock/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Stock\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | - } |
|
| 73 | + if( ctype_alnum( $name ) === false ) |
|
| 74 | + { |
|
| 75 | + $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Stock\\' . $name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Stock\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Stock\\' . $name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/stock' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/stock' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
| 32 | 32 | * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
| 33 | 33 | */ |
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 34 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
| 35 | 35 | { |
| 36 | 36 | /** client/html/catalog/stock/name |
| 37 | 37 | * Class name of the used catalog stock client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/stock/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/catalog/stock/name', 'Standard'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 73 | + if (ctype_alnum($name) === false) |
|
| 74 | 74 | { |
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Stock\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 75 | + $classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Catalog\\Stock\\'.$name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $iface = '\\Aimeos\\Client\\Html\\Iface'; |
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Stock\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Stock\\'.$name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase($context, $classname, $iface, $templatePaths); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/stock' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'catalog/stock'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -19,358 +19,358 @@ |
||
| 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/stock/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog stock 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/stock/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 61 | - |
|
| 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 | - try |
|
| 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->stockBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/stock/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog stock 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/stock/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/stock/standard/template-body'; |
|
| 104 | - $default = 'catalog/stock/body-default.php'; |
|
| 105 | - |
|
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | - } |
|
| 108 | - catch( \Exception $e ) |
|
| 109 | - { |
|
| 110 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Returns the HTML string for insertion into the header. |
|
| 117 | - * |
|
| 118 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 119 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 120 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 121 | - * @return string|null String including HTML tags for the header on error |
|
| 122 | - */ |
|
| 123 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 124 | - { |
|
| 125 | - try |
|
| 126 | - { |
|
| 127 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 128 | - |
|
| 129 | - $html = ''; |
|
| 130 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 131 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 132 | - } |
|
| 133 | - $view->stockHeader = $html; |
|
| 134 | - |
|
| 135 | - /** client/html/catalog/stock/standard/template-header |
|
| 136 | - * Relative path to the HTML header template of the catalog stock client. |
|
| 137 | - * |
|
| 138 | - * The template file contains the HTML code and processing instructions |
|
| 139 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 140 | - * of the rendered page in the frontend. The configuration string is the |
|
| 141 | - * path to the template file relative to the templates directory (usually |
|
| 142 | - * in client/html/templates). |
|
| 143 | - * |
|
| 144 | - * You can overwrite the template file configuration in extensions and |
|
| 145 | - * provide alternative templates. These alternative templates should be |
|
| 146 | - * named like the default one but with the string "standard" replaced by |
|
| 147 | - * an unique name. You may use the name of your project for this. If |
|
| 148 | - * you've implemented an alternative client class as well, "standard" |
|
| 149 | - * should be replaced by the name of the new class. |
|
| 150 | - * |
|
| 151 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 152 | - * @since 2014.03 |
|
| 153 | - * @category Developer |
|
| 154 | - * @see client/html/catalog/stock/standard/template-body |
|
| 155 | - */ |
|
| 156 | - $tplconf = 'client/html/catalog/stock/standard/template-header'; |
|
| 157 | - $default = 'catalog/stock/header-default.php'; |
|
| 158 | - |
|
| 159 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 160 | - } |
|
| 161 | - catch( \Exception $e ) |
|
| 162 | - { |
|
| 163 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Returns the sub-client given by its name. |
|
| 170 | - * |
|
| 171 | - * @param string $type Name of the client type |
|
| 172 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 173 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 174 | - */ |
|
| 175 | - public function getSubClient( $type, $name = null ) |
|
| 176 | - { |
|
| 177 | - /** client/html/catalog/stock/decorators/excludes |
|
| 178 | - * Excludes decorators added by the "common" option from the catalog stock html client |
|
| 179 | - * |
|
| 180 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 181 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 182 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 183 | - * modify what is returned to the caller. |
|
| 184 | - * |
|
| 185 | - * This option allows you to remove a decorator added via |
|
| 186 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 187 | - * around the html client. |
|
| 188 | - * |
|
| 189 | - * client/html/catalog/stock/decorators/excludes = array( 'decorator1' ) |
|
| 190 | - * |
|
| 191 | - * This would remove the decorator named "decorator1" from the list of |
|
| 192 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 193 | - * "client/html/common/decorators/default" to the html client. |
|
| 194 | - * |
|
| 195 | - * @param array List of decorator names |
|
| 196 | - * @since 2014.05 |
|
| 197 | - * @category Developer |
|
| 198 | - * @see client/html/common/decorators/default |
|
| 199 | - * @see client/html/catalog/stock/decorators/global |
|
| 200 | - * @see client/html/catalog/stock/decorators/local |
|
| 201 | - */ |
|
| 202 | - |
|
| 203 | - /** client/html/catalog/stock/decorators/global |
|
| 204 | - * Adds a list of globally available decorators only to the catalog stock html client |
|
| 205 | - * |
|
| 206 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 207 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 208 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 209 | - * modify what is returned to the caller. |
|
| 210 | - * |
|
| 211 | - * This option allows you to wrap global decorators |
|
| 212 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 213 | - * |
|
| 214 | - * client/html/catalog/stock/decorators/global = array( 'decorator1' ) |
|
| 215 | - * |
|
| 216 | - * This would add the decorator named "decorator1" defined by |
|
| 217 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 218 | - * |
|
| 219 | - * @param array List of decorator names |
|
| 220 | - * @since 2014.05 |
|
| 221 | - * @category Developer |
|
| 222 | - * @see client/html/common/decorators/default |
|
| 223 | - * @see client/html/catalog/stock/decorators/excludes |
|
| 224 | - * @see client/html/catalog/stock/decorators/local |
|
| 225 | - */ |
|
| 226 | - |
|
| 227 | - /** client/html/catalog/stock/decorators/local |
|
| 228 | - * Adds a list of local decorators only to the catalog stock html client |
|
| 229 | - * |
|
| 230 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 231 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 232 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 233 | - * modify what is returned to the caller. |
|
| 234 | - * |
|
| 235 | - * This option allows you to wrap local decorators |
|
| 236 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 237 | - * |
|
| 238 | - * client/html/catalog/stock/decorators/local = array( 'decorator2' ) |
|
| 239 | - * |
|
| 240 | - * This would add the decorator named "decorator2" defined by |
|
| 241 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 242 | - * |
|
| 243 | - * @param array List of decorator names |
|
| 244 | - * @since 2014.05 |
|
| 245 | - * @category Developer |
|
| 246 | - * @see client/html/common/decorators/default |
|
| 247 | - * @see client/html/catalog/stock/decorators/excludes |
|
| 248 | - * @see client/html/catalog/stock/decorators/global |
|
| 249 | - */ |
|
| 250 | - |
|
| 251 | - return $this->createSubClient( 'catalog/stock/' . $type, $name ); |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - |
|
| 255 | - /** |
|
| 256 | - * Processes the input, e.g. store given values. |
|
| 257 | - * A view must be available and this method doesn't generate any output |
|
| 258 | - * besides setting view variables. |
|
| 259 | - */ |
|
| 260 | - public function process() |
|
| 261 | - { |
|
| 262 | - try |
|
| 263 | - { |
|
| 264 | - parent::process(); |
|
| 265 | - } |
|
| 266 | - catch( \Exception $e ) |
|
| 267 | - { |
|
| 268 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 269 | - } |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - |
|
| 273 | - /** |
|
| 274 | - * Returns the list of sub-client names configured for the client. |
|
| 275 | - * |
|
| 276 | - * @return array List of HTML client names |
|
| 277 | - */ |
|
| 278 | - protected function getSubClientNames() |
|
| 279 | - { |
|
| 280 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * Sets the necessary parameter values in the view. |
|
| 286 | - * |
|
| 287 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 288 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 289 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 290 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 291 | - */ |
|
| 292 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 293 | - { |
|
| 294 | - if( !isset( $this->cache ) ) |
|
| 295 | - { |
|
| 296 | - $context = $this->getContext(); |
|
| 297 | - $siteConfig = $context->getLocale()->getSite()->getConfig(); |
|
| 298 | - |
|
| 299 | - /** client/html/catalog/stock/sort |
|
| 300 | - * Sortation key if stock levels for different warehouses exist |
|
| 301 | - * |
|
| 302 | - * Products can be shipped from several warehouses with a different |
|
| 303 | - * stock level for each one. The stock levels for each warehouse will |
|
| 304 | - * be shown in the product detail page. To get a consistent sortation |
|
| 305 | - * of this list, the configured key of the product warehouse manager |
|
| 306 | - * will be used. |
|
| 307 | - * |
|
| 308 | - * @param string Key for sorting |
|
| 309 | - * @since 2014.03 |
|
| 310 | - * @category Developer |
|
| 311 | - * @see client/html/catalog/stock/level/low |
|
| 312 | - */ |
|
| 313 | - $sortkey = $context->getConfig()->get( 'client/html/catalog/stock/sort', 'product.stock.warehouseid' ); |
|
| 314 | - $productIds = $view->param( 's_prodid' ); |
|
| 315 | - |
|
| 316 | - if( !is_array( $productIds ) ) { |
|
| 317 | - $productIds = explode( ' ', $productIds ); |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - |
|
| 321 | - $stockManager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock' ); |
|
| 322 | - |
|
| 323 | - $search = $stockManager->createSearch( true ); |
|
| 324 | - $expr = array( $search->compare( '==', 'product.stock.parentid', $productIds ) ); |
|
| 325 | - |
|
| 326 | - if( isset( $siteConfig['warehouse'] ) ) { |
|
| 327 | - $expr[] = $search->compare( '==', 'product.stock.warehouse.code', $siteConfig['warehouse'] ); |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - $expr[] = $search->getConditions(); |
|
| 331 | - |
|
| 332 | - $sortations = array( |
|
| 333 | - $search->sort( '+', 'product.stock.parentid' ), |
|
| 334 | - $search->sort( '+', $sortkey ), |
|
| 335 | - ); |
|
| 336 | - |
|
| 337 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 338 | - $search->setSortations( $sortations ); |
|
| 339 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 340 | - |
|
| 341 | - $stockItems = $stockManager->searchItems( $search ); |
|
| 342 | - |
|
| 343 | - |
|
| 344 | - if( !empty( $stockItems ) ) |
|
| 345 | - { |
|
| 346 | - $warehouseIds = $stockItemsByProducts = array(); |
|
| 347 | - |
|
| 348 | - foreach( $stockItems as $item ) |
|
| 349 | - { |
|
| 350 | - $warehouseIds[$item->getWarehouseId()] = null; |
|
| 351 | - $stockItemsByProducts[$item->getParentId()][] = $item; |
|
| 352 | - } |
|
| 353 | - |
|
| 354 | - $warehouseIds = array_keys( $warehouseIds ); |
|
| 355 | - |
|
| 356 | - |
|
| 357 | - $warehouseManager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock/warehouse' ); |
|
| 358 | - |
|
| 359 | - $search = $warehouseManager->createSearch(); |
|
| 360 | - $search->setConditions( $search->compare( '==', 'product.stock.warehouse.id', $warehouseIds ) ); |
|
| 361 | - $search->setSlice( 0, count( $warehouseIds ) ); |
|
| 362 | - |
|
| 363 | - |
|
| 364 | - $view->stockWarehouseItems = $warehouseManager->searchItems( $search ); |
|
| 365 | - $view->stockItemsByProducts = $stockItemsByProducts; |
|
| 366 | - } |
|
| 25 | + /** client/html/catalog/stock/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog stock 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/stock/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | + |
|
| 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 | + try |
|
| 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->stockBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/stock/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog stock 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/stock/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/stock/standard/template-body'; |
|
| 104 | + $default = 'catalog/stock/body-default.php'; |
|
| 105 | + |
|
| 106 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | + } |
|
| 108 | + catch( \Exception $e ) |
|
| 109 | + { |
|
| 110 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Returns the HTML string for insertion into the header. |
|
| 117 | + * |
|
| 118 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 119 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 120 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 121 | + * @return string|null String including HTML tags for the header on error |
|
| 122 | + */ |
|
| 123 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 124 | + { |
|
| 125 | + try |
|
| 126 | + { |
|
| 127 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 128 | + |
|
| 129 | + $html = ''; |
|
| 130 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 131 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 132 | + } |
|
| 133 | + $view->stockHeader = $html; |
|
| 134 | + |
|
| 135 | + /** client/html/catalog/stock/standard/template-header |
|
| 136 | + * Relative path to the HTML header template of the catalog stock client. |
|
| 137 | + * |
|
| 138 | + * The template file contains the HTML code and processing instructions |
|
| 139 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 140 | + * of the rendered page in the frontend. The configuration string is the |
|
| 141 | + * path to the template file relative to the templates directory (usually |
|
| 142 | + * in client/html/templates). |
|
| 143 | + * |
|
| 144 | + * You can overwrite the template file configuration in extensions and |
|
| 145 | + * provide alternative templates. These alternative templates should be |
|
| 146 | + * named like the default one but with the string "standard" replaced by |
|
| 147 | + * an unique name. You may use the name of your project for this. If |
|
| 148 | + * you've implemented an alternative client class as well, "standard" |
|
| 149 | + * should be replaced by the name of the new class. |
|
| 150 | + * |
|
| 151 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 152 | + * @since 2014.03 |
|
| 153 | + * @category Developer |
|
| 154 | + * @see client/html/catalog/stock/standard/template-body |
|
| 155 | + */ |
|
| 156 | + $tplconf = 'client/html/catalog/stock/standard/template-header'; |
|
| 157 | + $default = 'catalog/stock/header-default.php'; |
|
| 158 | + |
|
| 159 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 160 | + } |
|
| 161 | + catch( \Exception $e ) |
|
| 162 | + { |
|
| 163 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Returns the sub-client given by its name. |
|
| 170 | + * |
|
| 171 | + * @param string $type Name of the client type |
|
| 172 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 173 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 174 | + */ |
|
| 175 | + public function getSubClient( $type, $name = null ) |
|
| 176 | + { |
|
| 177 | + /** client/html/catalog/stock/decorators/excludes |
|
| 178 | + * Excludes decorators added by the "common" option from the catalog stock html client |
|
| 179 | + * |
|
| 180 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 181 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 182 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 183 | + * modify what is returned to the caller. |
|
| 184 | + * |
|
| 185 | + * This option allows you to remove a decorator added via |
|
| 186 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 187 | + * around the html client. |
|
| 188 | + * |
|
| 189 | + * client/html/catalog/stock/decorators/excludes = array( 'decorator1' ) |
|
| 190 | + * |
|
| 191 | + * This would remove the decorator named "decorator1" from the list of |
|
| 192 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 193 | + * "client/html/common/decorators/default" to the html client. |
|
| 194 | + * |
|
| 195 | + * @param array List of decorator names |
|
| 196 | + * @since 2014.05 |
|
| 197 | + * @category Developer |
|
| 198 | + * @see client/html/common/decorators/default |
|
| 199 | + * @see client/html/catalog/stock/decorators/global |
|
| 200 | + * @see client/html/catalog/stock/decorators/local |
|
| 201 | + */ |
|
| 202 | + |
|
| 203 | + /** client/html/catalog/stock/decorators/global |
|
| 204 | + * Adds a list of globally available decorators only to the catalog stock html client |
|
| 205 | + * |
|
| 206 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 207 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 208 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 209 | + * modify what is returned to the caller. |
|
| 210 | + * |
|
| 211 | + * This option allows you to wrap global decorators |
|
| 212 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 213 | + * |
|
| 214 | + * client/html/catalog/stock/decorators/global = array( 'decorator1' ) |
|
| 215 | + * |
|
| 216 | + * This would add the decorator named "decorator1" defined by |
|
| 217 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 218 | + * |
|
| 219 | + * @param array List of decorator names |
|
| 220 | + * @since 2014.05 |
|
| 221 | + * @category Developer |
|
| 222 | + * @see client/html/common/decorators/default |
|
| 223 | + * @see client/html/catalog/stock/decorators/excludes |
|
| 224 | + * @see client/html/catalog/stock/decorators/local |
|
| 225 | + */ |
|
| 226 | + |
|
| 227 | + /** client/html/catalog/stock/decorators/local |
|
| 228 | + * Adds a list of local decorators only to the catalog stock html client |
|
| 229 | + * |
|
| 230 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 231 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 232 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 233 | + * modify what is returned to the caller. |
|
| 234 | + * |
|
| 235 | + * This option allows you to wrap local decorators |
|
| 236 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 237 | + * |
|
| 238 | + * client/html/catalog/stock/decorators/local = array( 'decorator2' ) |
|
| 239 | + * |
|
| 240 | + * This would add the decorator named "decorator2" defined by |
|
| 241 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 242 | + * |
|
| 243 | + * @param array List of decorator names |
|
| 244 | + * @since 2014.05 |
|
| 245 | + * @category Developer |
|
| 246 | + * @see client/html/common/decorators/default |
|
| 247 | + * @see client/html/catalog/stock/decorators/excludes |
|
| 248 | + * @see client/html/catalog/stock/decorators/global |
|
| 249 | + */ |
|
| 250 | + |
|
| 251 | + return $this->createSubClient( 'catalog/stock/' . $type, $name ); |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * Processes the input, e.g. store given values. |
|
| 257 | + * A view must be available and this method doesn't generate any output |
|
| 258 | + * besides setting view variables. |
|
| 259 | + */ |
|
| 260 | + public function process() |
|
| 261 | + { |
|
| 262 | + try |
|
| 263 | + { |
|
| 264 | + parent::process(); |
|
| 265 | + } |
|
| 266 | + catch( \Exception $e ) |
|
| 267 | + { |
|
| 268 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + |
|
| 273 | + /** |
|
| 274 | + * Returns the list of sub-client names configured for the client. |
|
| 275 | + * |
|
| 276 | + * @return array List of HTML client names |
|
| 277 | + */ |
|
| 278 | + protected function getSubClientNames() |
|
| 279 | + { |
|
| 280 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * Sets the necessary parameter values in the view. |
|
| 286 | + * |
|
| 287 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 288 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 289 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 290 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 291 | + */ |
|
| 292 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 293 | + { |
|
| 294 | + if( !isset( $this->cache ) ) |
|
| 295 | + { |
|
| 296 | + $context = $this->getContext(); |
|
| 297 | + $siteConfig = $context->getLocale()->getSite()->getConfig(); |
|
| 298 | + |
|
| 299 | + /** client/html/catalog/stock/sort |
|
| 300 | + * Sortation key if stock levels for different warehouses exist |
|
| 301 | + * |
|
| 302 | + * Products can be shipped from several warehouses with a different |
|
| 303 | + * stock level for each one. The stock levels for each warehouse will |
|
| 304 | + * be shown in the product detail page. To get a consistent sortation |
|
| 305 | + * of this list, the configured key of the product warehouse manager |
|
| 306 | + * will be used. |
|
| 307 | + * |
|
| 308 | + * @param string Key for sorting |
|
| 309 | + * @since 2014.03 |
|
| 310 | + * @category Developer |
|
| 311 | + * @see client/html/catalog/stock/level/low |
|
| 312 | + */ |
|
| 313 | + $sortkey = $context->getConfig()->get( 'client/html/catalog/stock/sort', 'product.stock.warehouseid' ); |
|
| 314 | + $productIds = $view->param( 's_prodid' ); |
|
| 315 | + |
|
| 316 | + if( !is_array( $productIds ) ) { |
|
| 317 | + $productIds = explode( ' ', $productIds ); |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + |
|
| 321 | + $stockManager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock' ); |
|
| 322 | + |
|
| 323 | + $search = $stockManager->createSearch( true ); |
|
| 324 | + $expr = array( $search->compare( '==', 'product.stock.parentid', $productIds ) ); |
|
| 325 | + |
|
| 326 | + if( isset( $siteConfig['warehouse'] ) ) { |
|
| 327 | + $expr[] = $search->compare( '==', 'product.stock.warehouse.code', $siteConfig['warehouse'] ); |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + $expr[] = $search->getConditions(); |
|
| 331 | + |
|
| 332 | + $sortations = array( |
|
| 333 | + $search->sort( '+', 'product.stock.parentid' ), |
|
| 334 | + $search->sort( '+', $sortkey ), |
|
| 335 | + ); |
|
| 336 | + |
|
| 337 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 338 | + $search->setSortations( $sortations ); |
|
| 339 | + $search->setSlice( 0, 0x7fffffff ); |
|
| 340 | + |
|
| 341 | + $stockItems = $stockManager->searchItems( $search ); |
|
| 342 | + |
|
| 343 | + |
|
| 344 | + if( !empty( $stockItems ) ) |
|
| 345 | + { |
|
| 346 | + $warehouseIds = $stockItemsByProducts = array(); |
|
| 347 | + |
|
| 348 | + foreach( $stockItems as $item ) |
|
| 349 | + { |
|
| 350 | + $warehouseIds[$item->getWarehouseId()] = null; |
|
| 351 | + $stockItemsByProducts[$item->getParentId()][] = $item; |
|
| 352 | + } |
|
| 353 | + |
|
| 354 | + $warehouseIds = array_keys( $warehouseIds ); |
|
| 355 | + |
|
| 356 | + |
|
| 357 | + $warehouseManager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock/warehouse' ); |
|
| 358 | + |
|
| 359 | + $search = $warehouseManager->createSearch(); |
|
| 360 | + $search->setConditions( $search->compare( '==', 'product.stock.warehouse.id', $warehouseIds ) ); |
|
| 361 | + $search->setSlice( 0, count( $warehouseIds ) ); |
|
| 362 | + |
|
| 363 | + |
|
| 364 | + $view->stockWarehouseItems = $warehouseManager->searchItems( $search ); |
|
| 365 | + $view->stockItemsByProducts = $stockItemsByProducts; |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | 368 | |
| 369 | - $view->stockProductIds = $productIds; |
|
| 369 | + $view->stockProductIds = $productIds; |
|
| 370 | 370 | |
| 371 | - $this->cache = $view; |
|
| 372 | - } |
|
| 371 | + $this->cache = $view; |
|
| 372 | + } |
|
| 373 | 373 | |
| 374 | - return $this->cache; |
|
| 375 | - } |
|
| 374 | + return $this->cache; |
|
| 375 | + } |
|
| 376 | 376 | } |
@@ -68,15 +68,15 @@ 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 | 73 | try |
| 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->stockBody = $html; |
| 82 | 82 | |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/stock/standard/template-body'; |
| 104 | 104 | $default = 'catalog/stock/body-default.php'; |
| 105 | 105 | |
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + return $view->render($view->config($tplconf, $default)); |
|
| 107 | 107 | } |
| 108 | - catch( \Exception $e ) |
|
| 108 | + catch (\Exception $e) |
|
| 109 | 109 | { |
| 110 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 110 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 121 | 121 | * @return string|null String including HTML tags for the header on error |
| 122 | 122 | */ |
| 123 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 123 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 124 | 124 | { |
| 125 | 125 | try |
| 126 | 126 | { |
| 127 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 127 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 128 | 128 | |
| 129 | 129 | $html = ''; |
| 130 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 131 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 130 | + foreach ($this->getSubClients() as $subclient) { |
|
| 131 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 132 | 132 | } |
| 133 | 133 | $view->stockHeader = $html; |
| 134 | 134 | |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | $tplconf = 'client/html/catalog/stock/standard/template-header'; |
| 157 | 157 | $default = 'catalog/stock/header-default.php'; |
| 158 | 158 | |
| 159 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 159 | + return $view->render($view->config($tplconf, $default)); |
|
| 160 | 160 | } |
| 161 | - catch( \Exception $e ) |
|
| 161 | + catch (\Exception $e) |
|
| 162 | 162 | { |
| 163 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 163 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param string|null $name Name of the sub-client (Default if null) |
| 173 | 173 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 174 | 174 | */ |
| 175 | - public function getSubClient( $type, $name = null ) |
|
| 175 | + public function getSubClient($type, $name = null) |
|
| 176 | 176 | { |
| 177 | 177 | /** client/html/catalog/stock/decorators/excludes |
| 178 | 178 | * Excludes decorators added by the "common" option from the catalog stock html client |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @see client/html/catalog/stock/decorators/global |
| 249 | 249 | */ |
| 250 | 250 | |
| 251 | - return $this->createSubClient( 'catalog/stock/' . $type, $name ); |
|
| 251 | + return $this->createSubClient('catalog/stock/'.$type, $name); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | { |
| 264 | 264 | parent::process(); |
| 265 | 265 | } |
| 266 | - catch( \Exception $e ) |
|
| 266 | + catch (\Exception $e) |
|
| 267 | 267 | { |
| 268 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 268 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | protected function getSubClientNames() |
| 279 | 279 | { |
| 280 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 280 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 290 | 290 | * @return \Aimeos\MW\View\Iface Modified view object |
| 291 | 291 | */ |
| 292 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 292 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 293 | 293 | { |
| 294 | - if( !isset( $this->cache ) ) |
|
| 294 | + if (!isset($this->cache)) |
|
| 295 | 295 | { |
| 296 | 296 | $context = $this->getContext(); |
| 297 | 297 | $siteConfig = $context->getLocale()->getSite()->getConfig(); |
@@ -310,58 +310,58 @@ discard block |
||
| 310 | 310 | * @category Developer |
| 311 | 311 | * @see client/html/catalog/stock/level/low |
| 312 | 312 | */ |
| 313 | - $sortkey = $context->getConfig()->get( 'client/html/catalog/stock/sort', 'product.stock.warehouseid' ); |
|
| 314 | - $productIds = $view->param( 's_prodid' ); |
|
| 313 | + $sortkey = $context->getConfig()->get('client/html/catalog/stock/sort', 'product.stock.warehouseid'); |
|
| 314 | + $productIds = $view->param('s_prodid'); |
|
| 315 | 315 | |
| 316 | - if( !is_array( $productIds ) ) { |
|
| 317 | - $productIds = explode( ' ', $productIds ); |
|
| 316 | + if (!is_array($productIds)) { |
|
| 317 | + $productIds = explode(' ', $productIds); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | |
| 321 | - $stockManager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock' ); |
|
| 321 | + $stockManager = \Aimeos\MShop\Factory::createManager($context, 'product/stock'); |
|
| 322 | 322 | |
| 323 | - $search = $stockManager->createSearch( true ); |
|
| 324 | - $expr = array( $search->compare( '==', 'product.stock.parentid', $productIds ) ); |
|
| 323 | + $search = $stockManager->createSearch(true); |
|
| 324 | + $expr = array($search->compare('==', 'product.stock.parentid', $productIds)); |
|
| 325 | 325 | |
| 326 | - if( isset( $siteConfig['warehouse'] ) ) { |
|
| 327 | - $expr[] = $search->compare( '==', 'product.stock.warehouse.code', $siteConfig['warehouse'] ); |
|
| 326 | + if (isset($siteConfig['warehouse'])) { |
|
| 327 | + $expr[] = $search->compare('==', 'product.stock.warehouse.code', $siteConfig['warehouse']); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $expr[] = $search->getConditions(); |
| 331 | 331 | |
| 332 | 332 | $sortations = array( |
| 333 | - $search->sort( '+', 'product.stock.parentid' ), |
|
| 334 | - $search->sort( '+', $sortkey ), |
|
| 333 | + $search->sort('+', 'product.stock.parentid'), |
|
| 334 | + $search->sort('+', $sortkey), |
|
| 335 | 335 | ); |
| 336 | 336 | |
| 337 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 338 | - $search->setSortations( $sortations ); |
|
| 339 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 337 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 338 | + $search->setSortations($sortations); |
|
| 339 | + $search->setSlice(0, 0x7fffffff); |
|
| 340 | 340 | |
| 341 | - $stockItems = $stockManager->searchItems( $search ); |
|
| 341 | + $stockItems = $stockManager->searchItems($search); |
|
| 342 | 342 | |
| 343 | 343 | |
| 344 | - if( !empty( $stockItems ) ) |
|
| 344 | + if (!empty($stockItems)) |
|
| 345 | 345 | { |
| 346 | 346 | $warehouseIds = $stockItemsByProducts = array(); |
| 347 | 347 | |
| 348 | - foreach( $stockItems as $item ) |
|
| 348 | + foreach ($stockItems as $item) |
|
| 349 | 349 | { |
| 350 | 350 | $warehouseIds[$item->getWarehouseId()] = null; |
| 351 | 351 | $stockItemsByProducts[$item->getParentId()][] = $item; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - $warehouseIds = array_keys( $warehouseIds ); |
|
| 354 | + $warehouseIds = array_keys($warehouseIds); |
|
| 355 | 355 | |
| 356 | 356 | |
| 357 | - $warehouseManager = \Aimeos\MShop\Factory::createManager( $context, 'product/stock/warehouse' ); |
|
| 357 | + $warehouseManager = \Aimeos\MShop\Factory::createManager($context, 'product/stock/warehouse'); |
|
| 358 | 358 | |
| 359 | 359 | $search = $warehouseManager->createSearch(); |
| 360 | - $search->setConditions( $search->compare( '==', 'product.stock.warehouse.id', $warehouseIds ) ); |
|
| 361 | - $search->setSlice( 0, count( $warehouseIds ) ); |
|
| 360 | + $search->setConditions($search->compare('==', 'product.stock.warehouse.id', $warehouseIds)); |
|
| 361 | + $search->setSlice(0, count($warehouseIds)); |
|
| 362 | 362 | |
| 363 | 363 | |
| 364 | - $view->stockWarehouseItems = $warehouseManager->searchItems( $search ); |
|
| 364 | + $view->stockWarehouseItems = $warehouseManager->searchItems($search); |
|
| 365 | 365 | $view->stockItemsByProducts = $stockItemsByProducts; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 84 | 84 | } |
| 85 | 85 | $view->suggestBody = $html; |
| 86 | - } |
|
| 87 | - catch( \Exception $e ) |
|
| 86 | + } catch( \Exception $e ) |
|
| 88 | 87 | { |
| 89 | 88 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 90 | 89 | return; |
@@ -139,8 +138,7 @@ discard block |
||
| 139 | 138 | $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
| 140 | 139 | } |
| 141 | 140 | $view->suggestHeader = $html; |
| 142 | - } |
|
| 143 | - catch( \Exception $e ) |
|
| 141 | + } catch( \Exception $e ) |
|
| 144 | 142 | { |
| 145 | 143 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 146 | 144 | return; |
@@ -274,8 +272,7 @@ discard block |
||
| 274 | 272 | try |
| 275 | 273 | { |
| 276 | 274 | parent::process(); |
| 277 | - } |
|
| 278 | - catch( \Exception $e ) |
|
| 275 | + } catch( \Exception $e ) |
|
| 279 | 276 | { |
| 280 | 277 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 281 | 278 | } |
@@ -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; |
@@ -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,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; |
@@ -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,70 +19,70 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Factory |
| 22 | - extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Creates a catalog count client object. |
|
| 27 | - * |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | - * @param string|null $name Client name (default: "Standard") |
|
| 31 | - * @return \Aimeos\Client\Html\Iface Count part implementing \Aimeos\Client\Html\Iface |
|
| 32 | - * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | - */ |
|
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | - { |
|
| 36 | - /** client/html/catalog/count/name |
|
| 37 | - * Class name of the used catalog count client implementation |
|
| 38 | - * |
|
| 39 | - * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | - * To use this implementation, you have to set the last part of the class |
|
| 41 | - * name as configuration value so the client factory knows which class it |
|
| 42 | - * has to instantiate. |
|
| 43 | - * |
|
| 44 | - * For example, if the name of the default class is |
|
| 45 | - * |
|
| 46 | - * \Aimeos\Client\Html\Catalog\Count\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Catalog\Count\Mycount |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/catalog/count/name = Mycount |
|
| 55 | - * |
|
| 56 | - * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | - * so take care that the configuration value is exactly named like the last |
|
| 58 | - * part of the class name. |
|
| 59 | - * |
|
| 60 | - * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | - * characters are possible! You should always start the last part of the class |
|
| 62 | - * name with an upper case character and continue only with lower case characters |
|
| 63 | - * or numbers. Avoid chamel case names like "MyCount"! |
|
| 64 | - * |
|
| 65 | - * @param string Last part of the class name |
|
| 66 | - * @since 2014.03 |
|
| 67 | - * @category Developer |
|
| 68 | - */ |
|
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/count/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a catalog count client object. |
|
| 27 | + * |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | + * @param string|null $name Client name (default: "Standard") |
|
| 31 | + * @return \Aimeos\Client\Html\Iface Count part implementing \Aimeos\Client\Html\Iface |
|
| 32 | + * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | + */ |
|
| 34 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | + { |
|
| 36 | + /** client/html/catalog/count/name |
|
| 37 | + * Class name of the used catalog count client implementation |
|
| 38 | + * |
|
| 39 | + * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | + * To use this implementation, you have to set the last part of the class |
|
| 41 | + * name as configuration value so the client factory knows which class it |
|
| 42 | + * has to instantiate. |
|
| 43 | + * |
|
| 44 | + * For example, if the name of the default class is |
|
| 45 | + * |
|
| 46 | + * \Aimeos\Client\Html\Catalog\Count\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Catalog\Count\Mycount |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/catalog/count/name = Mycount |
|
| 55 | + * |
|
| 56 | + * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | + * so take care that the configuration value is exactly named like the last |
|
| 58 | + * part of the class name. |
|
| 59 | + * |
|
| 60 | + * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | + * characters are possible! You should always start the last part of the class |
|
| 62 | + * name with an upper case character and continue only with lower case characters |
|
| 63 | + * or numbers. Avoid chamel case names like "MyCount"! |
|
| 64 | + * |
|
| 65 | + * @param string Last part of the class name |
|
| 66 | + * @since 2014.03 |
|
| 67 | + * @category Developer |
|
| 68 | + */ |
|
| 69 | + if( $name === null ) { |
|
| 70 | + $name = $context->getConfig()->get( 'client/html/catalog/count/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Count\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | - } |
|
| 73 | + if( ctype_alnum( $name ) === false ) |
|
| 74 | + { |
|
| 75 | + $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Count\\' . $name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Count\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Count\\' . $name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/count' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/count' ); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | } |
| 88 | 88 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return \Aimeos\Client\Html\Iface Count part implementing \Aimeos\Client\Html\Iface |
| 32 | 32 | * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
| 33 | 33 | */ |
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 34 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
| 35 | 35 | { |
| 36 | 36 | /** client/html/catalog/count/name |
| 37 | 37 | * Class name of the used catalog count client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/count/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/catalog/count/name', 'Standard'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 73 | + if (ctype_alnum($name) === false) |
|
| 74 | 74 | { |
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Count\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 75 | + $classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Catalog\\Count\\'.$name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $iface = '\\Aimeos\\Client\\Html\\Iface'; |
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Count\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Count\\'.$name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase($context, $classname, $iface, $templatePaths); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/count' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'catalog/count'); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | } |
@@ -19,285 +19,285 @@ |
||
| 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/count/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog count 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/standard/subparts'; |
|
| 25 | + /** client/html/catalog/count/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog count 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/standard/subparts'; |
|
| 59 | 59 | |
| 60 | - /** client/html/catalog/count/tree/name |
|
| 61 | - * Name of the tree part used by the catalog count client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Tree\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 | - */ |
|
| 60 | + /** client/html/catalog/count/tree/name |
|
| 61 | + * Name of the tree part used by the catalog count client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Tree\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 | 70 | |
| 71 | - /** client/html/catalog/count/attribute/name |
|
| 72 | - * Name of the attribute part used by the catalog count client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Attribute\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( 'tree', 'attribute' ); |
|
| 71 | + /** client/html/catalog/count/attribute/name |
|
| 72 | + * Name of the attribute part used by the catalog count client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Attribute\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( 'tree', 'attribute' ); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Returns the HTML code for insertion into the body. |
|
| 86 | - * |
|
| 87 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 88 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 89 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 90 | - * @return string HTML code |
|
| 91 | - */ |
|
| 92 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 93 | - { |
|
| 94 | - try |
|
| 95 | - { |
|
| 96 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 84 | + /** |
|
| 85 | + * Returns the HTML code for insertion into the body. |
|
| 86 | + * |
|
| 87 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 88 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 89 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 90 | + * @return string HTML code |
|
| 91 | + */ |
|
| 92 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 93 | + { |
|
| 94 | + try |
|
| 95 | + { |
|
| 96 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 97 | 97 | |
| 98 | - $html = ''; |
|
| 99 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 100 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 101 | - } |
|
| 102 | - $view->countBody = $html; |
|
| 98 | + $html = ''; |
|
| 99 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 100 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 101 | + } |
|
| 102 | + $view->countBody = $html; |
|
| 103 | 103 | |
| 104 | - /** client/html/catalog/count/standard/template-body |
|
| 105 | - * Relative path to the HTML body template of the catalog count client. |
|
| 106 | - * |
|
| 107 | - * The template file contains the HTML code and processing instructions |
|
| 108 | - * to generate the result shown in the body of the frontend. The |
|
| 109 | - * configuration string is the path to the template file relative |
|
| 110 | - * to the templates directory (usually in client/html/templates). |
|
| 111 | - * |
|
| 112 | - * You can overwrite the template file configuration in extensions and |
|
| 113 | - * provide alternative templates. These alternative templates should be |
|
| 114 | - * named like the default one but with the string "standard" replaced by |
|
| 115 | - * an unique name. You may use the name of your project for this. If |
|
| 116 | - * you've implemented an alternative client class as well, "standard" |
|
| 117 | - * should be replaced by the name of the new class. |
|
| 118 | - * |
|
| 119 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 120 | - * @since 2014.03 |
|
| 121 | - * @category Developer |
|
| 122 | - * @see client/html/catalog/count/standard/template-header |
|
| 123 | - */ |
|
| 124 | - $tplconf = 'client/html/catalog/count/standard/template-body'; |
|
| 125 | - $default = 'catalog/count/body-default.php'; |
|
| 104 | + /** client/html/catalog/count/standard/template-body |
|
| 105 | + * Relative path to the HTML body template of the catalog count client. |
|
| 106 | + * |
|
| 107 | + * The template file contains the HTML code and processing instructions |
|
| 108 | + * to generate the result shown in the body of the frontend. The |
|
| 109 | + * configuration string is the path to the template file relative |
|
| 110 | + * to the templates directory (usually in client/html/templates). |
|
| 111 | + * |
|
| 112 | + * You can overwrite the template file configuration in extensions and |
|
| 113 | + * provide alternative templates. These alternative templates should be |
|
| 114 | + * named like the default one but with the string "standard" replaced by |
|
| 115 | + * an unique name. You may use the name of your project for this. If |
|
| 116 | + * you've implemented an alternative client class as well, "standard" |
|
| 117 | + * should be replaced by the name of the new class. |
|
| 118 | + * |
|
| 119 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 120 | + * @since 2014.03 |
|
| 121 | + * @category Developer |
|
| 122 | + * @see client/html/catalog/count/standard/template-header |
|
| 123 | + */ |
|
| 124 | + $tplconf = 'client/html/catalog/count/standard/template-body'; |
|
| 125 | + $default = 'catalog/count/body-default.php'; |
|
| 126 | 126 | |
| 127 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 128 | - } |
|
| 129 | - catch( \Exception $e ) |
|
| 130 | - { |
|
| 131 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 132 | - } |
|
| 133 | - } |
|
| 127 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 128 | + } |
|
| 129 | + catch( \Exception $e ) |
|
| 130 | + { |
|
| 131 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Returns the HTML string for insertion into the header. |
|
| 138 | - * |
|
| 139 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 140 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 141 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 142 | - * @return string|null String including HTML tags for the header on error |
|
| 143 | - */ |
|
| 144 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 145 | - { |
|
| 146 | - try |
|
| 147 | - { |
|
| 148 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 136 | + /** |
|
| 137 | + * Returns the HTML string for insertion into the header. |
|
| 138 | + * |
|
| 139 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 140 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 141 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 142 | + * @return string|null String including HTML tags for the header on error |
|
| 143 | + */ |
|
| 144 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 145 | + { |
|
| 146 | + try |
|
| 147 | + { |
|
| 148 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 149 | 149 | |
| 150 | - $html = ''; |
|
| 151 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 152 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 153 | - } |
|
| 154 | - $view->countHeader = $html; |
|
| 150 | + $html = ''; |
|
| 151 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 152 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 153 | + } |
|
| 154 | + $view->countHeader = $html; |
|
| 155 | 155 | |
| 156 | - /** client/html/catalog/count/standard/template-header |
|
| 157 | - * Relative path to the HTML header template of the catalog count client. |
|
| 158 | - * |
|
| 159 | - * The template file contains the HTML code and processing instructions |
|
| 160 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 161 | - * of the rendered page in the frontend. The configuration string is the |
|
| 162 | - * path to the template file relative to the templates directory (usually |
|
| 163 | - * in client/html/templates). |
|
| 164 | - * |
|
| 165 | - * You can overwrite the template file configuration in extensions and |
|
| 166 | - * provide alternative templates. These alternative templates should be |
|
| 167 | - * named like the default one but with the string "standard" replaced by |
|
| 168 | - * an unique name. You may use the name of your project for this. If |
|
| 169 | - * you've implemented an alternative client class as well, "standard" |
|
| 170 | - * should be replaced by the name of the new class. |
|
| 171 | - * |
|
| 172 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 173 | - * @since 2014.03 |
|
| 174 | - * @category Developer |
|
| 175 | - * @see client/html/catalog/count/standard/template-body |
|
| 176 | - */ |
|
| 177 | - $tplconf = 'client/html/catalog/count/standard/template-header'; |
|
| 178 | - $default = 'catalog/count/header-default.php'; |
|
| 156 | + /** client/html/catalog/count/standard/template-header |
|
| 157 | + * Relative path to the HTML header template of the catalog count client. |
|
| 158 | + * |
|
| 159 | + * The template file contains the HTML code and processing instructions |
|
| 160 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 161 | + * of the rendered page in the frontend. The configuration string is the |
|
| 162 | + * path to the template file relative to the templates directory (usually |
|
| 163 | + * in client/html/templates). |
|
| 164 | + * |
|
| 165 | + * You can overwrite the template file configuration in extensions and |
|
| 166 | + * provide alternative templates. These alternative templates should be |
|
| 167 | + * named like the default one but with the string "standard" replaced by |
|
| 168 | + * an unique name. You may use the name of your project for this. If |
|
| 169 | + * you've implemented an alternative client class as well, "standard" |
|
| 170 | + * should be replaced by the name of the new class. |
|
| 171 | + * |
|
| 172 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 173 | + * @since 2014.03 |
|
| 174 | + * @category Developer |
|
| 175 | + * @see client/html/catalog/count/standard/template-body |
|
| 176 | + */ |
|
| 177 | + $tplconf = 'client/html/catalog/count/standard/template-header'; |
|
| 178 | + $default = 'catalog/count/header-default.php'; |
|
| 179 | 179 | |
| 180 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 181 | - } |
|
| 182 | - catch( \Exception $e ) |
|
| 183 | - { |
|
| 184 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 185 | - } |
|
| 186 | - } |
|
| 180 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 181 | + } |
|
| 182 | + catch( \Exception $e ) |
|
| 183 | + { |
|
| 184 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 185 | + } |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | - /** |
|
| 190 | - * Returns the sub-client given by its name. |
|
| 191 | - * |
|
| 192 | - * @param string $type Name of the client type |
|
| 193 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 194 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 195 | - */ |
|
| 196 | - public function getSubClient( $type, $name = null ) |
|
| 197 | - { |
|
| 198 | - /** client/html/catalog/count/decorators/excludes |
|
| 199 | - * Excludes decorators added by the "common" option from the catalog count html client |
|
| 200 | - * |
|
| 201 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 202 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 203 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 204 | - * modify what is returned to the caller. |
|
| 205 | - * |
|
| 206 | - * This option allows you to remove a decorator added via |
|
| 207 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 208 | - * around the html client. |
|
| 209 | - * |
|
| 210 | - * client/html/catalog/count/decorators/excludes = array( 'decorator1' ) |
|
| 211 | - * |
|
| 212 | - * This would remove the decorator named "decorator1" from the list of |
|
| 213 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 214 | - * "client/html/common/decorators/default" to the html client. |
|
| 215 | - * |
|
| 216 | - * @param array List of decorator names |
|
| 217 | - * @since 2014.05 |
|
| 218 | - * @category Developer |
|
| 219 | - * @see client/html/common/decorators/default |
|
| 220 | - * @see client/html/catalog/count/decorators/global |
|
| 221 | - * @see client/html/catalog/count/decorators/local |
|
| 222 | - */ |
|
| 189 | + /** |
|
| 190 | + * Returns the sub-client given by its name. |
|
| 191 | + * |
|
| 192 | + * @param string $type Name of the client type |
|
| 193 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 194 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 195 | + */ |
|
| 196 | + public function getSubClient( $type, $name = null ) |
|
| 197 | + { |
|
| 198 | + /** client/html/catalog/count/decorators/excludes |
|
| 199 | + * Excludes decorators added by the "common" option from the catalog count html client |
|
| 200 | + * |
|
| 201 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 202 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 203 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 204 | + * modify what is returned to the caller. |
|
| 205 | + * |
|
| 206 | + * This option allows you to remove a decorator added via |
|
| 207 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 208 | + * around the html client. |
|
| 209 | + * |
|
| 210 | + * client/html/catalog/count/decorators/excludes = array( 'decorator1' ) |
|
| 211 | + * |
|
| 212 | + * This would remove the decorator named "decorator1" from the list of |
|
| 213 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 214 | + * "client/html/common/decorators/default" to the html client. |
|
| 215 | + * |
|
| 216 | + * @param array List of decorator names |
|
| 217 | + * @since 2014.05 |
|
| 218 | + * @category Developer |
|
| 219 | + * @see client/html/common/decorators/default |
|
| 220 | + * @see client/html/catalog/count/decorators/global |
|
| 221 | + * @see client/html/catalog/count/decorators/local |
|
| 222 | + */ |
|
| 223 | 223 | |
| 224 | - /** client/html/catalog/count/decorators/global |
|
| 225 | - * Adds a list of globally available decorators only to the catalog count html client |
|
| 226 | - * |
|
| 227 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 228 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 229 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 230 | - * modify what is returned to the caller. |
|
| 231 | - * |
|
| 232 | - * This option allows you to wrap global decorators |
|
| 233 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 234 | - * |
|
| 235 | - * client/html/catalog/count/decorators/global = array( 'decorator1' ) |
|
| 236 | - * |
|
| 237 | - * This would add the decorator named "decorator1" defined by |
|
| 238 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 239 | - * |
|
| 240 | - * @param array List of decorator names |
|
| 241 | - * @since 2014.05 |
|
| 242 | - * @category Developer |
|
| 243 | - * @see client/html/common/decorators/default |
|
| 244 | - * @see client/html/catalog/count/decorators/excludes |
|
| 245 | - * @see client/html/catalog/count/decorators/local |
|
| 246 | - */ |
|
| 224 | + /** client/html/catalog/count/decorators/global |
|
| 225 | + * Adds a list of globally available decorators only to the catalog count html client |
|
| 226 | + * |
|
| 227 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 228 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 229 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 230 | + * modify what is returned to the caller. |
|
| 231 | + * |
|
| 232 | + * This option allows you to wrap global decorators |
|
| 233 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 234 | + * |
|
| 235 | + * client/html/catalog/count/decorators/global = array( 'decorator1' ) |
|
| 236 | + * |
|
| 237 | + * This would add the decorator named "decorator1" defined by |
|
| 238 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 239 | + * |
|
| 240 | + * @param array List of decorator names |
|
| 241 | + * @since 2014.05 |
|
| 242 | + * @category Developer |
|
| 243 | + * @see client/html/common/decorators/default |
|
| 244 | + * @see client/html/catalog/count/decorators/excludes |
|
| 245 | + * @see client/html/catalog/count/decorators/local |
|
| 246 | + */ |
|
| 247 | 247 | |
| 248 | - /** client/html/catalog/count/decorators/local |
|
| 249 | - * Adds a list of local decorators only to the catalog count html client |
|
| 250 | - * |
|
| 251 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 252 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 253 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 254 | - * modify what is returned to the caller. |
|
| 255 | - * |
|
| 256 | - * This option allows you to wrap local decorators |
|
| 257 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 258 | - * |
|
| 259 | - * client/html/catalog/count/decorators/local = array( 'decorator2' ) |
|
| 260 | - * |
|
| 261 | - * This would add the decorator named "decorator2" defined by |
|
| 262 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 263 | - * |
|
| 264 | - * @param array List of decorator names |
|
| 265 | - * @since 2014.05 |
|
| 266 | - * @category Developer |
|
| 267 | - * @see client/html/common/decorators/default |
|
| 268 | - * @see client/html/catalog/count/decorators/excludes |
|
| 269 | - * @see client/html/catalog/count/decorators/global |
|
| 270 | - */ |
|
| 248 | + /** client/html/catalog/count/decorators/local |
|
| 249 | + * Adds a list of local decorators only to the catalog count html client |
|
| 250 | + * |
|
| 251 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 252 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 253 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 254 | + * modify what is returned to the caller. |
|
| 255 | + * |
|
| 256 | + * This option allows you to wrap local decorators |
|
| 257 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 258 | + * |
|
| 259 | + * client/html/catalog/count/decorators/local = array( 'decorator2' ) |
|
| 260 | + * |
|
| 261 | + * This would add the decorator named "decorator2" defined by |
|
| 262 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 263 | + * |
|
| 264 | + * @param array List of decorator names |
|
| 265 | + * @since 2014.05 |
|
| 266 | + * @category Developer |
|
| 267 | + * @see client/html/common/decorators/default |
|
| 268 | + * @see client/html/catalog/count/decorators/excludes |
|
| 269 | + * @see client/html/catalog/count/decorators/global |
|
| 270 | + */ |
|
| 271 | 271 | |
| 272 | - return $this->createSubClient( 'catalog/count/' . $type, $name ); |
|
| 273 | - } |
|
| 272 | + return $this->createSubClient( 'catalog/count/' . $type, $name ); |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | 275 | |
| 276 | - /** |
|
| 277 | - * Processes the input, e.g. store given values. |
|
| 278 | - * A view must be available and this method doesn't generate any output |
|
| 279 | - * besides setting view variables. |
|
| 280 | - */ |
|
| 281 | - public function process() |
|
| 282 | - { |
|
| 283 | - try |
|
| 284 | - { |
|
| 285 | - parent::process(); |
|
| 286 | - } |
|
| 287 | - catch( \Exception $e ) |
|
| 288 | - { |
|
| 289 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 290 | - } |
|
| 291 | - } |
|
| 276 | + /** |
|
| 277 | + * Processes the input, e.g. store given values. |
|
| 278 | + * A view must be available and this method doesn't generate any output |
|
| 279 | + * besides setting view variables. |
|
| 280 | + */ |
|
| 281 | + public function process() |
|
| 282 | + { |
|
| 283 | + try |
|
| 284 | + { |
|
| 285 | + parent::process(); |
|
| 286 | + } |
|
| 287 | + catch( \Exception $e ) |
|
| 288 | + { |
|
| 289 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 290 | + } |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | 293 | |
| 294 | - /** |
|
| 295 | - * Returns the list of sub-client names configured for the client. |
|
| 296 | - * |
|
| 297 | - * @return array List of HTML client names |
|
| 298 | - */ |
|
| 299 | - protected function getSubClientNames() |
|
| 300 | - { |
|
| 301 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 302 | - } |
|
| 294 | + /** |
|
| 295 | + * Returns the list of sub-client names configured for the client. |
|
| 296 | + * |
|
| 297 | + * @return array List of HTML client names |
|
| 298 | + */ |
|
| 299 | + protected function getSubClientNames() |
|
| 300 | + { |
|
| 301 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 302 | + } |
|
| 303 | 303 | } |
| 304 | 304 | \ 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( 'tree', 'attribute' ); |
|
| 81 | + private $subPartNames = array('tree', 'attribute'); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 90 | 90 | * @return string HTML code |
| 91 | 91 | */ |
| 92 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 92 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 93 | 93 | { |
| 94 | 94 | try |
| 95 | 95 | { |
| 96 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 96 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 97 | 97 | |
| 98 | 98 | $html = ''; |
| 99 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 100 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 99 | + foreach ($this->getSubClients() as $subclient) { |
|
| 100 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 101 | 101 | } |
| 102 | 102 | $view->countBody = $html; |
| 103 | 103 | |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | $tplconf = 'client/html/catalog/count/standard/template-body'; |
| 125 | 125 | $default = 'catalog/count/body-default.php'; |
| 126 | 126 | |
| 127 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 127 | + return $view->render($view->config($tplconf, $default)); |
|
| 128 | 128 | } |
| 129 | - catch( \Exception $e ) |
|
| 129 | + catch (\Exception $e) |
|
| 130 | 130 | { |
| 131 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 131 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -141,15 +141,15 @@ discard block |
||
| 141 | 141 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 142 | 142 | * @return string|null String including HTML tags for the header on error |
| 143 | 143 | */ |
| 144 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 144 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 145 | 145 | { |
| 146 | 146 | try |
| 147 | 147 | { |
| 148 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 148 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 149 | 149 | |
| 150 | 150 | $html = ''; |
| 151 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 152 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 151 | + foreach ($this->getSubClients() as $subclient) { |
|
| 152 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 153 | 153 | } |
| 154 | 154 | $view->countHeader = $html; |
| 155 | 155 | |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | $tplconf = 'client/html/catalog/count/standard/template-header'; |
| 178 | 178 | $default = 'catalog/count/header-default.php'; |
| 179 | 179 | |
| 180 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 180 | + return $view->render($view->config($tplconf, $default)); |
|
| 181 | 181 | } |
| 182 | - catch( \Exception $e ) |
|
| 182 | + catch (\Exception $e) |
|
| 183 | 183 | { |
| 184 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 184 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param string|null $name Name of the sub-client (Default if null) |
| 194 | 194 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 195 | 195 | */ |
| 196 | - public function getSubClient( $type, $name = null ) |
|
| 196 | + public function getSubClient($type, $name = null) |
|
| 197 | 197 | { |
| 198 | 198 | /** client/html/catalog/count/decorators/excludes |
| 199 | 199 | * Excludes decorators added by the "common" option from the catalog count html client |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @see client/html/catalog/count/decorators/global |
| 270 | 270 | */ |
| 271 | 271 | |
| 272 | - return $this->createSubClient( 'catalog/count/' . $type, $name ); |
|
| 272 | + return $this->createSubClient('catalog/count/'.$type, $name); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
@@ -284,9 +284,9 @@ discard block |
||
| 284 | 284 | { |
| 285 | 285 | parent::process(); |
| 286 | 286 | } |
| 287 | - catch( \Exception $e ) |
|
| 287 | + catch (\Exception $e) |
|
| 288 | 288 | { |
| 289 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 289 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
@@ -298,6 +298,6 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | protected function getSubClientNames() |
| 300 | 300 | { |
| 301 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 301 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | \ No newline at end of file |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 84 | 84 | } |
| 85 | 85 | $view->suggestBody = $html; |
| 86 | - } |
|
| 87 | - catch( \Exception $e ) |
|
| 86 | + } catch( \Exception $e ) |
|
| 88 | 87 | { |
| 89 | 88 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 90 | 89 | return; |
@@ -139,8 +138,7 @@ discard block |
||
| 139 | 138 | $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
| 140 | 139 | } |
| 141 | 140 | $view->suggestHeader = $html; |
| 142 | - } |
|
| 143 | - catch( \Exception $e ) |
|
| 141 | + } catch( \Exception $e ) |
|
| 144 | 142 | { |
| 145 | 143 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 146 | 144 | return; |
@@ -274,8 +272,7 @@ discard block |
||
| 274 | 272 | try |
| 275 | 273 | { |
| 276 | 274 | parent::process(); |
| 277 | - } |
|
| 278 | - catch( \Exception $e ) |
|
| 275 | + } catch( \Exception $e ) |
|
| 279 | 276 | { |
| 280 | 277 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 281 | 278 | } |
@@ -19,69 +19,69 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Factory |
| 22 | - extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Creates a suggest client object. |
|
| 27 | - * |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | - * @param string|null $name Client name (default: "Standard") |
|
| 31 | - * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | - * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | - */ |
|
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | - { |
|
| 36 | - /** client/html/catalog/suggest/name |
|
| 37 | - * Class name of the used catalog suggest client implementation |
|
| 38 | - * |
|
| 39 | - * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | - * To use this implementation, you have to set the last part of the class |
|
| 41 | - * name as configuration value so the client factory knows which class it |
|
| 42 | - * has to instantiate. |
|
| 43 | - * |
|
| 44 | - * For example, if the name of the default class is |
|
| 45 | - * |
|
| 46 | - * \Aimeos\Client\Html\Catalog\Suggest\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Catalog\Suggest\Mysuggest |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/catalog/suggest/name = Mysuggest |
|
| 55 | - * |
|
| 56 | - * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | - * so take care that the configuration value is exactly named like the last |
|
| 58 | - * part of the class name. |
|
| 59 | - * |
|
| 60 | - * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | - * characters are possible! You should always start the last part of the class |
|
| 62 | - * name with an upper case character and continue only with lower case characters |
|
| 63 | - * or numbers. Avoid chamel case names like "MySuggest"! |
|
| 64 | - * |
|
| 65 | - * @param string Last part of the class name |
|
| 66 | - * @since 2015.02 |
|
| 67 | - * @category Developer |
|
| 68 | - */ |
|
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/suggest/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a suggest client object. |
|
| 27 | + * |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | + * @param string|null $name Client name (default: "Standard") |
|
| 31 | + * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | + * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | + */ |
|
| 34 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | + { |
|
| 36 | + /** client/html/catalog/suggest/name |
|
| 37 | + * Class name of the used catalog suggest client implementation |
|
| 38 | + * |
|
| 39 | + * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | + * To use this implementation, you have to set the last part of the class |
|
| 41 | + * name as configuration value so the client factory knows which class it |
|
| 42 | + * has to instantiate. |
|
| 43 | + * |
|
| 44 | + * For example, if the name of the default class is |
|
| 45 | + * |
|
| 46 | + * \Aimeos\Client\Html\Catalog\Suggest\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Catalog\Suggest\Mysuggest |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/catalog/suggest/name = Mysuggest |
|
| 55 | + * |
|
| 56 | + * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | + * so take care that the configuration value is exactly named like the last |
|
| 58 | + * part of the class name. |
|
| 59 | + * |
|
| 60 | + * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | + * characters are possible! You should always start the last part of the class |
|
| 62 | + * name with an upper case character and continue only with lower case characters |
|
| 63 | + * or numbers. Avoid chamel case names like "MySuggest"! |
|
| 64 | + * |
|
| 65 | + * @param string Last part of the class name |
|
| 66 | + * @since 2015.02 |
|
| 67 | + * @category Developer |
|
| 68 | + */ |
|
| 69 | + if( $name === null ) { |
|
| 70 | + $name = $context->getConfig()->get( 'client/html/catalog/suggest/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | - } |
|
| 73 | + if( ctype_alnum( $name ) === false ) |
|
| 74 | + { |
|
| 75 | + $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\' . $name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\' . $name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/suggest' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/suggest' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
| 32 | 32 | * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
| 33 | 33 | */ |
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 34 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
| 35 | 35 | { |
| 36 | 36 | /** client/html/catalog/suggest/name |
| 37 | 37 | * Class name of the used catalog suggest client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2015.02 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/catalog/suggest/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/catalog/suggest/name', 'Standard'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 73 | + if (ctype_alnum($name) === false) |
|
| 74 | 74 | { |
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 75 | + $classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\'.$name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $iface = '\\Aimeos\\Client\\Html\\Iface'; |
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Suggest\\'.$name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase($context, $classname, $iface, $templatePaths); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/suggest' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'catalog/suggest'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 84 | 84 | } |
| 85 | 85 | $view->suggestBody = $html; |
| 86 | - } |
|
| 87 | - catch( \Exception $e ) |
|
| 86 | + } catch( \Exception $e ) |
|
| 88 | 87 | { |
| 89 | 88 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 90 | 89 | return; |
@@ -139,8 +138,7 @@ discard block |
||
| 139 | 138 | $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
| 140 | 139 | } |
| 141 | 140 | $view->suggestHeader = $html; |
| 142 | - } |
|
| 143 | - catch( \Exception $e ) |
|
| 141 | + } catch( \Exception $e ) |
|
| 144 | 142 | { |
| 145 | 143 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 146 | 144 | return; |
@@ -274,8 +272,7 @@ discard block |
||
| 274 | 272 | try |
| 275 | 273 | { |
| 276 | 274 | parent::process(); |
| 277 | - } |
|
| 278 | - catch( \Exception $e ) |
|
| 275 | + } catch( \Exception $e ) |
|
| 279 | 276 | { |
| 280 | 277 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 281 | 278 | } |
@@ -19,304 +19,304 @@ |
||
| 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/suggest/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog suggest client |
|
| 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 | - * Note: Up to 2015-02, this configuration option was available as |
|
| 55 | - * client/html/catalog/lists/simple/subparts |
|
| 56 | - * |
|
| 57 | - * @param array List of sub-client names |
|
| 58 | - * @since 2015.02 |
|
| 59 | - * @category Developer |
|
| 60 | - * @see client/html/catalog/lists/simple/subparts |
|
| 61 | - */ |
|
| 62 | - private $subPartPath = 'client/html/catalog/suggest/standard/subparts'; |
|
| 63 | - private $subPartNames = array(); |
|
| 64 | - private $cache; |
|
| 25 | + /** client/html/catalog/suggest/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog suggest client |
|
| 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 | + * Note: Up to 2015-02, this configuration option was available as |
|
| 55 | + * client/html/catalog/lists/simple/subparts |
|
| 56 | + * |
|
| 57 | + * @param array List of sub-client names |
|
| 58 | + * @since 2015.02 |
|
| 59 | + * @category Developer |
|
| 60 | + * @see client/html/catalog/lists/simple/subparts |
|
| 61 | + */ |
|
| 62 | + private $subPartPath = 'client/html/catalog/suggest/standard/subparts'; |
|
| 63 | + private $subPartNames = array(); |
|
| 64 | + private $cache; |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Returns the HTML code for insertion into the body. |
|
| 69 | - * |
|
| 70 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 71 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 72 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 73 | - * @return string HTML code |
|
| 74 | - */ |
|
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 76 | - { |
|
| 77 | - try |
|
| 78 | - { |
|
| 79 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 67 | + /** |
|
| 68 | + * Returns the HTML code for insertion into the body. |
|
| 69 | + * |
|
| 70 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 71 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 72 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 73 | + * @return string HTML code |
|
| 74 | + */ |
|
| 75 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 76 | + { |
|
| 77 | + try |
|
| 78 | + { |
|
| 79 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 80 | 80 | |
| 81 | - $html = ''; |
|
| 82 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 84 | - } |
|
| 85 | - $view->suggestBody = $html; |
|
| 86 | - } |
|
| 87 | - catch( \Exception $e ) |
|
| 88 | - { |
|
| 89 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 90 | - return; |
|
| 91 | - } |
|
| 81 | + $html = ''; |
|
| 82 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 84 | + } |
|
| 85 | + $view->suggestBody = $html; |
|
| 86 | + } |
|
| 87 | + catch( \Exception $e ) |
|
| 88 | + { |
|
| 89 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 90 | + return; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** client/html/catalog/suggest/standard/template-body |
|
| 94 | - * Relative path to the HTML body template of the catalog suggest client. |
|
| 95 | - * |
|
| 96 | - * The template file contains the HTML code and processing instructions |
|
| 97 | - * to generate the result shown in the body of the frontend. The |
|
| 98 | - * configuration string is the path to the template file relative |
|
| 99 | - * to the templates directory (usually in client/html/templates). |
|
| 100 | - * |
|
| 101 | - * You can overwrite the template file configuration in extensions and |
|
| 102 | - * provide alternative templates. These alternative templates should be |
|
| 103 | - * named like the default one but with the string "standard" replaced by |
|
| 104 | - * an unique name. You may use the name of your project for this. If |
|
| 105 | - * you've implemented an alternative client class as well, "standard" |
|
| 106 | - * should be replaced by the name of the new class. |
|
| 107 | - * |
|
| 108 | - * Note: Up to 2015-02, this configuration option was available as |
|
| 109 | - * client/html/catalog/lists/simple/template-body |
|
| 110 | - * |
|
| 111 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 112 | - * @since 2015.02 |
|
| 113 | - * @category Developer |
|
| 114 | - * @see client/html/catalog/suggest/standard/template-header |
|
| 115 | - */ |
|
| 116 | - $tplconf = 'client/html/catalog/suggest/standard/template-body'; |
|
| 117 | - $default = 'catalog/suggest/body-default.php'; |
|
| 93 | + /** client/html/catalog/suggest/standard/template-body |
|
| 94 | + * Relative path to the HTML body template of the catalog suggest client. |
|
| 95 | + * |
|
| 96 | + * The template file contains the HTML code and processing instructions |
|
| 97 | + * to generate the result shown in the body of the frontend. The |
|
| 98 | + * configuration string is the path to the template file relative |
|
| 99 | + * to the templates directory (usually in client/html/templates). |
|
| 100 | + * |
|
| 101 | + * You can overwrite the template file configuration in extensions and |
|
| 102 | + * provide alternative templates. These alternative templates should be |
|
| 103 | + * named like the default one but with the string "standard" replaced by |
|
| 104 | + * an unique name. You may use the name of your project for this. If |
|
| 105 | + * you've implemented an alternative client class as well, "standard" |
|
| 106 | + * should be replaced by the name of the new class. |
|
| 107 | + * |
|
| 108 | + * Note: Up to 2015-02, this configuration option was available as |
|
| 109 | + * client/html/catalog/lists/simple/template-body |
|
| 110 | + * |
|
| 111 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 112 | + * @since 2015.02 |
|
| 113 | + * @category Developer |
|
| 114 | + * @see client/html/catalog/suggest/standard/template-header |
|
| 115 | + */ |
|
| 116 | + $tplconf = 'client/html/catalog/suggest/standard/template-body'; |
|
| 117 | + $default = 'catalog/suggest/body-default.php'; |
|
| 118 | 118 | |
| 119 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 120 | - } |
|
| 119 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * Returns the HTML string for insertion into the header. |
|
| 125 | - * |
|
| 126 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 127 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 128 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 129 | - * @return string|null String including HTML tags for the header on error |
|
| 130 | - */ |
|
| 131 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 132 | - { |
|
| 133 | - try |
|
| 134 | - { |
|
| 135 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 123 | + /** |
|
| 124 | + * Returns the HTML string for insertion into the header. |
|
| 125 | + * |
|
| 126 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 127 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 128 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 129 | + * @return string|null String including HTML tags for the header on error |
|
| 130 | + */ |
|
| 131 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 132 | + { |
|
| 133 | + try |
|
| 134 | + { |
|
| 135 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 136 | 136 | |
| 137 | - $html = ''; |
|
| 138 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 139 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 140 | - } |
|
| 141 | - $view->suggestHeader = $html; |
|
| 142 | - } |
|
| 143 | - catch( \Exception $e ) |
|
| 144 | - { |
|
| 145 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 146 | - return; |
|
| 147 | - } |
|
| 137 | + $html = ''; |
|
| 138 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 139 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 140 | + } |
|
| 141 | + $view->suggestHeader = $html; |
|
| 142 | + } |
|
| 143 | + catch( \Exception $e ) |
|
| 144 | + { |
|
| 145 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 146 | + return; |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - /** client/html/catalog/suggest/standard/template-header |
|
| 150 | - * Relative path to the HTML header template of the catalog suggest client. |
|
| 151 | - * |
|
| 152 | - * The template file contains the HTML code and processing instructions |
|
| 153 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 154 | - * of the rendered page in the frontend. The configuration string is the |
|
| 155 | - * path to the template file relative to the templates directory (usually |
|
| 156 | - * in client/html/templates). |
|
| 157 | - * |
|
| 158 | - * You can overwrite the template file configuration in extensions and |
|
| 159 | - * provide alternative templates. These alternative templates should be |
|
| 160 | - * named like the default one but with the string "standard" replaced by |
|
| 161 | - * an unique name. You may use the name of your project for this. If |
|
| 162 | - * you've implemented an alternative client class as well, "standard" |
|
| 163 | - * should be replaced by the name of the new class. |
|
| 164 | - * |
|
| 165 | - * Note: Up to 2015-02, this configuration option was available as |
|
| 166 | - * client/html/catalog/lists/simple/template-header |
|
| 167 | - * |
|
| 168 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 169 | - * @since 2015.02 |
|
| 170 | - * @category Developer |
|
| 171 | - * @see client/html/catalog/suggest/standard/template-body |
|
| 172 | - */ |
|
| 173 | - $tplconf = 'client/html/catalog/suggest/standard/template-header'; |
|
| 174 | - $default = 'catalog/suggest/header-default.php'; |
|
| 149 | + /** client/html/catalog/suggest/standard/template-header |
|
| 150 | + * Relative path to the HTML header template of the catalog suggest client. |
|
| 151 | + * |
|
| 152 | + * The template file contains the HTML code and processing instructions |
|
| 153 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 154 | + * of the rendered page in the frontend. The configuration string is the |
|
| 155 | + * path to the template file relative to the templates directory (usually |
|
| 156 | + * in client/html/templates). |
|
| 157 | + * |
|
| 158 | + * You can overwrite the template file configuration in extensions and |
|
| 159 | + * provide alternative templates. These alternative templates should be |
|
| 160 | + * named like the default one but with the string "standard" replaced by |
|
| 161 | + * an unique name. You may use the name of your project for this. If |
|
| 162 | + * you've implemented an alternative client class as well, "standard" |
|
| 163 | + * should be replaced by the name of the new class. |
|
| 164 | + * |
|
| 165 | + * Note: Up to 2015-02, this configuration option was available as |
|
| 166 | + * client/html/catalog/lists/simple/template-header |
|
| 167 | + * |
|
| 168 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 169 | + * @since 2015.02 |
|
| 170 | + * @category Developer |
|
| 171 | + * @see client/html/catalog/suggest/standard/template-body |
|
| 172 | + */ |
|
| 173 | + $tplconf = 'client/html/catalog/suggest/standard/template-header'; |
|
| 174 | + $default = 'catalog/suggest/header-default.php'; |
|
| 175 | 175 | |
| 176 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 177 | - } |
|
| 176 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Returns the sub-client given by its name. |
|
| 182 | - * |
|
| 183 | - * @param string $type Name of the client type |
|
| 184 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 185 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 186 | - */ |
|
| 187 | - public function getSubClient( $type, $name = null ) |
|
| 188 | - { |
|
| 189 | - /** client/html/catalog/suggest/decorators/excludes |
|
| 190 | - * Excludes decorators added by the "common" option from the catalog suggest 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 remove a decorator added via |
|
| 198 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 199 | - * around the html client. |
|
| 200 | - * |
|
| 201 | - * client/html/catalog/suggest/decorators/excludes = array( 'decorator1' ) |
|
| 202 | - * |
|
| 203 | - * This would remove the decorator named "decorator1" from the list of |
|
| 204 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 205 | - * "client/html/common/decorators/default" to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.02 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/suggest/decorators/global |
|
| 212 | - * @see client/html/catalog/suggest/decorators/local |
|
| 213 | - */ |
|
| 180 | + /** |
|
| 181 | + * Returns the sub-client given by its name. |
|
| 182 | + * |
|
| 183 | + * @param string $type Name of the client type |
|
| 184 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 185 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 186 | + */ |
|
| 187 | + public function getSubClient( $type, $name = null ) |
|
| 188 | + { |
|
| 189 | + /** client/html/catalog/suggest/decorators/excludes |
|
| 190 | + * Excludes decorators added by the "common" option from the catalog suggest 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 remove a decorator added via |
|
| 198 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 199 | + * around the html client. |
|
| 200 | + * |
|
| 201 | + * client/html/catalog/suggest/decorators/excludes = array( 'decorator1' ) |
|
| 202 | + * |
|
| 203 | + * This would remove the decorator named "decorator1" from the list of |
|
| 204 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 205 | + * "client/html/common/decorators/default" to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.02 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/suggest/decorators/global |
|
| 212 | + * @see client/html/catalog/suggest/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/catalog/suggest/decorators/global |
|
| 216 | - * Adds a list of globally available decorators only to the catalog suggest 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 global decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/suggest/decorators/global = array( 'decorator1' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator1" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.02 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/suggest/decorators/excludes |
|
| 236 | - * @see client/html/catalog/suggest/decorators/local |
|
| 237 | - */ |
|
| 215 | + /** client/html/catalog/suggest/decorators/global |
|
| 216 | + * Adds a list of globally available decorators only to the catalog suggest 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 global decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/suggest/decorators/global = array( 'decorator1' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator1" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.02 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/suggest/decorators/excludes |
|
| 236 | + * @see client/html/catalog/suggest/decorators/local |
|
| 237 | + */ |
|
| 238 | 238 | |
| 239 | - /** client/html/catalog/suggest/decorators/local |
|
| 240 | - * Adds a list of local decorators only to the catalog suggest html client |
|
| 241 | - * |
|
| 242 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 243 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 244 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 245 | - * modify what is returned to the caller. |
|
| 246 | - * |
|
| 247 | - * This option allows you to wrap local decorators |
|
| 248 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 249 | - * |
|
| 250 | - * client/html/catalog/suggest/decorators/local = array( 'decorator2' ) |
|
| 251 | - * |
|
| 252 | - * This would add the decorator named "decorator2" defined by |
|
| 253 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 254 | - * |
|
| 255 | - * @param array List of decorator names |
|
| 256 | - * @since 2015.02 |
|
| 257 | - * @category Developer |
|
| 258 | - * @see client/html/common/decorators/default |
|
| 259 | - * @see client/html/catalog/suggest/decorators/excludes |
|
| 260 | - * @see client/html/catalog/suggest/decorators/global |
|
| 261 | - */ |
|
| 239 | + /** client/html/catalog/suggest/decorators/local |
|
| 240 | + * Adds a list of local decorators only to the catalog suggest html client |
|
| 241 | + * |
|
| 242 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 243 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 244 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 245 | + * modify what is returned to the caller. |
|
| 246 | + * |
|
| 247 | + * This option allows you to wrap local decorators |
|
| 248 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 249 | + * |
|
| 250 | + * client/html/catalog/suggest/decorators/local = array( 'decorator2' ) |
|
| 251 | + * |
|
| 252 | + * This would add the decorator named "decorator2" defined by |
|
| 253 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 254 | + * |
|
| 255 | + * @param array List of decorator names |
|
| 256 | + * @since 2015.02 |
|
| 257 | + * @category Developer |
|
| 258 | + * @see client/html/common/decorators/default |
|
| 259 | + * @see client/html/catalog/suggest/decorators/excludes |
|
| 260 | + * @see client/html/catalog/suggest/decorators/global |
|
| 261 | + */ |
|
| 262 | 262 | |
| 263 | - return $this->createSubClient( 'catalog/suggest/' . $type, $name ); |
|
| 264 | - } |
|
| 263 | + return $this->createSubClient( 'catalog/suggest/' . $type, $name ); |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Processes the input, e.g. store given values. |
|
| 269 | - * A view must be available and this method doesn't generate any output |
|
| 270 | - * besides setting view variables. |
|
| 271 | - */ |
|
| 272 | - public function process() |
|
| 273 | - { |
|
| 274 | - try |
|
| 275 | - { |
|
| 276 | - parent::process(); |
|
| 277 | - } |
|
| 278 | - catch( \Exception $e ) |
|
| 279 | - { |
|
| 280 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 281 | - } |
|
| 282 | - } |
|
| 267 | + /** |
|
| 268 | + * Processes the input, e.g. store given values. |
|
| 269 | + * A view must be available and this method doesn't generate any output |
|
| 270 | + * besides setting view variables. |
|
| 271 | + */ |
|
| 272 | + public function process() |
|
| 273 | + { |
|
| 274 | + try |
|
| 275 | + { |
|
| 276 | + parent::process(); |
|
| 277 | + } |
|
| 278 | + catch( \Exception $e ) |
|
| 279 | + { |
|
| 280 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | 284 | |
| 285 | - /** |
|
| 286 | - * Returns the list of sub-client names configured for the client. |
|
| 287 | - * |
|
| 288 | - * @return array List of HTML client names |
|
| 289 | - */ |
|
| 290 | - protected function getSubClientNames() |
|
| 291 | - { |
|
| 292 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 293 | - } |
|
| 285 | + /** |
|
| 286 | + * Returns the list of sub-client names configured for the client. |
|
| 287 | + * |
|
| 288 | + * @return array List of HTML client names |
|
| 289 | + */ |
|
| 290 | + protected function getSubClientNames() |
|
| 291 | + { |
|
| 292 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 293 | + } |
|
| 294 | 294 | |
| 295 | 295 | |
| 296 | - /** |
|
| 297 | - * Sets the necessary parameter values in the view. |
|
| 298 | - * |
|
| 299 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 300 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 301 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 302 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 303 | - */ |
|
| 304 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 305 | - { |
|
| 306 | - if( !isset( $this->cache ) ) |
|
| 307 | - { |
|
| 308 | - $input = $view->param( 'f_search' ); |
|
| 296 | + /** |
|
| 297 | + * Sets the necessary parameter values in the view. |
|
| 298 | + * |
|
| 299 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 300 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 301 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 302 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 303 | + */ |
|
| 304 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 305 | + { |
|
| 306 | + if( !isset( $this->cache ) ) |
|
| 307 | + { |
|
| 308 | + $input = $view->param( 'f_search' ); |
|
| 309 | 309 | |
| 310 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
| 310 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
| 311 | 311 | |
| 312 | - $filter = $controller->createTextFilter( $input ); |
|
| 313 | - $items = $controller->getTextList( $filter ); |
|
| 312 | + $filter = $controller->createTextFilter( $input ); |
|
| 313 | + $items = $controller->getTextList( $filter ); |
|
| 314 | 314 | |
| 315 | - $view->suggestTextItems = $items; |
|
| 315 | + $view->suggestTextItems = $items; |
|
| 316 | 316 | |
| 317 | - $this->cache = $view; |
|
| 318 | - } |
|
| 317 | + $this->cache = $view; |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | - return $this->cache; |
|
| 321 | - } |
|
| 320 | + return $this->cache; |
|
| 321 | + } |
|
| 322 | 322 | } |
| 323 | 323 | \ No newline at end of file |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 73 | 73 | * @return string HTML code |
| 74 | 74 | */ |
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 76 | 76 | { |
| 77 | 77 | try |
| 78 | 78 | { |
| 79 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 79 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 80 | 80 | |
| 81 | 81 | $html = ''; |
| 82 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 82 | + foreach ($this->getSubClients() as $subclient) { |
|
| 83 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 84 | 84 | } |
| 85 | 85 | $view->suggestBody = $html; |
| 86 | 86 | } |
| 87 | - catch( \Exception $e ) |
|
| 87 | + catch (\Exception $e) |
|
| 88 | 88 | { |
| 89 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 89 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $tplconf = 'client/html/catalog/suggest/standard/template-body'; |
| 117 | 117 | $default = 'catalog/suggest/body-default.php'; |
| 118 | 118 | |
| 119 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 119 | + return $view->render($view->config($tplconf, $default)); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -128,21 +128,21 @@ discard block |
||
| 128 | 128 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 129 | 129 | * @return string|null String including HTML tags for the header on error |
| 130 | 130 | */ |
| 131 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 131 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 132 | 132 | { |
| 133 | 133 | try |
| 134 | 134 | { |
| 135 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 135 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 136 | 136 | |
| 137 | 137 | $html = ''; |
| 138 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 139 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 138 | + foreach ($this->getSubClients() as $subclient) { |
|
| 139 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 140 | 140 | } |
| 141 | 141 | $view->suggestHeader = $html; |
| 142 | 142 | } |
| 143 | - catch( \Exception $e ) |
|
| 143 | + catch (\Exception $e) |
|
| 144 | 144 | { |
| 145 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 145 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $tplconf = 'client/html/catalog/suggest/standard/template-header'; |
| 174 | 174 | $default = 'catalog/suggest/header-default.php'; |
| 175 | 175 | |
| 176 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 176 | + return $view->render($view->config($tplconf, $default)); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param string|null $name Name of the sub-client (Default if null) |
| 185 | 185 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 186 | 186 | */ |
| 187 | - public function getSubClient( $type, $name = null ) |
|
| 187 | + public function getSubClient($type, $name = null) |
|
| 188 | 188 | { |
| 189 | 189 | /** client/html/catalog/suggest/decorators/excludes |
| 190 | 190 | * Excludes decorators added by the "common" option from the catalog suggest html client |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @see client/html/catalog/suggest/decorators/global |
| 261 | 261 | */ |
| 262 | 262 | |
| 263 | - return $this->createSubClient( 'catalog/suggest/' . $type, $name ); |
|
| 263 | + return $this->createSubClient('catalog/suggest/'.$type, $name); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | { |
| 276 | 276 | parent::process(); |
| 277 | 277 | } |
| 278 | - catch( \Exception $e ) |
|
| 278 | + catch (\Exception $e) |
|
| 279 | 279 | { |
| 280 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 280 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected function getSubClientNames() |
| 291 | 291 | { |
| 292 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 292 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | |
@@ -301,16 +301,16 @@ discard block |
||
| 301 | 301 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 302 | 302 | * @return \Aimeos\MW\View\Iface Modified view object |
| 303 | 303 | */ |
| 304 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 304 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 305 | 305 | { |
| 306 | - if( !isset( $this->cache ) ) |
|
| 306 | + if (!isset($this->cache)) |
|
| 307 | 307 | { |
| 308 | - $input = $view->param( 'f_search' ); |
|
| 308 | + $input = $view->param('f_search'); |
|
| 309 | 309 | |
| 310 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
| 310 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog'); |
|
| 311 | 311 | |
| 312 | - $filter = $controller->createTextFilter( $input ); |
|
| 313 | - $items = $controller->getTextList( $filter ); |
|
| 312 | + $filter = $controller->createTextFilter($input); |
|
| 313 | + $items = $controller->getTextList($filter); |
|
| 314 | 314 | |
| 315 | 315 | $view->suggestTextItems = $items; |
| 316 | 316 | |