@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/additional/text/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail additional text section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/detail/additional/text/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->textBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/catalog/detail/additional/text/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the catalog detail additional text client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/catalog/detail/additional/text/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/catalog/detail/additional/text/standard/template-body'; |
|
| 101 | - $default = 'catalog/detail/additional-text-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->textHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/catalog/detail/additional/text/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the catalog detail additional text client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/catalog/detail/additional/text/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/catalog/detail/additional/text/standard/template-header'; |
|
| 147 | - $default = 'catalog/detail/additional-text-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/catalog/detail/additional/text/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the catalog detail additional text html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/catalog/detail/additional/text/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/catalog/detail/additional/text/decorators/global |
|
| 185 | - * @see client/html/catalog/detail/additional/text/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/catalog/detail/additional/text/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the catalog detail additional text html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/catalog/detail/additional/text/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/catalog/detail/additional/text/decorators/excludes |
|
| 209 | - * @see client/html/catalog/detail/additional/text/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/catalog/detail/additional/text/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the catalog detail additional text html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/catalog/detail/additional/text/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/catalog/detail/additional/text/decorators/excludes |
|
| 233 | - * @see client/html/catalog/detail/additional/text/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'catalog/detail/additional/text/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/catalog/detail/additional/text/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail additional text section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/detail/additional/text/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->textBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/catalog/detail/additional/text/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the catalog detail additional text client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/catalog/detail/additional/text/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/catalog/detail/additional/text/standard/template-body'; |
|
| 101 | + $default = 'catalog/detail/additional-text-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->textHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/catalog/detail/additional/text/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the catalog detail additional text client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/catalog/detail/additional/text/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/catalog/detail/additional/text/standard/template-header'; |
|
| 147 | + $default = 'catalog/detail/additional-text-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/catalog/detail/additional/text/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the catalog detail additional text html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/catalog/detail/additional/text/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/catalog/detail/additional/text/decorators/global |
|
| 185 | + * @see client/html/catalog/detail/additional/text/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/catalog/detail/additional/text/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the catalog detail additional text html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/catalog/detail/additional/text/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/catalog/detail/additional/text/decorators/excludes |
|
| 209 | + * @see client/html/catalog/detail/additional/text/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/catalog/detail/additional/text/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the catalog detail additional text html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/catalog/detail/additional/text/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/catalog/detail/additional/text/decorators/excludes |
|
| 233 | + * @see client/html/catalog/detail/additional/text/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'catalog/detail/additional/text/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->textBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/catalog/detail/additional/text/standard/template-body'; |
| 101 | 101 | $default = 'catalog/detail/additional-text-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->textHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/catalog/detail/additional/text/standard/template-header'; |
| 147 | 147 | $default = 'catalog/detail/additional-text-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/catalog/detail/additional/text/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the catalog detail additional text html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/catalog/detail/additional/text/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'catalog/detail/additional/text/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('catalog/detail/additional/text/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/basic/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail basic section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/detail/basic/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->basicBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/catalog/detail/basic/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the catalog detail basic client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/catalog/detail/basic/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/catalog/detail/basic/standard/template-body'; |
|
| 101 | - $default = 'catalog/detail/basic-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->basicHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/catalog/detail/basic/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the catalog detail basic client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/catalog/detail/basic/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/catalog/detail/basic/standard/template-header'; |
|
| 147 | - $default = 'catalog/detail/basic-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/catalog/detail/basic/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the catalog detail basic html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/catalog/detail/basic/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/catalog/detail/basic/decorators/global |
|
| 185 | - * @see client/html/catalog/detail/basic/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/catalog/detail/basic/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the catalog detail basic html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/catalog/detail/basic/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/catalog/detail/basic/decorators/excludes |
|
| 209 | - * @see client/html/catalog/detail/basic/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/catalog/detail/basic/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the catalog detail basic html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/catalog/detail/basic/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/catalog/detail/basic/decorators/excludes |
|
| 233 | - * @see client/html/catalog/detail/basic/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'catalog/detail/basic/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/catalog/detail/basic/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail basic section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/detail/basic/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->basicBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/catalog/detail/basic/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the catalog detail basic client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/catalog/detail/basic/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/catalog/detail/basic/standard/template-body'; |
|
| 101 | + $default = 'catalog/detail/basic-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->basicHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/catalog/detail/basic/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the catalog detail basic client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/catalog/detail/basic/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/catalog/detail/basic/standard/template-header'; |
|
| 147 | + $default = 'catalog/detail/basic-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/catalog/detail/basic/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the catalog detail basic html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/catalog/detail/basic/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/catalog/detail/basic/decorators/global |
|
| 185 | + * @see client/html/catalog/detail/basic/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/catalog/detail/basic/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the catalog detail basic html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/catalog/detail/basic/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/catalog/detail/basic/decorators/excludes |
|
| 209 | + * @see client/html/catalog/detail/basic/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/catalog/detail/basic/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the catalog detail basic html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/catalog/detail/basic/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/catalog/detail/basic/decorators/excludes |
|
| 233 | + * @see client/html/catalog/detail/basic/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'catalog/detail/basic/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->basicBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/catalog/detail/basic/standard/template-body'; |
| 101 | 101 | $default = 'catalog/detail/basic-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->basicHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/catalog/detail/basic/standard/template-header'; |
| 147 | 147 | $default = 'catalog/detail/basic-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/catalog/detail/basic/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the catalog detail basic html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/catalog/detail/basic/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'catalog/detail/basic/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('catalog/detail/basic/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 112 | 112 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | + * @return string String including HTML tags for the header on error |
|
| 115 | 115 | */ |
| 116 | 116 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 117 | 117 | { |
@@ -19,266 +19,266 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/basket/attribute/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail basket attribute section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/detail/basket/attribute/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/catalog/detail/basket/attribute/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail basket attribute section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/detail/basket/attribute/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->attributeBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->attributeBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/catalog/detail/basket/attribute/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the catalog detail basket attribute client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * should be replaced by the name of the new class. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2014.03 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/catalog/detail/basket/attribute/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/catalog/detail/basket/attribute/standard/template-body'; |
|
| 102 | - $default = 'catalog/detail/basket-attribute-body-default.php'; |
|
| 81 | + /** client/html/catalog/detail/basket/attribute/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the catalog detail basket attribute client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * should be replaced by the name of the new class. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2014.03 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/catalog/detail/basket/attribute/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/catalog/detail/basket/attribute/standard/template-body'; |
|
| 102 | + $default = 'catalog/detail/basket-attribute-body-default.php'; |
|
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns the HTML string for insertion into the header. |
|
| 110 | - * |
|
| 111 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | - */ |
|
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML string for insertion into the header. |
|
| 110 | + * |
|
| 111 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 112 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 113 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 114 | + * @return string|null String including HTML tags for the header on error |
|
| 115 | + */ |
|
| 116 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | 119 | |
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->attributeHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->attributeHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/catalog/detail/basket/attribute/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the catalog detail basket attribute client. |
|
| 128 | - * |
|
| 129 | - * The template file contains the HTML code and processing instructions |
|
| 130 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | - * of the rendered page in the frontend. The configuration string is the |
|
| 132 | - * path to the template file relative to the templates directory (usually |
|
| 133 | - * in client/html/templates). |
|
| 134 | - * |
|
| 135 | - * You can overwrite the template file configuration in extensions and |
|
| 136 | - * provide alternative templates. These alternative templates should be |
|
| 137 | - * named like the default one but with the string "standard" replaced by |
|
| 138 | - * an unique name. You may use the name of your project for this. If |
|
| 139 | - * you've implemented an alternative client class as well, "standard" |
|
| 140 | - * should be replaced by the name of the new class. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2014.03 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/catalog/detail/basket/attribute/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/catalog/detail/basket/attribute/standard/template-header'; |
|
| 148 | - $default = 'catalog/detail/basket-attribute-header-default.php'; |
|
| 126 | + /** client/html/catalog/detail/basket/attribute/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the catalog detail basket attribute client. |
|
| 128 | + * |
|
| 129 | + * The template file contains the HTML code and processing instructions |
|
| 130 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 131 | + * of the rendered page in the frontend. The configuration string is the |
|
| 132 | + * path to the template file relative to the templates directory (usually |
|
| 133 | + * in client/html/templates). |
|
| 134 | + * |
|
| 135 | + * You can overwrite the template file configuration in extensions and |
|
| 136 | + * provide alternative templates. These alternative templates should be |
|
| 137 | + * named like the default one but with the string "standard" replaced by |
|
| 138 | + * an unique name. You may use the name of your project for this. If |
|
| 139 | + * you've implemented an alternative client class as well, "standard" |
|
| 140 | + * should be replaced by the name of the new class. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2014.03 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/catalog/detail/basket/attribute/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/catalog/detail/basket/attribute/standard/template-header'; |
|
| 148 | + $default = 'catalog/detail/basket-attribute-header-default.php'; |
|
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | - /** |
|
| 155 | - * Returns the sub-client given by its name. |
|
| 156 | - * |
|
| 157 | - * @param string $type Name of the client type |
|
| 158 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | - */ |
|
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 162 | - { |
|
| 163 | - /** client/html/catalog/detail/basket/attribute/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the catalog detail basket attribute html client |
|
| 165 | - * |
|
| 166 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | - * modify what is returned to the caller. |
|
| 170 | - * |
|
| 171 | - * This option allows you to remove a decorator added via |
|
| 172 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | - * around the html client. |
|
| 174 | - * |
|
| 175 | - * client/html/catalog/detail/basket/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 176 | - * |
|
| 177 | - * This would remove the decorator named "decorator1" from the list of |
|
| 178 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | - * "client/html/common/decorators/default" to the html client. |
|
| 180 | - * |
|
| 181 | - * @param array List of decorator names |
|
| 182 | - * @since 2015.08 |
|
| 183 | - * @category Developer |
|
| 184 | - * @see client/html/common/decorators/default |
|
| 185 | - * @see client/html/catalog/detail/basket/attribute/decorators/global |
|
| 186 | - * @see client/html/catalog/detail/basket/attribute/decorators/local |
|
| 187 | - */ |
|
| 154 | + /** |
|
| 155 | + * Returns the sub-client given by its name. |
|
| 156 | + * |
|
| 157 | + * @param string $type Name of the client type |
|
| 158 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 159 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 160 | + */ |
|
| 161 | + public function getSubClient( $type, $name = null ) |
|
| 162 | + { |
|
| 163 | + /** client/html/catalog/detail/basket/attribute/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the catalog detail basket attribute html client |
|
| 165 | + * |
|
| 166 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 167 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 168 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 169 | + * modify what is returned to the caller. |
|
| 170 | + * |
|
| 171 | + * This option allows you to remove a decorator added via |
|
| 172 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 173 | + * around the html client. |
|
| 174 | + * |
|
| 175 | + * client/html/catalog/detail/basket/attribute/decorators/excludes = array( 'decorator1' ) |
|
| 176 | + * |
|
| 177 | + * This would remove the decorator named "decorator1" from the list of |
|
| 178 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 179 | + * "client/html/common/decorators/default" to the html client. |
|
| 180 | + * |
|
| 181 | + * @param array List of decorator names |
|
| 182 | + * @since 2015.08 |
|
| 183 | + * @category Developer |
|
| 184 | + * @see client/html/common/decorators/default |
|
| 185 | + * @see client/html/catalog/detail/basket/attribute/decorators/global |
|
| 186 | + * @see client/html/catalog/detail/basket/attribute/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/catalog/detail/basket/attribute/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the catalog detail basket attribute html client |
|
| 191 | - * |
|
| 192 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | - * modify what is returned to the caller. |
|
| 196 | - * |
|
| 197 | - * This option allows you to wrap global decorators |
|
| 198 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | - * |
|
| 200 | - * client/html/catalog/detail/basket/attribute/decorators/global = array( 'decorator1' ) |
|
| 201 | - * |
|
| 202 | - * This would add the decorator named "decorator1" defined by |
|
| 203 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | - * |
|
| 205 | - * @param array List of decorator names |
|
| 206 | - * @since 2015.08 |
|
| 207 | - * @category Developer |
|
| 208 | - * @see client/html/common/decorators/default |
|
| 209 | - * @see client/html/catalog/detail/basket/attribute/decorators/excludes |
|
| 210 | - * @see client/html/catalog/detail/basket/attribute/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/catalog/detail/basket/attribute/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the catalog detail basket attribute html client |
|
| 191 | + * |
|
| 192 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 193 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 194 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 195 | + * modify what is returned to the caller. |
|
| 196 | + * |
|
| 197 | + * This option allows you to wrap global decorators |
|
| 198 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 199 | + * |
|
| 200 | + * client/html/catalog/detail/basket/attribute/decorators/global = array( 'decorator1' ) |
|
| 201 | + * |
|
| 202 | + * This would add the decorator named "decorator1" defined by |
|
| 203 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 204 | + * |
|
| 205 | + * @param array List of decorator names |
|
| 206 | + * @since 2015.08 |
|
| 207 | + * @category Developer |
|
| 208 | + * @see client/html/common/decorators/default |
|
| 209 | + * @see client/html/catalog/detail/basket/attribute/decorators/excludes |
|
| 210 | + * @see client/html/catalog/detail/basket/attribute/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/catalog/detail/basket/attribute/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the catalog detail basket attribute html client |
|
| 215 | - * |
|
| 216 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | - * modify what is returned to the caller. |
|
| 220 | - * |
|
| 221 | - * This option allows you to wrap local decorators |
|
| 222 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/catalog/detail/basket/attribute/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | - * |
|
| 229 | - * @param array List of decorator names |
|
| 230 | - * @since 2015.08 |
|
| 231 | - * @category Developer |
|
| 232 | - * @see client/html/common/decorators/default |
|
| 233 | - * @see client/html/catalog/detail/basket/attribute/decorators/excludes |
|
| 234 | - * @see client/html/catalog/detail/basket/attribute/attribute/decorators/global |
|
| 235 | - */ |
|
| 213 | + /** client/html/catalog/detail/basket/attribute/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the catalog detail basket attribute html client |
|
| 215 | + * |
|
| 216 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 217 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 218 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 219 | + * modify what is returned to the caller. |
|
| 220 | + * |
|
| 221 | + * This option allows you to wrap local decorators |
|
| 222 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/catalog/detail/basket/attribute/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 228 | + * |
|
| 229 | + * @param array List of decorator names |
|
| 230 | + * @since 2015.08 |
|
| 231 | + * @category Developer |
|
| 232 | + * @see client/html/common/decorators/default |
|
| 233 | + * @see client/html/catalog/detail/basket/attribute/decorators/excludes |
|
| 234 | + * @see client/html/catalog/detail/basket/attribute/attribute/decorators/global |
|
| 235 | + */ |
|
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/detail/basket/attribute/' . $type, $name ); |
|
| 238 | - } |
|
| 237 | + return $this->createSubClient( 'catalog/detail/basket/attribute/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns the list of sub-client names configured for the client. |
|
| 243 | - * |
|
| 244 | - * @return array List of HTML client names |
|
| 245 | - */ |
|
| 246 | - protected function getSubClientNames() |
|
| 247 | - { |
|
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns the list of sub-client names configured for the client. |
|
| 243 | + * |
|
| 244 | + * @return array List of HTML client names |
|
| 245 | + */ |
|
| 246 | + protected function getSubClientNames() |
|
| 247 | + { |
|
| 248 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Sets the necessary parameter values in the view. |
|
| 254 | - * |
|
| 255 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | - */ |
|
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | - { |
|
| 262 | - if( !isset( $this->cache ) ) |
|
| 263 | - { |
|
| 264 | - $attributeTypes = array(); |
|
| 265 | - $attrItems = $view->get( 'detailProductAttributeItems', array() ); |
|
| 266 | - $configAttributes = $view->detailProductItem->getRefItems( 'attribute', null, 'config' ); |
|
| 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 | + $attributeTypes = array(); |
|
| 265 | + $attrItems = $view->get( 'detailProductAttributeItems', array() ); |
|
| 266 | + $configAttributes = $view->detailProductItem->getRefItems( 'attribute', null, 'config' ); |
|
| 267 | 267 | |
| 268 | - foreach( $configAttributes as $id => $attribute ) |
|
| 269 | - { |
|
| 270 | - if( isset( $attrItems[$id] ) ) { |
|
| 271 | - $attributeTypes[$attrItems[$id]->getType()][$id] = $attrItems[$id]; |
|
| 272 | - } |
|
| 273 | - } |
|
| 268 | + foreach( $configAttributes as $id => $attribute ) |
|
| 269 | + { |
|
| 270 | + if( isset( $attrItems[$id] ) ) { |
|
| 271 | + $attributeTypes[$attrItems[$id]->getType()][$id] = $attrItems[$id]; |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - $view->attributeConfigItems = $attributeTypes; |
|
| 276 | - $view->attributeCustomItems = $view->detailProductItem->getRefItems( 'attribute', null, 'custom' ); |
|
| 277 | - $view->attributeHiddenItems = $view->detailProductItem->getRefItems( 'attribute', null, 'hidden' ); |
|
| 275 | + $view->attributeConfigItems = $attributeTypes; |
|
| 276 | + $view->attributeCustomItems = $view->detailProductItem->getRefItems( 'attribute', null, 'custom' ); |
|
| 277 | + $view->attributeHiddenItems = $view->detailProductItem->getRefItems( 'attribute', null, 'hidden' ); |
|
| 278 | 278 | |
| 279 | - $this->cache = $view; |
|
| 280 | - } |
|
| 279 | + $this->cache = $view; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - return $this->cache; |
|
| 283 | - } |
|
| 282 | + return $this->cache; |
|
| 283 | + } |
|
| 284 | 284 | } |
| 285 | 285 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->attributeBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/catalog/detail/basket/attribute/standard/template-body'; |
| 102 | 102 | $default = 'catalog/detail/basket-attribute-body-default.php'; |
| 103 | 103 | |
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + return $view->render($view->config($tplconf, $default)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 114 | 114 | * @return string|null String including HTML tags for the header on error |
| 115 | 115 | */ |
| 116 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 119 | 119 | |
| 120 | 120 | $html = ''; |
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + foreach ($this->getSubClients() as $subclient) { |
|
| 122 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 123 | 123 | } |
| 124 | 124 | $view->attributeHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/catalog/detail/basket/attribute/standard/template-header'; |
| 148 | 148 | $default = 'catalog/detail/basket-attribute-header-default.php'; |
| 149 | 149 | |
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + return $view->render($view->config($tplconf, $default)); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @param string|null $name Name of the sub-client (Default if null) |
| 159 | 159 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 160 | 160 | */ |
| 161 | - public function getSubClient( $type, $name = null ) |
|
| 161 | + public function getSubClient($type, $name = null) |
|
| 162 | 162 | { |
| 163 | 163 | /** client/html/catalog/detail/basket/attribute/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the catalog detail basket attribute html client |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see client/html/catalog/detail/basket/attribute/attribute/decorators/global |
| 235 | 235 | */ |
| 236 | 236 | |
| 237 | - return $this->createSubClient( 'catalog/detail/basket/attribute/' . $type, $name ); |
|
| 237 | + return $this->createSubClient('catalog/detail/basket/attribute/'.$type, $name); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | protected function getSubClientNames() |
| 247 | 247 | { |
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
@@ -257,24 +257,24 @@ discard block |
||
| 257 | 257 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 258 | 258 | * @return \Aimeos\MW\View\Iface Modified view object |
| 259 | 259 | */ |
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 261 | 261 | { |
| 262 | - if( !isset( $this->cache ) ) |
|
| 262 | + if (!isset($this->cache)) |
|
| 263 | 263 | { |
| 264 | 264 | $attributeTypes = array(); |
| 265 | - $attrItems = $view->get( 'detailProductAttributeItems', array() ); |
|
| 266 | - $configAttributes = $view->detailProductItem->getRefItems( 'attribute', null, 'config' ); |
|
| 265 | + $attrItems = $view->get('detailProductAttributeItems', array()); |
|
| 266 | + $configAttributes = $view->detailProductItem->getRefItems('attribute', null, 'config'); |
|
| 267 | 267 | |
| 268 | - foreach( $configAttributes as $id => $attribute ) |
|
| 268 | + foreach ($configAttributes as $id => $attribute) |
|
| 269 | 269 | { |
| 270 | - if( isset( $attrItems[$id] ) ) { |
|
| 270 | + if (isset($attrItems[$id])) { |
|
| 271 | 271 | $attributeTypes[$attrItems[$id]->getType()][$id] = $attrItems[$id]; |
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | $view->attributeConfigItems = $attributeTypes; |
| 276 | - $view->attributeCustomItems = $view->detailProductItem->getRefItems( 'attribute', null, 'custom' ); |
|
| 277 | - $view->attributeHiddenItems = $view->detailProductItem->getRefItems( 'attribute', null, 'hidden' ); |
|
| 276 | + $view->attributeCustomItems = $view->detailProductItem->getRefItems('attribute', null, 'custom'); |
|
| 277 | + $view->attributeHiddenItems = $view->detailProductItem->getRefItems('attribute', null, 'hidden'); |
|
| 278 | 278 | |
| 279 | 279 | $this->cache = $view; |
| 280 | 280 | } |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 114 | 114 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | + * @return string String including HTML tags for the header on error |
|
| 117 | 117 | */ |
| 118 | 118 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 119 | 119 | { |
@@ -19,345 +19,345 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/basket/selection/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail basket selection section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/detail/basket/selection/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->selectionBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/detail/basket/selection/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog detail basket selection client. |
|
| 85 | - * |
|
| 86 | - * The template file contains the HTML code and processing instructions |
|
| 87 | - * to generate the result shown in the body of the frontend. The |
|
| 88 | - * configuration string is the path to the template file relative |
|
| 89 | - * to the templates directory (usually in client/html/templates). |
|
| 90 | - * |
|
| 91 | - * You can overwrite the template file configuration in extensions and |
|
| 92 | - * provide alternative templates. These alternative templates should be |
|
| 93 | - * named like the default one but with the string "standard" replaced by |
|
| 94 | - * an unique name. You may use the name of your project for this. If |
|
| 95 | - * you've implemented an alternative client class as well, "standard" |
|
| 96 | - * should be replaced by the name of the new class. |
|
| 97 | - * |
|
| 98 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | - * @since 2014.03 |
|
| 100 | - * @category Developer |
|
| 101 | - * @see client/html/catalog/detail/basket/selection/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/detail/basket/selection/standard/template-body'; |
|
| 104 | - $default = 'catalog/detail/basket-selection-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->selectionHeader = $html; |
|
| 127 | - |
|
| 128 | - /** client/html/catalog/detail/basket/selection/standard/template-header |
|
| 129 | - * Relative path to the HTML header template of the catalog detail basket selection client. |
|
| 130 | - * |
|
| 131 | - * The template file contains the HTML code and processing instructions |
|
| 132 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | - * of the rendered page in the frontend. The configuration string is the |
|
| 134 | - * path to the template file relative to the templates directory (usually |
|
| 135 | - * in client/html/templates). |
|
| 136 | - * |
|
| 137 | - * You can overwrite the template file configuration in extensions and |
|
| 138 | - * provide alternative templates. These alternative templates should be |
|
| 139 | - * named like the default one but with the string "standard" replaced by |
|
| 140 | - * an unique name. You may use the name of your project for this. If |
|
| 141 | - * you've implemented an alternative client class as well, "standard" |
|
| 142 | - * should be replaced by the name of the new class. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2014.03 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/catalog/detail/basket/selection/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/catalog/detail/basket/selection/standard/template-header'; |
|
| 150 | - $default = 'catalog/detail/basket-selection-header-default.php'; |
|
| 151 | - |
|
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/catalog/detail/basket/selection/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the catalog detail basket selection html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/catalog/detail/basket/selection/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/catalog/detail/basket/selection/decorators/global |
|
| 188 | - * @see client/html/catalog/detail/basket/selection/decorators/local |
|
| 189 | - */ |
|
| 190 | - |
|
| 191 | - /** client/html/catalog/detail/basket/selection/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the catalog detail basket selection html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/catalog/detail/basket/selection/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/detail/basket/selection/decorators/excludes |
|
| 212 | - * @see client/html/catalog/detail/basket/selection/decorators/local |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - /** client/html/catalog/detail/basket/selection/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the catalog detail basket selection html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/detail/basket/selection/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/detail/basket/selection/decorators/excludes |
|
| 236 | - * @see client/html/catalog/detail/basket/selection/decorators/global |
|
| 237 | - */ |
|
| 238 | - |
|
| 239 | - return $this->createSubClient( 'catalog/detail/basket/selection/' . $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 | - if( $view->detailProductItem->getType() === 'select' ) |
|
| 267 | - { |
|
| 268 | - $context = $this->getContext(); |
|
| 269 | - $config = $context->getConfig(); |
|
| 270 | - $domains = array( 'text', 'price', 'media', 'attribute' ); |
|
| 271 | - $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' ); |
|
| 272 | - |
|
| 273 | - /** client/html/catalog/detail/basket/selection/domains |
|
| 274 | - * A list of domain names whose items should be available in the basket |
|
| 275 | - * selection part of the catalog detail view templates |
|
| 276 | - * |
|
| 277 | - * The templates rendering basket selection related data usually add |
|
| 278 | - * the images and texts associated to each item. If you want to |
|
| 279 | - * display additional content like the attributes, you can configure |
|
| 280 | - * your own list of domains (attribute, media, price, product, text, |
|
| 281 | - * etc. are domains) whose items are fetched from the storage. |
|
| 282 | - * Please keep in mind that the more domains you add to the |
|
| 283 | - * configuration, the more time is required for fetching the content! |
|
| 284 | - * |
|
| 285 | - * @param array List of domain names |
|
| 286 | - * @since 2015.09 |
|
| 287 | - * @category Developer |
|
| 288 | - * @see client/html/catalog/detail/basket/selection/domains-attributes |
|
| 289 | - */ |
|
| 290 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains ); |
|
| 291 | - |
|
| 292 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 293 | - $subproducts = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 294 | - $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array(); |
|
| 295 | - |
|
| 296 | - foreach( $subproducts as $subProdId => $subProduct ) |
|
| 297 | - { |
|
| 298 | - foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem ) |
|
| 299 | - { |
|
| 300 | - $attrTypeDeps[$attrItem->getType()][$attrId] = $attrItem->getPosition(); |
|
| 301 | - $attrDeps[$attrId][] = $subProdId; |
|
| 302 | - $prodDeps[$subProdId][] = $attrId; |
|
| 303 | - $attrIds[] = $attrId; |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - ksort( $attrTypeDeps ); |
|
| 308 | - |
|
| 309 | - $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags ); |
|
| 310 | - $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire ); |
|
| 311 | - |
|
| 312 | - |
|
| 313 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 314 | - |
|
| 315 | - $search = $attrManager->createSearch( true ); |
|
| 316 | - $expr = array( |
|
| 317 | - $search->compare( '==', 'attribute.id', $attrIds ), |
|
| 318 | - $search->getConditions(), |
|
| 319 | - ); |
|
| 320 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 321 | - |
|
| 322 | - /** client/html/catalog/detail/basket/selection/domains-attributes |
|
| 323 | - * A list of domain names whose items should be available for the attributes |
|
| 324 | - * in the basket selection part of the catalog detail view templates |
|
| 325 | - * |
|
| 326 | - * The templates rendering basket selection related data usually add |
|
| 327 | - * the images and texts associated to each item. If you want to |
|
| 328 | - * display additional content like the attributes, you can configure |
|
| 329 | - * your own list of domains (attribute, media, price, product, text, |
|
| 330 | - * etc. are domains) whose items are fetched from the storage. |
|
| 331 | - * Please keep in mind that the more domains you add to the |
|
| 332 | - * configuration, the more time is required for fetching the content! |
|
| 333 | - * |
|
| 334 | - * @param array List of domain names |
|
| 335 | - * @since 2015.09 |
|
| 336 | - * @category Developer |
|
| 337 | - * @see client/html/catalog/detail/basket/selection/domains |
|
| 338 | - */ |
|
| 339 | - $domains = array( 'text', 'media' ); |
|
| 340 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', $domains ); |
|
| 341 | - |
|
| 342 | - $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 343 | - |
|
| 344 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 345 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 346 | - |
|
| 347 | - |
|
| 348 | - $view->selectionProducts = $subproducts; |
|
| 349 | - $view->selectionProductDependencies = $prodDeps; |
|
| 350 | - $view->selectionAttributeDependencies = $attrDeps; |
|
| 351 | - $view->selectionAttributeTypeDependencies = $attrTypeDeps; |
|
| 352 | - $view->selectionAttributeItems = $attributes; |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - $this->cache = $view; |
|
| 356 | - } |
|
| 357 | - |
|
| 358 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 359 | - $tags = array_merge( $tags, $this->tags ); |
|
| 360 | - |
|
| 361 | - return $this->cache; |
|
| 362 | - } |
|
| 25 | + /** client/html/catalog/detail/basket/selection/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail basket selection section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/detail/basket/selection/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->selectionBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/detail/basket/selection/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog detail basket selection client. |
|
| 85 | + * |
|
| 86 | + * The template file contains the HTML code and processing instructions |
|
| 87 | + * to generate the result shown in the body of the frontend. The |
|
| 88 | + * configuration string is the path to the template file relative |
|
| 89 | + * to the templates directory (usually in client/html/templates). |
|
| 90 | + * |
|
| 91 | + * You can overwrite the template file configuration in extensions and |
|
| 92 | + * provide alternative templates. These alternative templates should be |
|
| 93 | + * named like the default one but with the string "standard" replaced by |
|
| 94 | + * an unique name. You may use the name of your project for this. If |
|
| 95 | + * you've implemented an alternative client class as well, "standard" |
|
| 96 | + * should be replaced by the name of the new class. |
|
| 97 | + * |
|
| 98 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 99 | + * @since 2014.03 |
|
| 100 | + * @category Developer |
|
| 101 | + * @see client/html/catalog/detail/basket/selection/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/detail/basket/selection/standard/template-body'; |
|
| 104 | + $default = 'catalog/detail/basket-selection-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->selectionHeader = $html; |
|
| 127 | + |
|
| 128 | + /** client/html/catalog/detail/basket/selection/standard/template-header |
|
| 129 | + * Relative path to the HTML header template of the catalog detail basket selection client. |
|
| 130 | + * |
|
| 131 | + * The template file contains the HTML code and processing instructions |
|
| 132 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 133 | + * of the rendered page in the frontend. The configuration string is the |
|
| 134 | + * path to the template file relative to the templates directory (usually |
|
| 135 | + * in client/html/templates). |
|
| 136 | + * |
|
| 137 | + * You can overwrite the template file configuration in extensions and |
|
| 138 | + * provide alternative templates. These alternative templates should be |
|
| 139 | + * named like the default one but with the string "standard" replaced by |
|
| 140 | + * an unique name. You may use the name of your project for this. If |
|
| 141 | + * you've implemented an alternative client class as well, "standard" |
|
| 142 | + * should be replaced by the name of the new class. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2014.03 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/catalog/detail/basket/selection/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/catalog/detail/basket/selection/standard/template-header'; |
|
| 150 | + $default = 'catalog/detail/basket-selection-header-default.php'; |
|
| 151 | + |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/catalog/detail/basket/selection/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the catalog detail basket selection html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/catalog/detail/basket/selection/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/catalog/detail/basket/selection/decorators/global |
|
| 188 | + * @see client/html/catalog/detail/basket/selection/decorators/local |
|
| 189 | + */ |
|
| 190 | + |
|
| 191 | + /** client/html/catalog/detail/basket/selection/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the catalog detail basket selection html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/catalog/detail/basket/selection/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/detail/basket/selection/decorators/excludes |
|
| 212 | + * @see client/html/catalog/detail/basket/selection/decorators/local |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + /** client/html/catalog/detail/basket/selection/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the catalog detail basket selection html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/detail/basket/selection/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/detail/basket/selection/decorators/excludes |
|
| 236 | + * @see client/html/catalog/detail/basket/selection/decorators/global |
|
| 237 | + */ |
|
| 238 | + |
|
| 239 | + return $this->createSubClient( 'catalog/detail/basket/selection/' . $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 | + if( $view->detailProductItem->getType() === 'select' ) |
|
| 267 | + { |
|
| 268 | + $context = $this->getContext(); |
|
| 269 | + $config = $context->getConfig(); |
|
| 270 | + $domains = array( 'text', 'price', 'media', 'attribute' ); |
|
| 271 | + $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' ); |
|
| 272 | + |
|
| 273 | + /** client/html/catalog/detail/basket/selection/domains |
|
| 274 | + * A list of domain names whose items should be available in the basket |
|
| 275 | + * selection part of the catalog detail view templates |
|
| 276 | + * |
|
| 277 | + * The templates rendering basket selection related data usually add |
|
| 278 | + * the images and texts associated to each item. If you want to |
|
| 279 | + * display additional content like the attributes, you can configure |
|
| 280 | + * your own list of domains (attribute, media, price, product, text, |
|
| 281 | + * etc. are domains) whose items are fetched from the storage. |
|
| 282 | + * Please keep in mind that the more domains you add to the |
|
| 283 | + * configuration, the more time is required for fetching the content! |
|
| 284 | + * |
|
| 285 | + * @param array List of domain names |
|
| 286 | + * @since 2015.09 |
|
| 287 | + * @category Developer |
|
| 288 | + * @see client/html/catalog/detail/basket/selection/domains-attributes |
|
| 289 | + */ |
|
| 290 | + $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains ); |
|
| 291 | + |
|
| 292 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 293 | + $subproducts = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 294 | + $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array(); |
|
| 295 | + |
|
| 296 | + foreach( $subproducts as $subProdId => $subProduct ) |
|
| 297 | + { |
|
| 298 | + foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem ) |
|
| 299 | + { |
|
| 300 | + $attrTypeDeps[$attrItem->getType()][$attrId] = $attrItem->getPosition(); |
|
| 301 | + $attrDeps[$attrId][] = $subProdId; |
|
| 302 | + $prodDeps[$subProdId][] = $attrId; |
|
| 303 | + $attrIds[] = $attrId; |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + ksort( $attrTypeDeps ); |
|
| 308 | + |
|
| 309 | + $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags ); |
|
| 310 | + $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire ); |
|
| 311 | + |
|
| 312 | + |
|
| 313 | + $attrManager = $controller->createManager( 'attribute' ); |
|
| 314 | + |
|
| 315 | + $search = $attrManager->createSearch( true ); |
|
| 316 | + $expr = array( |
|
| 317 | + $search->compare( '==', 'attribute.id', $attrIds ), |
|
| 318 | + $search->getConditions(), |
|
| 319 | + ); |
|
| 320 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 321 | + |
|
| 322 | + /** client/html/catalog/detail/basket/selection/domains-attributes |
|
| 323 | + * A list of domain names whose items should be available for the attributes |
|
| 324 | + * in the basket selection part of the catalog detail view templates |
|
| 325 | + * |
|
| 326 | + * The templates rendering basket selection related data usually add |
|
| 327 | + * the images and texts associated to each item. If you want to |
|
| 328 | + * display additional content like the attributes, you can configure |
|
| 329 | + * your own list of domains (attribute, media, price, product, text, |
|
| 330 | + * etc. are domains) whose items are fetched from the storage. |
|
| 331 | + * Please keep in mind that the more domains you add to the |
|
| 332 | + * configuration, the more time is required for fetching the content! |
|
| 333 | + * |
|
| 334 | + * @param array List of domain names |
|
| 335 | + * @since 2015.09 |
|
| 336 | + * @category Developer |
|
| 337 | + * @see client/html/catalog/detail/basket/selection/domains |
|
| 338 | + */ |
|
| 339 | + $domains = array( 'text', 'media' ); |
|
| 340 | + $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', $domains ); |
|
| 341 | + |
|
| 342 | + $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 343 | + |
|
| 344 | + $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 345 | + $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 346 | + |
|
| 347 | + |
|
| 348 | + $view->selectionProducts = $subproducts; |
|
| 349 | + $view->selectionProductDependencies = $prodDeps; |
|
| 350 | + $view->selectionAttributeDependencies = $attrDeps; |
|
| 351 | + $view->selectionAttributeTypeDependencies = $attrTypeDeps; |
|
| 352 | + $view->selectionAttributeItems = $attributes; |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + $this->cache = $view; |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 359 | + $tags = array_merge( $tags, $this->tags ); |
|
| 360 | + |
|
| 361 | + return $this->cache; |
|
| 362 | + } |
|
| 363 | 363 | } |
| 364 | 364 | \ No newline at end of file |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 71 | 71 | * @return string HTML code |
| 72 | 72 | */ |
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 74 | 74 | { |
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 76 | 76 | |
| 77 | 77 | $html = ''; |
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + foreach ($this->getSubClients() as $subclient) { |
|
| 79 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 80 | 80 | } |
| 81 | 81 | $view->selectionBody = $html; |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/detail/basket/selection/standard/template-body'; |
| 104 | 104 | $default = 'catalog/detail/basket-selection-body-default.php'; |
| 105 | 105 | |
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + return $view->render($view->config($tplconf, $default)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | 116 | * @return string|null String including HTML tags for the header on error |
| 117 | 117 | */ |
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 119 | 119 | { |
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 121 | 121 | |
| 122 | 122 | $html = ''; |
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + foreach ($this->getSubClients() as $subclient) { |
|
| 124 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 125 | 125 | } |
| 126 | 126 | $view->selectionHeader = $html; |
| 127 | 127 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/catalog/detail/basket/selection/standard/template-header'; |
| 150 | 150 | $default = 'catalog/detail/basket-selection-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/catalog/detail/basket/selection/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the catalog detail basket selection html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/catalog/detail/basket/selection/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'catalog/detail/basket/selection/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('catalog/detail/basket/selection/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,16 +259,16 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - if( !isset( $this->cache ) ) |
|
| 264 | + if (!isset($this->cache)) |
|
| 265 | 265 | { |
| 266 | - if( $view->detailProductItem->getType() === 'select' ) |
|
| 266 | + if ($view->detailProductItem->getType() === 'select') |
|
| 267 | 267 | { |
| 268 | 268 | $context = $this->getContext(); |
| 269 | 269 | $config = $context->getConfig(); |
| 270 | - $domains = array( 'text', 'price', 'media', 'attribute' ); |
|
| 271 | - $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' ); |
|
| 270 | + $domains = array('text', 'price', 'media', 'attribute'); |
|
| 271 | + $products = $view->detailProductItem->getRefItems('product', 'default', 'default'); |
|
| 272 | 272 | |
| 273 | 273 | /** client/html/catalog/detail/basket/selection/domains |
| 274 | 274 | * A list of domain names whose items should be available in the basket |
@@ -287,15 +287,15 @@ discard block |
||
| 287 | 287 | * @category Developer |
| 288 | 288 | * @see client/html/catalog/detail/basket/selection/domains-attributes |
| 289 | 289 | */ |
| 290 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains ); |
|
| 290 | + $domains = $config->get('client/html/catalog/detail/basket/selection/domains', $domains); |
|
| 291 | 291 | |
| 292 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 293 | - $subproducts = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 292 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 293 | + $subproducts = $controller->getProductItems(array_keys($products), $domains); |
|
| 294 | 294 | $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array(); |
| 295 | 295 | |
| 296 | - foreach( $subproducts as $subProdId => $subProduct ) |
|
| 296 | + foreach ($subproducts as $subProdId => $subProduct) |
|
| 297 | 297 | { |
| 298 | - foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem ) |
|
| 298 | + foreach ($subProduct->getRefItems('attribute', null, 'variant') as $attrId => $attrItem) |
|
| 299 | 299 | { |
| 300 | 300 | $attrTypeDeps[$attrItem->getType()][$attrId] = $attrItem->getPosition(); |
| 301 | 301 | $attrDeps[$attrId][] = $subProdId; |
@@ -304,20 +304,20 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - ksort( $attrTypeDeps ); |
|
| 307 | + ksort($attrTypeDeps); |
|
| 308 | 308 | |
| 309 | - $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags ); |
|
| 310 | - $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire ); |
|
| 309 | + $this->addMetaItem($subproducts, 'product', $this->expire, $this->tags); |
|
| 310 | + $this->addMetaList(array_keys($subproducts), 'product', $this->expire); |
|
| 311 | 311 | |
| 312 | 312 | |
| 313 | - $attrManager = $controller->createManager( 'attribute' ); |
|
| 313 | + $attrManager = $controller->createManager('attribute'); |
|
| 314 | 314 | |
| 315 | - $search = $attrManager->createSearch( true ); |
|
| 315 | + $search = $attrManager->createSearch(true); |
|
| 316 | 316 | $expr = array( |
| 317 | - $search->compare( '==', 'attribute.id', $attrIds ), |
|
| 317 | + $search->compare('==', 'attribute.id', $attrIds), |
|
| 318 | 318 | $search->getConditions(), |
| 319 | 319 | ); |
| 320 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 320 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 321 | 321 | |
| 322 | 322 | /** client/html/catalog/detail/basket/selection/domains-attributes |
| 323 | 323 | * A list of domain names whose items should be available for the attributes |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | * @category Developer |
| 337 | 337 | * @see client/html/catalog/detail/basket/selection/domains |
| 338 | 338 | */ |
| 339 | - $domains = array( 'text', 'media' ); |
|
| 340 | - $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', $domains ); |
|
| 339 | + $domains = array('text', 'media'); |
|
| 340 | + $domains = $config->get('client/html/catalog/detail/basket/selection/domains-attributes', $domains); |
|
| 341 | 341 | |
| 342 | - $attributes = $attrManager->searchItems( $search, $domains ); |
|
| 342 | + $attributes = $attrManager->searchItems($search, $domains); |
|
| 343 | 343 | |
| 344 | - $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags ); |
|
| 345 | - $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire ); |
|
| 344 | + $this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags); |
|
| 345 | + $this->addMetaList(array_keys($attributes), 'attribute', $this->expire); |
|
| 346 | 346 | |
| 347 | 347 | |
| 348 | 348 | $view->selectionProducts = $subproducts; |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | $this->cache = $view; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 359 | - $tags = array_merge( $tags, $this->tags ); |
|
| 358 | + $expire = $this->expires($this->expire, $expire); |
|
| 359 | + $tags = array_merge($tags, $this->tags); |
|
| 360 | 360 | |
| 361 | 361 | return $this->cache; |
| 362 | 362 | } |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 114 | 114 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | + * @return string String including HTML tags for the header on error |
|
| 117 | 117 | */ |
| 118 | 118 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 119 | 119 | { |
@@ -18,312 +18,312 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** client/html/catalog/detail/basket/service/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the catalog detail basket attribute section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2016.05 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/catalog/detail/basket/service/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - |
|
| 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->serviceBody = $html; |
|
| 82 | - |
|
| 83 | - /** client/html/catalog/detail/basket/service/standard/template-body |
|
| 84 | - * Relative path to the HTML body template of the catalog detail basket service 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 2016.05 |
|
| 100 | - * @category Developer |
|
| 101 | - * @see client/html/catalog/detail/basket/service/standard/template-header |
|
| 102 | - */ |
|
| 103 | - $tplconf = 'client/html/catalog/detail/basket/service/standard/template-body'; |
|
| 104 | - $default = 'catalog/detail/basket-service-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->serviceHeader = $html; |
|
| 127 | - |
|
| 128 | - /** client/html/catalog/detail/basket/service/standard/template-header |
|
| 129 | - * Relative path to the HTML header template of the catalog detail basket service 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 2016.05 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/catalog/detail/basket/service/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/catalog/detail/basket/service/standard/template-header'; |
|
| 150 | - $default = 'catalog/detail/basket-service-header-default.php'; |
|
| 151 | - |
|
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/catalog/detail/basket/service/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the catalog detail basket service html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/catalog/detail/basket/service/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 2016.05 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/catalog/detail/basket/service/decorators/global |
|
| 188 | - * @see client/html/catalog/detail/basket/service/decorators/local |
|
| 189 | - */ |
|
| 190 | - |
|
| 191 | - /** client/html/catalog/detail/basket/service/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the catalog detail basket service html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/catalog/detail/basket/service/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 2016.05 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/catalog/detail/basket/service/decorators/excludes |
|
| 212 | - * @see client/html/catalog/detail/basket/service/decorators/local |
|
| 213 | - */ |
|
| 214 | - |
|
| 215 | - /** client/html/catalog/detail/basket/service/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the catalog detail basket service html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/catalog/detail/basket/service/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 2016.05 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/catalog/detail/basket/service/decorators/excludes |
|
| 236 | - * @see client/html/catalog/detail/basket/service/service/decorators/global |
|
| 237 | - */ |
|
| 238 | - |
|
| 239 | - return $this->createSubClient( 'catalog/detail/basket/service/' . $type, $name ); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * Returns the list of sub-client names configured for the client. |
|
| 245 | - * |
|
| 246 | - * @return array List of HTML client names |
|
| 247 | - */ |
|
| 248 | - protected function getSubClientNames() |
|
| 249 | - { |
|
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Sets the necessary parameter values in the view. |
|
| 256 | - * |
|
| 257 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | - */ |
|
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | - { |
|
| 264 | - if( !isset( $this->cache ) ) |
|
| 265 | - { |
|
| 266 | - $context = $this->getContext(); |
|
| 267 | - $config = $context->getConfig(); |
|
| 268 | - |
|
| 269 | - /** client/html/catalog/detail/basket/service/types |
|
| 270 | - * The service types available in the basket service template |
|
| 271 | - * |
|
| 272 | - * By default, only delivery services will be available in the |
|
| 273 | - * template but you can extend the list to payment services too. |
|
| 274 | - * |
|
| 275 | - * @param array List of type codes |
|
| 276 | - * @since 2016.05 |
|
| 277 | - * @category Developer |
|
| 278 | - * @see client/html/catalog/detail/basket/service/domains |
|
| 279 | - */ |
|
| 280 | - $types = $config->get( 'client/html/catalog/detail/basket/service/types', array( 'delivery' ) ); |
|
| 281 | - |
|
| 282 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 283 | - $search = $manager->createSearch( true ); |
|
| 284 | - |
|
| 285 | - $expr = array( |
|
| 286 | - $search->compare( '==', 'service.type.code', $types ), |
|
| 287 | - $search->getConditions(), |
|
| 288 | - ); |
|
| 289 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 290 | - |
|
| 291 | - $sortation = array( |
|
| 292 | - $search->sort( '+', 'service.type.code' ), |
|
| 293 | - $search->sort( '+', 'service.position' ), |
|
| 294 | - ); |
|
| 295 | - $search->setSortations( $sortation ); |
|
| 296 | - |
|
| 297 | - /** client/html/catalog/detail/basket/service/domains |
|
| 298 | - * A list of domain names whose items should be available for the services |
|
| 299 | - * in the basket services part of the catalog detail view templates |
|
| 300 | - * |
|
| 301 | - * Usually, service prices and texts are available in the templates |
|
| 302 | - * rendering basket services related data. If you want to |
|
| 303 | - * display additional content like the attributes, you can configure |
|
| 304 | - * your own list of domains (attribute, media, price, text, |
|
| 305 | - * etc. are domains) whose items are fetched from the storage. |
|
| 306 | - * |
|
| 307 | - * @param array List of domain names |
|
| 308 | - * @since 2016.05 |
|
| 309 | - * @category Developer |
|
| 310 | - * @see client/html/catalog/detail/basket/service/types |
|
| 311 | - */ |
|
| 312 | - $domains = $config->get( 'client/html/catalog/detail/basket/service/domains', array( 'text', 'price' ) ); |
|
| 313 | - |
|
| 314 | - $services = $manager->searchItems( $search, $domains ); |
|
| 315 | - |
|
| 316 | - $this->addMetaItem( $services, 'service', $this->expire, $this->tags ); |
|
| 317 | - $this->addMetaList( array_keys( $services ), 'service', $this->expire ); |
|
| 318 | - |
|
| 319 | - $view->serviceItems = $services; |
|
| 320 | - |
|
| 321 | - $this->cache = $view; |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 325 | - $tags = array_merge( $tags, $this->tags ); |
|
| 326 | - |
|
| 327 | - return $this->cache; |
|
| 328 | - } |
|
| 24 | + /** client/html/catalog/detail/basket/service/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the catalog detail basket attribute section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2016.05 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/catalog/detail/basket/service/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + |
|
| 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->serviceBody = $html; |
|
| 82 | + |
|
| 83 | + /** client/html/catalog/detail/basket/service/standard/template-body |
|
| 84 | + * Relative path to the HTML body template of the catalog detail basket service 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 2016.05 |
|
| 100 | + * @category Developer |
|
| 101 | + * @see client/html/catalog/detail/basket/service/standard/template-header |
|
| 102 | + */ |
|
| 103 | + $tplconf = 'client/html/catalog/detail/basket/service/standard/template-body'; |
|
| 104 | + $default = 'catalog/detail/basket-service-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->serviceHeader = $html; |
|
| 127 | + |
|
| 128 | + /** client/html/catalog/detail/basket/service/standard/template-header |
|
| 129 | + * Relative path to the HTML header template of the catalog detail basket service 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 2016.05 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/catalog/detail/basket/service/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/catalog/detail/basket/service/standard/template-header'; |
|
| 150 | + $default = 'catalog/detail/basket-service-header-default.php'; |
|
| 151 | + |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/catalog/detail/basket/service/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the catalog detail basket service html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/catalog/detail/basket/service/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 2016.05 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/catalog/detail/basket/service/decorators/global |
|
| 188 | + * @see client/html/catalog/detail/basket/service/decorators/local |
|
| 189 | + */ |
|
| 190 | + |
|
| 191 | + /** client/html/catalog/detail/basket/service/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the catalog detail basket service html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/catalog/detail/basket/service/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 2016.05 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/catalog/detail/basket/service/decorators/excludes |
|
| 212 | + * @see client/html/catalog/detail/basket/service/decorators/local |
|
| 213 | + */ |
|
| 214 | + |
|
| 215 | + /** client/html/catalog/detail/basket/service/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the catalog detail basket service html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/catalog/detail/basket/service/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 2016.05 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/catalog/detail/basket/service/decorators/excludes |
|
| 236 | + * @see client/html/catalog/detail/basket/service/service/decorators/global |
|
| 237 | + */ |
|
| 238 | + |
|
| 239 | + return $this->createSubClient( 'catalog/detail/basket/service/' . $type, $name ); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * Returns the list of sub-client names configured for the client. |
|
| 245 | + * |
|
| 246 | + * @return array List of HTML client names |
|
| 247 | + */ |
|
| 248 | + protected function getSubClientNames() |
|
| 249 | + { |
|
| 250 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Sets the necessary parameter values in the view. |
|
| 256 | + * |
|
| 257 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | + */ |
|
| 262 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | + { |
|
| 264 | + if( !isset( $this->cache ) ) |
|
| 265 | + { |
|
| 266 | + $context = $this->getContext(); |
|
| 267 | + $config = $context->getConfig(); |
|
| 268 | + |
|
| 269 | + /** client/html/catalog/detail/basket/service/types |
|
| 270 | + * The service types available in the basket service template |
|
| 271 | + * |
|
| 272 | + * By default, only delivery services will be available in the |
|
| 273 | + * template but you can extend the list to payment services too. |
|
| 274 | + * |
|
| 275 | + * @param array List of type codes |
|
| 276 | + * @since 2016.05 |
|
| 277 | + * @category Developer |
|
| 278 | + * @see client/html/catalog/detail/basket/service/domains |
|
| 279 | + */ |
|
| 280 | + $types = $config->get( 'client/html/catalog/detail/basket/service/types', array( 'delivery' ) ); |
|
| 281 | + |
|
| 282 | + $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 283 | + $search = $manager->createSearch( true ); |
|
| 284 | + |
|
| 285 | + $expr = array( |
|
| 286 | + $search->compare( '==', 'service.type.code', $types ), |
|
| 287 | + $search->getConditions(), |
|
| 288 | + ); |
|
| 289 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 290 | + |
|
| 291 | + $sortation = array( |
|
| 292 | + $search->sort( '+', 'service.type.code' ), |
|
| 293 | + $search->sort( '+', 'service.position' ), |
|
| 294 | + ); |
|
| 295 | + $search->setSortations( $sortation ); |
|
| 296 | + |
|
| 297 | + /** client/html/catalog/detail/basket/service/domains |
|
| 298 | + * A list of domain names whose items should be available for the services |
|
| 299 | + * in the basket services part of the catalog detail view templates |
|
| 300 | + * |
|
| 301 | + * Usually, service prices and texts are available in the templates |
|
| 302 | + * rendering basket services related data. If you want to |
|
| 303 | + * display additional content like the attributes, you can configure |
|
| 304 | + * your own list of domains (attribute, media, price, text, |
|
| 305 | + * etc. are domains) whose items are fetched from the storage. |
|
| 306 | + * |
|
| 307 | + * @param array List of domain names |
|
| 308 | + * @since 2016.05 |
|
| 309 | + * @category Developer |
|
| 310 | + * @see client/html/catalog/detail/basket/service/types |
|
| 311 | + */ |
|
| 312 | + $domains = $config->get( 'client/html/catalog/detail/basket/service/domains', array( 'text', 'price' ) ); |
|
| 313 | + |
|
| 314 | + $services = $manager->searchItems( $search, $domains ); |
|
| 315 | + |
|
| 316 | + $this->addMetaItem( $services, 'service', $this->expire, $this->tags ); |
|
| 317 | + $this->addMetaList( array_keys( $services ), 'service', $this->expire ); |
|
| 318 | + |
|
| 319 | + $view->serviceItems = $services; |
|
| 320 | + |
|
| 321 | + $this->cache = $view; |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 325 | + $tags = array_merge( $tags, $this->tags ); |
|
| 326 | + |
|
| 327 | + return $this->cache; |
|
| 328 | + } |
|
| 329 | 329 | } |
| 330 | 330 | \ No newline at end of file |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 71 | 71 | * @return string HTML code |
| 72 | 72 | */ |
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 74 | 74 | { |
| 75 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 76 | 76 | |
| 77 | 77 | $html = ''; |
| 78 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 79 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + foreach ($this->getSubClients() as $subclient) { |
|
| 79 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 80 | 80 | } |
| 81 | 81 | $view->serviceBody = $html; |
| 82 | 82 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $tplconf = 'client/html/catalog/detail/basket/service/standard/template-body'; |
| 104 | 104 | $default = 'catalog/detail/basket-service-body-default.php'; |
| 105 | 105 | |
| 106 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + return $view->render($view->config($tplconf, $default)); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 116 | 116 | * @return string|null String including HTML tags for the header on error |
| 117 | 117 | */ |
| 118 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 119 | 119 | { |
| 120 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 121 | 121 | |
| 122 | 122 | $html = ''; |
| 123 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 124 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + foreach ($this->getSubClients() as $subclient) { |
|
| 124 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 125 | 125 | } |
| 126 | 126 | $view->serviceHeader = $html; |
| 127 | 127 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/catalog/detail/basket/service/standard/template-header'; |
| 150 | 150 | $default = 'catalog/detail/basket-service-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/catalog/detail/basket/service/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the catalog detail basket service html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/catalog/detail/basket/service/service/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'catalog/detail/basket/service/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('catalog/detail/basket/service/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - if( !isset( $this->cache ) ) |
|
| 264 | + if (!isset($this->cache)) |
|
| 265 | 265 | { |
| 266 | 266 | $context = $this->getContext(); |
| 267 | 267 | $config = $context->getConfig(); |
@@ -277,22 +277,22 @@ discard block |
||
| 277 | 277 | * @category Developer |
| 278 | 278 | * @see client/html/catalog/detail/basket/service/domains |
| 279 | 279 | */ |
| 280 | - $types = $config->get( 'client/html/catalog/detail/basket/service/types', array( 'delivery' ) ); |
|
| 280 | + $types = $config->get('client/html/catalog/detail/basket/service/types', array('delivery')); |
|
| 281 | 281 | |
| 282 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 283 | - $search = $manager->createSearch( true ); |
|
| 282 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 283 | + $search = $manager->createSearch(true); |
|
| 284 | 284 | |
| 285 | 285 | $expr = array( |
| 286 | - $search->compare( '==', 'service.type.code', $types ), |
|
| 286 | + $search->compare('==', 'service.type.code', $types), |
|
| 287 | 287 | $search->getConditions(), |
| 288 | 288 | ); |
| 289 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 289 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 290 | 290 | |
| 291 | 291 | $sortation = array( |
| 292 | - $search->sort( '+', 'service.type.code' ), |
|
| 293 | - $search->sort( '+', 'service.position' ), |
|
| 292 | + $search->sort('+', 'service.type.code'), |
|
| 293 | + $search->sort('+', 'service.position'), |
|
| 294 | 294 | ); |
| 295 | - $search->setSortations( $sortation ); |
|
| 295 | + $search->setSortations($sortation); |
|
| 296 | 296 | |
| 297 | 297 | /** client/html/catalog/detail/basket/service/domains |
| 298 | 298 | * A list of domain names whose items should be available for the services |
@@ -309,20 +309,20 @@ discard block |
||
| 309 | 309 | * @category Developer |
| 310 | 310 | * @see client/html/catalog/detail/basket/service/types |
| 311 | 311 | */ |
| 312 | - $domains = $config->get( 'client/html/catalog/detail/basket/service/domains', array( 'text', 'price' ) ); |
|
| 312 | + $domains = $config->get('client/html/catalog/detail/basket/service/domains', array('text', 'price')); |
|
| 313 | 313 | |
| 314 | - $services = $manager->searchItems( $search, $domains ); |
|
| 314 | + $services = $manager->searchItems($search, $domains); |
|
| 315 | 315 | |
| 316 | - $this->addMetaItem( $services, 'service', $this->expire, $this->tags ); |
|
| 317 | - $this->addMetaList( array_keys( $services ), 'service', $this->expire ); |
|
| 316 | + $this->addMetaItem($services, 'service', $this->expire, $this->tags); |
|
| 317 | + $this->addMetaList(array_keys($services), 'service', $this->expire); |
|
| 318 | 318 | |
| 319 | 319 | $view->serviceItems = $services; |
| 320 | 320 | |
| 321 | 321 | $this->cache = $view; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 325 | - $tags = array_merge( $tags, $this->tags ); |
|
| 324 | + $expire = $this->expires($this->expire, $expire); |
|
| 325 | + $tags = array_merge($tags, $this->tags); |
|
| 326 | 326 | |
| 327 | 327 | return $this->cache; |
| 328 | 328 | } |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 134 | 134 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 135 | 135 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 136 | - * @return string|null String including HTML tags for the header on error |
|
| 136 | + * @return string String including HTML tags for the header on error |
|
| 137 | 137 | */ |
| 138 | 138 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 139 | 139 | { |
@@ -19,326 +19,326 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/basket/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail basket section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/detail/basket/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/catalog/detail/basket/selection/name |
|
| 61 | - * Name of the selection part used by the catalog detail basket client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basket\Selection\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.03 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/catalog/detail/basket/attribute/name |
|
| 72 | - * Name of the attribute part used by the catalog detail basket client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basket\Attribute\Myname". |
|
| 75 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | - * |
|
| 77 | - * @param string Last part of the client class name |
|
| 78 | - * @since 2014.03 |
|
| 79 | - * @category Developer |
|
| 80 | - */ |
|
| 81 | - private $subPartNames = array( 'service', 'selection', 'attribute' ); |
|
| 82 | - private $cache; |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Returns the HTML code for insertion into the body. |
|
| 87 | - * |
|
| 88 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 89 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 90 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 91 | - * @return string HTML code |
|
| 92 | - */ |
|
| 93 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 94 | - { |
|
| 95 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 96 | - |
|
| 97 | - $html = ''; |
|
| 98 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 99 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 100 | - } |
|
| 101 | - $view->basketBody = $html; |
|
| 102 | - |
|
| 103 | - /** client/html/catalog/detail/basket/standard/template-body |
|
| 104 | - * Relative path to the HTML body template of the catalog detail basket client. |
|
| 105 | - * |
|
| 106 | - * The template file contains the HTML code and processing instructions |
|
| 107 | - * to generate the result shown in the body of the frontend. The |
|
| 108 | - * configuration string is the path to the template file relative |
|
| 109 | - * to the templates directory (usually in client/html/templates). |
|
| 110 | - * |
|
| 111 | - * You can overwrite the template file configuration in extensions and |
|
| 112 | - * provide alternative templates. These alternative templates should be |
|
| 113 | - * named like the default one but with the string "standard" replaced by |
|
| 114 | - * an unique name. You may use the name of your project for this. If |
|
| 115 | - * you've implemented an alternative client class as well, "standard" |
|
| 116 | - * should be replaced by the name of the new class. |
|
| 117 | - * |
|
| 118 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 119 | - * @since 2014.03 |
|
| 120 | - * @category Developer |
|
| 121 | - * @see client/html/catalog/detail/basket/standard/template-header |
|
| 122 | - */ |
|
| 123 | - $tplconf = 'client/html/catalog/detail/basket/standard/template-body'; |
|
| 124 | - $default = 'catalog/detail/basket-body-default.php'; |
|
| 125 | - |
|
| 126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Returns the HTML string for insertion into the header. |
|
| 132 | - * |
|
| 133 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 134 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 135 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 136 | - * @return string|null String including HTML tags for the header on error |
|
| 137 | - */ |
|
| 138 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 139 | - { |
|
| 140 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 141 | - |
|
| 142 | - $html = ''; |
|
| 143 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 144 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 145 | - } |
|
| 146 | - $view->basketHeader = $html; |
|
| 147 | - |
|
| 148 | - /** client/html/catalog/detail/basket/standard/template-header |
|
| 149 | - * Relative path to the HTML header template of the catalog detail basket client. |
|
| 150 | - * |
|
| 151 | - * The template file contains the HTML code and processing instructions |
|
| 152 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 153 | - * of the rendered page in the frontend. The configuration string is the |
|
| 154 | - * path to the template file relative to the templates directory (usually |
|
| 155 | - * in client/html/templates). |
|
| 156 | - * |
|
| 157 | - * You can overwrite the template file configuration in extensions and |
|
| 158 | - * provide alternative templates. These alternative templates should be |
|
| 159 | - * named like the default one but with the string "standard" replaced by |
|
| 160 | - * an unique name. You may use the name of your project for this. If |
|
| 161 | - * you've implemented an alternative client class as well, "standard" |
|
| 162 | - * should be replaced by the name of the new class. |
|
| 163 | - * |
|
| 164 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 165 | - * @since 2014.03 |
|
| 166 | - * @category Developer |
|
| 167 | - * @see client/html/catalog/detail/basket/standard/template-body |
|
| 168 | - */ |
|
| 169 | - $tplconf = 'client/html/catalog/detail/basket/standard/template-header'; |
|
| 170 | - $default = 'catalog/detail/basket-header-default.php'; |
|
| 171 | - |
|
| 172 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Returns the sub-client given by its name. |
|
| 178 | - * |
|
| 179 | - * @param string $type Name of the client type |
|
| 180 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 181 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 182 | - */ |
|
| 183 | - public function getSubClient( $type, $name = null ) |
|
| 184 | - { |
|
| 185 | - /** client/html/catalog/detail/basket/decorators/excludes |
|
| 186 | - * Excludes decorators added by the "common" option from the catalog detail basket html client |
|
| 187 | - * |
|
| 188 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 189 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 190 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 191 | - * modify what is returned to the caller. |
|
| 192 | - * |
|
| 193 | - * This option allows you to remove a decorator added via |
|
| 194 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 195 | - * around the html client. |
|
| 196 | - * |
|
| 197 | - * client/html/catalog/detail/basket/decorators/excludes = array( 'decorator1' ) |
|
| 198 | - * |
|
| 199 | - * This would remove the decorator named "decorator1" from the list of |
|
| 200 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 201 | - * "client/html/common/decorators/default" to the html client. |
|
| 202 | - * |
|
| 203 | - * @param array List of decorator names |
|
| 204 | - * @since 2015.08 |
|
| 205 | - * @category Developer |
|
| 206 | - * @see client/html/common/decorators/default |
|
| 207 | - * @see client/html/catalog/detail/basket/decorators/global |
|
| 208 | - * @see client/html/catalog/detail/basket/decorators/local |
|
| 209 | - */ |
|
| 210 | - |
|
| 211 | - /** client/html/catalog/detail/basket/decorators/global |
|
| 212 | - * Adds a list of globally available decorators only to the catalog detail basket html client |
|
| 213 | - * |
|
| 214 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 215 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 216 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 217 | - * modify what is returned to the caller. |
|
| 218 | - * |
|
| 219 | - * This option allows you to wrap global decorators |
|
| 220 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 221 | - * |
|
| 222 | - * client/html/catalog/detail/basket/decorators/global = array( 'decorator1' ) |
|
| 223 | - * |
|
| 224 | - * This would add the decorator named "decorator1" defined by |
|
| 225 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 226 | - * |
|
| 227 | - * @param array List of decorator names |
|
| 228 | - * @since 2015.08 |
|
| 229 | - * @category Developer |
|
| 230 | - * @see client/html/common/decorators/default |
|
| 231 | - * @see client/html/catalog/detail/basket/decorators/excludes |
|
| 232 | - * @see client/html/catalog/detail/basket/decorators/local |
|
| 233 | - */ |
|
| 234 | - |
|
| 235 | - /** client/html/catalog/detail/basket/decorators/local |
|
| 236 | - * Adds a list of local decorators only to the catalog detail basket html client |
|
| 237 | - * |
|
| 238 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 239 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 240 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 241 | - * modify what is returned to the caller. |
|
| 242 | - * |
|
| 243 | - * This option allows you to wrap local decorators |
|
| 244 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 245 | - * |
|
| 246 | - * client/html/catalog/detail/basket/decorators/local = array( 'decorator2' ) |
|
| 247 | - * |
|
| 248 | - * This would add the decorator named "decorator2" defined by |
|
| 249 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 250 | - * |
|
| 251 | - * @param array List of decorator names |
|
| 252 | - * @since 2015.08 |
|
| 253 | - * @category Developer |
|
| 254 | - * @see client/html/common/decorators/default |
|
| 255 | - * @see client/html/catalog/detail/basket/decorators/excludes |
|
| 256 | - * @see client/html/catalog/detail/basket/decorators/global |
|
| 257 | - */ |
|
| 258 | - |
|
| 259 | - return $this->createSubClient( 'catalog/detail/basket/' . $type, $name ); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - |
|
| 263 | - /** |
|
| 264 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 265 | - * |
|
| 266 | - * @param string $content Cached content |
|
| 267 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 268 | - * @return string Modified body content |
|
| 269 | - */ |
|
| 270 | - public function modifyBody( $content, $uid ) |
|
| 271 | - { |
|
| 272 | - $content = parent::modifyBody( $content, $uid ); |
|
| 273 | - |
|
| 274 | - return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.detail.basket.csrf' ); |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Returns the list of sub-client names configured for the client. |
|
| 280 | - * |
|
| 281 | - * @return array List of HTML client names |
|
| 282 | - */ |
|
| 283 | - protected function getSubClientNames() |
|
| 284 | - { |
|
| 285 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * Sets the necessary parameter values in the view. |
|
| 291 | - * |
|
| 292 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 293 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 294 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 295 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 296 | - */ |
|
| 297 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 298 | - { |
|
| 299 | - if( !isset( $this->cache ) ) |
|
| 300 | - { |
|
| 301 | - $config = $this->getContext()->getConfig(); |
|
| 302 | - |
|
| 303 | - /** client/html/catalog/detail/stock/enable |
|
| 304 | - * Enables or disables displaying product stock levels in product detail view |
|
| 305 | - * |
|
| 306 | - * This configuration option allows shop owners to display product |
|
| 307 | - * stock levels for each product in the detail views or to disable |
|
| 308 | - * fetching product stock information. |
|
| 309 | - * |
|
| 310 | - * The stock information is fetched via AJAX and inserted via Javascript. |
|
| 311 | - * This allows to cache product items by leaving out such highly |
|
| 312 | - * dynamic content like stock levels which changes with each order. |
|
| 313 | - * |
|
| 314 | - * @param boolean Value of "1" to display stock levels, "0" to disable displaying them |
|
| 315 | - * @since 2014.03 |
|
| 316 | - * @category User |
|
| 317 | - * @category Developer |
|
| 318 | - * @see client/html/catalog/lists/stock/enable |
|
| 319 | - * @see client/html/catalog/stock/url/target |
|
| 320 | - * @see client/html/catalog/stock/url/controller |
|
| 321 | - * @see client/html/catalog/stock/url/action |
|
| 322 | - * @see client/html/catalog/stock/url/config |
|
| 323 | - */ |
|
| 324 | - if( isset( $view->detailProductItem ) && $config->get( 'client/html/catalog/detail/stock/enable', true ) === true ) |
|
| 325 | - { |
|
| 326 | - $stockTarget = $config->get( 'client/html/catalog/stock/url/target' ); |
|
| 327 | - $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 328 | - $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 329 | - $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() ); |
|
| 330 | - |
|
| 331 | - $prodIds = array_keys( $view->detailProductItem->getRefItems( 'product', null, 'default' ) ); |
|
| 332 | - array_unshift( $prodIds, $view->detailProductItem->getId() ); |
|
| 333 | - $params = array( 's_prodid' => $prodIds ); |
|
| 334 | - |
|
| 335 | - $view->basketStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 336 | - $view->basketProductIds = $prodIds; |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - $this->cache = $view; |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - return $this->cache; |
|
| 343 | - } |
|
| 25 | + /** client/html/catalog/detail/basket/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail basket section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/detail/basket/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/catalog/detail/basket/selection/name |
|
| 61 | + * Name of the selection part used by the catalog detail basket client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basket\Selection\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.03 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/catalog/detail/basket/attribute/name |
|
| 72 | + * Name of the attribute part used by the catalog detail basket client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basket\Attribute\Myname". |
|
| 75 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | + * |
|
| 77 | + * @param string Last part of the client class name |
|
| 78 | + * @since 2014.03 |
|
| 79 | + * @category Developer |
|
| 80 | + */ |
|
| 81 | + private $subPartNames = array( 'service', 'selection', 'attribute' ); |
|
| 82 | + private $cache; |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Returns the HTML code for insertion into the body. |
|
| 87 | + * |
|
| 88 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 89 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 90 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 91 | + * @return string HTML code |
|
| 92 | + */ |
|
| 93 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 94 | + { |
|
| 95 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 96 | + |
|
| 97 | + $html = ''; |
|
| 98 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 99 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 100 | + } |
|
| 101 | + $view->basketBody = $html; |
|
| 102 | + |
|
| 103 | + /** client/html/catalog/detail/basket/standard/template-body |
|
| 104 | + * Relative path to the HTML body template of the catalog detail basket client. |
|
| 105 | + * |
|
| 106 | + * The template file contains the HTML code and processing instructions |
|
| 107 | + * to generate the result shown in the body of the frontend. The |
|
| 108 | + * configuration string is the path to the template file relative |
|
| 109 | + * to the templates directory (usually in client/html/templates). |
|
| 110 | + * |
|
| 111 | + * You can overwrite the template file configuration in extensions and |
|
| 112 | + * provide alternative templates. These alternative templates should be |
|
| 113 | + * named like the default one but with the string "standard" replaced by |
|
| 114 | + * an unique name. You may use the name of your project for this. If |
|
| 115 | + * you've implemented an alternative client class as well, "standard" |
|
| 116 | + * should be replaced by the name of the new class. |
|
| 117 | + * |
|
| 118 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 119 | + * @since 2014.03 |
|
| 120 | + * @category Developer |
|
| 121 | + * @see client/html/catalog/detail/basket/standard/template-header |
|
| 122 | + */ |
|
| 123 | + $tplconf = 'client/html/catalog/detail/basket/standard/template-body'; |
|
| 124 | + $default = 'catalog/detail/basket-body-default.php'; |
|
| 125 | + |
|
| 126 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Returns the HTML string for insertion into the header. |
|
| 132 | + * |
|
| 133 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 134 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 135 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 136 | + * @return string|null String including HTML tags for the header on error |
|
| 137 | + */ |
|
| 138 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 139 | + { |
|
| 140 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 141 | + |
|
| 142 | + $html = ''; |
|
| 143 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 144 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 145 | + } |
|
| 146 | + $view->basketHeader = $html; |
|
| 147 | + |
|
| 148 | + /** client/html/catalog/detail/basket/standard/template-header |
|
| 149 | + * Relative path to the HTML header template of the catalog detail basket client. |
|
| 150 | + * |
|
| 151 | + * The template file contains the HTML code and processing instructions |
|
| 152 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 153 | + * of the rendered page in the frontend. The configuration string is the |
|
| 154 | + * path to the template file relative to the templates directory (usually |
|
| 155 | + * in client/html/templates). |
|
| 156 | + * |
|
| 157 | + * You can overwrite the template file configuration in extensions and |
|
| 158 | + * provide alternative templates. These alternative templates should be |
|
| 159 | + * named like the default one but with the string "standard" replaced by |
|
| 160 | + * an unique name. You may use the name of your project for this. If |
|
| 161 | + * you've implemented an alternative client class as well, "standard" |
|
| 162 | + * should be replaced by the name of the new class. |
|
| 163 | + * |
|
| 164 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 165 | + * @since 2014.03 |
|
| 166 | + * @category Developer |
|
| 167 | + * @see client/html/catalog/detail/basket/standard/template-body |
|
| 168 | + */ |
|
| 169 | + $tplconf = 'client/html/catalog/detail/basket/standard/template-header'; |
|
| 170 | + $default = 'catalog/detail/basket-header-default.php'; |
|
| 171 | + |
|
| 172 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Returns the sub-client given by its name. |
|
| 178 | + * |
|
| 179 | + * @param string $type Name of the client type |
|
| 180 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 181 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 182 | + */ |
|
| 183 | + public function getSubClient( $type, $name = null ) |
|
| 184 | + { |
|
| 185 | + /** client/html/catalog/detail/basket/decorators/excludes |
|
| 186 | + * Excludes decorators added by the "common" option from the catalog detail basket html client |
|
| 187 | + * |
|
| 188 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 189 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 190 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 191 | + * modify what is returned to the caller. |
|
| 192 | + * |
|
| 193 | + * This option allows you to remove a decorator added via |
|
| 194 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 195 | + * around the html client. |
|
| 196 | + * |
|
| 197 | + * client/html/catalog/detail/basket/decorators/excludes = array( 'decorator1' ) |
|
| 198 | + * |
|
| 199 | + * This would remove the decorator named "decorator1" from the list of |
|
| 200 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 201 | + * "client/html/common/decorators/default" to the html client. |
|
| 202 | + * |
|
| 203 | + * @param array List of decorator names |
|
| 204 | + * @since 2015.08 |
|
| 205 | + * @category Developer |
|
| 206 | + * @see client/html/common/decorators/default |
|
| 207 | + * @see client/html/catalog/detail/basket/decorators/global |
|
| 208 | + * @see client/html/catalog/detail/basket/decorators/local |
|
| 209 | + */ |
|
| 210 | + |
|
| 211 | + /** client/html/catalog/detail/basket/decorators/global |
|
| 212 | + * Adds a list of globally available decorators only to the catalog detail basket html client |
|
| 213 | + * |
|
| 214 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 215 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 216 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 217 | + * modify what is returned to the caller. |
|
| 218 | + * |
|
| 219 | + * This option allows you to wrap global decorators |
|
| 220 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 221 | + * |
|
| 222 | + * client/html/catalog/detail/basket/decorators/global = array( 'decorator1' ) |
|
| 223 | + * |
|
| 224 | + * This would add the decorator named "decorator1" defined by |
|
| 225 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 226 | + * |
|
| 227 | + * @param array List of decorator names |
|
| 228 | + * @since 2015.08 |
|
| 229 | + * @category Developer |
|
| 230 | + * @see client/html/common/decorators/default |
|
| 231 | + * @see client/html/catalog/detail/basket/decorators/excludes |
|
| 232 | + * @see client/html/catalog/detail/basket/decorators/local |
|
| 233 | + */ |
|
| 234 | + |
|
| 235 | + /** client/html/catalog/detail/basket/decorators/local |
|
| 236 | + * Adds a list of local decorators only to the catalog detail basket html client |
|
| 237 | + * |
|
| 238 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 239 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 240 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 241 | + * modify what is returned to the caller. |
|
| 242 | + * |
|
| 243 | + * This option allows you to wrap local decorators |
|
| 244 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 245 | + * |
|
| 246 | + * client/html/catalog/detail/basket/decorators/local = array( 'decorator2' ) |
|
| 247 | + * |
|
| 248 | + * This would add the decorator named "decorator2" defined by |
|
| 249 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 250 | + * |
|
| 251 | + * @param array List of decorator names |
|
| 252 | + * @since 2015.08 |
|
| 253 | + * @category Developer |
|
| 254 | + * @see client/html/common/decorators/default |
|
| 255 | + * @see client/html/catalog/detail/basket/decorators/excludes |
|
| 256 | + * @see client/html/catalog/detail/basket/decorators/global |
|
| 257 | + */ |
|
| 258 | + |
|
| 259 | + return $this->createSubClient( 'catalog/detail/basket/' . $type, $name ); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 265 | + * |
|
| 266 | + * @param string $content Cached content |
|
| 267 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 268 | + * @return string Modified body content |
|
| 269 | + */ |
|
| 270 | + public function modifyBody( $content, $uid ) |
|
| 271 | + { |
|
| 272 | + $content = parent::modifyBody( $content, $uid ); |
|
| 273 | + |
|
| 274 | + return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.detail.basket.csrf' ); |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Returns the list of sub-client names configured for the client. |
|
| 280 | + * |
|
| 281 | + * @return array List of HTML client names |
|
| 282 | + */ |
|
| 283 | + protected function getSubClientNames() |
|
| 284 | + { |
|
| 285 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * Sets the necessary parameter values in the view. |
|
| 291 | + * |
|
| 292 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 293 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 294 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 295 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 296 | + */ |
|
| 297 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 298 | + { |
|
| 299 | + if( !isset( $this->cache ) ) |
|
| 300 | + { |
|
| 301 | + $config = $this->getContext()->getConfig(); |
|
| 302 | + |
|
| 303 | + /** client/html/catalog/detail/stock/enable |
|
| 304 | + * Enables or disables displaying product stock levels in product detail view |
|
| 305 | + * |
|
| 306 | + * This configuration option allows shop owners to display product |
|
| 307 | + * stock levels for each product in the detail views or to disable |
|
| 308 | + * fetching product stock information. |
|
| 309 | + * |
|
| 310 | + * The stock information is fetched via AJAX and inserted via Javascript. |
|
| 311 | + * This allows to cache product items by leaving out such highly |
|
| 312 | + * dynamic content like stock levels which changes with each order. |
|
| 313 | + * |
|
| 314 | + * @param boolean Value of "1" to display stock levels, "0" to disable displaying them |
|
| 315 | + * @since 2014.03 |
|
| 316 | + * @category User |
|
| 317 | + * @category Developer |
|
| 318 | + * @see client/html/catalog/lists/stock/enable |
|
| 319 | + * @see client/html/catalog/stock/url/target |
|
| 320 | + * @see client/html/catalog/stock/url/controller |
|
| 321 | + * @see client/html/catalog/stock/url/action |
|
| 322 | + * @see client/html/catalog/stock/url/config |
|
| 323 | + */ |
|
| 324 | + if( isset( $view->detailProductItem ) && $config->get( 'client/html/catalog/detail/stock/enable', true ) === true ) |
|
| 325 | + { |
|
| 326 | + $stockTarget = $config->get( 'client/html/catalog/stock/url/target' ); |
|
| 327 | + $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 328 | + $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 329 | + $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() ); |
|
| 330 | + |
|
| 331 | + $prodIds = array_keys( $view->detailProductItem->getRefItems( 'product', null, 'default' ) ); |
|
| 332 | + array_unshift( $prodIds, $view->detailProductItem->getId() ); |
|
| 333 | + $params = array( 's_prodid' => $prodIds ); |
|
| 334 | + |
|
| 335 | + $view->basketStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 336 | + $view->basketProductIds = $prodIds; |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + $this->cache = $view; |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + return $this->cache; |
|
| 343 | + } |
|
| 344 | 344 | } |
| 345 | 345 | \ No newline at end of file |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @since 2014.03 |
| 79 | 79 | * @category Developer |
| 80 | 80 | */ |
| 81 | - private $subPartNames = array( 'service', 'selection', 'attribute' ); |
|
| 81 | + private $subPartNames = array('service', 'selection', 'attribute'); |
|
| 82 | 82 | private $cache; |
| 83 | 83 | |
| 84 | 84 | |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 91 | 91 | * @return string HTML code |
| 92 | 92 | */ |
| 93 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 93 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 94 | 94 | { |
| 95 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 95 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 96 | 96 | |
| 97 | 97 | $html = ''; |
| 98 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 99 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 98 | + foreach ($this->getSubClients() as $subclient) { |
|
| 99 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 100 | 100 | } |
| 101 | 101 | $view->basketBody = $html; |
| 102 | 102 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $tplconf = 'client/html/catalog/detail/basket/standard/template-body'; |
| 124 | 124 | $default = 'catalog/detail/basket-body-default.php'; |
| 125 | 125 | |
| 126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 126 | + return $view->render($view->config($tplconf, $default)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 136 | 136 | * @return string|null String including HTML tags for the header on error |
| 137 | 137 | */ |
| 138 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 138 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 139 | 139 | { |
| 140 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 140 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 141 | 141 | |
| 142 | 142 | $html = ''; |
| 143 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 144 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 143 | + foreach ($this->getSubClients() as $subclient) { |
|
| 144 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 145 | 145 | } |
| 146 | 146 | $view->basketHeader = $html; |
| 147 | 147 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $tplconf = 'client/html/catalog/detail/basket/standard/template-header'; |
| 170 | 170 | $default = 'catalog/detail/basket-header-default.php'; |
| 171 | 171 | |
| 172 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 172 | + return $view->render($view->config($tplconf, $default)); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param string|null $name Name of the sub-client (Default if null) |
| 181 | 181 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 182 | 182 | */ |
| 183 | - public function getSubClient( $type, $name = null ) |
|
| 183 | + public function getSubClient($type, $name = null) |
|
| 184 | 184 | { |
| 185 | 185 | /** client/html/catalog/detail/basket/decorators/excludes |
| 186 | 186 | * Excludes decorators added by the "common" option from the catalog detail basket html client |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @see client/html/catalog/detail/basket/decorators/global |
| 257 | 257 | */ |
| 258 | 258 | |
| 259 | - return $this->createSubClient( 'catalog/detail/basket/' . $type, $name ); |
|
| 259 | + return $this->createSubClient('catalog/detail/basket/'.$type, $name); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 268 | 268 | * @return string Modified body content |
| 269 | 269 | */ |
| 270 | - public function modifyBody( $content, $uid ) |
|
| 270 | + public function modifyBody($content, $uid) |
|
| 271 | 271 | { |
| 272 | - $content = parent::modifyBody( $content, $uid ); |
|
| 272 | + $content = parent::modifyBody($content, $uid); |
|
| 273 | 273 | |
| 274 | - return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.detail.basket.csrf' ); |
|
| 274 | + return $this->replaceSection($content, $this->getView()->csrf()->formfield(), 'catalog.detail.basket.csrf'); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | protected function getSubClientNames() |
| 284 | 284 | { |
| 285 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 285 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 295 | 295 | * @return \Aimeos\MW\View\Iface Modified view object |
| 296 | 296 | */ |
| 297 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 297 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 298 | 298 | { |
| 299 | - if( !isset( $this->cache ) ) |
|
| 299 | + if (!isset($this->cache)) |
|
| 300 | 300 | { |
| 301 | 301 | $config = $this->getContext()->getConfig(); |
| 302 | 302 | |
@@ -321,18 +321,18 @@ discard block |
||
| 321 | 321 | * @see client/html/catalog/stock/url/action |
| 322 | 322 | * @see client/html/catalog/stock/url/config |
| 323 | 323 | */ |
| 324 | - if( isset( $view->detailProductItem ) && $config->get( 'client/html/catalog/detail/stock/enable', true ) === true ) |
|
| 324 | + if (isset($view->detailProductItem) && $config->get('client/html/catalog/detail/stock/enable', true) === true) |
|
| 325 | 325 | { |
| 326 | - $stockTarget = $config->get( 'client/html/catalog/stock/url/target' ); |
|
| 327 | - $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' ); |
|
| 328 | - $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' ); |
|
| 329 | - $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() ); |
|
| 326 | + $stockTarget = $config->get('client/html/catalog/stock/url/target'); |
|
| 327 | + $stockController = $config->get('client/html/catalog/stock/url/controller', 'catalog'); |
|
| 328 | + $stockAction = $config->get('client/html/catalog/stock/url/action', 'stock'); |
|
| 329 | + $stockConfig = $config->get('client/html/catalog/stock/url/config', array()); |
|
| 330 | 330 | |
| 331 | - $prodIds = array_keys( $view->detailProductItem->getRefItems( 'product', null, 'default' ) ); |
|
| 332 | - array_unshift( $prodIds, $view->detailProductItem->getId() ); |
|
| 333 | - $params = array( 's_prodid' => $prodIds ); |
|
| 331 | + $prodIds = array_keys($view->detailProductItem->getRefItems('product', null, 'default')); |
|
| 332 | + array_unshift($prodIds, $view->detailProductItem->getId()); |
|
| 333 | + $params = array('s_prodid' => $prodIds); |
|
| 334 | 334 | |
| 335 | - $view->basketStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig ); |
|
| 335 | + $view->basketStockUrl = $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); |
|
| 336 | 336 | $view->basketProductIds = $prodIds; |
| 337 | 337 | } |
| 338 | 338 | |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 113 | 113 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | + * @return string String including HTML tags for the header on error |
|
| 116 | 116 | */ |
| 117 | 117 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 118 | 118 | { |
@@ -18,302 +18,302 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** client/html/catalog/detail/bought/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the catalog detail bought section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2014.09 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/catalog/detail/bought/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - private $tags = array(); |
|
| 60 | - private $expire; |
|
| 61 | - private $cache; |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Returns the HTML code for insertion into the body. |
|
| 66 | - * |
|
| 67 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | - * @return string HTML code |
|
| 71 | - */ |
|
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | - { |
|
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | - |
|
| 76 | - $html = ''; |
|
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | - } |
|
| 80 | - $view->boughtBody = $html; |
|
| 81 | - |
|
| 82 | - /** client/html/catalog/detail/bought/standard/template-body |
|
| 83 | - * Relative path to the HTML body template of the catalog detail bought client. |
|
| 84 | - * |
|
| 85 | - * The template file contains the HTML code and processing instructions |
|
| 86 | - * to generate the result shown in the body of the frontend. The |
|
| 87 | - * configuration string is the path to the template file relative |
|
| 88 | - * to the templates directory (usually in client/html/templates). |
|
| 89 | - * |
|
| 90 | - * You can overwrite the template file configuration in extensions and |
|
| 91 | - * provide alternative templates. These alternative templates should be |
|
| 92 | - * named like the default one but with the string "standard" replaced by |
|
| 93 | - * an unique name. You may use the name of your project for this. If |
|
| 94 | - * you've implemented an alternative client class as well, "standard" |
|
| 95 | - * should be replaced by the name of the new class. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2014.03 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/catalog/detail/bought/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/catalog/detail/bought/standard/template-body'; |
|
| 103 | - $default = 'catalog/detail/bought-body-default.php'; |
|
| 104 | - |
|
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | - |
|
| 121 | - $html = ''; |
|
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | - } |
|
| 125 | - $view->boughtHeader = $html; |
|
| 126 | - |
|
| 127 | - /** client/html/catalog/detail/bought/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the catalog detail bought client. |
|
| 129 | - * |
|
| 130 | - * The template file contains the HTML code and processing instructions |
|
| 131 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | - * of the rendered page in the frontend. The configuration string is the |
|
| 133 | - * path to the template file relative to the templates directory (usually |
|
| 134 | - * in client/html/templates). |
|
| 135 | - * |
|
| 136 | - * You can overwrite the template file configuration in extensions and |
|
| 137 | - * provide alternative templates. These alternative templates should be |
|
| 138 | - * named like the default one but with the string "standard" replaced by |
|
| 139 | - * an unique name. You may use the name of your project for this. If |
|
| 140 | - * you've implemented an alternative client class as well, "standard" |
|
| 141 | - * should be replaced by the name of the new class. |
|
| 142 | - * |
|
| 143 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | - * @since 2014.03 |
|
| 145 | - * @category Developer |
|
| 146 | - * @see client/html/catalog/detail/bought/standard/template-body |
|
| 147 | - */ |
|
| 148 | - $tplconf = 'client/html/catalog/detail/bought/standard/template-header'; |
|
| 149 | - $default = 'catalog/detail/bought-header-default.php'; |
|
| 150 | - |
|
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Returns the sub-client given by its name. |
|
| 157 | - * |
|
| 158 | - * @param string $type Name of the client type |
|
| 159 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | - */ |
|
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 163 | - { |
|
| 164 | - /** client/html/catalog/detail/bought/decorators/excludes |
|
| 165 | - * Excludes decorators added by the "common" option from the catalog detail bought html client |
|
| 166 | - * |
|
| 167 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 168 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 169 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 170 | - * modify what is returned to the caller. |
|
| 171 | - * |
|
| 172 | - * This option allows you to remove a decorator added via |
|
| 173 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 174 | - * around the html client. |
|
| 175 | - * |
|
| 176 | - * client/html/catalog/detail/bought/decorators/excludes = array( 'decorator1' ) |
|
| 177 | - * |
|
| 178 | - * This would remove the decorator named "decorator1" from the list of |
|
| 179 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 180 | - * "client/html/common/decorators/default" to the html client. |
|
| 181 | - * |
|
| 182 | - * @param array List of decorator names |
|
| 183 | - * @since 2015.08 |
|
| 184 | - * @category Developer |
|
| 185 | - * @see client/html/common/decorators/default |
|
| 186 | - * @see client/html/catalog/detail/bought/decorators/global |
|
| 187 | - * @see client/html/catalog/detail/bought/decorators/local |
|
| 188 | - */ |
|
| 189 | - |
|
| 190 | - /** client/html/catalog/detail/bought/decorators/global |
|
| 191 | - * Adds a list of globally available decorators only to the catalog detail bought html client |
|
| 192 | - * |
|
| 193 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 194 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 195 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 196 | - * modify what is returned to the caller. |
|
| 197 | - * |
|
| 198 | - * This option allows you to wrap global decorators |
|
| 199 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 200 | - * |
|
| 201 | - * client/html/catalog/detail/bought/decorators/global = array( 'decorator1' ) |
|
| 202 | - * |
|
| 203 | - * This would add the decorator named "decorator1" defined by |
|
| 204 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 205 | - * |
|
| 206 | - * @param array List of decorator names |
|
| 207 | - * @since 2015.08 |
|
| 208 | - * @category Developer |
|
| 209 | - * @see client/html/common/decorators/default |
|
| 210 | - * @see client/html/catalog/detail/bought/decorators/excludes |
|
| 211 | - * @see client/html/catalog/detail/bought/decorators/local |
|
| 212 | - */ |
|
| 213 | - |
|
| 214 | - /** client/html/catalog/detail/bought/decorators/local |
|
| 215 | - * Adds a list of local decorators only to the catalog detail bought html client |
|
| 216 | - * |
|
| 217 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 218 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 219 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 220 | - * modify what is returned to the caller. |
|
| 221 | - * |
|
| 222 | - * This option allows you to wrap local decorators |
|
| 223 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 224 | - * |
|
| 225 | - * client/html/catalog/detail/bought/decorators/local = array( 'decorator2' ) |
|
| 226 | - * |
|
| 227 | - * This would add the decorator named "decorator2" defined by |
|
| 228 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 229 | - * |
|
| 230 | - * @param array List of decorator names |
|
| 231 | - * @since 2015.08 |
|
| 232 | - * @category Developer |
|
| 233 | - * @see client/html/common/decorators/default |
|
| 234 | - * @see client/html/catalog/detail/bought/decorators/excludes |
|
| 235 | - * @see client/html/catalog/detail/bought/decorators/global |
|
| 236 | - */ |
|
| 237 | - |
|
| 238 | - return $this->createSubClient( 'catalog/detail/bought/' . $type, $name ); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * Returns the list of sub-client names configured for the client. |
|
| 244 | - * |
|
| 245 | - * @return array List of HTML client names |
|
| 246 | - */ |
|
| 247 | - protected function getSubClientNames() |
|
| 248 | - { |
|
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Sets the necessary parameter values in the view. |
|
| 255 | - * |
|
| 256 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | - */ |
|
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | - { |
|
| 263 | - if( !isset( $this->cache ) ) |
|
| 264 | - { |
|
| 265 | - if( isset( $view->detailProductItem ) ) |
|
| 266 | - { |
|
| 267 | - $context = $this->getContext(); |
|
| 268 | - $config = $context->getConfig(); |
|
| 269 | - $domains = array( 'text', 'price', 'media' ); |
|
| 270 | - $products = $view->detailProductItem->getRefItems( 'product', null, 'bought-together' ); |
|
| 271 | - |
|
| 272 | - /** client/html/catalog/detail/domains |
|
| 273 | - * A list of domain names whose items should be available in the catalog view templates |
|
| 274 | - * |
|
| 275 | - * @see client/html/catalog/detail/domains |
|
| 276 | - */ |
|
| 277 | - $domains = $config->get( 'client/html/catalog/detail/domains', $domains ); |
|
| 278 | - |
|
| 279 | - /** client/html/catalog/detail/bought/domains |
|
| 280 | - * A list of domain names whose items should be available in the bought part of the catalog detail view templates |
|
| 281 | - * |
|
| 282 | - * The templates rendering bought related data usually add |
|
| 283 | - * the images and texts associated to each item. If you want to |
|
| 284 | - * display additional content like the attributes, you can configure |
|
| 285 | - * your own list of domains (attribute, media, price, product, text, |
|
| 286 | - * etc. are domains) whose items are fetched from the storage. |
|
| 287 | - * Please keep in mind that the more domains you add to the |
|
| 288 | - * configuration, the more time is required for fetching the content! |
|
| 289 | - * |
|
| 290 | - * This configuration option can be overwritten by the |
|
| 291 | - * "client/html/catalog/detail/domains" configuration option that |
|
| 292 | - * allows to configure the domain names of the items fetched |
|
| 293 | - * specifically for all types of product listings. |
|
| 294 | - * |
|
| 295 | - * @param array List of domain names |
|
| 296 | - * @since 2015.09 |
|
| 297 | - * @category Developer |
|
| 298 | - * @see client/html/catalog/detail/domains |
|
| 299 | - */ |
|
| 300 | - $domains = $config->get( 'client/html/catalog/detail/bought/domains', $domains ); |
|
| 301 | - |
|
| 302 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 303 | - |
|
| 304 | - $view->boughtItems = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 305 | - $view->boughtPosItems = $products; |
|
| 306 | - |
|
| 307 | - $this->addMetaItem( $view->boughtItems, 'product', $this->expire, $this->tags ); |
|
| 308 | - $this->addMetaList( array_keys( $view->boughtItems ), 'product', $this->expire ); |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - $this->cache = $view; |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 315 | - $tags = array_merge( $tags, $this->tags ); |
|
| 316 | - |
|
| 317 | - return $this->cache; |
|
| 318 | - } |
|
| 24 | + /** client/html/catalog/detail/bought/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the catalog detail bought section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2014.09 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/catalog/detail/bought/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + private $tags = array(); |
|
| 60 | + private $expire; |
|
| 61 | + private $cache; |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Returns the HTML code for insertion into the body. |
|
| 66 | + * |
|
| 67 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | + * @return string HTML code |
|
| 71 | + */ |
|
| 72 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + { |
|
| 74 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | + |
|
| 76 | + $html = ''; |
|
| 77 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | + } |
|
| 80 | + $view->boughtBody = $html; |
|
| 81 | + |
|
| 82 | + /** client/html/catalog/detail/bought/standard/template-body |
|
| 83 | + * Relative path to the HTML body template of the catalog detail bought client. |
|
| 84 | + * |
|
| 85 | + * The template file contains the HTML code and processing instructions |
|
| 86 | + * to generate the result shown in the body of the frontend. The |
|
| 87 | + * configuration string is the path to the template file relative |
|
| 88 | + * to the templates directory (usually in client/html/templates). |
|
| 89 | + * |
|
| 90 | + * You can overwrite the template file configuration in extensions and |
|
| 91 | + * provide alternative templates. These alternative templates should be |
|
| 92 | + * named like the default one but with the string "standard" replaced by |
|
| 93 | + * an unique name. You may use the name of your project for this. If |
|
| 94 | + * you've implemented an alternative client class as well, "standard" |
|
| 95 | + * should be replaced by the name of the new class. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2014.03 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/catalog/detail/bought/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/catalog/detail/bought/standard/template-body'; |
|
| 103 | + $default = 'catalog/detail/bought-body-default.php'; |
|
| 104 | + |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | + |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->boughtHeader = $html; |
|
| 126 | + |
|
| 127 | + /** client/html/catalog/detail/bought/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the catalog detail bought client. |
|
| 129 | + * |
|
| 130 | + * The template file contains the HTML code and processing instructions |
|
| 131 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | + * of the rendered page in the frontend. The configuration string is the |
|
| 133 | + * path to the template file relative to the templates directory (usually |
|
| 134 | + * in client/html/templates). |
|
| 135 | + * |
|
| 136 | + * You can overwrite the template file configuration in extensions and |
|
| 137 | + * provide alternative templates. These alternative templates should be |
|
| 138 | + * named like the default one but with the string "standard" replaced by |
|
| 139 | + * an unique name. You may use the name of your project for this. If |
|
| 140 | + * you've implemented an alternative client class as well, "standard" |
|
| 141 | + * should be replaced by the name of the new class. |
|
| 142 | + * |
|
| 143 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | + * @since 2014.03 |
|
| 145 | + * @category Developer |
|
| 146 | + * @see client/html/catalog/detail/bought/standard/template-body |
|
| 147 | + */ |
|
| 148 | + $tplconf = 'client/html/catalog/detail/bought/standard/template-header'; |
|
| 149 | + $default = 'catalog/detail/bought-header-default.php'; |
|
| 150 | + |
|
| 151 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Returns the sub-client given by its name. |
|
| 157 | + * |
|
| 158 | + * @param string $type Name of the client type |
|
| 159 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | + */ |
|
| 162 | + public function getSubClient( $type, $name = null ) |
|
| 163 | + { |
|
| 164 | + /** client/html/catalog/detail/bought/decorators/excludes |
|
| 165 | + * Excludes decorators added by the "common" option from the catalog detail bought html client |
|
| 166 | + * |
|
| 167 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 168 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 169 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 170 | + * modify what is returned to the caller. |
|
| 171 | + * |
|
| 172 | + * This option allows you to remove a decorator added via |
|
| 173 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 174 | + * around the html client. |
|
| 175 | + * |
|
| 176 | + * client/html/catalog/detail/bought/decorators/excludes = array( 'decorator1' ) |
|
| 177 | + * |
|
| 178 | + * This would remove the decorator named "decorator1" from the list of |
|
| 179 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 180 | + * "client/html/common/decorators/default" to the html client. |
|
| 181 | + * |
|
| 182 | + * @param array List of decorator names |
|
| 183 | + * @since 2015.08 |
|
| 184 | + * @category Developer |
|
| 185 | + * @see client/html/common/decorators/default |
|
| 186 | + * @see client/html/catalog/detail/bought/decorators/global |
|
| 187 | + * @see client/html/catalog/detail/bought/decorators/local |
|
| 188 | + */ |
|
| 189 | + |
|
| 190 | + /** client/html/catalog/detail/bought/decorators/global |
|
| 191 | + * Adds a list of globally available decorators only to the catalog detail bought html client |
|
| 192 | + * |
|
| 193 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 194 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 195 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 196 | + * modify what is returned to the caller. |
|
| 197 | + * |
|
| 198 | + * This option allows you to wrap global decorators |
|
| 199 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 200 | + * |
|
| 201 | + * client/html/catalog/detail/bought/decorators/global = array( 'decorator1' ) |
|
| 202 | + * |
|
| 203 | + * This would add the decorator named "decorator1" defined by |
|
| 204 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 205 | + * |
|
| 206 | + * @param array List of decorator names |
|
| 207 | + * @since 2015.08 |
|
| 208 | + * @category Developer |
|
| 209 | + * @see client/html/common/decorators/default |
|
| 210 | + * @see client/html/catalog/detail/bought/decorators/excludes |
|
| 211 | + * @see client/html/catalog/detail/bought/decorators/local |
|
| 212 | + */ |
|
| 213 | + |
|
| 214 | + /** client/html/catalog/detail/bought/decorators/local |
|
| 215 | + * Adds a list of local decorators only to the catalog detail bought html client |
|
| 216 | + * |
|
| 217 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 218 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 219 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 220 | + * modify what is returned to the caller. |
|
| 221 | + * |
|
| 222 | + * This option allows you to wrap local decorators |
|
| 223 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 224 | + * |
|
| 225 | + * client/html/catalog/detail/bought/decorators/local = array( 'decorator2' ) |
|
| 226 | + * |
|
| 227 | + * This would add the decorator named "decorator2" defined by |
|
| 228 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 229 | + * |
|
| 230 | + * @param array List of decorator names |
|
| 231 | + * @since 2015.08 |
|
| 232 | + * @category Developer |
|
| 233 | + * @see client/html/common/decorators/default |
|
| 234 | + * @see client/html/catalog/detail/bought/decorators/excludes |
|
| 235 | + * @see client/html/catalog/detail/bought/decorators/global |
|
| 236 | + */ |
|
| 237 | + |
|
| 238 | + return $this->createSubClient( 'catalog/detail/bought/' . $type, $name ); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * Returns the list of sub-client names configured for the client. |
|
| 244 | + * |
|
| 245 | + * @return array List of HTML client names |
|
| 246 | + */ |
|
| 247 | + protected function getSubClientNames() |
|
| 248 | + { |
|
| 249 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Sets the necessary parameter values in the view. |
|
| 255 | + * |
|
| 256 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | + */ |
|
| 261 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + { |
|
| 263 | + if( !isset( $this->cache ) ) |
|
| 264 | + { |
|
| 265 | + if( isset( $view->detailProductItem ) ) |
|
| 266 | + { |
|
| 267 | + $context = $this->getContext(); |
|
| 268 | + $config = $context->getConfig(); |
|
| 269 | + $domains = array( 'text', 'price', 'media' ); |
|
| 270 | + $products = $view->detailProductItem->getRefItems( 'product', null, 'bought-together' ); |
|
| 271 | + |
|
| 272 | + /** client/html/catalog/detail/domains |
|
| 273 | + * A list of domain names whose items should be available in the catalog view templates |
|
| 274 | + * |
|
| 275 | + * @see client/html/catalog/detail/domains |
|
| 276 | + */ |
|
| 277 | + $domains = $config->get( 'client/html/catalog/detail/domains', $domains ); |
|
| 278 | + |
|
| 279 | + /** client/html/catalog/detail/bought/domains |
|
| 280 | + * A list of domain names whose items should be available in the bought part of the catalog detail view templates |
|
| 281 | + * |
|
| 282 | + * The templates rendering bought related data usually add |
|
| 283 | + * the images and texts associated to each item. If you want to |
|
| 284 | + * display additional content like the attributes, you can configure |
|
| 285 | + * your own list of domains (attribute, media, price, product, text, |
|
| 286 | + * etc. are domains) whose items are fetched from the storage. |
|
| 287 | + * Please keep in mind that the more domains you add to the |
|
| 288 | + * configuration, the more time is required for fetching the content! |
|
| 289 | + * |
|
| 290 | + * This configuration option can be overwritten by the |
|
| 291 | + * "client/html/catalog/detail/domains" configuration option that |
|
| 292 | + * allows to configure the domain names of the items fetched |
|
| 293 | + * specifically for all types of product listings. |
|
| 294 | + * |
|
| 295 | + * @param array List of domain names |
|
| 296 | + * @since 2015.09 |
|
| 297 | + * @category Developer |
|
| 298 | + * @see client/html/catalog/detail/domains |
|
| 299 | + */ |
|
| 300 | + $domains = $config->get( 'client/html/catalog/detail/bought/domains', $domains ); |
|
| 301 | + |
|
| 302 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 303 | + |
|
| 304 | + $view->boughtItems = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 305 | + $view->boughtPosItems = $products; |
|
| 306 | + |
|
| 307 | + $this->addMetaItem( $view->boughtItems, 'product', $this->expire, $this->tags ); |
|
| 308 | + $this->addMetaList( array_keys( $view->boughtItems ), 'product', $this->expire ); |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + $this->cache = $view; |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 315 | + $tags = array_merge( $tags, $this->tags ); |
|
| 316 | + |
|
| 317 | + return $this->cache; |
|
| 318 | + } |
|
| 319 | 319 | } |
| 320 | 320 | \ No newline at end of file |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 70 | 70 | * @return string HTML code |
| 71 | 71 | */ |
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 73 | 73 | { |
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 75 | 75 | |
| 76 | 76 | $html = ''; |
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + foreach ($this->getSubClients() as $subclient) { |
|
| 78 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 79 | 79 | } |
| 80 | 80 | $view->boughtBody = $html; |
| 81 | 81 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/catalog/detail/bought/standard/template-body'; |
| 103 | 103 | $default = 'catalog/detail/bought-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->boughtHeader = $html; |
| 126 | 126 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $tplconf = 'client/html/catalog/detail/bought/standard/template-header'; |
| 149 | 149 | $default = 'catalog/detail/bought-header-default.php'; |
| 150 | 150 | |
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + return $view->render($view->config($tplconf, $default)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string|null $name Name of the sub-client (Default if null) |
| 160 | 160 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 161 | 161 | */ |
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 162 | + public function getSubClient($type, $name = null) |
|
| 163 | 163 | { |
| 164 | 164 | /** client/html/catalog/detail/bought/decorators/excludes |
| 165 | 165 | * Excludes decorators added by the "common" option from the catalog detail bought html client |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @see client/html/catalog/detail/bought/decorators/global |
| 236 | 236 | */ |
| 237 | 237 | |
| 238 | - return $this->createSubClient( 'catalog/detail/bought/' . $type, $name ); |
|
| 238 | + return $this->createSubClient('catalog/detail/bought/'.$type, $name); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function getSubClientNames() |
| 248 | 248 | { |
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,23 +258,23 @@ discard block |
||
| 258 | 258 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 259 | 259 | * @return \Aimeos\MW\View\Iface Modified view object |
| 260 | 260 | */ |
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 262 | 262 | { |
| 263 | - if( !isset( $this->cache ) ) |
|
| 263 | + if (!isset($this->cache)) |
|
| 264 | 264 | { |
| 265 | - if( isset( $view->detailProductItem ) ) |
|
| 265 | + if (isset($view->detailProductItem)) |
|
| 266 | 266 | { |
| 267 | 267 | $context = $this->getContext(); |
| 268 | 268 | $config = $context->getConfig(); |
| 269 | - $domains = array( 'text', 'price', 'media' ); |
|
| 270 | - $products = $view->detailProductItem->getRefItems( 'product', null, 'bought-together' ); |
|
| 269 | + $domains = array('text', 'price', 'media'); |
|
| 270 | + $products = $view->detailProductItem->getRefItems('product', null, 'bought-together'); |
|
| 271 | 271 | |
| 272 | 272 | /** client/html/catalog/detail/domains |
| 273 | 273 | * A list of domain names whose items should be available in the catalog view templates |
| 274 | 274 | * |
| 275 | 275 | * @see client/html/catalog/detail/domains |
| 276 | 276 | */ |
| 277 | - $domains = $config->get( 'client/html/catalog/detail/domains', $domains ); |
|
| 277 | + $domains = $config->get('client/html/catalog/detail/domains', $domains); |
|
| 278 | 278 | |
| 279 | 279 | /** client/html/catalog/detail/bought/domains |
| 280 | 280 | * A list of domain names whose items should be available in the bought part of the catalog detail view templates |
@@ -297,22 +297,22 @@ discard block |
||
| 297 | 297 | * @category Developer |
| 298 | 298 | * @see client/html/catalog/detail/domains |
| 299 | 299 | */ |
| 300 | - $domains = $config->get( 'client/html/catalog/detail/bought/domains', $domains ); |
|
| 300 | + $domains = $config->get('client/html/catalog/detail/bought/domains', $domains); |
|
| 301 | 301 | |
| 302 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 302 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 303 | 303 | |
| 304 | - $view->boughtItems = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 304 | + $view->boughtItems = $controller->getProductItems(array_keys($products), $domains); |
|
| 305 | 305 | $view->boughtPosItems = $products; |
| 306 | 306 | |
| 307 | - $this->addMetaItem( $view->boughtItems, 'product', $this->expire, $this->tags ); |
|
| 308 | - $this->addMetaList( array_keys( $view->boughtItems ), 'product', $this->expire ); |
|
| 307 | + $this->addMetaItem($view->boughtItems, 'product', $this->expire, $this->tags); |
|
| 308 | + $this->addMetaList(array_keys($view->boughtItems), 'product', $this->expire); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $this->cache = $view; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 315 | - $tags = array_merge( $tags, $this->tags ); |
|
| 314 | + $expire = $this->expires($this->expire, $expire); |
|
| 315 | + $tags = array_merge($tags, $this->tags); |
|
| 316 | 316 | |
| 317 | 317 | return $this->cache; |
| 318 | 318 | } |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 113 | 113 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 115 | + * @return string String including HTML tags for the header on error |
|
| 116 | 116 | */ |
| 117 | 117 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 118 | 118 | { |
@@ -18,302 +18,302 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** client/html/catalog/detail/bundle/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the catalog detail bundle section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2014.03 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/catalog/detail/bundle/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - private $tags = array(); |
|
| 60 | - private $expire; |
|
| 61 | - private $cache; |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Returns the HTML code for insertion into the body. |
|
| 66 | - * |
|
| 67 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | - * @return string HTML code |
|
| 71 | - */ |
|
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | - { |
|
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | - |
|
| 76 | - $html = ''; |
|
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | - } |
|
| 80 | - $view->bundleBody = $html; |
|
| 81 | - |
|
| 82 | - /** client/html/catalog/detail/bundle/standard/template-body |
|
| 83 | - * Relative path to the HTML body template of the catalog detail bundle client. |
|
| 84 | - * |
|
| 85 | - * The template file contains the HTML code and processing instructions |
|
| 86 | - * to generate the result shown in the body of the frontend. The |
|
| 87 | - * configuration string is the path to the template file relative |
|
| 88 | - * to the templates directory (usually in client/html/templates). |
|
| 89 | - * |
|
| 90 | - * You can overwrite the template file configuration in extensions and |
|
| 91 | - * provide alternative templates. These alternative templates should be |
|
| 92 | - * named like the default one but with the string "standard" replaced by |
|
| 93 | - * an unique name. You may use the name of your project for this. If |
|
| 94 | - * you've implemented an alternative client class as well, "standard" |
|
| 95 | - * should be replaced by the name of the new class. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2014.03 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/catalog/detail/bundle/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/catalog/detail/bundle/standard/template-body'; |
|
| 103 | - $default = 'catalog/detail/bundle-body-default.php'; |
|
| 104 | - |
|
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | - |
|
| 121 | - $html = ''; |
|
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | - } |
|
| 125 | - $view->bundleHeader = $html; |
|
| 126 | - |
|
| 127 | - /** client/html/catalog/detail/bundle/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the catalog detail bundle client. |
|
| 129 | - * |
|
| 130 | - * The template file contains the HTML code and processing instructions |
|
| 131 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | - * of the rendered page in the frontend. The configuration string is the |
|
| 133 | - * path to the template file relative to the templates directory (usually |
|
| 134 | - * in client/html/templates). |
|
| 135 | - * |
|
| 136 | - * You can overwrite the template file configuration in extensions and |
|
| 137 | - * provide alternative templates. These alternative templates should be |
|
| 138 | - * named like the default one but with the string "standard" replaced by |
|
| 139 | - * an unique name. You may use the name of your project for this. If |
|
| 140 | - * you've implemented an alternative client class as well, "standard" |
|
| 141 | - * should be replaced by the name of the new class. |
|
| 142 | - * |
|
| 143 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | - * @since 2014.03 |
|
| 145 | - * @category Developer |
|
| 146 | - * @see client/html/catalog/detail/bundle/standard/template-body |
|
| 147 | - */ |
|
| 148 | - $tplconf = 'client/html/catalog/detail/bundle/standard/template-header'; |
|
| 149 | - $default = 'catalog/detail/bundle-header-default.php'; |
|
| 150 | - |
|
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Returns the sub-client given by its name. |
|
| 157 | - * |
|
| 158 | - * @param string $type Name of the client type |
|
| 159 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | - */ |
|
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 163 | - { |
|
| 164 | - /** client/html/catalog/detail/bundle/decorators/excludes |
|
| 165 | - * Excludes decorators added by the "common" option from the catalog detail bundle html client |
|
| 166 | - * |
|
| 167 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 168 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 169 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 170 | - * modify what is returned to the caller. |
|
| 171 | - * |
|
| 172 | - * This option allows you to remove a decorator added via |
|
| 173 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 174 | - * around the html client. |
|
| 175 | - * |
|
| 176 | - * client/html/catalog/detail/bundle/decorators/excludes = array( 'decorator1' ) |
|
| 177 | - * |
|
| 178 | - * This would remove the decorator named "decorator1" from the list of |
|
| 179 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 180 | - * "client/html/common/decorators/default" to the html client. |
|
| 181 | - * |
|
| 182 | - * @param array List of decorator names |
|
| 183 | - * @since 2015.08 |
|
| 184 | - * @category Developer |
|
| 185 | - * @see client/html/common/decorators/default |
|
| 186 | - * @see client/html/catalog/detail/bundle/decorators/global |
|
| 187 | - * @see client/html/catalog/detail/bundle/decorators/local |
|
| 188 | - */ |
|
| 189 | - |
|
| 190 | - /** client/html/catalog/detail/bundle/decorators/global |
|
| 191 | - * Adds a list of globally available decorators only to the catalog detail bundle html client |
|
| 192 | - * |
|
| 193 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 194 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 195 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 196 | - * modify what is returned to the caller. |
|
| 197 | - * |
|
| 198 | - * This option allows you to wrap global decorators |
|
| 199 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 200 | - * |
|
| 201 | - * client/html/catalog/detail/bundle/decorators/global = array( 'decorator1' ) |
|
| 202 | - * |
|
| 203 | - * This would add the decorator named "decorator1" defined by |
|
| 204 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 205 | - * |
|
| 206 | - * @param array List of decorator names |
|
| 207 | - * @since 2015.08 |
|
| 208 | - * @category Developer |
|
| 209 | - * @see client/html/common/decorators/default |
|
| 210 | - * @see client/html/catalog/detail/bundle/decorators/excludes |
|
| 211 | - * @see client/html/catalog/detail/bundle/decorators/local |
|
| 212 | - */ |
|
| 213 | - |
|
| 214 | - /** client/html/catalog/detail/bundle/decorators/local |
|
| 215 | - * Adds a list of local decorators only to the catalog detail bundle html client |
|
| 216 | - * |
|
| 217 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 218 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 219 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 220 | - * modify what is returned to the caller. |
|
| 221 | - * |
|
| 222 | - * This option allows you to wrap local decorators |
|
| 223 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 224 | - * |
|
| 225 | - * client/html/catalog/detail/bundle/decorators/local = array( 'decorator2' ) |
|
| 226 | - * |
|
| 227 | - * This would add the decorator named "decorator2" defined by |
|
| 228 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 229 | - * |
|
| 230 | - * @param array List of decorator names |
|
| 231 | - * @since 2015.08 |
|
| 232 | - * @category Developer |
|
| 233 | - * @see client/html/common/decorators/default |
|
| 234 | - * @see client/html/catalog/detail/bundle/decorators/excludes |
|
| 235 | - * @see client/html/catalog/detail/bundle/decorators/global |
|
| 236 | - */ |
|
| 237 | - |
|
| 238 | - return $this->createSubClient( 'catalog/detail/bundle/' . $type, $name ); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * Returns the list of sub-client names configured for the client. |
|
| 244 | - * |
|
| 245 | - * @return array List of HTML client names |
|
| 246 | - */ |
|
| 247 | - protected function getSubClientNames() |
|
| 248 | - { |
|
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Sets the necessary parameter values in the view. |
|
| 255 | - * |
|
| 256 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | - */ |
|
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | - { |
|
| 263 | - if( !isset( $this->cache ) ) |
|
| 264 | - { |
|
| 265 | - if( isset( $view->detailProductItem ) && $view->detailProductItem->getType() === 'bundle' ) |
|
| 266 | - { |
|
| 267 | - $context = $this->getContext(); |
|
| 268 | - $config = $context->getConfig(); |
|
| 269 | - $domains = array( 'text', 'price', 'media' ); |
|
| 270 | - $products = $view->detailProductItem->getRefItems( 'product', null, 'default' ); |
|
| 271 | - |
|
| 272 | - /** client/html/catalog/detail/domains |
|
| 273 | - * A list of domain names whose items should be available in the catalog view templates |
|
| 274 | - * |
|
| 275 | - * @see client/html/catalog/detail/domains |
|
| 276 | - */ |
|
| 277 | - $domains = $config->get( 'client/html/catalog/detail/domains', $domains ); |
|
| 278 | - |
|
| 279 | - /** client/html/catalog/detail/bundle/domains |
|
| 280 | - * A list of domain names whose items should be available in the bundle part of the catalog detail view templates |
|
| 281 | - * |
|
| 282 | - * The templates rendering bundle related data usually add |
|
| 283 | - * the images and texts associated to each item. If you want to |
|
| 284 | - * display additional content like the attributes, you can configure |
|
| 285 | - * your own list of domains (attribute, media, price, product, text, |
|
| 286 | - * etc. are domains) whose items are fetched from the storage. |
|
| 287 | - * Please keep in mind that the more domains you add to the |
|
| 288 | - * configuration, the more time is required for fetching the content! |
|
| 289 | - * |
|
| 290 | - * This configuration option can be overwritten by the |
|
| 291 | - * "client/html/catalog/detail/domains" configuration option that |
|
| 292 | - * allows to configure the domain names of the items fetched |
|
| 293 | - * specifically for all types of product listings. |
|
| 294 | - * |
|
| 295 | - * @param array List of domain names |
|
| 296 | - * @since 2015.09 |
|
| 297 | - * @category Developer |
|
| 298 | - * @see client/html/catalog/detail/domains |
|
| 299 | - */ |
|
| 300 | - $domains = $config->get( 'client/html/catalog/detail/bundle/domains', $domains ); |
|
| 301 | - |
|
| 302 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 303 | - |
|
| 304 | - $view->bundleItems = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 305 | - $view->bundlePosItems = $products; |
|
| 306 | - |
|
| 307 | - $this->addMetaItem( $view->bundleItems, 'product', $this->expire, $this->tags ); |
|
| 308 | - $this->addMetaList( array_keys( $view->bundleItems ), 'product', $this->expire ); |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - $this->cache = $view; |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 315 | - $tags = array_merge( $tags, $this->tags ); |
|
| 316 | - |
|
| 317 | - return $this->cache; |
|
| 318 | - } |
|
| 24 | + /** client/html/catalog/detail/bundle/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the catalog detail bundle section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2014.03 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/catalog/detail/bundle/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + private $tags = array(); |
|
| 60 | + private $expire; |
|
| 61 | + private $cache; |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Returns the HTML code for insertion into the body. |
|
| 66 | + * |
|
| 67 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 68 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 69 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 70 | + * @return string HTML code |
|
| 71 | + */ |
|
| 72 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + { |
|
| 74 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 75 | + |
|
| 76 | + $html = ''; |
|
| 77 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 79 | + } |
|
| 80 | + $view->bundleBody = $html; |
|
| 81 | + |
|
| 82 | + /** client/html/catalog/detail/bundle/standard/template-body |
|
| 83 | + * Relative path to the HTML body template of the catalog detail bundle client. |
|
| 84 | + * |
|
| 85 | + * The template file contains the HTML code and processing instructions |
|
| 86 | + * to generate the result shown in the body of the frontend. The |
|
| 87 | + * configuration string is the path to the template file relative |
|
| 88 | + * to the templates directory (usually in client/html/templates). |
|
| 89 | + * |
|
| 90 | + * You can overwrite the template file configuration in extensions and |
|
| 91 | + * provide alternative templates. These alternative templates should be |
|
| 92 | + * named like the default one but with the string "standard" replaced by |
|
| 93 | + * an unique name. You may use the name of your project for this. If |
|
| 94 | + * you've implemented an alternative client class as well, "standard" |
|
| 95 | + * should be replaced by the name of the new class. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2014.03 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/catalog/detail/bundle/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/catalog/detail/bundle/standard/template-body'; |
|
| 103 | + $default = 'catalog/detail/bundle-body-default.php'; |
|
| 104 | + |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | + |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->bundleHeader = $html; |
|
| 126 | + |
|
| 127 | + /** client/html/catalog/detail/bundle/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the catalog detail bundle client. |
|
| 129 | + * |
|
| 130 | + * The template file contains the HTML code and processing instructions |
|
| 131 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | + * of the rendered page in the frontend. The configuration string is the |
|
| 133 | + * path to the template file relative to the templates directory (usually |
|
| 134 | + * in client/html/templates). |
|
| 135 | + * |
|
| 136 | + * You can overwrite the template file configuration in extensions and |
|
| 137 | + * provide alternative templates. These alternative templates should be |
|
| 138 | + * named like the default one but with the string "standard" replaced by |
|
| 139 | + * an unique name. You may use the name of your project for this. If |
|
| 140 | + * you've implemented an alternative client class as well, "standard" |
|
| 141 | + * should be replaced by the name of the new class. |
|
| 142 | + * |
|
| 143 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | + * @since 2014.03 |
|
| 145 | + * @category Developer |
|
| 146 | + * @see client/html/catalog/detail/bundle/standard/template-body |
|
| 147 | + */ |
|
| 148 | + $tplconf = 'client/html/catalog/detail/bundle/standard/template-header'; |
|
| 149 | + $default = 'catalog/detail/bundle-header-default.php'; |
|
| 150 | + |
|
| 151 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Returns the sub-client given by its name. |
|
| 157 | + * |
|
| 158 | + * @param string $type Name of the client type |
|
| 159 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | + */ |
|
| 162 | + public function getSubClient( $type, $name = null ) |
|
| 163 | + { |
|
| 164 | + /** client/html/catalog/detail/bundle/decorators/excludes |
|
| 165 | + * Excludes decorators added by the "common" option from the catalog detail bundle html client |
|
| 166 | + * |
|
| 167 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 168 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 169 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 170 | + * modify what is returned to the caller. |
|
| 171 | + * |
|
| 172 | + * This option allows you to remove a decorator added via |
|
| 173 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 174 | + * around the html client. |
|
| 175 | + * |
|
| 176 | + * client/html/catalog/detail/bundle/decorators/excludes = array( 'decorator1' ) |
|
| 177 | + * |
|
| 178 | + * This would remove the decorator named "decorator1" from the list of |
|
| 179 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 180 | + * "client/html/common/decorators/default" to the html client. |
|
| 181 | + * |
|
| 182 | + * @param array List of decorator names |
|
| 183 | + * @since 2015.08 |
|
| 184 | + * @category Developer |
|
| 185 | + * @see client/html/common/decorators/default |
|
| 186 | + * @see client/html/catalog/detail/bundle/decorators/global |
|
| 187 | + * @see client/html/catalog/detail/bundle/decorators/local |
|
| 188 | + */ |
|
| 189 | + |
|
| 190 | + /** client/html/catalog/detail/bundle/decorators/global |
|
| 191 | + * Adds a list of globally available decorators only to the catalog detail bundle html client |
|
| 192 | + * |
|
| 193 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 194 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 195 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 196 | + * modify what is returned to the caller. |
|
| 197 | + * |
|
| 198 | + * This option allows you to wrap global decorators |
|
| 199 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 200 | + * |
|
| 201 | + * client/html/catalog/detail/bundle/decorators/global = array( 'decorator1' ) |
|
| 202 | + * |
|
| 203 | + * This would add the decorator named "decorator1" defined by |
|
| 204 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 205 | + * |
|
| 206 | + * @param array List of decorator names |
|
| 207 | + * @since 2015.08 |
|
| 208 | + * @category Developer |
|
| 209 | + * @see client/html/common/decorators/default |
|
| 210 | + * @see client/html/catalog/detail/bundle/decorators/excludes |
|
| 211 | + * @see client/html/catalog/detail/bundle/decorators/local |
|
| 212 | + */ |
|
| 213 | + |
|
| 214 | + /** client/html/catalog/detail/bundle/decorators/local |
|
| 215 | + * Adds a list of local decorators only to the catalog detail bundle html client |
|
| 216 | + * |
|
| 217 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 218 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 219 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 220 | + * modify what is returned to the caller. |
|
| 221 | + * |
|
| 222 | + * This option allows you to wrap local decorators |
|
| 223 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 224 | + * |
|
| 225 | + * client/html/catalog/detail/bundle/decorators/local = array( 'decorator2' ) |
|
| 226 | + * |
|
| 227 | + * This would add the decorator named "decorator2" defined by |
|
| 228 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 229 | + * |
|
| 230 | + * @param array List of decorator names |
|
| 231 | + * @since 2015.08 |
|
| 232 | + * @category Developer |
|
| 233 | + * @see client/html/common/decorators/default |
|
| 234 | + * @see client/html/catalog/detail/bundle/decorators/excludes |
|
| 235 | + * @see client/html/catalog/detail/bundle/decorators/global |
|
| 236 | + */ |
|
| 237 | + |
|
| 238 | + return $this->createSubClient( 'catalog/detail/bundle/' . $type, $name ); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * Returns the list of sub-client names configured for the client. |
|
| 244 | + * |
|
| 245 | + * @return array List of HTML client names |
|
| 246 | + */ |
|
| 247 | + protected function getSubClientNames() |
|
| 248 | + { |
|
| 249 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Sets the necessary parameter values in the view. |
|
| 255 | + * |
|
| 256 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 257 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 258 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 259 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 260 | + */ |
|
| 261 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + { |
|
| 263 | + if( !isset( $this->cache ) ) |
|
| 264 | + { |
|
| 265 | + if( isset( $view->detailProductItem ) && $view->detailProductItem->getType() === 'bundle' ) |
|
| 266 | + { |
|
| 267 | + $context = $this->getContext(); |
|
| 268 | + $config = $context->getConfig(); |
|
| 269 | + $domains = array( 'text', 'price', 'media' ); |
|
| 270 | + $products = $view->detailProductItem->getRefItems( 'product', null, 'default' ); |
|
| 271 | + |
|
| 272 | + /** client/html/catalog/detail/domains |
|
| 273 | + * A list of domain names whose items should be available in the catalog view templates |
|
| 274 | + * |
|
| 275 | + * @see client/html/catalog/detail/domains |
|
| 276 | + */ |
|
| 277 | + $domains = $config->get( 'client/html/catalog/detail/domains', $domains ); |
|
| 278 | + |
|
| 279 | + /** client/html/catalog/detail/bundle/domains |
|
| 280 | + * A list of domain names whose items should be available in the bundle part of the catalog detail view templates |
|
| 281 | + * |
|
| 282 | + * The templates rendering bundle related data usually add |
|
| 283 | + * the images and texts associated to each item. If you want to |
|
| 284 | + * display additional content like the attributes, you can configure |
|
| 285 | + * your own list of domains (attribute, media, price, product, text, |
|
| 286 | + * etc. are domains) whose items are fetched from the storage. |
|
| 287 | + * Please keep in mind that the more domains you add to the |
|
| 288 | + * configuration, the more time is required for fetching the content! |
|
| 289 | + * |
|
| 290 | + * This configuration option can be overwritten by the |
|
| 291 | + * "client/html/catalog/detail/domains" configuration option that |
|
| 292 | + * allows to configure the domain names of the items fetched |
|
| 293 | + * specifically for all types of product listings. |
|
| 294 | + * |
|
| 295 | + * @param array List of domain names |
|
| 296 | + * @since 2015.09 |
|
| 297 | + * @category Developer |
|
| 298 | + * @see client/html/catalog/detail/domains |
|
| 299 | + */ |
|
| 300 | + $domains = $config->get( 'client/html/catalog/detail/bundle/domains', $domains ); |
|
| 301 | + |
|
| 302 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 303 | + |
|
| 304 | + $view->bundleItems = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 305 | + $view->bundlePosItems = $products; |
|
| 306 | + |
|
| 307 | + $this->addMetaItem( $view->bundleItems, 'product', $this->expire, $this->tags ); |
|
| 308 | + $this->addMetaList( array_keys( $view->bundleItems ), 'product', $this->expire ); |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + $this->cache = $view; |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + $expire = $this->expires( $this->expire, $expire ); |
|
| 315 | + $tags = array_merge( $tags, $this->tags ); |
|
| 316 | + |
|
| 317 | + return $this->cache; |
|
| 318 | + } |
|
| 319 | 319 | } |
| 320 | 320 | \ No newline at end of file |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 70 | 70 | * @return string HTML code |
| 71 | 71 | */ |
| 72 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 73 | 73 | { |
| 74 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 75 | 75 | |
| 76 | 76 | $html = ''; |
| 77 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 78 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + foreach ($this->getSubClients() as $subclient) { |
|
| 78 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 79 | 79 | } |
| 80 | 80 | $view->bundleBody = $html; |
| 81 | 81 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/catalog/detail/bundle/standard/template-body'; |
| 103 | 103 | $default = 'catalog/detail/bundle-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->bundleHeader = $html; |
| 126 | 126 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $tplconf = 'client/html/catalog/detail/bundle/standard/template-header'; |
| 149 | 149 | $default = 'catalog/detail/bundle-header-default.php'; |
| 150 | 150 | |
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + return $view->render($view->config($tplconf, $default)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param string|null $name Name of the sub-client (Default if null) |
| 160 | 160 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 161 | 161 | */ |
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 162 | + public function getSubClient($type, $name = null) |
|
| 163 | 163 | { |
| 164 | 164 | /** client/html/catalog/detail/bundle/decorators/excludes |
| 165 | 165 | * Excludes decorators added by the "common" option from the catalog detail bundle html client |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @see client/html/catalog/detail/bundle/decorators/global |
| 236 | 236 | */ |
| 237 | 237 | |
| 238 | - return $this->createSubClient( 'catalog/detail/bundle/' . $type, $name ); |
|
| 238 | + return $this->createSubClient('catalog/detail/bundle/'.$type, $name); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function getSubClientNames() |
| 248 | 248 | { |
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,23 +258,23 @@ discard block |
||
| 258 | 258 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 259 | 259 | * @return \Aimeos\MW\View\Iface Modified view object |
| 260 | 260 | */ |
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 262 | 262 | { |
| 263 | - if( !isset( $this->cache ) ) |
|
| 263 | + if (!isset($this->cache)) |
|
| 264 | 264 | { |
| 265 | - if( isset( $view->detailProductItem ) && $view->detailProductItem->getType() === 'bundle' ) |
|
| 265 | + if (isset($view->detailProductItem) && $view->detailProductItem->getType() === 'bundle') |
|
| 266 | 266 | { |
| 267 | 267 | $context = $this->getContext(); |
| 268 | 268 | $config = $context->getConfig(); |
| 269 | - $domains = array( 'text', 'price', 'media' ); |
|
| 270 | - $products = $view->detailProductItem->getRefItems( 'product', null, 'default' ); |
|
| 269 | + $domains = array('text', 'price', 'media'); |
|
| 270 | + $products = $view->detailProductItem->getRefItems('product', null, 'default'); |
|
| 271 | 271 | |
| 272 | 272 | /** client/html/catalog/detail/domains |
| 273 | 273 | * A list of domain names whose items should be available in the catalog view templates |
| 274 | 274 | * |
| 275 | 275 | * @see client/html/catalog/detail/domains |
| 276 | 276 | */ |
| 277 | - $domains = $config->get( 'client/html/catalog/detail/domains', $domains ); |
|
| 277 | + $domains = $config->get('client/html/catalog/detail/domains', $domains); |
|
| 278 | 278 | |
| 279 | 279 | /** client/html/catalog/detail/bundle/domains |
| 280 | 280 | * A list of domain names whose items should be available in the bundle part of the catalog detail view templates |
@@ -297,22 +297,22 @@ discard block |
||
| 297 | 297 | * @category Developer |
| 298 | 298 | * @see client/html/catalog/detail/domains |
| 299 | 299 | */ |
| 300 | - $domains = $config->get( 'client/html/catalog/detail/bundle/domains', $domains ); |
|
| 300 | + $domains = $config->get('client/html/catalog/detail/bundle/domains', $domains); |
|
| 301 | 301 | |
| 302 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 302 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 303 | 303 | |
| 304 | - $view->bundleItems = $controller->getProductItems( array_keys( $products ), $domains ); |
|
| 304 | + $view->bundleItems = $controller->getProductItems(array_keys($products), $domains); |
|
| 305 | 305 | $view->bundlePosItems = $products; |
| 306 | 306 | |
| 307 | - $this->addMetaItem( $view->bundleItems, 'product', $this->expire, $this->tags ); |
|
| 308 | - $this->addMetaList( array_keys( $view->bundleItems ), 'product', $this->expire ); |
|
| 307 | + $this->addMetaItem($view->bundleItems, 'product', $this->expire, $this->tags); |
|
| 308 | + $this->addMetaList(array_keys($view->bundleItems), 'product', $this->expire); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $this->cache = $view; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - $expire = $this->expires( $this->expire, $expire ); |
|
| 315 | - $tags = array_merge( $tags, $this->tags ); |
|
| 314 | + $expire = $this->expires($this->expire, $expire); |
|
| 315 | + $tags = array_merge($tags, $this->tags); |
|
| 316 | 316 | |
| 317 | 317 | return $this->cache; |
| 318 | 318 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/catalog/detail/image/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the catalog detail image section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/catalog/detail/image/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->imageBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/catalog/detail/image/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the catalog detail image client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/catalog/detail/image/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/catalog/detail/image/standard/template-body'; |
|
| 101 | - $default = 'catalog/detail/image-body-bottom.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->imageHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/catalog/detail/image/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the catalog detail image client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/catalog/detail/image/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/catalog/detail/image/standard/template-header'; |
|
| 147 | - $default = 'catalog/detail/image-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/catalog/detail/image/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the catalog detail image html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/catalog/detail/image/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/catalog/detail/image/decorators/global |
|
| 185 | - * @see client/html/catalog/detail/image/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/catalog/detail/image/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the catalog detail image html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/catalog/detail/image/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/catalog/detail/image/decorators/excludes |
|
| 209 | - * @see client/html/catalog/detail/image/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/catalog/detail/image/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the catalog detail image html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/catalog/detail/image/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/catalog/detail/image/decorators/excludes |
|
| 233 | - * @see client/html/catalog/detail/image/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'catalog/detail/image/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/catalog/detail/image/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the catalog detail image section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/catalog/detail/image/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->imageBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/catalog/detail/image/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the catalog detail image client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/catalog/detail/image/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/catalog/detail/image/standard/template-body'; |
|
| 101 | + $default = 'catalog/detail/image-body-bottom.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->imageHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/catalog/detail/image/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the catalog detail image client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/catalog/detail/image/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/catalog/detail/image/standard/template-header'; |
|
| 147 | + $default = 'catalog/detail/image-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/catalog/detail/image/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the catalog detail image html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/catalog/detail/image/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/catalog/detail/image/decorators/global |
|
| 185 | + * @see client/html/catalog/detail/image/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/catalog/detail/image/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the catalog detail image html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/catalog/detail/image/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/catalog/detail/image/decorators/excludes |
|
| 209 | + * @see client/html/catalog/detail/image/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/catalog/detail/image/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the catalog detail image html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/catalog/detail/image/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/catalog/detail/image/decorators/excludes |
|
| 233 | + * @see client/html/catalog/detail/image/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'catalog/detail/image/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->imageBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/catalog/detail/image/standard/template-body'; |
| 101 | 101 | $default = 'catalog/detail/image-body-bottom.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->imageHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/catalog/detail/image/standard/template-header'; |
| 147 | 147 | $default = 'catalog/detail/image-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/catalog/detail/image/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the catalog detail image html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/catalog/detail/image/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'catalog/detail/image/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('catalog/detail/image/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |