@@ -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 | |
@@ -19,349 +19,349 @@ |
||
| 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/filter/attribute/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog filter 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/filter/attribute/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $tags = array(); |
|
| 61 | - private $expire; |
|
| 62 | - private $cache; |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Returns the HTML code for insertion into the body. |
|
| 67 | - * |
|
| 68 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | - * @return string HTML code |
|
| 72 | - */ |
|
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | - { |
|
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | - |
|
| 77 | - $html = ''; |
|
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | - } |
|
| 81 | - $view->attributeBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/filter/attribute/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog filter attribute client. |
|
| 85 | - * |
|
| 86 | - * The template file contains the HTML code and processing instructions |
|
| 87 | - * to generate the result shown in the body of the frontend. The |
|
| 88 | - * configuration string is the path to the template file relative |
|
| 89 | - * to the templates directory (usually in client/html/templates). |
|
| 90 | - * |
|
| 91 | - * You can overwrite the template file configuration in extensions and |
|
| 92 | - * provide alternative templates. These alternative templates should be |
|
| 93 | - * named like the default one but with the string "standard" replaced by |
|
| 94 | - * an unique name. You may use the name of your project for this. If |
|
| 95 | - * you've implemented an alternative client class as well, "standard" |
|
| 96 | - * should be replaced by the name of the new class. |
|
| 97 | - * |
|
| 98 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | - * @since 2014.03 |
|
| 100 | - * @category Developer |
|
| 101 | - * @see client/html/catalog/filter/attribute/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/filter/attribute/standard/template-body'; |
|
| 104 | - $default = 'catalog/filter/attribute-body-default.php'; |
|
| 105 | - |
|
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Returns the HTML string for insertion into the header. |
|
| 112 | - * |
|
| 113 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 117 | - */ |
|
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | - { |
|
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | - |
|
| 122 | - $html = ''; |
|
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | - } |
|
| 126 | - $view->attributeHeader = $html; |
|
| 127 | - |
|
| 128 | - /** client/html/catalog/filter/attribute/standard/template-header |
|
| 129 | - * Relative path to the HTML header template of the catalog filter attribute client. |
|
| 130 | - * |
|
| 131 | - * The template file contains the HTML code and processing instructions |
|
| 132 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | - * of the rendered page in the frontend. The configuration string is the |
|
| 134 | - * path to the template file relative to the templates directory (usually |
|
| 135 | - * in client/html/templates). |
|
| 136 | - * |
|
| 137 | - * You can overwrite the template file configuration in extensions and |
|
| 138 | - * provide alternative templates. These alternative templates should be |
|
| 139 | - * named like the default one but with the string "standard" replaced by |
|
| 140 | - * an unique name. You may use the name of your project for this. If |
|
| 141 | - * you've implemented an alternative client class as well, "standard" |
|
| 142 | - * should be replaced by the name of the new class. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2014.03 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/catalog/filter/attribute/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/catalog/filter/attribute/standard/template-header'; |
|
| 150 | - $default = 'catalog/filter/attribute-header-default.php'; |
|
| 151 | - |
|
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/catalog/filter/attribute/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the catalog filter attribute html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/catalog/filter/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/catalog/filter/attribute/decorators/global |
|
| 188 | - * @see client/html/catalog/filter/attribute/decorators/local |
|
| 189 | - */ |
|
| 190 | - |
|
| 191 | - /** client/html/catalog/filter/attribute/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the catalog filter attribute html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/catalog/filter/attribute/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/filter/attribute/decorators/excludes |
|
| 212 | - * @see client/html/catalog/filter/attribute/decorators/local |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - /** client/html/catalog/filter/attribute/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the catalog filter attribute html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/filter/attribute/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/filter/attribute/decorators/excludes |
|
| 236 | - * @see client/html/catalog/filter/attribute/decorators/global |
|
| 237 | - */ |
|
| 238 | - |
|
| 239 | - return $this->createSubClient( 'catalog/filter/attribute/' . $type, $name ); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Returns the list of sub-client names configured for the client. |
|
| 245 | - * |
|
| 246 | - * @return array List of HTML client names |
|
| 247 | - */ |
|
| 248 | - protected function getSubClientNames() |
|
| 249 | - { |
|
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Sets the necessary parameter values in the view. |
|
| 256 | - * |
|
| 257 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | - */ |
|
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | - { |
|
| 264 | - if( !isset( $this->cache ) ) |
|
| 265 | - { |
|
| 266 | - $attrMap = array(); |
|
| 267 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
| 268 | - |
|
| 269 | - /** client/html/catalog/filter/attribute/types |
|
| 270 | - * List of attribute types that should be displayed in this order in the catalog filter |
|
| 271 | - * |
|
| 272 | - * The attribute section in the catalog filter component can display |
|
| 273 | - * all attributes a visitor can use to reduce the listed products |
|
| 274 | - * to those that contains one or more attributes. By default, all |
|
| 275 | - * available attributes will be displayed and ordered by their |
|
| 276 | - * attribute type. |
|
| 277 | - * |
|
| 278 | - * With this setting, you can limit the attribute types to only thoses |
|
| 279 | - * whose names are part of the setting value. Furthermore, a particular |
|
| 280 | - * order for the attribute types can be enforced that is different |
|
| 281 | - * from the standard order. |
|
| 282 | - * |
|
| 283 | - * @param array List of attribute type codes |
|
| 284 | - * @since 2015.05 |
|
| 285 | - * @category User |
|
| 286 | - * @category Developer |
|
| 287 | - * @see client/html/catalog/filter/attribute/domains |
|
| 288 | - */ |
|
| 289 | - $attrTypes = $view->config( 'client/html/catalog/filter/attribute/types', array() ); |
|
| 290 | - |
|
| 291 | - $manager = $controller->createManager( 'attribute' ); |
|
| 292 | - $search = $manager->createSearch( true ); |
|
| 293 | - |
|
| 294 | - $expr = array(); |
|
| 295 | - if( !empty( $attrTypes ) ) { |
|
| 296 | - $expr[] = $search->compare( '==', 'attribute.type.code', $attrTypes ); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - $expr[] = $search->compare( '==', 'attribute.domain', 'product' ); |
|
| 300 | - $expr[] = $search->getConditions(); |
|
| 301 | - |
|
| 302 | - $sort = array( $search->sort( '+', 'attribute.position' ) ); |
|
| 303 | - |
|
| 304 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 305 | - $search->setSortations( $sort ); |
|
| 306 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 307 | - |
|
| 308 | - /** client/html/catalog/filter/attribute/domains |
|
| 309 | - * List of domain names whose items should be fetched with the filter attributes |
|
| 310 | - * |
|
| 311 | - * The templates rendering the attributes in the catalog filter usually |
|
| 312 | - * add the images and texts associated to each item. If you want to |
|
| 313 | - * display additional content, you can configure your own list of |
|
| 314 | - * domains (attribute, media, price, product, text, etc. are domains) |
|
| 315 | - * whose items are fetched from the storage. Please keep in mind that |
|
| 316 | - * the more domains you add to the configuration, the more time is |
|
| 317 | - * required for fetching the content! |
|
| 318 | - * |
|
| 319 | - * @param array List of domain item names |
|
| 320 | - * @since 2015.05 |
|
| 321 | - * @category Developer |
|
| 322 | - * @see client/html/catalog/filter/attribute/types |
|
| 323 | - */ |
|
| 324 | - $domains = $view->config( 'client/html/catalog/filter/attribute/domains', array( 'text', 'media' ) ); |
|
| 325 | - |
|
| 326 | - $attributes = $manager->searchItems( $search, $domains ); |
|
| 327 | - |
|
| 328 | - foreach( $attributes as $id => $item ) { |
|
| 329 | - $attrMap[$item->getType()][$id] = $item; |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - if( !empty( $attrTypes ) ) |
|
| 333 | - { |
|
| 334 | - $sortedMap = array(); |
|
| 335 | - |
|
| 336 | - foreach( $attrTypes as $type ) |
|
| 337 | - { |
|
| 338 | - if( isset( $attrMap[$type] ) ) { |
|
| 339 | - $sortedMap[$type] = $attrMap[$type]; |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - $attrMap = $sortedMap; |
|
| 344 | - } |
|
| 345 | - else |
|
| 346 | - { |
|
| 347 | - ksort( $attrMap ); |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 351 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 352 | - |
|
| 353 | - // Delete cache when attributes are added or deleted even in "tag-all" mode |
|
| 354 | - $this->tags[] = 'attribute'; |
|
| 355 | - |
|
| 356 | - |
|
| 357 | - $view->attributeMap = $attrMap; |
|
| 358 | - |
|
| 359 | - $this->cache = $view; |
|
| 360 | - } |
|
| 361 | - |
|
| 362 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 363 | - $tags = array_merge( $tags, $this->tags ); |
|
| 364 | - |
|
| 365 | - return $this->cache; |
|
| 366 | - } |
|
| 25 | + /** client/html/catalog/filter/attribute/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog filter 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/filter/attribute/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $tags = array(); |
|
| 61 | + private $expire; |
|
| 62 | + private $cache; |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Returns the HTML code for insertion into the body. |
|
| 67 | + * |
|
| 68 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 69 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 70 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 71 | + * @return string HTML code |
|
| 72 | + */ |
|
| 73 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 74 | + { |
|
| 75 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 76 | + |
|
| 77 | + $html = ''; |
|
| 78 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 80 | + } |
|
| 81 | + $view->attributeBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/filter/attribute/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog filter attribute client. |
|
| 85 | + * |
|
| 86 | + * The template file contains the HTML code and processing instructions |
|
| 87 | + * to generate the result shown in the body of the frontend. The |
|
| 88 | + * configuration string is the path to the template file relative |
|
| 89 | + * to the templates directory (usually in client/html/templates). |
|
| 90 | + * |
|
| 91 | + * You can overwrite the template file configuration in extensions and |
|
| 92 | + * provide alternative templates. These alternative templates should be |
|
| 93 | + * named like the default one but with the string "standard" replaced by |
|
| 94 | + * an unique name. You may use the name of your project for this. If |
|
| 95 | + * you've implemented an alternative client class as well, "standard" |
|
| 96 | + * should be replaced by the name of the new class. |
|
| 97 | + * |
|
| 98 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | + * @since 2014.03 |
|
| 100 | + * @category Developer |
|
| 101 | + * @see client/html/catalog/filter/attribute/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/filter/attribute/standard/template-body'; |
|
| 104 | + $default = 'catalog/filter/attribute-body-default.php'; |
|
| 105 | + |
|
| 106 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Returns the HTML string for insertion into the header. |
|
| 112 | + * |
|
| 113 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 114 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 115 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 116 | + * @return string|null String including HTML tags for the header on error |
|
| 117 | + */ |
|
| 118 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 119 | + { |
|
| 120 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 121 | + |
|
| 122 | + $html = ''; |
|
| 123 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 125 | + } |
|
| 126 | + $view->attributeHeader = $html; |
|
| 127 | + |
|
| 128 | + /** client/html/catalog/filter/attribute/standard/template-header |
|
| 129 | + * Relative path to the HTML header template of the catalog filter attribute client. |
|
| 130 | + * |
|
| 131 | + * The template file contains the HTML code and processing instructions |
|
| 132 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | + * of the rendered page in the frontend. The configuration string is the |
|
| 134 | + * path to the template file relative to the templates directory (usually |
|
| 135 | + * in client/html/templates). |
|
| 136 | + * |
|
| 137 | + * You can overwrite the template file configuration in extensions and |
|
| 138 | + * provide alternative templates. These alternative templates should be |
|
| 139 | + * named like the default one but with the string "standard" replaced by |
|
| 140 | + * an unique name. You may use the name of your project for this. If |
|
| 141 | + * you've implemented an alternative client class as well, "standard" |
|
| 142 | + * should be replaced by the name of the new class. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2014.03 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/catalog/filter/attribute/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/catalog/filter/attribute/standard/template-header'; |
|
| 150 | + $default = 'catalog/filter/attribute-header-default.php'; |
|
| 151 | + |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/catalog/filter/attribute/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the catalog filter attribute html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/catalog/filter/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/catalog/filter/attribute/decorators/global |
|
| 188 | + * @see client/html/catalog/filter/attribute/decorators/local |
|
| 189 | + */ |
|
| 190 | + |
|
| 191 | + /** client/html/catalog/filter/attribute/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the catalog filter attribute html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/catalog/filter/attribute/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/filter/attribute/decorators/excludes |
|
| 212 | + * @see client/html/catalog/filter/attribute/decorators/local |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + /** client/html/catalog/filter/attribute/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the catalog filter attribute html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/filter/attribute/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/filter/attribute/decorators/excludes |
|
| 236 | + * @see client/html/catalog/filter/attribute/decorators/global |
|
| 237 | + */ |
|
| 238 | + |
|
| 239 | + return $this->createSubClient( 'catalog/filter/attribute/' . $type, $name ); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Returns the list of sub-client names configured for the client. |
|
| 245 | + * |
|
| 246 | + * @return array List of HTML client names |
|
| 247 | + */ |
|
| 248 | + protected function getSubClientNames() |
|
| 249 | + { |
|
| 250 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Sets the necessary parameter values in the view. |
|
| 256 | + * |
|
| 257 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | + */ |
|
| 262 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | + { |
|
| 264 | + if( !isset( $this->cache ) ) |
|
| 265 | + { |
|
| 266 | + $attrMap = array(); |
|
| 267 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
| 268 | + |
|
| 269 | + /** client/html/catalog/filter/attribute/types |
|
| 270 | + * List of attribute types that should be displayed in this order in the catalog filter |
|
| 271 | + * |
|
| 272 | + * The attribute section in the catalog filter component can display |
|
| 273 | + * all attributes a visitor can use to reduce the listed products |
|
| 274 | + * to those that contains one or more attributes. By default, all |
|
| 275 | + * available attributes will be displayed and ordered by their |
|
| 276 | + * attribute type. |
|
| 277 | + * |
|
| 278 | + * With this setting, you can limit the attribute types to only thoses |
|
| 279 | + * whose names are part of the setting value. Furthermore, a particular |
|
| 280 | + * order for the attribute types can be enforced that is different |
|
| 281 | + * from the standard order. |
|
| 282 | + * |
|
| 283 | + * @param array List of attribute type codes |
|
| 284 | + * @since 2015.05 |
|
| 285 | + * @category User |
|
| 286 | + * @category Developer |
|
| 287 | + * @see client/html/catalog/filter/attribute/domains |
|
| 288 | + */ |
|
| 289 | + $attrTypes = $view->config( 'client/html/catalog/filter/attribute/types', array() ); |
|
| 290 | + |
|
| 291 | + $manager = $controller->createManager( 'attribute' ); |
|
| 292 | + $search = $manager->createSearch( true ); |
|
| 293 | + |
|
| 294 | + $expr = array(); |
|
| 295 | + if( !empty( $attrTypes ) ) { |
|
| 296 | + $expr[] = $search->compare( '==', 'attribute.type.code', $attrTypes ); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + $expr[] = $search->compare( '==', 'attribute.domain', 'product' ); |
|
| 300 | + $expr[] = $search->getConditions(); |
|
| 301 | + |
|
| 302 | + $sort = array( $search->sort( '+', 'attribute.position' ) ); |
|
| 303 | + |
|
| 304 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 305 | + $search->setSortations( $sort ); |
|
| 306 | + $search->setSlice( 0, 0x7fffffff ); |
|
| 307 | + |
|
| 308 | + /** client/html/catalog/filter/attribute/domains |
|
| 309 | + * List of domain names whose items should be fetched with the filter attributes |
|
| 310 | + * |
|
| 311 | + * The templates rendering the attributes in the catalog filter usually |
|
| 312 | + * add the images and texts associated to each item. If you want to |
|
| 313 | + * display additional content, you can configure your own list of |
|
| 314 | + * domains (attribute, media, price, product, text, etc. are domains) |
|
| 315 | + * whose items are fetched from the storage. Please keep in mind that |
|
| 316 | + * the more domains you add to the configuration, the more time is |
|
| 317 | + * required for fetching the content! |
|
| 318 | + * |
|
| 319 | + * @param array List of domain item names |
|
| 320 | + * @since 2015.05 |
|
| 321 | + * @category Developer |
|
| 322 | + * @see client/html/catalog/filter/attribute/types |
|
| 323 | + */ |
|
| 324 | + $domains = $view->config( 'client/html/catalog/filter/attribute/domains', array( 'text', 'media' ) ); |
|
| 325 | + |
|
| 326 | + $attributes = $manager->searchItems( $search, $domains ); |
|
| 327 | + |
|
| 328 | + foreach( $attributes as $id => $item ) { |
|
| 329 | + $attrMap[$item->getType()][$id] = $item; |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + if( !empty( $attrTypes ) ) |
|
| 333 | + { |
|
| 334 | + $sortedMap = array(); |
|
| 335 | + |
|
| 336 | + foreach( $attrTypes as $type ) |
|
| 337 | + { |
|
| 338 | + if( isset( $attrMap[$type] ) ) { |
|
| 339 | + $sortedMap[$type] = $attrMap[$type]; |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + $attrMap = $sortedMap; |
|
| 344 | + } |
|
| 345 | + else |
|
| 346 | + { |
|
| 347 | + ksort( $attrMap ); |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 351 | + $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 352 | + |
|
| 353 | + // Delete cache when attributes are added or deleted even in "tag-all" mode |
|
| 354 | + $this->tags[] = 'attribute'; |
|
| 355 | + |
|
| 356 | + |
|
| 357 | + $view->attributeMap = $attrMap; |
|
| 358 | + |
|
| 359 | + $this->cache = $view; |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 363 | + $tags = array_merge( $tags, $this->tags ); |
|
| 364 | + |
|
| 365 | + return $this->cache; |
|
| 366 | + } |
|
| 367 | 367 | } |
| 368 | 368 | \ No newline at end of file |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/filter/search/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog filter search 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/filter/search/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | - |
|
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->searchBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/catalog/filter/search/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the catalog filter search client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/catalog/filter/search/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/catalog/filter/search/standard/template-body'; |
|
| 101 | - $default = 'catalog/filter/search-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->searchHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/catalog/filter/search/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the catalog filter search client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/catalog/filter/search/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/catalog/filter/search/standard/template-header'; |
|
| 147 | - $default = 'catalog/filter/search-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/catalog/filter/search/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the catalog filter search html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/catalog/filter/search/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/catalog/filter/search/decorators/global |
|
| 185 | - * @see client/html/catalog/filter/search/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/catalog/filter/search/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the catalog filter search html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/catalog/filter/search/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/catalog/filter/search/decorators/excludes |
|
| 209 | - * @see client/html/catalog/filter/search/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/catalog/filter/search/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the catalog filter search html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/catalog/filter/search/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/catalog/filter/search/decorators/excludes |
|
| 233 | - * @see client/html/catalog/filter/search/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'catalog/filter/search/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/catalog/filter/search/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog filter search 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/filter/search/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->searchBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/catalog/filter/search/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the catalog filter search client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/catalog/filter/search/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/catalog/filter/search/standard/template-body'; |
|
| 101 | + $default = 'catalog/filter/search-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->searchHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/catalog/filter/search/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the catalog filter search client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/catalog/filter/search/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/catalog/filter/search/standard/template-header'; |
|
| 147 | + $default = 'catalog/filter/search-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/catalog/filter/search/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the catalog filter search html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/catalog/filter/search/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/catalog/filter/search/decorators/global |
|
| 185 | + * @see client/html/catalog/filter/search/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/catalog/filter/search/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the catalog filter search html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/catalog/filter/search/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/catalog/filter/search/decorators/excludes |
|
| 209 | + * @see client/html/catalog/filter/search/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/catalog/filter/search/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the catalog filter search html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/catalog/filter/search/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/catalog/filter/search/decorators/excludes |
|
| 233 | + * @see client/html/catalog/filter/search/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'catalog/filter/search/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -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 filter 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/filter/name |
|
| 37 | - * Class name of the used catalog filter 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\Filter\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Catalog\Filter\Myfilter |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/catalog/filter/name = Myfilter |
|
| 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 "MyFilter"! |
|
| 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/filter/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a filter 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/filter/name |
|
| 37 | + * Class name of the used catalog filter 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\Filter\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Catalog\Filter\Myfilter |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/catalog/filter/name = Myfilter |
|
| 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 "MyFilter"! |
|
| 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/filter/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Catalog\\Filter\\' . $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\\Filter\\' . $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\\Filter\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Catalog\\Filter\\' . $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/filter' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'catalog/filter' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -19,519 +19,519 @@ |
||
| 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 | - private static $headerSingleton; |
|
| 26 | - |
|
| 27 | - /** client/html/catalog/filter/standard/subparts |
|
| 28 | - * List of HTML sub-clients rendered within the catalog filter section |
|
| 29 | - * |
|
| 30 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 31 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 32 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 33 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 34 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 35 | - * the output that is placed inside the container of its parent. |
|
| 36 | - * |
|
| 37 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 38 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 39 | - * determines the order of the output of these sub-clients inside the parent |
|
| 40 | - * container. If the configured list of clients is |
|
| 41 | - * |
|
| 42 | - * array( "subclient1", "subclient2" ) |
|
| 43 | - * |
|
| 44 | - * you can easily change the order of the output by reordering the subparts: |
|
| 45 | - * |
|
| 46 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 47 | - * |
|
| 48 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 49 | - * |
|
| 50 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 51 | - * |
|
| 52 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 53 | - * should support adding, removing or reordering content by a fluid like |
|
| 54 | - * design. |
|
| 55 | - * |
|
| 56 | - * @param array List of sub-client names |
|
| 57 | - * @since 2014.03 |
|
| 58 | - * @category Developer |
|
| 59 | - */ |
|
| 60 | - private $subPartPath = 'client/html/catalog/filter/standard/subparts'; |
|
| 61 | - |
|
| 62 | - /** client/html/catalog/filter/search/name |
|
| 63 | - * Name of the search part used by the catalog filter client implementation |
|
| 64 | - * |
|
| 65 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Search\Myname". |
|
| 66 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 67 | - * |
|
| 68 | - * @param string Last part of the client class name |
|
| 69 | - * @since 2014.03 |
|
| 70 | - * @category Developer |
|
| 71 | - */ |
|
| 72 | - |
|
| 73 | - /** client/html/catalog/filter/tree/name |
|
| 74 | - * Name of the tree part used by the catalog filter client implementation |
|
| 75 | - * |
|
| 76 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Tree\Myname". |
|
| 77 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 78 | - * |
|
| 79 | - * @param string Last part of the client class name |
|
| 80 | - * @since 2014.03 |
|
| 81 | - * @category Developer |
|
| 82 | - */ |
|
| 83 | - |
|
| 84 | - /** client/html/catalog/filter/attribute/name |
|
| 85 | - * Name of the attribute part used by the catalog filter client implementation |
|
| 86 | - * |
|
| 87 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Attribute\Myname". |
|
| 88 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 89 | - * |
|
| 90 | - * @param string Last part of the client class name |
|
| 91 | - * @since 2014.03 |
|
| 92 | - * @category Developer |
|
| 93 | - */ |
|
| 94 | - private $subPartNames = array( 'search', 'tree', 'attribute' ); |
|
| 95 | - private $cache; |
|
| 96 | - |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * Returns the HTML code for insertion into the body. |
|
| 100 | - * |
|
| 101 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 102 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 103 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 104 | - * @return string HTML code |
|
| 105 | - */ |
|
| 106 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 107 | - { |
|
| 108 | - $prefixes = array( 'f' ); |
|
| 109 | - $context = $this->getContext(); |
|
| 110 | - |
|
| 111 | - /** client/html/catalog/filter |
|
| 112 | - * All parameters defined for the catalog filter component and its subparts |
|
| 113 | - * |
|
| 114 | - * This returns all settings related to the filter component. |
|
| 115 | - * Please refer to the single settings for details. |
|
| 116 | - * |
|
| 117 | - * @param array Associative list of name/value settings |
|
| 118 | - * @category Developer |
|
| 119 | - * @see client/html/catalog#filter |
|
| 120 | - */ |
|
| 121 | - $confkey = 'client/html/catalog/filter'; |
|
| 122 | - |
|
| 123 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 124 | - { |
|
| 125 | - $view = $this->getView(); |
|
| 126 | - |
|
| 127 | - try |
|
| 128 | - { |
|
| 129 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 130 | - |
|
| 131 | - $html = ''; |
|
| 132 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 133 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 134 | - } |
|
| 135 | - $view->filterBody = $html; |
|
| 136 | - } |
|
| 137 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 138 | - { |
|
| 139 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 140 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 141 | - } |
|
| 142 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 143 | - { |
|
| 144 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 145 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 146 | - } |
|
| 147 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 148 | - { |
|
| 149 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 150 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 151 | - } |
|
| 152 | - catch( \Exception $e ) |
|
| 153 | - { |
|
| 154 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 155 | - |
|
| 156 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 157 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** client/html/catalog/filter/standard/template-body |
|
| 161 | - * Relative path to the HTML body template of the catalog filter client. |
|
| 162 | - * |
|
| 163 | - * The template file contains the HTML code and processing instructions |
|
| 164 | - * to generate the result shown in the body of the frontend. The |
|
| 165 | - * configuration string is the path to the template file relative |
|
| 166 | - * to the templates directory (usually 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 body |
|
| 176 | - * @since 2014.03 |
|
| 177 | - * @category Developer |
|
| 178 | - * @see client/html/catalog/filter/standard/template-header |
|
| 179 | - */ |
|
| 180 | - $tplconf = 'client/html/catalog/filter/standard/template-body'; |
|
| 181 | - $default = 'catalog/filter/body-default.php'; |
|
| 182 | - |
|
| 183 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 184 | - |
|
| 185 | - $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 186 | - } |
|
| 187 | - else |
|
| 188 | - { |
|
| 189 | - $html = $this->modifyBody( $html, $uid ); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - return $html; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * Returns the HTML string for insertion into the header. |
|
| 198 | - * |
|
| 199 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 200 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 201 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 202 | - * @return string|null String including HTML tags for the header on error |
|
| 203 | - */ |
|
| 204 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 205 | - { |
|
| 206 | - if( self::$headerSingleton !== null ) { |
|
| 207 | - return ''; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - self::$headerSingleton = true; |
|
| 211 | - |
|
| 212 | - $prefixes = array( 'f' ); |
|
| 213 | - $context = $this->getContext(); |
|
| 214 | - $confkey = 'client/html/catalog/filter'; |
|
| 215 | - |
|
| 216 | - if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 217 | - { |
|
| 218 | - $view = $this->getView(); |
|
| 219 | - |
|
| 220 | - try |
|
| 221 | - { |
|
| 222 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 223 | - |
|
| 224 | - $html = ''; |
|
| 225 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 226 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 227 | - } |
|
| 228 | - $view->filterHeader = $html; |
|
| 229 | - } |
|
| 230 | - catch( \Exception $e ) |
|
| 231 | - { |
|
| 232 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - /** client/html/catalog/filter/standard/template-header |
|
| 236 | - * Relative path to the HTML header template of the catalog filter client. |
|
| 237 | - * |
|
| 238 | - * The template file contains the HTML code and processing instructions |
|
| 239 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 240 | - * of the rendered page in the frontend. The configuration string is the |
|
| 241 | - * path to the template file relative to the templates directory (usually |
|
| 242 | - * in client/html/templates). |
|
| 243 | - * |
|
| 244 | - * You can overwrite the template file configuration in extensions and |
|
| 245 | - * provide alternative templates. These alternative templates should be |
|
| 246 | - * named like the default one but with the string "standard" replaced by |
|
| 247 | - * an unique name. You may use the name of your project for this. If |
|
| 248 | - * you've implemented an alternative client class as well, "standard" |
|
| 249 | - * should be replaced by the name of the new class. |
|
| 250 | - * |
|
| 251 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 252 | - * @since 2014.03 |
|
| 253 | - * @category Developer |
|
| 254 | - * @see client/html/catalog/filter/standard/template-body |
|
| 255 | - */ |
|
| 256 | - $tplconf = 'client/html/catalog/filter/standard/template-header'; |
|
| 257 | - $default = 'catalog/filter/header-default.php'; |
|
| 258 | - |
|
| 259 | - $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 260 | - |
|
| 261 | - $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 262 | - } |
|
| 263 | - else |
|
| 264 | - { |
|
| 265 | - $html = $this->modifyHeader( $html, $uid ); |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - return $html; |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - |
|
| 272 | - /** |
|
| 273 | - * Returns the sub-client given by its name. |
|
| 274 | - * |
|
| 275 | - * @param string $type Name of the client type |
|
| 276 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 277 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 278 | - */ |
|
| 279 | - public function getSubClient( $type, $name = null ) |
|
| 280 | - { |
|
| 281 | - /** client/html/catalog/filter/decorators/excludes |
|
| 282 | - * Excludes decorators added by the "common" option from the catalog filter html client |
|
| 283 | - * |
|
| 284 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 285 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 286 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 287 | - * modify what is returned to the caller. |
|
| 288 | - * |
|
| 289 | - * This option allows you to remove a decorator added via |
|
| 290 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 291 | - * around the html client. |
|
| 292 | - * |
|
| 293 | - * client/html/catalog/filter/decorators/excludes = array( 'decorator1' ) |
|
| 294 | - * |
|
| 295 | - * This would remove the decorator named "decorator1" from the list of |
|
| 296 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 297 | - * "client/html/common/decorators/default" to the html client. |
|
| 298 | - * |
|
| 299 | - * @param array List of decorator names |
|
| 300 | - * @since 2014.05 |
|
| 301 | - * @category Developer |
|
| 302 | - * @see client/html/common/decorators/default |
|
| 303 | - * @see client/html/catalog/filter/decorators/global |
|
| 304 | - * @see client/html/catalog/filter/decorators/local |
|
| 305 | - */ |
|
| 306 | - |
|
| 307 | - /** client/html/catalog/filter/decorators/global |
|
| 308 | - * Adds a list of globally available decorators only to the catalog filter html client |
|
| 309 | - * |
|
| 310 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 311 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 312 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 313 | - * modify what is returned to the caller. |
|
| 314 | - * |
|
| 315 | - * This option allows you to wrap global decorators |
|
| 316 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 317 | - * |
|
| 318 | - * client/html/catalog/filter/decorators/global = array( 'decorator1' ) |
|
| 319 | - * |
|
| 320 | - * This would add the decorator named "decorator1" defined by |
|
| 321 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 322 | - * |
|
| 323 | - * @param array List of decorator names |
|
| 324 | - * @since 2014.05 |
|
| 325 | - * @category Developer |
|
| 326 | - * @see client/html/common/decorators/default |
|
| 327 | - * @see client/html/catalog/filter/decorators/excludes |
|
| 328 | - * @see client/html/catalog/filter/decorators/local |
|
| 329 | - */ |
|
| 330 | - |
|
| 331 | - /** client/html/catalog/filter/decorators/local |
|
| 332 | - * Adds a list of local decorators only to the catalog filter html client |
|
| 333 | - * |
|
| 334 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 335 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 336 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 337 | - * modify what is returned to the caller. |
|
| 338 | - * |
|
| 339 | - * This option allows you to wrap local decorators |
|
| 340 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 341 | - * |
|
| 342 | - * client/html/catalog/filter/decorators/local = array( 'decorator2' ) |
|
| 343 | - * |
|
| 344 | - * This would add the decorator named "decorator2" defined by |
|
| 345 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 346 | - * |
|
| 347 | - * @param array List of decorator names |
|
| 348 | - * @since 2014.05 |
|
| 349 | - * @category Developer |
|
| 350 | - * @see client/html/common/decorators/default |
|
| 351 | - * @see client/html/catalog/filter/decorators/excludes |
|
| 352 | - * @see client/html/catalog/filter/decorators/global |
|
| 353 | - */ |
|
| 354 | - |
|
| 355 | - return $this->createSubClient( 'catalog/filter/' . $type, $name ); |
|
| 356 | - } |
|
| 357 | - |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 361 | - * |
|
| 362 | - * @param string $content Cached content |
|
| 363 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 364 | - * @return string Modified body content |
|
| 365 | - */ |
|
| 366 | - public function modifyBody( $content, $uid ) |
|
| 367 | - { |
|
| 368 | - $content = parent::modifyBody( $content, $uid ); |
|
| 369 | - |
|
| 370 | - return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.filter.csrf' ); |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - |
|
| 374 | - /** |
|
| 375 | - * Processes the input, e.g. store given values. |
|
| 376 | - * A view must be available and this method doesn't generate any output |
|
| 377 | - * besides setting view variables. |
|
| 378 | - */ |
|
| 379 | - public function process() |
|
| 380 | - { |
|
| 381 | - $context = $this->getContext(); |
|
| 382 | - $view = $this->getView(); |
|
| 383 | - |
|
| 384 | - try |
|
| 385 | - { |
|
| 386 | - parent::process(); |
|
| 387 | - } |
|
| 388 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 389 | - { |
|
| 390 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 391 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 392 | - } |
|
| 393 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 394 | - { |
|
| 395 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 396 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 397 | - } |
|
| 398 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 399 | - { |
|
| 400 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 401 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 402 | - } |
|
| 403 | - catch( \Exception $e ) |
|
| 404 | - { |
|
| 405 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 406 | - |
|
| 407 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 408 | - $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 409 | - } |
|
| 410 | - } |
|
| 411 | - |
|
| 412 | - |
|
| 413 | - protected function getSubClientNames() |
|
| 414 | - { |
|
| 415 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - |
|
| 419 | - /** |
|
| 420 | - * Sets the necessary parameter values in the view. |
|
| 421 | - * |
|
| 422 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 423 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 424 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 425 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 426 | - */ |
|
| 427 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 428 | - { |
|
| 429 | - if( !isset( $this->cache ) ) |
|
| 430 | - { |
|
| 431 | - $config = $this->getContext()->getConfig(); |
|
| 432 | - |
|
| 433 | - /** client/html/catalog/count/enable |
|
| 434 | - * Enables or disables displaying product counts in the catalog filter |
|
| 435 | - * |
|
| 436 | - * This configuration option allows shop owners to display product |
|
| 437 | - * counts in the catalog filter or to disable fetching product count |
|
| 438 | - * information. |
|
| 439 | - * |
|
| 440 | - * The product count information is fetched via AJAX and inserted via |
|
| 441 | - * Javascript. This allows to cache parts of the catalog filter by |
|
| 442 | - * leaving out such highly dynamic content like product count which |
|
| 443 | - * changes with used filter parameter. |
|
| 444 | - * |
|
| 445 | - * @param boolean Value of "1" to display product counts, "0" to disable them |
|
| 446 | - * @since 2014.03 |
|
| 447 | - * @category User |
|
| 448 | - * @category Developer |
|
| 449 | - * @see client/html/catalog/count/url/target |
|
| 450 | - * @see client/html/catalog/count/url/controller |
|
| 451 | - * @see client/html/catalog/count/url/action |
|
| 452 | - * @see client/html/catalog/count/url/config |
|
| 453 | - */ |
|
| 454 | - if( $config->get( 'client/html/catalog/count/enable', true ) == true ) |
|
| 455 | - { |
|
| 456 | - /** client/html/catalog/count/url/target |
|
| 457 | - * Destination of the URL where the controller specified in the URL is known |
|
| 458 | - * |
|
| 459 | - * The destination can be a page ID like in a content management system or the |
|
| 460 | - * module of a software development framework. This "target" must contain or know |
|
| 461 | - * the controller that should be called by the generated URL. |
|
| 462 | - * |
|
| 463 | - * @param string Destination of the URL |
|
| 464 | - * @since 2014.03 |
|
| 465 | - * @category Developer |
|
| 466 | - * @see client/html/catalog/count/url/controller |
|
| 467 | - * @see client/html/catalog/count/url/action |
|
| 468 | - * @see client/html/catalog/count/url/config |
|
| 469 | - */ |
|
| 470 | - $target = $config->get( 'client/html/catalog/count/url/target' ); |
|
| 471 | - |
|
| 472 | - /** client/html/catalog/count/url/controller |
|
| 473 | - * Name of the controller whose action should be called |
|
| 474 | - * |
|
| 475 | - * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 476 | - * that create parts of the output displayed in the generated HTML page. Controller |
|
| 477 | - * names are usually alpha-numeric. |
|
| 478 | - * |
|
| 479 | - * @param string Name of the controller |
|
| 480 | - * @since 2014.03 |
|
| 481 | - * @category Developer |
|
| 482 | - * @see client/html/catalog/count/url/target |
|
| 483 | - * @see client/html/catalog/count/url/action |
|
| 484 | - * @see client/html/catalog/count/url/config |
|
| 485 | - */ |
|
| 486 | - $controller = $config->get( 'client/html/catalog/count/url/controller', 'catalog' ); |
|
| 487 | - |
|
| 488 | - /** client/html/catalog/count/url/action |
|
| 489 | - * Name of the action that should create the output |
|
| 490 | - * |
|
| 491 | - * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 492 | - * controller that create parts of the output displayed in the generated HTML page. |
|
| 493 | - * Action names are usually alpha-numeric. |
|
| 494 | - * |
|
| 495 | - * @param string Name of the action |
|
| 496 | - * @since 2014.03 |
|
| 497 | - * @category Developer |
|
| 498 | - * @see client/html/catalog/count/url/target |
|
| 499 | - * @see client/html/catalog/count/url/controller |
|
| 500 | - * @see client/html/catalog/count/url/config |
|
| 501 | - */ |
|
| 502 | - $action = $config->get( 'client/html/catalog/count/url/action', 'count' ); |
|
| 503 | - |
|
| 504 | - /** client/html/catalog/count/url/config |
|
| 505 | - * Associative list of configuration options used for generating the URL |
|
| 506 | - * |
|
| 507 | - * You can specify additional options as key/value pairs used when generating |
|
| 508 | - * the URLs, like |
|
| 509 | - * |
|
| 510 | - * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 511 | - * |
|
| 512 | - * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 513 | - * framework. This is because the infrastructure of the application is used for |
|
| 514 | - * generating the URLs. The full list of available config options is referenced |
|
| 515 | - * in the "see also" section of this page. |
|
| 516 | - * |
|
| 517 | - * @param string Associative list of configuration options |
|
| 518 | - * @since 2014.03 |
|
| 519 | - * @category Developer |
|
| 520 | - * @see client/html/catalog/count/url/target |
|
| 521 | - * @see client/html/catalog/count/url/controller |
|
| 522 | - * @see client/html/catalog/count/url/action |
|
| 523 | - * @see client/html/url/config |
|
| 524 | - */ |
|
| 525 | - $config = $config->get( 'client/html/catalog/count/url/config', array() ); |
|
| 526 | - |
|
| 527 | - $params = $this->getClientParams( $view->param(), array( 'f' ) ); |
|
| 528 | - |
|
| 529 | - $view->filterCountUrl = $view->url( $target, $controller, $action, $params, array(), $config ); |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - $this->cache = $view; |
|
| 533 | - } |
|
| 534 | - |
|
| 535 | - return $this->cache; |
|
| 536 | - } |
|
| 25 | + private static $headerSingleton; |
|
| 26 | + |
|
| 27 | + /** client/html/catalog/filter/standard/subparts |
|
| 28 | + * List of HTML sub-clients rendered within the catalog filter section |
|
| 29 | + * |
|
| 30 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 31 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 32 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 33 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 34 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 35 | + * the output that is placed inside the container of its parent. |
|
| 36 | + * |
|
| 37 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 38 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 39 | + * determines the order of the output of these sub-clients inside the parent |
|
| 40 | + * container. If the configured list of clients is |
|
| 41 | + * |
|
| 42 | + * array( "subclient1", "subclient2" ) |
|
| 43 | + * |
|
| 44 | + * you can easily change the order of the output by reordering the subparts: |
|
| 45 | + * |
|
| 46 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 47 | + * |
|
| 48 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 49 | + * |
|
| 50 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 51 | + * |
|
| 52 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 53 | + * should support adding, removing or reordering content by a fluid like |
|
| 54 | + * design. |
|
| 55 | + * |
|
| 56 | + * @param array List of sub-client names |
|
| 57 | + * @since 2014.03 |
|
| 58 | + * @category Developer |
|
| 59 | + */ |
|
| 60 | + private $subPartPath = 'client/html/catalog/filter/standard/subparts'; |
|
| 61 | + |
|
| 62 | + /** client/html/catalog/filter/search/name |
|
| 63 | + * Name of the search part used by the catalog filter client implementation |
|
| 64 | + * |
|
| 65 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Search\Myname". |
|
| 66 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 67 | + * |
|
| 68 | + * @param string Last part of the client class name |
|
| 69 | + * @since 2014.03 |
|
| 70 | + * @category Developer |
|
| 71 | + */ |
|
| 72 | + |
|
| 73 | + /** client/html/catalog/filter/tree/name |
|
| 74 | + * Name of the tree part used by the catalog filter client implementation |
|
| 75 | + * |
|
| 76 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Tree\Myname". |
|
| 77 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 78 | + * |
|
| 79 | + * @param string Last part of the client class name |
|
| 80 | + * @since 2014.03 |
|
| 81 | + * @category Developer |
|
| 82 | + */ |
|
| 83 | + |
|
| 84 | + /** client/html/catalog/filter/attribute/name |
|
| 85 | + * Name of the attribute part used by the catalog filter client implementation |
|
| 86 | + * |
|
| 87 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Attribute\Myname". |
|
| 88 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 89 | + * |
|
| 90 | + * @param string Last part of the client class name |
|
| 91 | + * @since 2014.03 |
|
| 92 | + * @category Developer |
|
| 93 | + */ |
|
| 94 | + private $subPartNames = array( 'search', 'tree', 'attribute' ); |
|
| 95 | + private $cache; |
|
| 96 | + |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * Returns the HTML code for insertion into the body. |
|
| 100 | + * |
|
| 101 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 102 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 103 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 104 | + * @return string HTML code |
|
| 105 | + */ |
|
| 106 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 107 | + { |
|
| 108 | + $prefixes = array( 'f' ); |
|
| 109 | + $context = $this->getContext(); |
|
| 110 | + |
|
| 111 | + /** client/html/catalog/filter |
|
| 112 | + * All parameters defined for the catalog filter component and its subparts |
|
| 113 | + * |
|
| 114 | + * This returns all settings related to the filter component. |
|
| 115 | + * Please refer to the single settings for details. |
|
| 116 | + * |
|
| 117 | + * @param array Associative list of name/value settings |
|
| 118 | + * @category Developer |
|
| 119 | + * @see client/html/catalog#filter |
|
| 120 | + */ |
|
| 121 | + $confkey = 'client/html/catalog/filter'; |
|
| 122 | + |
|
| 123 | + if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null ) |
|
| 124 | + { |
|
| 125 | + $view = $this->getView(); |
|
| 126 | + |
|
| 127 | + try |
|
| 128 | + { |
|
| 129 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 130 | + |
|
| 131 | + $html = ''; |
|
| 132 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 133 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 134 | + } |
|
| 135 | + $view->filterBody = $html; |
|
| 136 | + } |
|
| 137 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 138 | + { |
|
| 139 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 140 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 141 | + } |
|
| 142 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 143 | + { |
|
| 144 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 145 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 146 | + } |
|
| 147 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 148 | + { |
|
| 149 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 150 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 151 | + } |
|
| 152 | + catch( \Exception $e ) |
|
| 153 | + { |
|
| 154 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 155 | + |
|
| 156 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 157 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** client/html/catalog/filter/standard/template-body |
|
| 161 | + * Relative path to the HTML body template of the catalog filter client. |
|
| 162 | + * |
|
| 163 | + * The template file contains the HTML code and processing instructions |
|
| 164 | + * to generate the result shown in the body of the frontend. The |
|
| 165 | + * configuration string is the path to the template file relative |
|
| 166 | + * to the templates directory (usually 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 body |
|
| 176 | + * @since 2014.03 |
|
| 177 | + * @category Developer |
|
| 178 | + * @see client/html/catalog/filter/standard/template-header |
|
| 179 | + */ |
|
| 180 | + $tplconf = 'client/html/catalog/filter/standard/template-body'; |
|
| 181 | + $default = 'catalog/filter/body-default.php'; |
|
| 182 | + |
|
| 183 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 184 | + |
|
| 185 | + $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 186 | + } |
|
| 187 | + else |
|
| 188 | + { |
|
| 189 | + $html = $this->modifyBody( $html, $uid ); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + return $html; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * Returns the HTML string for insertion into the header. |
|
| 198 | + * |
|
| 199 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 200 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 201 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 202 | + * @return string|null String including HTML tags for the header on error |
|
| 203 | + */ |
|
| 204 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 205 | + { |
|
| 206 | + if( self::$headerSingleton !== null ) { |
|
| 207 | + return ''; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + self::$headerSingleton = true; |
|
| 211 | + |
|
| 212 | + $prefixes = array( 'f' ); |
|
| 213 | + $context = $this->getContext(); |
|
| 214 | + $confkey = 'client/html/catalog/filter'; |
|
| 215 | + |
|
| 216 | + if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null ) |
|
| 217 | + { |
|
| 218 | + $view = $this->getView(); |
|
| 219 | + |
|
| 220 | + try |
|
| 221 | + { |
|
| 222 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 223 | + |
|
| 224 | + $html = ''; |
|
| 225 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 226 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 227 | + } |
|
| 228 | + $view->filterHeader = $html; |
|
| 229 | + } |
|
| 230 | + catch( \Exception $e ) |
|
| 231 | + { |
|
| 232 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + /** client/html/catalog/filter/standard/template-header |
|
| 236 | + * Relative path to the HTML header template of the catalog filter client. |
|
| 237 | + * |
|
| 238 | + * The template file contains the HTML code and processing instructions |
|
| 239 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 240 | + * of the rendered page in the frontend. The configuration string is the |
|
| 241 | + * path to the template file relative to the templates directory (usually |
|
| 242 | + * in client/html/templates). |
|
| 243 | + * |
|
| 244 | + * You can overwrite the template file configuration in extensions and |
|
| 245 | + * provide alternative templates. These alternative templates should be |
|
| 246 | + * named like the default one but with the string "standard" replaced by |
|
| 247 | + * an unique name. You may use the name of your project for this. If |
|
| 248 | + * you've implemented an alternative client class as well, "standard" |
|
| 249 | + * should be replaced by the name of the new class. |
|
| 250 | + * |
|
| 251 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 252 | + * @since 2014.03 |
|
| 253 | + * @category Developer |
|
| 254 | + * @see client/html/catalog/filter/standard/template-body |
|
| 255 | + */ |
|
| 256 | + $tplconf = 'client/html/catalog/filter/standard/template-header'; |
|
| 257 | + $default = 'catalog/filter/header-default.php'; |
|
| 258 | + |
|
| 259 | + $html = $view->render( $view->config( $tplconf, $default ) ); |
|
| 260 | + |
|
| 261 | + $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire ); |
|
| 262 | + } |
|
| 263 | + else |
|
| 264 | + { |
|
| 265 | + $html = $this->modifyHeader( $html, $uid ); |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + return $html; |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + |
|
| 272 | + /** |
|
| 273 | + * Returns the sub-client given by its name. |
|
| 274 | + * |
|
| 275 | + * @param string $type Name of the client type |
|
| 276 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 277 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 278 | + */ |
|
| 279 | + public function getSubClient( $type, $name = null ) |
|
| 280 | + { |
|
| 281 | + /** client/html/catalog/filter/decorators/excludes |
|
| 282 | + * Excludes decorators added by the "common" option from the catalog filter html client |
|
| 283 | + * |
|
| 284 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 285 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 286 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 287 | + * modify what is returned to the caller. |
|
| 288 | + * |
|
| 289 | + * This option allows you to remove a decorator added via |
|
| 290 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 291 | + * around the html client. |
|
| 292 | + * |
|
| 293 | + * client/html/catalog/filter/decorators/excludes = array( 'decorator1' ) |
|
| 294 | + * |
|
| 295 | + * This would remove the decorator named "decorator1" from the list of |
|
| 296 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 297 | + * "client/html/common/decorators/default" to the html client. |
|
| 298 | + * |
|
| 299 | + * @param array List of decorator names |
|
| 300 | + * @since 2014.05 |
|
| 301 | + * @category Developer |
|
| 302 | + * @see client/html/common/decorators/default |
|
| 303 | + * @see client/html/catalog/filter/decorators/global |
|
| 304 | + * @see client/html/catalog/filter/decorators/local |
|
| 305 | + */ |
|
| 306 | + |
|
| 307 | + /** client/html/catalog/filter/decorators/global |
|
| 308 | + * Adds a list of globally available decorators only to the catalog filter html client |
|
| 309 | + * |
|
| 310 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 311 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 312 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 313 | + * modify what is returned to the caller. |
|
| 314 | + * |
|
| 315 | + * This option allows you to wrap global decorators |
|
| 316 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 317 | + * |
|
| 318 | + * client/html/catalog/filter/decorators/global = array( 'decorator1' ) |
|
| 319 | + * |
|
| 320 | + * This would add the decorator named "decorator1" defined by |
|
| 321 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 322 | + * |
|
| 323 | + * @param array List of decorator names |
|
| 324 | + * @since 2014.05 |
|
| 325 | + * @category Developer |
|
| 326 | + * @see client/html/common/decorators/default |
|
| 327 | + * @see client/html/catalog/filter/decorators/excludes |
|
| 328 | + * @see client/html/catalog/filter/decorators/local |
|
| 329 | + */ |
|
| 330 | + |
|
| 331 | + /** client/html/catalog/filter/decorators/local |
|
| 332 | + * Adds a list of local decorators only to the catalog filter html client |
|
| 333 | + * |
|
| 334 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 335 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 336 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 337 | + * modify what is returned to the caller. |
|
| 338 | + * |
|
| 339 | + * This option allows you to wrap local decorators |
|
| 340 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 341 | + * |
|
| 342 | + * client/html/catalog/filter/decorators/local = array( 'decorator2' ) |
|
| 343 | + * |
|
| 344 | + * This would add the decorator named "decorator2" defined by |
|
| 345 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 346 | + * |
|
| 347 | + * @param array List of decorator names |
|
| 348 | + * @since 2014.05 |
|
| 349 | + * @category Developer |
|
| 350 | + * @see client/html/common/decorators/default |
|
| 351 | + * @see client/html/catalog/filter/decorators/excludes |
|
| 352 | + * @see client/html/catalog/filter/decorators/global |
|
| 353 | + */ |
|
| 354 | + |
|
| 355 | + return $this->createSubClient( 'catalog/filter/' . $type, $name ); |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 361 | + * |
|
| 362 | + * @param string $content Cached content |
|
| 363 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 364 | + * @return string Modified body content |
|
| 365 | + */ |
|
| 366 | + public function modifyBody( $content, $uid ) |
|
| 367 | + { |
|
| 368 | + $content = parent::modifyBody( $content, $uid ); |
|
| 369 | + |
|
| 370 | + return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.filter.csrf' ); |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + |
|
| 374 | + /** |
|
| 375 | + * Processes the input, e.g. store given values. |
|
| 376 | + * A view must be available and this method doesn't generate any output |
|
| 377 | + * besides setting view variables. |
|
| 378 | + */ |
|
| 379 | + public function process() |
|
| 380 | + { |
|
| 381 | + $context = $this->getContext(); |
|
| 382 | + $view = $this->getView(); |
|
| 383 | + |
|
| 384 | + try |
|
| 385 | + { |
|
| 386 | + parent::process(); |
|
| 387 | + } |
|
| 388 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 389 | + { |
|
| 390 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 391 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 392 | + } |
|
| 393 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 394 | + { |
|
| 395 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 396 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 397 | + } |
|
| 398 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 399 | + { |
|
| 400 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 401 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 402 | + } |
|
| 403 | + catch( \Exception $e ) |
|
| 404 | + { |
|
| 405 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 406 | + |
|
| 407 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 408 | + $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error; |
|
| 409 | + } |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + |
|
| 413 | + protected function getSubClientNames() |
|
| 414 | + { |
|
| 415 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + |
|
| 419 | + /** |
|
| 420 | + * Sets the necessary parameter values in the view. |
|
| 421 | + * |
|
| 422 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 423 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 424 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 425 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 426 | + */ |
|
| 427 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 428 | + { |
|
| 429 | + if( !isset( $this->cache ) ) |
|
| 430 | + { |
|
| 431 | + $config = $this->getContext()->getConfig(); |
|
| 432 | + |
|
| 433 | + /** client/html/catalog/count/enable |
|
| 434 | + * Enables or disables displaying product counts in the catalog filter |
|
| 435 | + * |
|
| 436 | + * This configuration option allows shop owners to display product |
|
| 437 | + * counts in the catalog filter or to disable fetching product count |
|
| 438 | + * information. |
|
| 439 | + * |
|
| 440 | + * The product count information is fetched via AJAX and inserted via |
|
| 441 | + * Javascript. This allows to cache parts of the catalog filter by |
|
| 442 | + * leaving out such highly dynamic content like product count which |
|
| 443 | + * changes with used filter parameter. |
|
| 444 | + * |
|
| 445 | + * @param boolean Value of "1" to display product counts, "0" to disable them |
|
| 446 | + * @since 2014.03 |
|
| 447 | + * @category User |
|
| 448 | + * @category Developer |
|
| 449 | + * @see client/html/catalog/count/url/target |
|
| 450 | + * @see client/html/catalog/count/url/controller |
|
| 451 | + * @see client/html/catalog/count/url/action |
|
| 452 | + * @see client/html/catalog/count/url/config |
|
| 453 | + */ |
|
| 454 | + if( $config->get( 'client/html/catalog/count/enable', true ) == true ) |
|
| 455 | + { |
|
| 456 | + /** client/html/catalog/count/url/target |
|
| 457 | + * Destination of the URL where the controller specified in the URL is known |
|
| 458 | + * |
|
| 459 | + * The destination can be a page ID like in a content management system or the |
|
| 460 | + * module of a software development framework. This "target" must contain or know |
|
| 461 | + * the controller that should be called by the generated URL. |
|
| 462 | + * |
|
| 463 | + * @param string Destination of the URL |
|
| 464 | + * @since 2014.03 |
|
| 465 | + * @category Developer |
|
| 466 | + * @see client/html/catalog/count/url/controller |
|
| 467 | + * @see client/html/catalog/count/url/action |
|
| 468 | + * @see client/html/catalog/count/url/config |
|
| 469 | + */ |
|
| 470 | + $target = $config->get( 'client/html/catalog/count/url/target' ); |
|
| 471 | + |
|
| 472 | + /** client/html/catalog/count/url/controller |
|
| 473 | + * Name of the controller whose action should be called |
|
| 474 | + * |
|
| 475 | + * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 476 | + * that create parts of the output displayed in the generated HTML page. Controller |
|
| 477 | + * names are usually alpha-numeric. |
|
| 478 | + * |
|
| 479 | + * @param string Name of the controller |
|
| 480 | + * @since 2014.03 |
|
| 481 | + * @category Developer |
|
| 482 | + * @see client/html/catalog/count/url/target |
|
| 483 | + * @see client/html/catalog/count/url/action |
|
| 484 | + * @see client/html/catalog/count/url/config |
|
| 485 | + */ |
|
| 486 | + $controller = $config->get( 'client/html/catalog/count/url/controller', 'catalog' ); |
|
| 487 | + |
|
| 488 | + /** client/html/catalog/count/url/action |
|
| 489 | + * Name of the action that should create the output |
|
| 490 | + * |
|
| 491 | + * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 492 | + * controller that create parts of the output displayed in the generated HTML page. |
|
| 493 | + * Action names are usually alpha-numeric. |
|
| 494 | + * |
|
| 495 | + * @param string Name of the action |
|
| 496 | + * @since 2014.03 |
|
| 497 | + * @category Developer |
|
| 498 | + * @see client/html/catalog/count/url/target |
|
| 499 | + * @see client/html/catalog/count/url/controller |
|
| 500 | + * @see client/html/catalog/count/url/config |
|
| 501 | + */ |
|
| 502 | + $action = $config->get( 'client/html/catalog/count/url/action', 'count' ); |
|
| 503 | + |
|
| 504 | + /** client/html/catalog/count/url/config |
|
| 505 | + * Associative list of configuration options used for generating the URL |
|
| 506 | + * |
|
| 507 | + * You can specify additional options as key/value pairs used when generating |
|
| 508 | + * the URLs, like |
|
| 509 | + * |
|
| 510 | + * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 511 | + * |
|
| 512 | + * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 513 | + * framework. This is because the infrastructure of the application is used for |
|
| 514 | + * generating the URLs. The full list of available config options is referenced |
|
| 515 | + * in the "see also" section of this page. |
|
| 516 | + * |
|
| 517 | + * @param string Associative list of configuration options |
|
| 518 | + * @since 2014.03 |
|
| 519 | + * @category Developer |
|
| 520 | + * @see client/html/catalog/count/url/target |
|
| 521 | + * @see client/html/catalog/count/url/controller |
|
| 522 | + * @see client/html/catalog/count/url/action |
|
| 523 | + * @see client/html/url/config |
|
| 524 | + */ |
|
| 525 | + $config = $config->get( 'client/html/catalog/count/url/config', array() ); |
|
| 526 | + |
|
| 527 | + $params = $this->getClientParams( $view->param(), array( 'f' ) ); |
|
| 528 | + |
|
| 529 | + $view->filterCountUrl = $view->url( $target, $controller, $action, $params, array(), $config ); |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + $this->cache = $view; |
|
| 533 | + } |
|
| 534 | + |
|
| 535 | + return $this->cache; |
|
| 536 | + } |
|
| 537 | 537 | } |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/confirm/retry/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout confirm retry 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/checkout/confirm/retry/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | - |
|
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->retryBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/checkout/confirm/retry/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the checkout confirm retry client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/checkout/confirm/retry/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/checkout/confirm/retry/standard/template-body'; |
|
| 101 | - $default = 'checkout/confirm/retry-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->retryHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/checkout/confirm/retry/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the checkout confirm retry client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/confirm/retry/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/confirm/retry/standard/template-header'; |
|
| 147 | - $default = 'checkout/confirm/retry-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/checkout/confirm/retry/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout confirm retry html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/checkout/confirm/retry/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/checkout/confirm/retry/decorators/global |
|
| 185 | - * @see client/html/checkout/confirm/retry/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/checkout/confirm/retry/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout confirm retry html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/checkout/confirm/retry/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/checkout/confirm/retry/decorators/excludes |
|
| 209 | - * @see client/html/checkout/confirm/retry/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/checkout/confirm/retry/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout confirm retry html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/checkout/confirm/retry/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/checkout/confirm/retry/decorators/excludes |
|
| 233 | - * @see client/html/checkout/confirm/retry/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'checkout/confirm/retry/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/checkout/confirm/retry/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout confirm retry 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/checkout/confirm/retry/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->retryBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/checkout/confirm/retry/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the checkout confirm retry client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/checkout/confirm/retry/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/checkout/confirm/retry/standard/template-body'; |
|
| 101 | + $default = 'checkout/confirm/retry-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->retryHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/checkout/confirm/retry/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the checkout confirm retry client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/confirm/retry/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/confirm/retry/standard/template-header'; |
|
| 147 | + $default = 'checkout/confirm/retry-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/checkout/confirm/retry/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout confirm retry html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/checkout/confirm/retry/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/checkout/confirm/retry/decorators/global |
|
| 185 | + * @see client/html/checkout/confirm/retry/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/checkout/confirm/retry/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout confirm retry html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/checkout/confirm/retry/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/checkout/confirm/retry/decorators/excludes |
|
| 209 | + * @see client/html/checkout/confirm/retry/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/checkout/confirm/retry/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout confirm retry html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/checkout/confirm/retry/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/checkout/confirm/retry/decorators/excludes |
|
| 233 | + * @see client/html/checkout/confirm/retry/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'checkout/confirm/retry/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -18,232 +18,232 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Summary\Service\Base |
|
| 21 | + extends \Aimeos\Client\Html\Common\Summary\Service\Base |
|
| 22 | 22 | { |
| 23 | - /** client/html/checkout/confirm/order/service/standard/subparts |
|
| 24 | - * List of HTML sub-clients rendered within the checkout confirm order service section |
|
| 25 | - * |
|
| 26 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | - * the output that is placed inside the container of its parent. |
|
| 32 | - * |
|
| 33 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | - * determines the order of the output of these sub-clients inside the parent |
|
| 36 | - * container. If the configured list of clients is |
|
| 37 | - * |
|
| 38 | - * array( "subclient1", "subclient2" ) |
|
| 39 | - * |
|
| 40 | - * you can easily change the order of the output by reordering the subparts: |
|
| 41 | - * |
|
| 42 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | - * |
|
| 44 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | - * |
|
| 46 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | - * |
|
| 48 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | - * should support adding, removing or reordering content by a fluid like |
|
| 50 | - * design. |
|
| 51 | - * |
|
| 52 | - * @param array List of sub-client names |
|
| 53 | - * @since 2015.11 |
|
| 54 | - * @category Developer |
|
| 55 | - */ |
|
| 56 | - private $subPartPath = 'client/html/checkout/confirm/order/service/standard/subparts'; |
|
| 57 | - private $subPartNames = array(); |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Returns the HTML code for insertion into the body. |
|
| 62 | - * |
|
| 63 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 64 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 65 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 66 | - * @return string HTML code |
|
| 67 | - */ |
|
| 68 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | - { |
|
| 70 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | - |
|
| 72 | - $html = ''; |
|
| 73 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 74 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | - } |
|
| 76 | - $view->serviceBody = $html; |
|
| 77 | - |
|
| 78 | - /** client/html/checkout/confirm/order/service/standard/template-body |
|
| 79 | - * Relative path to the HTML body template of the checkout confirm order service client. |
|
| 80 | - * |
|
| 81 | - * The template file contains the HTML code and processing instructions |
|
| 82 | - * to generate the result shown in the body of the frontend. The |
|
| 83 | - * configuration string is the path to the template file relative |
|
| 84 | - * to the templates directory (usually in client/html/templates). |
|
| 85 | - * |
|
| 86 | - * You can overwrite the template file configuration in extensions and |
|
| 87 | - * provide alternative templates. These alternative templates should be |
|
| 88 | - * named like the default one but with the string "standard" replaced by |
|
| 89 | - * an unique name. You may use the name of your project for this. If |
|
| 90 | - * you've implemented an alternative client class as well, "standard" |
|
| 91 | - * (second one) should be replaced by the name of the new class in lower |
|
| 92 | - * case. |
|
| 93 | - * |
|
| 94 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | - * @since 2015.11 |
|
| 96 | - * @category Developer |
|
| 97 | - * @see client/html/checkout/confirm/order/service/standard/template-header |
|
| 98 | - */ |
|
| 99 | - $tplconf = 'client/html/checkout/confirm/order/service/standard/template-body'; |
|
| 100 | - $default = 'common/summary/service-body-default.php'; |
|
| 101 | - |
|
| 102 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Returns the HTML string for insertion into the header. |
|
| 108 | - * |
|
| 109 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 110 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 111 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 112 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | - */ |
|
| 114 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | - { |
|
| 116 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | - |
|
| 118 | - $html = ''; |
|
| 119 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | - } |
|
| 122 | - $view->serviceHeader = $html; |
|
| 123 | - |
|
| 124 | - /** client/html/checkout/confirm/order/service/standard/template-header |
|
| 125 | - * Relative path to the HTML header template of the checkout confirm order service client. |
|
| 126 | - * |
|
| 127 | - * The template file contains the HTML code and processing instructions |
|
| 128 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 129 | - * of the rendered page in the frontend. The configuration string is the |
|
| 130 | - * path to the template file relative to the templates directory (usually |
|
| 131 | - * in client/html/templates). |
|
| 132 | - * |
|
| 133 | - * You can overwrite the template file configuration in extensions and |
|
| 134 | - * provide alternative templates. These alternative templates should be |
|
| 135 | - * named like the default one but with the string "standard" replaced by |
|
| 136 | - * an unique name. You may use the name of your project for this. If |
|
| 137 | - * you've implemented an alternative client class as well, "standard" |
|
| 138 | - * (second one) should be replaced by the name of the new class in lower |
|
| 139 | - * case. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2015.11 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/confirm/order/service/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/confirm/order/service/standard/template-header'; |
|
| 147 | - $default = 'common/summary/service-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/checkout/confirm/order/service/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout confirm order service html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/checkout/confirm/order/service/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/checkout/confirm/order/service/decorators/global |
|
| 185 | - * @see client/html/checkout/confirm/order/service/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/checkout/confirm/order/service/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout confirm order service html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/checkout/confirm/order/service/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/checkout/confirm/order/service/decorators/excludes |
|
| 209 | - * @see client/html/checkout/confirm/order/service/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/checkout/confirm/order/service/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout confirm order service html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/checkout/confirm/order/service/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/checkout/confirm/order/service/decorators/excludes |
|
| 233 | - * @see client/html/checkout/confirm/order/service/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'checkout/confirm/order/service/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 23 | + /** client/html/checkout/confirm/order/service/standard/subparts |
|
| 24 | + * List of HTML sub-clients rendered within the checkout confirm order service section |
|
| 25 | + * |
|
| 26 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | + * the output that is placed inside the container of its parent. |
|
| 32 | + * |
|
| 33 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | + * determines the order of the output of these sub-clients inside the parent |
|
| 36 | + * container. If the configured list of clients is |
|
| 37 | + * |
|
| 38 | + * array( "subclient1", "subclient2" ) |
|
| 39 | + * |
|
| 40 | + * you can easily change the order of the output by reordering the subparts: |
|
| 41 | + * |
|
| 42 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | + * |
|
| 44 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | + * |
|
| 46 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | + * |
|
| 48 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | + * should support adding, removing or reordering content by a fluid like |
|
| 50 | + * design. |
|
| 51 | + * |
|
| 52 | + * @param array List of sub-client names |
|
| 53 | + * @since 2015.11 |
|
| 54 | + * @category Developer |
|
| 55 | + */ |
|
| 56 | + private $subPartPath = 'client/html/checkout/confirm/order/service/standard/subparts'; |
|
| 57 | + private $subPartNames = array(); |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Returns the HTML code for insertion into the body. |
|
| 62 | + * |
|
| 63 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 64 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 65 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 66 | + * @return string HTML code |
|
| 67 | + */ |
|
| 68 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | + { |
|
| 70 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + |
|
| 72 | + $html = ''; |
|
| 73 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 74 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + } |
|
| 76 | + $view->serviceBody = $html; |
|
| 77 | + |
|
| 78 | + /** client/html/checkout/confirm/order/service/standard/template-body |
|
| 79 | + * Relative path to the HTML body template of the checkout confirm order service client. |
|
| 80 | + * |
|
| 81 | + * The template file contains the HTML code and processing instructions |
|
| 82 | + * to generate the result shown in the body of the frontend. The |
|
| 83 | + * configuration string is the path to the template file relative |
|
| 84 | + * to the templates directory (usually in client/html/templates). |
|
| 85 | + * |
|
| 86 | + * You can overwrite the template file configuration in extensions and |
|
| 87 | + * provide alternative templates. These alternative templates should be |
|
| 88 | + * named like the default one but with the string "standard" replaced by |
|
| 89 | + * an unique name. You may use the name of your project for this. If |
|
| 90 | + * you've implemented an alternative client class as well, "standard" |
|
| 91 | + * (second one) should be replaced by the name of the new class in lower |
|
| 92 | + * case. |
|
| 93 | + * |
|
| 94 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | + * @since 2015.11 |
|
| 96 | + * @category Developer |
|
| 97 | + * @see client/html/checkout/confirm/order/service/standard/template-header |
|
| 98 | + */ |
|
| 99 | + $tplconf = 'client/html/checkout/confirm/order/service/standard/template-body'; |
|
| 100 | + $default = 'common/summary/service-body-default.php'; |
|
| 101 | + |
|
| 102 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Returns the HTML string for insertion into the header. |
|
| 108 | + * |
|
| 109 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 110 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 111 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 112 | + * @return string|null String including HTML tags for the header on error |
|
| 113 | + */ |
|
| 114 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + { |
|
| 116 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + |
|
| 118 | + $html = ''; |
|
| 119 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + } |
|
| 122 | + $view->serviceHeader = $html; |
|
| 123 | + |
|
| 124 | + /** client/html/checkout/confirm/order/service/standard/template-header |
|
| 125 | + * Relative path to the HTML header template of the checkout confirm order service client. |
|
| 126 | + * |
|
| 127 | + * The template file contains the HTML code and processing instructions |
|
| 128 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 129 | + * of the rendered page in the frontend. The configuration string is the |
|
| 130 | + * path to the template file relative to the templates directory (usually |
|
| 131 | + * in client/html/templates). |
|
| 132 | + * |
|
| 133 | + * You can overwrite the template file configuration in extensions and |
|
| 134 | + * provide alternative templates. These alternative templates should be |
|
| 135 | + * named like the default one but with the string "standard" replaced by |
|
| 136 | + * an unique name. You may use the name of your project for this. If |
|
| 137 | + * you've implemented an alternative client class as well, "standard" |
|
| 138 | + * (second one) should be replaced by the name of the new class in lower |
|
| 139 | + * case. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2015.11 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/confirm/order/service/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/confirm/order/service/standard/template-header'; |
|
| 147 | + $default = 'common/summary/service-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/checkout/confirm/order/service/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout confirm order service html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/checkout/confirm/order/service/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/checkout/confirm/order/service/decorators/global |
|
| 185 | + * @see client/html/checkout/confirm/order/service/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/checkout/confirm/order/service/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout confirm order service html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/checkout/confirm/order/service/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/checkout/confirm/order/service/decorators/excludes |
|
| 209 | + * @see client/html/checkout/confirm/order/service/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/checkout/confirm/order/service/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout confirm order service html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/checkout/confirm/order/service/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/checkout/confirm/order/service/decorators/excludes |
|
| 233 | + * @see client/html/checkout/confirm/order/service/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'checkout/confirm/order/service/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -18,232 +18,232 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Summary\Coupon\Base |
|
| 21 | + extends \Aimeos\Client\Html\Common\Summary\Coupon\Base |
|
| 22 | 22 | { |
| 23 | - /** client/html/checkout/confirm/order/coupon/standard/subparts |
|
| 24 | - * List of HTML sub-clients rendered within the checkout confirm order coupon section |
|
| 25 | - * |
|
| 26 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | - * the output that is placed inside the container of its parent. |
|
| 32 | - * |
|
| 33 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | - * determines the order of the output of these sub-clients inside the parent |
|
| 36 | - * container. If the configured list of clients is |
|
| 37 | - * |
|
| 38 | - * array( "subclient1", "subclient2" ) |
|
| 39 | - * |
|
| 40 | - * you can easily change the order of the output by reordering the subparts: |
|
| 41 | - * |
|
| 42 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | - * |
|
| 44 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | - * |
|
| 46 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | - * |
|
| 48 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | - * should support adding, removing or reordering content by a fluid like |
|
| 50 | - * design. |
|
| 51 | - * |
|
| 52 | - * @param array List of sub-client names |
|
| 53 | - * @since 2015.11 |
|
| 54 | - * @category Developer |
|
| 55 | - */ |
|
| 56 | - private $subPartPath = 'client/html/checkout/confirm/order/coupon/standard/subparts'; |
|
| 57 | - private $subPartNames = array(); |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Returns the HTML code for insertion into the body. |
|
| 62 | - * |
|
| 63 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 64 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 65 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 66 | - * @return string HTML code |
|
| 67 | - */ |
|
| 68 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | - { |
|
| 70 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | - |
|
| 72 | - $html = ''; |
|
| 73 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 74 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | - } |
|
| 76 | - $view->couponBody = $html; |
|
| 77 | - |
|
| 78 | - /** client/html/checkout/confirm/order/coupon/standard/template-body |
|
| 79 | - * Relative path to the HTML body template of the checkout confirm order coupon client. |
|
| 80 | - * |
|
| 81 | - * The template file contains the HTML code and processing instructions |
|
| 82 | - * to generate the result shown in the body of the frontend. The |
|
| 83 | - * configuration string is the path to the template file relative |
|
| 84 | - * to the templates directory (usually in client/html/templates). |
|
| 85 | - * |
|
| 86 | - * You can overwrite the template file configuration in extensions and |
|
| 87 | - * provide alternative templates. These alternative templates should be |
|
| 88 | - * named like the default one but with the string "standard" replaced by |
|
| 89 | - * an unique name. You may use the name of your project for this. If |
|
| 90 | - * you've implemented an alternative client class as well, "standard" |
|
| 91 | - * (second one) should be replaced by the name of the new class in lower |
|
| 92 | - * case. |
|
| 93 | - * |
|
| 94 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | - * @since 2015.11 |
|
| 96 | - * @category Developer |
|
| 97 | - * @see client/html/checkout/confirm/order/coupon/standard/template-header |
|
| 98 | - */ |
|
| 99 | - $tplconf = 'client/html/checkout/confirm/order/coupon/standard/template-body'; |
|
| 100 | - $default = 'common/summary/coupon-body-default.php'; |
|
| 101 | - |
|
| 102 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Returns the HTML string for insertion into the header. |
|
| 108 | - * |
|
| 109 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 110 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 111 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 112 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | - */ |
|
| 114 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | - { |
|
| 116 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | - |
|
| 118 | - $html = ''; |
|
| 119 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | - } |
|
| 122 | - $view->couponHeader = $html; |
|
| 123 | - |
|
| 124 | - /** client/html/checkout/confirm/order/coupon/standard/template-header |
|
| 125 | - * Relative path to the HTML header template of the checkout confirm order coupon client. |
|
| 126 | - * |
|
| 127 | - * The template file contains the HTML code and processing instructions |
|
| 128 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 129 | - * of the rendered page in the frontend. The configuration string is the |
|
| 130 | - * path to the template file relative to the templates directory (usually |
|
| 131 | - * in client/html/templates). |
|
| 132 | - * |
|
| 133 | - * You can overwrite the template file configuration in extensions and |
|
| 134 | - * provide alternative templates. These alternative templates should be |
|
| 135 | - * named like the default one but with the string "standard" replaced by |
|
| 136 | - * an unique name. You may use the name of your project for this. If |
|
| 137 | - * you've implemented an alternative client class as well, "standard" |
|
| 138 | - * (second one) should be replaced by the name of the new class in lower |
|
| 139 | - * case. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2015.11 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/confirm/order/coupon/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/confirm/order/coupon/standard/template-header'; |
|
| 147 | - $default = 'common/summary/coupon-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/checkout/confirm/order/coupon/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout confirm order coupon html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/checkout/confirm/order/coupon/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/checkout/confirm/order/coupon/decorators/global |
|
| 185 | - * @see client/html/checkout/confirm/order/coupon/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/checkout/confirm/order/coupon/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout confirm order coupon html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/checkout/confirm/order/coupon/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/checkout/confirm/order/coupon/decorators/excludes |
|
| 209 | - * @see client/html/checkout/confirm/order/coupon/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/checkout/confirm/order/coupon/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout confirm order coupon html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/checkout/confirm/order/coupon/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/checkout/confirm/order/coupon/decorators/excludes |
|
| 233 | - * @see client/html/checkout/confirm/order/coupon/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'checkout/confirm/order/coupon/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 23 | + /** client/html/checkout/confirm/order/coupon/standard/subparts |
|
| 24 | + * List of HTML sub-clients rendered within the checkout confirm order coupon section |
|
| 25 | + * |
|
| 26 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | + * the output that is placed inside the container of its parent. |
|
| 32 | + * |
|
| 33 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | + * determines the order of the output of these sub-clients inside the parent |
|
| 36 | + * container. If the configured list of clients is |
|
| 37 | + * |
|
| 38 | + * array( "subclient1", "subclient2" ) |
|
| 39 | + * |
|
| 40 | + * you can easily change the order of the output by reordering the subparts: |
|
| 41 | + * |
|
| 42 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | + * |
|
| 44 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | + * |
|
| 46 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | + * |
|
| 48 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | + * should support adding, removing or reordering content by a fluid like |
|
| 50 | + * design. |
|
| 51 | + * |
|
| 52 | + * @param array List of sub-client names |
|
| 53 | + * @since 2015.11 |
|
| 54 | + * @category Developer |
|
| 55 | + */ |
|
| 56 | + private $subPartPath = 'client/html/checkout/confirm/order/coupon/standard/subparts'; |
|
| 57 | + private $subPartNames = array(); |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Returns the HTML code for insertion into the body. |
|
| 62 | + * |
|
| 63 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 64 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 65 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 66 | + * @return string HTML code |
|
| 67 | + */ |
|
| 68 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | + { |
|
| 70 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + |
|
| 72 | + $html = ''; |
|
| 73 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 74 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + } |
|
| 76 | + $view->couponBody = $html; |
|
| 77 | + |
|
| 78 | + /** client/html/checkout/confirm/order/coupon/standard/template-body |
|
| 79 | + * Relative path to the HTML body template of the checkout confirm order coupon client. |
|
| 80 | + * |
|
| 81 | + * The template file contains the HTML code and processing instructions |
|
| 82 | + * to generate the result shown in the body of the frontend. The |
|
| 83 | + * configuration string is the path to the template file relative |
|
| 84 | + * to the templates directory (usually in client/html/templates). |
|
| 85 | + * |
|
| 86 | + * You can overwrite the template file configuration in extensions and |
|
| 87 | + * provide alternative templates. These alternative templates should be |
|
| 88 | + * named like the default one but with the string "standard" replaced by |
|
| 89 | + * an unique name. You may use the name of your project for this. If |
|
| 90 | + * you've implemented an alternative client class as well, "standard" |
|
| 91 | + * (second one) should be replaced by the name of the new class in lower |
|
| 92 | + * case. |
|
| 93 | + * |
|
| 94 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | + * @since 2015.11 |
|
| 96 | + * @category Developer |
|
| 97 | + * @see client/html/checkout/confirm/order/coupon/standard/template-header |
|
| 98 | + */ |
|
| 99 | + $tplconf = 'client/html/checkout/confirm/order/coupon/standard/template-body'; |
|
| 100 | + $default = 'common/summary/coupon-body-default.php'; |
|
| 101 | + |
|
| 102 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Returns the HTML string for insertion into the header. |
|
| 108 | + * |
|
| 109 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 110 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 111 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 112 | + * @return string|null String including HTML tags for the header on error |
|
| 113 | + */ |
|
| 114 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + { |
|
| 116 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + |
|
| 118 | + $html = ''; |
|
| 119 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + } |
|
| 122 | + $view->couponHeader = $html; |
|
| 123 | + |
|
| 124 | + /** client/html/checkout/confirm/order/coupon/standard/template-header |
|
| 125 | + * Relative path to the HTML header template of the checkout confirm order coupon client. |
|
| 126 | + * |
|
| 127 | + * The template file contains the HTML code and processing instructions |
|
| 128 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 129 | + * of the rendered page in the frontend. The configuration string is the |
|
| 130 | + * path to the template file relative to the templates directory (usually |
|
| 131 | + * in client/html/templates). |
|
| 132 | + * |
|
| 133 | + * You can overwrite the template file configuration in extensions and |
|
| 134 | + * provide alternative templates. These alternative templates should be |
|
| 135 | + * named like the default one but with the string "standard" replaced by |
|
| 136 | + * an unique name. You may use the name of your project for this. If |
|
| 137 | + * you've implemented an alternative client class as well, "standard" |
|
| 138 | + * (second one) should be replaced by the name of the new class in lower |
|
| 139 | + * case. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2015.11 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/confirm/order/coupon/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/confirm/order/coupon/standard/template-header'; |
|
| 147 | + $default = 'common/summary/coupon-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/checkout/confirm/order/coupon/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout confirm order coupon html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/checkout/confirm/order/coupon/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/checkout/confirm/order/coupon/decorators/global |
|
| 185 | + * @see client/html/checkout/confirm/order/coupon/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/checkout/confirm/order/coupon/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout confirm order coupon html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/checkout/confirm/order/coupon/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/checkout/confirm/order/coupon/decorators/excludes |
|
| 209 | + * @see client/html/checkout/confirm/order/coupon/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/checkout/confirm/order/coupon/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout confirm order coupon html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/checkout/confirm/order/coupon/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/checkout/confirm/order/coupon/decorators/excludes |
|
| 233 | + * @see client/html/checkout/confirm/order/coupon/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'checkout/confirm/order/coupon/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -18,260 +18,260 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 21 | + extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 22 | 22 | { |
| 23 | - /** client/html/checkout/confirm/order/detail/standard/subparts |
|
| 24 | - * List of HTML sub-clients rendered within the checkout confirm order detail section |
|
| 25 | - * |
|
| 26 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | - * the output that is placed inside the container of its parent. |
|
| 32 | - * |
|
| 33 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | - * determines the order of the output of these sub-clients inside the parent |
|
| 36 | - * container. If the configured list of clients is |
|
| 37 | - * |
|
| 38 | - * array( "subclient1", "subclient2" ) |
|
| 39 | - * |
|
| 40 | - * you can easily change the order of the output by reordering the subparts: |
|
| 41 | - * |
|
| 42 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | - * |
|
| 44 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | - * |
|
| 46 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | - * |
|
| 48 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | - * should support adding, removing or reordering content by a fluid like |
|
| 50 | - * design. |
|
| 51 | - * |
|
| 52 | - * @param array List of sub-client names |
|
| 53 | - * @since 2015.11 |
|
| 54 | - * @category Developer |
|
| 55 | - */ |
|
| 56 | - private $subPartPath = 'client/html/checkout/confirm/order/detail/standard/subparts'; |
|
| 57 | - private $subPartNames = array(); |
|
| 58 | - private $cache; |
|
| 23 | + /** client/html/checkout/confirm/order/detail/standard/subparts |
|
| 24 | + * List of HTML sub-clients rendered within the checkout confirm order detail section |
|
| 25 | + * |
|
| 26 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | + * the output that is placed inside the container of its parent. |
|
| 32 | + * |
|
| 33 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | + * determines the order of the output of these sub-clients inside the parent |
|
| 36 | + * container. If the configured list of clients is |
|
| 37 | + * |
|
| 38 | + * array( "subclient1", "subclient2" ) |
|
| 39 | + * |
|
| 40 | + * you can easily change the order of the output by reordering the subparts: |
|
| 41 | + * |
|
| 42 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | + * |
|
| 44 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | + * |
|
| 46 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | + * |
|
| 48 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | + * should support adding, removing or reordering content by a fluid like |
|
| 50 | + * design. |
|
| 51 | + * |
|
| 52 | + * @param array List of sub-client names |
|
| 53 | + * @since 2015.11 |
|
| 54 | + * @category Developer |
|
| 55 | + */ |
|
| 56 | + private $subPartPath = 'client/html/checkout/confirm/order/detail/standard/subparts'; |
|
| 57 | + private $subPartNames = array(); |
|
| 58 | + private $cache; |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Returns the HTML code for insertion into the body. |
|
| 63 | - * |
|
| 64 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | - * @return string HTML code |
|
| 68 | - */ |
|
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | - { |
|
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 61 | + /** |
|
| 62 | + * Returns the HTML code for insertion into the body. |
|
| 63 | + * |
|
| 64 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | + * @return string HTML code |
|
| 68 | + */ |
|
| 69 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + { |
|
| 71 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | 72 | |
| 73 | - $html = ''; |
|
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | - } |
|
| 77 | - $view->detailBody = $html; |
|
| 73 | + $html = ''; |
|
| 74 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + } |
|
| 77 | + $view->detailBody = $html; |
|
| 78 | 78 | |
| 79 | - /** client/html/checkout/confirm/order/detail/standard/template-body |
|
| 80 | - * Relative path to the HTML body template of the checkout confirm order detail client. |
|
| 81 | - * |
|
| 82 | - * The template file contains the HTML code and processing instructions |
|
| 83 | - * to generate the result shown in the body of the frontend. The |
|
| 84 | - * configuration string is the path to the template file relative |
|
| 85 | - * to the templates directory (usually in client/html/templates). |
|
| 86 | - * |
|
| 87 | - * You can overwrite the template file configuration in extensions and |
|
| 88 | - * provide alternative templates. These alternative templates should be |
|
| 89 | - * named like the default one but with the string "standard" replaced by |
|
| 90 | - * an unique name. You may use the name of your project for this. If |
|
| 91 | - * you've implemented an alternative client class as well, "standard" |
|
| 92 | - * (second one) should be replaced by the name of the new class in lower |
|
| 93 | - * case. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2015.11 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/checkout/confirm/order/detail/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/checkout/confirm/order/detail/standard/template-body'; |
|
| 101 | - $default = 'common/summary/detail-body-default.php'; |
|
| 79 | + /** client/html/checkout/confirm/order/detail/standard/template-body |
|
| 80 | + * Relative path to the HTML body template of the checkout confirm order detail client. |
|
| 81 | + * |
|
| 82 | + * The template file contains the HTML code and processing instructions |
|
| 83 | + * to generate the result shown in the body of the frontend. The |
|
| 84 | + * configuration string is the path to the template file relative |
|
| 85 | + * to the templates directory (usually in client/html/templates). |
|
| 86 | + * |
|
| 87 | + * You can overwrite the template file configuration in extensions and |
|
| 88 | + * provide alternative templates. These alternative templates should be |
|
| 89 | + * named like the default one but with the string "standard" replaced by |
|
| 90 | + * an unique name. You may use the name of your project for this. If |
|
| 91 | + * you've implemented an alternative client class as well, "standard" |
|
| 92 | + * (second one) should be replaced by the name of the new class in lower |
|
| 93 | + * case. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2015.11 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/checkout/confirm/order/detail/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/checkout/confirm/order/detail/standard/template-body'; |
|
| 101 | + $default = 'common/summary/detail-body-default.php'; |
|
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | 118 | |
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->detailHeader = $html; |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->detailHeader = $html; |
|
| 124 | 124 | |
| 125 | - /** client/html/checkout/confirm/order/detail/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the checkout confirm order detail client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * (second one) should be replaced by the name of the new class in lower |
|
| 140 | - * case. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2015.11 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/checkout/confirm/order/detail/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/checkout/confirm/order/detail/standard/template-header'; |
|
| 148 | - $default = 'common/summary/detail-header-default.php'; |
|
| 125 | + /** client/html/checkout/confirm/order/detail/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the checkout confirm order detail client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * (second one) should be replaced by the name of the new class in lower |
|
| 140 | + * case. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2015.11 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/checkout/confirm/order/detail/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/checkout/confirm/order/detail/standard/template-header'; |
|
| 148 | + $default = 'common/summary/detail-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/checkout/confirm/order/detail/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the checkout confirm order detail 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/checkout/confirm/order/detail/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/checkout/confirm/order/detail/decorators/global |
|
| 186 | - * @see client/html/checkout/confirm/order/detail/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/checkout/confirm/order/detail/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the checkout confirm order detail 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/checkout/confirm/order/detail/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/checkout/confirm/order/detail/decorators/global |
|
| 186 | + * @see client/html/checkout/confirm/order/detail/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/checkout/confirm/order/detail/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the checkout confirm order detail 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/checkout/confirm/order/detail/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/checkout/confirm/order/detail/decorators/excludes |
|
| 210 | - * @see client/html/checkout/confirm/order/detail/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/checkout/confirm/order/detail/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the checkout confirm order detail 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/checkout/confirm/order/detail/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/checkout/confirm/order/detail/decorators/excludes |
|
| 210 | + * @see client/html/checkout/confirm/order/detail/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/checkout/confirm/order/detail/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the checkout confirm order detail 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\Checkout\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/checkout/confirm/order/detail/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Checkout\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/checkout/confirm/order/detail/decorators/excludes |
|
| 234 | - * @see client/html/checkout/confirm/order/detail/decorators/global |
|
| 235 | - */ |
|
| 213 | + /** client/html/checkout/confirm/order/detail/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the checkout confirm order detail 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\Checkout\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/checkout/confirm/order/detail/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Checkout\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/checkout/confirm/order/detail/decorators/excludes |
|
| 234 | + * @see client/html/checkout/confirm/order/detail/decorators/global |
|
| 235 | + */ |
|
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'checkout/confirm/order/detail/' . $type, $name ); |
|
| 238 | - } |
|
| 237 | + return $this->createSubClient( 'checkout/confirm/order/detail/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns the list of sub-client names configured for the client. |
|
| 243 | - * |
|
| 244 | - * @return array List of HTML client names |
|
| 245 | - */ |
|
| 246 | - protected function getSubClientNames() |
|
| 247 | - { |
|
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns the list of sub-client names configured for the client. |
|
| 243 | + * |
|
| 244 | + * @return array List of HTML client names |
|
| 245 | + */ |
|
| 246 | + protected function getSubClientNames() |
|
| 247 | + { |
|
| 248 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Sets the necessary parameter values in the view. |
|
| 254 | - * |
|
| 255 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | - */ |
|
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | - { |
|
| 262 | - if( !isset( $this->cache ) ) |
|
| 263 | - { |
|
| 264 | - $view = parent::setViewParams( $view ); |
|
| 252 | + /** |
|
| 253 | + * Sets the necessary parameter values in the view. |
|
| 254 | + * |
|
| 255 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | + */ |
|
| 260 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + { |
|
| 262 | + if( !isset( $this->cache ) ) |
|
| 263 | + { |
|
| 264 | + $view = parent::setViewParams( $view ); |
|
| 265 | 265 | |
| 266 | - if( $view->confirmOrderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) { |
|
| 267 | - $view->summaryShowDownloadAttributes = true; |
|
| 268 | - } |
|
| 266 | + if( $view->confirmOrderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) { |
|
| 267 | + $view->summaryShowDownloadAttributes = true; |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - $view->summaryTaxRates = $this->getTaxRates( $view->summaryBasket ); |
|
| 270 | + $view->summaryTaxRates = $this->getTaxRates( $view->summaryBasket ); |
|
| 271 | 271 | |
| 272 | - $this->cache = $view; |
|
| 273 | - } |
|
| 272 | + $this->cache = $view; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - return $this->cache; |
|
| 276 | - } |
|
| 275 | + return $this->cache; |
|
| 276 | + } |
|
| 277 | 277 | } |
| 278 | 278 | \ No newline at end of file |