@@ -117,7 +117,7 @@ |
||
| 117 | 117 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 118 | 118 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 119 | 119 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 120 | - * @return string|null String including HTML tags for the header on error |
|
| 120 | + * @return string String including HTML tags for the header on error |
|
| 121 | 121 | */ |
| 122 | 122 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 123 | 123 | { |
@@ -19,278 +19,278 @@ |
||
| 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/account/history/lists/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the account history list 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/account/history/lists/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 61 | - |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->getView(); |
|
| 74 | - |
|
| 75 | - if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 76 | - return ''; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 80 | - |
|
| 81 | - $html = ''; |
|
| 82 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 84 | - } |
|
| 85 | - $view->listsBody = $html; |
|
| 86 | - |
|
| 87 | - /** client/html/account/history/lists/standard/template-body |
|
| 88 | - * Relative path to the HTML body template of the account history list client. |
|
| 89 | - * |
|
| 90 | - * The template file contains the HTML code and processing instructions |
|
| 91 | - * to generate the result shown in the body of the frontend. The |
|
| 92 | - * configuration string is the path to the template file relative |
|
| 93 | - * to the templates directory (usually in client/html/templates). |
|
| 94 | - * |
|
| 95 | - * You can overwrite the template file configuration in extensions and |
|
| 96 | - * provide alternative templates. These alternative templates should be |
|
| 97 | - * named like the default one but with the string "standard" replaced by |
|
| 98 | - * an unique name. You may use the name of your project for this. If |
|
| 99 | - * you've implemented an alternative client class as well, "standard" |
|
| 100 | - * should be replaced by the name of the new class. |
|
| 101 | - * |
|
| 102 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 103 | - * @since 2014.03 |
|
| 104 | - * @category Developer |
|
| 105 | - * @see client/html/account/history/lists/standard/template-header |
|
| 106 | - */ |
|
| 107 | - $tplconf = 'client/html/account/history/lists/standard/template-body'; |
|
| 108 | - $default = 'account/history/list-body-default.php'; |
|
| 109 | - |
|
| 110 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Returns the HTML string for insertion into the header. |
|
| 116 | - * |
|
| 117 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 118 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 119 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 120 | - * @return string|null String including HTML tags for the header on error |
|
| 121 | - */ |
|
| 122 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 123 | - { |
|
| 124 | - $view = $this->getView(); |
|
| 125 | - |
|
| 126 | - if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 127 | - return ''; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 131 | - |
|
| 132 | - $html = ''; |
|
| 133 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 135 | - } |
|
| 136 | - $view->listsHeader = $html; |
|
| 137 | - |
|
| 138 | - /** client/html/account/history/lists/standard/template-header |
|
| 139 | - * Relative path to the HTML header template of the account history list client. |
|
| 140 | - * |
|
| 141 | - * The template file contains the HTML code and processing instructions |
|
| 142 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 143 | - * of the rendered page in the frontend. The configuration string is the |
|
| 144 | - * path to the template file relative to the templates directory (usually |
|
| 145 | - * in client/html/templates). |
|
| 146 | - * |
|
| 147 | - * You can overwrite the template file configuration in extensions and |
|
| 148 | - * provide alternative templates. These alternative templates should be |
|
| 149 | - * named like the default one but with the string "standard" replaced by |
|
| 150 | - * an unique name. You may use the name of your project for this. If |
|
| 151 | - * you've implemented an alternative client class as well, "standard" |
|
| 152 | - * should be replaced by the name of the new class. |
|
| 153 | - * |
|
| 154 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 155 | - * @since 2014.03 |
|
| 156 | - * @category Developer |
|
| 157 | - * @see client/html/account/history/lists/standard/template-body |
|
| 158 | - */ |
|
| 159 | - $tplconf = 'client/html/account/history/lists/standard/template-header'; |
|
| 160 | - $default = 'account/history/list-header-default.php'; |
|
| 161 | - |
|
| 162 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * Returns the sub-client given by its name. |
|
| 168 | - * |
|
| 169 | - * @param string $type Name of the client type |
|
| 170 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 171 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 172 | - */ |
|
| 173 | - public function getSubClient( $type, $name = null ) |
|
| 174 | - { |
|
| 175 | - /** client/html/account/history/lists/decorators/excludes |
|
| 176 | - * Excludes decorators added by the "common" option from the account history list html client |
|
| 177 | - * |
|
| 178 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 179 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 180 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 181 | - * modify what is returned to the caller. |
|
| 182 | - * |
|
| 183 | - * This option allows you to remove a decorator added via |
|
| 184 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 185 | - * around the html client. |
|
| 186 | - * |
|
| 187 | - * client/html/account/history/lists/decorators/excludes = array( 'decorator1' ) |
|
| 188 | - * |
|
| 189 | - * This would remove the decorator named "decorator1" from the list of |
|
| 190 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 191 | - * "client/html/common/decorators/default" to the html client. |
|
| 192 | - * |
|
| 193 | - * @param array List of decorator names |
|
| 194 | - * @since 2015.08 |
|
| 195 | - * @category Developer |
|
| 196 | - * @see client/html/common/decorators/default |
|
| 197 | - * @see client/html/account/history/lists/decorators/global |
|
| 198 | - * @see client/html/account/history/lists/decorators/local |
|
| 199 | - */ |
|
| 200 | - |
|
| 201 | - /** client/html/account/history/lists/decorators/global |
|
| 202 | - * Adds a list of globally available decorators only to the account history list html client |
|
| 203 | - * |
|
| 204 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 205 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 206 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 207 | - * modify what is returned to the caller. |
|
| 208 | - * |
|
| 209 | - * This option allows you to wrap global decorators |
|
| 210 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 211 | - * |
|
| 212 | - * client/html/account/history/lists/decorators/global = array( 'decorator1' ) |
|
| 213 | - * |
|
| 214 | - * This would add the decorator named "decorator1" defined by |
|
| 215 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 216 | - * |
|
| 217 | - * @param array List of decorator names |
|
| 218 | - * @since 2015.08 |
|
| 219 | - * @category Developer |
|
| 220 | - * @see client/html/common/decorators/default |
|
| 221 | - * @see client/html/account/history/lists/decorators/excludes |
|
| 222 | - * @see client/html/account/history/lists/decorators/local |
|
| 223 | - */ |
|
| 224 | - |
|
| 225 | - /** client/html/account/history/lists/decorators/local |
|
| 226 | - * Adds a list of local decorators only to the account history list html client |
|
| 227 | - * |
|
| 228 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 229 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 230 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 231 | - * modify what is returned to the caller. |
|
| 232 | - * |
|
| 233 | - * This option allows you to wrap local decorators |
|
| 234 | - * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client. |
|
| 235 | - * |
|
| 236 | - * client/html/account/history/lists/decorators/local = array( 'decorator2' ) |
|
| 237 | - * |
|
| 238 | - * This would add the decorator named "decorator2" defined by |
|
| 239 | - * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client. |
|
| 240 | - * |
|
| 241 | - * @param array List of decorator names |
|
| 242 | - * @since 2015.08 |
|
| 243 | - * @category Developer |
|
| 244 | - * @see client/html/common/decorators/default |
|
| 245 | - * @see client/html/account/history/lists/decorators/excludes |
|
| 246 | - * @see client/html/account/history/lists/decorators/global |
|
| 247 | - */ |
|
| 248 | - |
|
| 249 | - return $this->createSubClient( 'account/history/lists/' . $type, $name ); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - |
|
| 253 | - /** |
|
| 254 | - * Returns the list of sub-client names configured for the client. |
|
| 255 | - * |
|
| 256 | - * @return array List of HTML client names |
|
| 257 | - */ |
|
| 258 | - protected function getSubClientNames() |
|
| 259 | - { |
|
| 260 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * Sets the necessary parameter values in the view. |
|
| 266 | - * |
|
| 267 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 268 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 269 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 270 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 271 | - */ |
|
| 272 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 273 | - { |
|
| 274 | - if( !isset( $this->cache ) ) |
|
| 275 | - { |
|
| 276 | - $context = $this->getContext(); |
|
| 277 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 278 | - |
|
| 279 | - |
|
| 280 | - $search = $manager->createSearch( true ); |
|
| 281 | - $expr = array( |
|
| 282 | - $search->getConditions(), |
|
| 283 | - $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 284 | - ); |
|
| 285 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 286 | - $search->setSortations( array( $search->sort( '-', 'order.id' ) ) ); |
|
| 287 | - |
|
| 288 | - |
|
| 289 | - $view->listsOrderItems = $manager->searchItems( $search ); |
|
| 290 | - |
|
| 291 | - $this->cache = $view; |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - return $this->cache; |
|
| 295 | - } |
|
| 25 | + /** client/html/account/history/lists/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the account history list 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/account/history/lists/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | + |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->getView(); |
|
| 74 | + |
|
| 75 | + if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 76 | + return ''; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 80 | + |
|
| 81 | + $html = ''; |
|
| 82 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 84 | + } |
|
| 85 | + $view->listsBody = $html; |
|
| 86 | + |
|
| 87 | + /** client/html/account/history/lists/standard/template-body |
|
| 88 | + * Relative path to the HTML body template of the account history list client. |
|
| 89 | + * |
|
| 90 | + * The template file contains the HTML code and processing instructions |
|
| 91 | + * to generate the result shown in the body of the frontend. The |
|
| 92 | + * configuration string is the path to the template file relative |
|
| 93 | + * to the templates directory (usually in client/html/templates). |
|
| 94 | + * |
|
| 95 | + * You can overwrite the template file configuration in extensions and |
|
| 96 | + * provide alternative templates. These alternative templates should be |
|
| 97 | + * named like the default one but with the string "standard" replaced by |
|
| 98 | + * an unique name. You may use the name of your project for this. If |
|
| 99 | + * you've implemented an alternative client class as well, "standard" |
|
| 100 | + * should be replaced by the name of the new class. |
|
| 101 | + * |
|
| 102 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 103 | + * @since 2014.03 |
|
| 104 | + * @category Developer |
|
| 105 | + * @see client/html/account/history/lists/standard/template-header |
|
| 106 | + */ |
|
| 107 | + $tplconf = 'client/html/account/history/lists/standard/template-body'; |
|
| 108 | + $default = 'account/history/list-body-default.php'; |
|
| 109 | + |
|
| 110 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Returns the HTML string for insertion into the header. |
|
| 116 | + * |
|
| 117 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 118 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 119 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 120 | + * @return string|null String including HTML tags for the header on error |
|
| 121 | + */ |
|
| 122 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 123 | + { |
|
| 124 | + $view = $this->getView(); |
|
| 125 | + |
|
| 126 | + if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 127 | + return ''; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 131 | + |
|
| 132 | + $html = ''; |
|
| 133 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 135 | + } |
|
| 136 | + $view->listsHeader = $html; |
|
| 137 | + |
|
| 138 | + /** client/html/account/history/lists/standard/template-header |
|
| 139 | + * Relative path to the HTML header template of the account history list client. |
|
| 140 | + * |
|
| 141 | + * The template file contains the HTML code and processing instructions |
|
| 142 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 143 | + * of the rendered page in the frontend. The configuration string is the |
|
| 144 | + * path to the template file relative to the templates directory (usually |
|
| 145 | + * in client/html/templates). |
|
| 146 | + * |
|
| 147 | + * You can overwrite the template file configuration in extensions and |
|
| 148 | + * provide alternative templates. These alternative templates should be |
|
| 149 | + * named like the default one but with the string "standard" replaced by |
|
| 150 | + * an unique name. You may use the name of your project for this. If |
|
| 151 | + * you've implemented an alternative client class as well, "standard" |
|
| 152 | + * should be replaced by the name of the new class. |
|
| 153 | + * |
|
| 154 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 155 | + * @since 2014.03 |
|
| 156 | + * @category Developer |
|
| 157 | + * @see client/html/account/history/lists/standard/template-body |
|
| 158 | + */ |
|
| 159 | + $tplconf = 'client/html/account/history/lists/standard/template-header'; |
|
| 160 | + $default = 'account/history/list-header-default.php'; |
|
| 161 | + |
|
| 162 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * Returns the sub-client given by its name. |
|
| 168 | + * |
|
| 169 | + * @param string $type Name of the client type |
|
| 170 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 171 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 172 | + */ |
|
| 173 | + public function getSubClient( $type, $name = null ) |
|
| 174 | + { |
|
| 175 | + /** client/html/account/history/lists/decorators/excludes |
|
| 176 | + * Excludes decorators added by the "common" option from the account history list html client |
|
| 177 | + * |
|
| 178 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 179 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 180 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 181 | + * modify what is returned to the caller. |
|
| 182 | + * |
|
| 183 | + * This option allows you to remove a decorator added via |
|
| 184 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 185 | + * around the html client. |
|
| 186 | + * |
|
| 187 | + * client/html/account/history/lists/decorators/excludes = array( 'decorator1' ) |
|
| 188 | + * |
|
| 189 | + * This would remove the decorator named "decorator1" from the list of |
|
| 190 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 191 | + * "client/html/common/decorators/default" to the html client. |
|
| 192 | + * |
|
| 193 | + * @param array List of decorator names |
|
| 194 | + * @since 2015.08 |
|
| 195 | + * @category Developer |
|
| 196 | + * @see client/html/common/decorators/default |
|
| 197 | + * @see client/html/account/history/lists/decorators/global |
|
| 198 | + * @see client/html/account/history/lists/decorators/local |
|
| 199 | + */ |
|
| 200 | + |
|
| 201 | + /** client/html/account/history/lists/decorators/global |
|
| 202 | + * Adds a list of globally available decorators only to the account history list html client |
|
| 203 | + * |
|
| 204 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 205 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 206 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 207 | + * modify what is returned to the caller. |
|
| 208 | + * |
|
| 209 | + * This option allows you to wrap global decorators |
|
| 210 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 211 | + * |
|
| 212 | + * client/html/account/history/lists/decorators/global = array( 'decorator1' ) |
|
| 213 | + * |
|
| 214 | + * This would add the decorator named "decorator1" defined by |
|
| 215 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 216 | + * |
|
| 217 | + * @param array List of decorator names |
|
| 218 | + * @since 2015.08 |
|
| 219 | + * @category Developer |
|
| 220 | + * @see client/html/common/decorators/default |
|
| 221 | + * @see client/html/account/history/lists/decorators/excludes |
|
| 222 | + * @see client/html/account/history/lists/decorators/local |
|
| 223 | + */ |
|
| 224 | + |
|
| 225 | + /** client/html/account/history/lists/decorators/local |
|
| 226 | + * Adds a list of local decorators only to the account history list html client |
|
| 227 | + * |
|
| 228 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 229 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 230 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 231 | + * modify what is returned to the caller. |
|
| 232 | + * |
|
| 233 | + * This option allows you to wrap local decorators |
|
| 234 | + * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client. |
|
| 235 | + * |
|
| 236 | + * client/html/account/history/lists/decorators/local = array( 'decorator2' ) |
|
| 237 | + * |
|
| 238 | + * This would add the decorator named "decorator2" defined by |
|
| 239 | + * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client. |
|
| 240 | + * |
|
| 241 | + * @param array List of decorator names |
|
| 242 | + * @since 2015.08 |
|
| 243 | + * @category Developer |
|
| 244 | + * @see client/html/common/decorators/default |
|
| 245 | + * @see client/html/account/history/lists/decorators/excludes |
|
| 246 | + * @see client/html/account/history/lists/decorators/global |
|
| 247 | + */ |
|
| 248 | + |
|
| 249 | + return $this->createSubClient( 'account/history/lists/' . $type, $name ); |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + |
|
| 253 | + /** |
|
| 254 | + * Returns the list of sub-client names configured for the client. |
|
| 255 | + * |
|
| 256 | + * @return array List of HTML client names |
|
| 257 | + */ |
|
| 258 | + protected function getSubClientNames() |
|
| 259 | + { |
|
| 260 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * Sets the necessary parameter values in the view. |
|
| 266 | + * |
|
| 267 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 268 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 269 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 270 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 271 | + */ |
|
| 272 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 273 | + { |
|
| 274 | + if( !isset( $this->cache ) ) |
|
| 275 | + { |
|
| 276 | + $context = $this->getContext(); |
|
| 277 | + $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 278 | + |
|
| 279 | + |
|
| 280 | + $search = $manager->createSearch( true ); |
|
| 281 | + $expr = array( |
|
| 282 | + $search->getConditions(), |
|
| 283 | + $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 284 | + ); |
|
| 285 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 286 | + $search->setSortations( array( $search->sort( '-', 'order.id' ) ) ); |
|
| 287 | + |
|
| 288 | + |
|
| 289 | + $view->listsOrderItems = $manager->searchItems( $search ); |
|
| 290 | + |
|
| 291 | + $this->cache = $view; |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + return $this->cache; |
|
| 295 | + } |
|
| 296 | 296 | } |
| 297 | 297 | \ No newline at end of file |
@@ -68,19 +68,19 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | 73 | $view = $this->getView(); |
| 74 | 74 | |
| 75 | - if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 75 | + if ($view->param('his_action', 'list') != 'list') { |
|
| 76 | 76 | return ''; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 79 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 80 | 80 | |
| 81 | 81 | $html = ''; |
| 82 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 83 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 82 | + foreach ($this->getSubClients() as $subclient) { |
|
| 83 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 84 | 84 | } |
| 85 | 85 | $view->listsBody = $html; |
| 86 | 86 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $tplconf = 'client/html/account/history/lists/standard/template-body'; |
| 108 | 108 | $default = 'account/history/list-body-default.php'; |
| 109 | 109 | |
| 110 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 110 | + return $view->render($view->config($tplconf, $default)); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 120 | 120 | * @return string|null String including HTML tags for the header on error |
| 121 | 121 | */ |
| 122 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 122 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 123 | 123 | { |
| 124 | 124 | $view = $this->getView(); |
| 125 | 125 | |
| 126 | - if( $view->param( 'his_action', 'list' ) != 'list' ) { |
|
| 126 | + if ($view->param('his_action', 'list') != 'list') { |
|
| 127 | 127 | return ''; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 130 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 131 | 131 | |
| 132 | 132 | $html = ''; |
| 133 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 134 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 133 | + foreach ($this->getSubClients() as $subclient) { |
|
| 134 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 135 | 135 | } |
| 136 | 136 | $view->listsHeader = $html; |
| 137 | 137 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $tplconf = 'client/html/account/history/lists/standard/template-header'; |
| 160 | 160 | $default = 'account/history/list-header-default.php'; |
| 161 | 161 | |
| 162 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 162 | + return $view->render($view->config($tplconf, $default)); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
| 171 | 171 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 172 | 172 | */ |
| 173 | - public function getSubClient( $type, $name = null ) |
|
| 173 | + public function getSubClient($type, $name = null) |
|
| 174 | 174 | { |
| 175 | 175 | /** client/html/account/history/lists/decorators/excludes |
| 176 | 176 | * Excludes decorators added by the "common" option from the account history list html client |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @see client/html/account/history/lists/decorators/global |
| 247 | 247 | */ |
| 248 | 248 | |
| 249 | - return $this->createSubClient( 'account/history/lists/' . $type, $name ); |
|
| 249 | + return $this->createSubClient('account/history/lists/'.$type, $name); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | protected function getSubClientNames() |
| 259 | 259 | { |
| 260 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 260 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
@@ -269,24 +269,24 @@ discard block |
||
| 269 | 269 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 270 | 270 | * @return \Aimeos\MW\View\Iface Modified view object |
| 271 | 271 | */ |
| 272 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 272 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 273 | 273 | { |
| 274 | - if( !isset( $this->cache ) ) |
|
| 274 | + if (!isset($this->cache)) |
|
| 275 | 275 | { |
| 276 | 276 | $context = $this->getContext(); |
| 277 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 277 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 278 | 278 | |
| 279 | 279 | |
| 280 | - $search = $manager->createSearch( true ); |
|
| 280 | + $search = $manager->createSearch(true); |
|
| 281 | 281 | $expr = array( |
| 282 | 282 | $search->getConditions(), |
| 283 | - $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 283 | + $search->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 284 | 284 | ); |
| 285 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 286 | - $search->setSortations( array( $search->sort( '-', 'order.id' ) ) ); |
|
| 285 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 286 | + $search->setSortations(array($search->sort('-', 'order.id'))); |
|
| 287 | 287 | |
| 288 | 288 | |
| 289 | - $view->listsOrderItems = $manager->searchItems( $search ); |
|
| 289 | + $view->listsOrderItems = $manager->searchItems($search); |
|
| 290 | 290 | |
| 291 | 291 | $this->cache = $view; |
| 292 | 292 | } |
@@ -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,232 +19,232 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Address\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Address\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/account/history/order/address/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the account history order address section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2015.11 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/account/history/order/address/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->addressBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/account/history/order/address/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the account history order address 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 | - * (second one) should be replaced by the name of the new class in lower |
|
| 94 | - * case. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2015.11 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/account/history/order/address/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/account/history/order/address/standard/template-body'; |
|
| 102 | - $default = 'common/summary/address-body-default.php'; |
|
| 103 | - |
|
| 104 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | - } |
|
| 106 | - |
|
| 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 ); |
|
| 119 | - |
|
| 120 | - $html = ''; |
|
| 121 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | - } |
|
| 124 | - $view->addressHeader = $html; |
|
| 125 | - |
|
| 126 | - /** client/html/account/history/order/address/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the account history order address 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 | - * (second one) should be replaced by the name of the new class in lower |
|
| 141 | - * case. |
|
| 142 | - * |
|
| 143 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | - * @since 2015.11 |
|
| 145 | - * @category Developer |
|
| 146 | - * @see client/html/account/history/order/address/standard/template-body |
|
| 147 | - */ |
|
| 148 | - $tplconf = 'client/html/account/history/order/address/standard/template-header'; |
|
| 149 | - $default = 'common/summary/address-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/account/history/order/address/decorators/excludes |
|
| 165 | - * Excludes decorators added by the "common" option from the account history order address 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/account/history/order/address/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/account/history/order/address/decorators/global |
|
| 187 | - * @see client/html/account/history/order/address/decorators/local |
|
| 188 | - */ |
|
| 189 | - |
|
| 190 | - /** client/html/account/history/order/address/decorators/global |
|
| 191 | - * Adds a list of globally available decorators only to the account history order address 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/account/history/order/address/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/account/history/order/address/decorators/excludes |
|
| 211 | - * @see client/html/account/history/order/address/decorators/local |
|
| 212 | - */ |
|
| 213 | - |
|
| 214 | - /** client/html/account/history/order/address/decorators/local |
|
| 215 | - * Adds a list of local decorators only to the account history order address 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\Basket\Decorator\*") around the html client. |
|
| 224 | - * |
|
| 225 | - * client/html/account/history/order/address/decorators/local = array( 'decorator2' ) |
|
| 226 | - * |
|
| 227 | - * This would add the decorator named "decorator2" defined by |
|
| 228 | - * "\Aimeos\Client\Html\Basket\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/account/history/order/address/decorators/excludes |
|
| 235 | - * @see client/html/account/history/order/address/decorators/global |
|
| 236 | - */ |
|
| 237 | - return $this->createSubClient( 'account/history/order/address/' . $type, $name ); |
|
| 238 | - } |
|
| 239 | - |
|
| 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 | - } |
|
| 25 | + /** client/html/account/history/order/address/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the account history order address section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2015.11 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/account/history/order/address/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->addressBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/account/history/order/address/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the account history order address 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 | + * (second one) should be replaced by the name of the new class in lower |
|
| 94 | + * case. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2015.11 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/account/history/order/address/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/account/history/order/address/standard/template-body'; |
|
| 102 | + $default = 'common/summary/address-body-default.php'; |
|
| 103 | + |
|
| 104 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + } |
|
| 106 | + |
|
| 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 ); |
|
| 119 | + |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->addressHeader = $html; |
|
| 125 | + |
|
| 126 | + /** client/html/account/history/order/address/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the account history order address 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 | + * (second one) should be replaced by the name of the new class in lower |
|
| 141 | + * case. |
|
| 142 | + * |
|
| 143 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | + * @since 2015.11 |
|
| 145 | + * @category Developer |
|
| 146 | + * @see client/html/account/history/order/address/standard/template-body |
|
| 147 | + */ |
|
| 148 | + $tplconf = 'client/html/account/history/order/address/standard/template-header'; |
|
| 149 | + $default = 'common/summary/address-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/account/history/order/address/decorators/excludes |
|
| 165 | + * Excludes decorators added by the "common" option from the account history order address 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/account/history/order/address/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/account/history/order/address/decorators/global |
|
| 187 | + * @see client/html/account/history/order/address/decorators/local |
|
| 188 | + */ |
|
| 189 | + |
|
| 190 | + /** client/html/account/history/order/address/decorators/global |
|
| 191 | + * Adds a list of globally available decorators only to the account history order address 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/account/history/order/address/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/account/history/order/address/decorators/excludes |
|
| 211 | + * @see client/html/account/history/order/address/decorators/local |
|
| 212 | + */ |
|
| 213 | + |
|
| 214 | + /** client/html/account/history/order/address/decorators/local |
|
| 215 | + * Adds a list of local decorators only to the account history order address 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\Basket\Decorator\*") around the html client. |
|
| 224 | + * |
|
| 225 | + * client/html/account/history/order/address/decorators/local = array( 'decorator2' ) |
|
| 226 | + * |
|
| 227 | + * This would add the decorator named "decorator2" defined by |
|
| 228 | + * "\Aimeos\Client\Html\Basket\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/account/history/order/address/decorators/excludes |
|
| 235 | + * @see client/html/account/history/order/address/decorators/global |
|
| 236 | + */ |
|
| 237 | + return $this->createSubClient( 'account/history/order/address/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | + |
|
| 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 | + } |
|
| 250 | 250 | } |
| 251 | 251 | \ 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->addressBody = $html; |
| 79 | 79 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/account/history/order/address/standard/template-body'; |
| 102 | 102 | $default = 'common/summary/address-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->addressHeader = $html; |
| 125 | 125 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $tplconf = 'client/html/account/history/order/address/standard/template-header'; |
| 149 | 149 | $default = 'common/summary/address-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/account/history/order/address/decorators/excludes |
| 165 | 165 | * Excludes decorators added by the "common" option from the account history order address html client |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see client/html/account/history/order/address/decorators/excludes |
| 235 | 235 | * @see client/html/account/history/order/address/decorators/global |
| 236 | 236 | */ |
| 237 | - return $this->createSubClient( 'account/history/order/address/' . $type, $name ); |
|
| 237 | + return $this->createSubClient('account/history/order/address/'.$type, $name); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | |
@@ -245,6 +245,6 @@ 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 | \ 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\Summary\Coupon\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Coupon\Base |
|
| 23 | 23 | { |
| 24 | - /** client/html/account/history/order/coupon/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the account history order coupon section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2015.11 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/account/history/order/coupon/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Returns the HTML code for insertion into the body. |
|
| 63 | - * |
|
| 64 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | - * @return string HTML code |
|
| 68 | - */ |
|
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | - { |
|
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | - |
|
| 73 | - $html = ''; |
|
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | - } |
|
| 77 | - $view->couponBody = $html; |
|
| 78 | - |
|
| 79 | - /** client/html/account/history/order/coupon/standard/template-body |
|
| 80 | - * Relative path to the HTML body template of the account history order coupon client. |
|
| 81 | - * |
|
| 82 | - * The template file contains the HTML code and processing instructions |
|
| 83 | - * to generate the result shown in the body of the frontend. The |
|
| 84 | - * configuration string is the path to the template file relative |
|
| 85 | - * to the templates directory (usually in client/html/templates). |
|
| 86 | - * |
|
| 87 | - * You can overwrite the template file configuration in extensions and |
|
| 88 | - * provide alternative templates. These alternative templates should be |
|
| 89 | - * named like the default one but with the string "standard" replaced by |
|
| 90 | - * an unique name. You may use the name of your project for this. If |
|
| 91 | - * you've implemented an alternative client class as well, "standard" |
|
| 92 | - * (second one) should be replaced by the name of the new class in lower |
|
| 93 | - * case. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2015.11 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/account/history/order/coupon/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/account/history/order/coupon/standard/template-body'; |
|
| 101 | - $default = 'common/summary/coupon-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->couponHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/account/history/order/coupon/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the account history order coupon client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * (second one) should be replaced by the name of the new class in lower |
|
| 140 | - * case. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2015.11 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/account/history/order/coupon/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/account/history/order/coupon/standard/template-header'; |
|
| 148 | - $default = 'common/summary/coupon-header-default.php'; |
|
| 149 | - |
|
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 152 | - |
|
| 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/account/history/order/coupon/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the account history order coupon 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/account/history/order/coupon/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/account/history/order/coupon/decorators/global |
|
| 186 | - * @see client/html/account/history/order/coupon/decorators/local |
|
| 187 | - */ |
|
| 188 | - |
|
| 189 | - /** client/html/account/history/order/coupon/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the account history order coupon 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/account/history/order/coupon/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/account/history/order/coupon/decorators/excludes |
|
| 210 | - * @see client/html/account/history/order/coupon/decorators/local |
|
| 211 | - */ |
|
| 212 | - |
|
| 213 | - /** client/html/account/history/order/coupon/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the account history order coupon 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\Basket\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/account/history/order/coupon/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Basket\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/account/history/order/coupon/decorators/excludes |
|
| 234 | - * @see client/html/account/history/order/coupon/decorators/global |
|
| 235 | - */ |
|
| 236 | - return $this->createSubClient( 'account/history/order/coupon/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 24 | + /** client/html/account/history/order/coupon/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the account history order coupon section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2015.11 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/account/history/order/coupon/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Returns the HTML code for insertion into the body. |
|
| 63 | + * |
|
| 64 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | + * @return string HTML code |
|
| 68 | + */ |
|
| 69 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + { |
|
| 71 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + |
|
| 73 | + $html = ''; |
|
| 74 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + } |
|
| 77 | + $view->couponBody = $html; |
|
| 78 | + |
|
| 79 | + /** client/html/account/history/order/coupon/standard/template-body |
|
| 80 | + * Relative path to the HTML body template of the account history order coupon client. |
|
| 81 | + * |
|
| 82 | + * The template file contains the HTML code and processing instructions |
|
| 83 | + * to generate the result shown in the body of the frontend. The |
|
| 84 | + * configuration string is the path to the template file relative |
|
| 85 | + * to the templates directory (usually in client/html/templates). |
|
| 86 | + * |
|
| 87 | + * You can overwrite the template file configuration in extensions and |
|
| 88 | + * provide alternative templates. These alternative templates should be |
|
| 89 | + * named like the default one but with the string "standard" replaced by |
|
| 90 | + * an unique name. You may use the name of your project for this. If |
|
| 91 | + * you've implemented an alternative client class as well, "standard" |
|
| 92 | + * (second one) should be replaced by the name of the new class in lower |
|
| 93 | + * case. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2015.11 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/account/history/order/coupon/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/account/history/order/coupon/standard/template-body'; |
|
| 101 | + $default = 'common/summary/coupon-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->couponHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/account/history/order/coupon/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the account history order coupon client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * (second one) should be replaced by the name of the new class in lower |
|
| 140 | + * case. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2015.11 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/account/history/order/coupon/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/account/history/order/coupon/standard/template-header'; |
|
| 148 | + $default = 'common/summary/coupon-header-default.php'; |
|
| 149 | + |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | + |
|
| 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/account/history/order/coupon/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the account history order coupon 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/account/history/order/coupon/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/account/history/order/coupon/decorators/global |
|
| 186 | + * @see client/html/account/history/order/coupon/decorators/local |
|
| 187 | + */ |
|
| 188 | + |
|
| 189 | + /** client/html/account/history/order/coupon/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the account history order coupon 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/account/history/order/coupon/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/account/history/order/coupon/decorators/excludes |
|
| 210 | + * @see client/html/account/history/order/coupon/decorators/local |
|
| 211 | + */ |
|
| 212 | + |
|
| 213 | + /** client/html/account/history/order/coupon/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the account history order coupon 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\Basket\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/account/history/order/coupon/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Basket\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/account/history/order/coupon/decorators/excludes |
|
| 234 | + * @see client/html/account/history/order/coupon/decorators/global |
|
| 235 | + */ |
|
| 236 | + return $this->createSubClient( 'account/history/order/coupon/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 67 | 67 | * @return string HTML code |
| 68 | 68 | */ |
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 70 | 70 | { |
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 72 | 72 | |
| 73 | 73 | $html = ''; |
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 74 | + foreach ($this->getSubClients() as $subclient) { |
|
| 75 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 76 | 76 | } |
| 77 | 77 | $view->couponBody = $html; |
| 78 | 78 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/account/history/order/coupon/standard/template-body'; |
| 101 | 101 | $default = 'common/summary/coupon-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->couponHeader = $html; |
| 124 | 124 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/account/history/order/coupon/standard/template-header'; |
| 148 | 148 | $default = 'common/summary/coupon-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/account/history/order/coupon/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the account history order coupon html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/account/history/order/coupon/decorators/excludes |
| 234 | 234 | * @see client/html/account/history/order/coupon/decorators/global |
| 235 | 235 | */ |
| 236 | - return $this->createSubClient( 'account/history/order/coupon/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('account/history/order/coupon/'.$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,259 +19,259 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 23 | 23 | { |
| 24 | - /** client/html/account/history/order/detail/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the account history order detail section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2015.11 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/account/history/order/detail/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - private $cache; |
|
| 24 | + /** client/html/account/history/order/detail/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the account history order detail section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2015.11 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/account/history/order/detail/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + private $cache; |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | 73 | |
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->detailBody = $html; |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->detailBody = $html; |
|
| 79 | 79 | |
| 80 | - /** client/html/account/history/order/detail/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the account history order detail 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 | - * (second one) should be replaced by the name of the new class in lower |
|
| 94 | - * case. |
|
| 95 | - * |
|
| 96 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | - * @since 2015.11 |
|
| 98 | - * @category Developer |
|
| 99 | - * @see client/html/account/history/order/detail/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/account/history/order/detail/standard/template-body'; |
|
| 102 | - $default = 'common/summary/detail-body-default.php'; |
|
| 80 | + /** client/html/account/history/order/detail/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the account history order detail 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 | + * (second one) should be replaced by the name of the new class in lower |
|
| 94 | + * case. |
|
| 95 | + * |
|
| 96 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 97 | + * @since 2015.11 |
|
| 98 | + * @category Developer |
|
| 99 | + * @see client/html/account/history/order/detail/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/account/history/order/detail/standard/template-body'; |
|
| 102 | + $default = 'common/summary/detail-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->detailHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->detailHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/account/history/order/detail/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the account history order detail 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 | - * (second one) should be replaced by the name of the new class in lower |
|
| 141 | - * case. |
|
| 142 | - * |
|
| 143 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | - * @since 2015.11 |
|
| 145 | - * @category Developer |
|
| 146 | - * @see client/html/account/history/order/detail/standard/template-body |
|
| 147 | - */ |
|
| 148 | - $tplconf = 'client/html/account/history/order/detail/standard/template-header'; |
|
| 149 | - $default = 'common/summary/detail-header-default.php'; |
|
| 126 | + /** client/html/account/history/order/detail/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the account history order detail 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 | + * (second one) should be replaced by the name of the new class in lower |
|
| 141 | + * case. |
|
| 142 | + * |
|
| 143 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 144 | + * @since 2015.11 |
|
| 145 | + * @category Developer |
|
| 146 | + * @see client/html/account/history/order/detail/standard/template-body |
|
| 147 | + */ |
|
| 148 | + $tplconf = 'client/html/account/history/order/detail/standard/template-header'; |
|
| 149 | + $default = 'common/summary/detail-header-default.php'; |
|
| 150 | 150 | |
| 151 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | - } |
|
| 151 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Returns the sub-client given by its name. |
|
| 157 | - * |
|
| 158 | - * @param string $type Name of the client type |
|
| 159 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | - */ |
|
| 162 | - public function getSubClient( $type, $name = null ) |
|
| 163 | - { |
|
| 164 | - /** client/html/account/history/order/detail/decorators/excludes |
|
| 165 | - * Excludes decorators added by the "common" option from the account history order detail 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/account/history/order/detail/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/account/history/order/detail/decorators/global |
|
| 187 | - * @see client/html/account/history/order/detail/decorators/local |
|
| 188 | - */ |
|
| 155 | + /** |
|
| 156 | + * Returns the sub-client given by its name. |
|
| 157 | + * |
|
| 158 | + * @param string $type Name of the client type |
|
| 159 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 160 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 161 | + */ |
|
| 162 | + public function getSubClient( $type, $name = null ) |
|
| 163 | + { |
|
| 164 | + /** client/html/account/history/order/detail/decorators/excludes |
|
| 165 | + * Excludes decorators added by the "common" option from the account history order detail 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/account/history/order/detail/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/account/history/order/detail/decorators/global |
|
| 187 | + * @see client/html/account/history/order/detail/decorators/local |
|
| 188 | + */ |
|
| 189 | 189 | |
| 190 | - /** client/html/account/history/order/detail/decorators/global |
|
| 191 | - * Adds a list of globally available decorators only to the account history order detail 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/account/history/order/detail/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/account/history/order/detail/decorators/excludes |
|
| 211 | - * @see client/html/account/history/order/detail/decorators/local |
|
| 212 | - */ |
|
| 190 | + /** client/html/account/history/order/detail/decorators/global |
|
| 191 | + * Adds a list of globally available decorators only to the account history order detail 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/account/history/order/detail/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/account/history/order/detail/decorators/excludes |
|
| 211 | + * @see client/html/account/history/order/detail/decorators/local |
|
| 212 | + */ |
|
| 213 | 213 | |
| 214 | - /** client/html/account/history/order/detail/decorators/local |
|
| 215 | - * Adds a list of local decorators only to the account history order detail 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\Basket\Decorator\*") around the html client. |
|
| 224 | - * |
|
| 225 | - * client/html/account/history/order/detail/decorators/local = array( 'decorator2' ) |
|
| 226 | - * |
|
| 227 | - * This would add the decorator named "decorator2" defined by |
|
| 228 | - * "\Aimeos\Client\Html\Basket\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/account/history/order/detail/decorators/excludes |
|
| 235 | - * @see client/html/account/history/order/detail/decorators/global |
|
| 236 | - */ |
|
| 237 | - return $this->createSubClient( 'account/history/order/detail/' . $type, $name ); |
|
| 238 | - } |
|
| 214 | + /** client/html/account/history/order/detail/decorators/local |
|
| 215 | + * Adds a list of local decorators only to the account history order detail 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\Basket\Decorator\*") around the html client. |
|
| 224 | + * |
|
| 225 | + * client/html/account/history/order/detail/decorators/local = array( 'decorator2' ) |
|
| 226 | + * |
|
| 227 | + * This would add the decorator named "decorator2" defined by |
|
| 228 | + * "\Aimeos\Client\Html\Basket\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/account/history/order/detail/decorators/excludes |
|
| 235 | + * @see client/html/account/history/order/detail/decorators/global |
|
| 236 | + */ |
|
| 237 | + return $this->createSubClient( 'account/history/order/detail/' . $type, $name ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Returns the list of sub-client names configured for the client. |
|
| 243 | - * |
|
| 244 | - * @return array List of HTML client names |
|
| 245 | - */ |
|
| 246 | - protected function getSubClientNames() |
|
| 247 | - { |
|
| 248 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | - } |
|
| 241 | + /** |
|
| 242 | + * Returns the list of sub-client names configured for the client. |
|
| 243 | + * |
|
| 244 | + * @return array List of HTML client names |
|
| 245 | + */ |
|
| 246 | + protected function getSubClientNames() |
|
| 247 | + { |
|
| 248 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Sets the necessary parameter values in the view. |
|
| 254 | - * |
|
| 255 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | - */ |
|
| 260 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | - { |
|
| 262 | - if( !isset( $this->cache ) ) |
|
| 263 | - { |
|
| 264 | - $view = parent::setViewParams( $view ); |
|
| 252 | + /** |
|
| 253 | + * Sets the necessary parameter values in the view. |
|
| 254 | + * |
|
| 255 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 256 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 257 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 258 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 259 | + */ |
|
| 260 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + { |
|
| 262 | + if( !isset( $this->cache ) ) |
|
| 263 | + { |
|
| 264 | + $view = parent::setViewParams( $view ); |
|
| 265 | 265 | |
| 266 | - if( $view->orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) { |
|
| 267 | - $view->summaryShowDownloadAttributes = true; |
|
| 268 | - } |
|
| 266 | + if( $view->orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) { |
|
| 267 | + $view->summaryShowDownloadAttributes = true; |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - $view->summaryTaxRates = $this->getTaxRates( $view->summaryBasket ); |
|
| 270 | + $view->summaryTaxRates = $this->getTaxRates( $view->summaryBasket ); |
|
| 271 | 271 | |
| 272 | - $this->cache = $view; |
|
| 273 | - } |
|
| 272 | + $this->cache = $view; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - return $this->cache; |
|
| 276 | - } |
|
| 275 | + return $this->cache; |
|
| 276 | + } |
|
| 277 | 277 | } |
| 278 | 278 | \ No newline at end of file |
@@ -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->detailBody = $html; |
| 79 | 79 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/account/history/order/detail/standard/template-body'; |
| 102 | 102 | $default = 'common/summary/detail-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->detailHeader = $html; |
| 125 | 125 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $tplconf = 'client/html/account/history/order/detail/standard/template-header'; |
| 149 | 149 | $default = 'common/summary/detail-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/account/history/order/detail/decorators/excludes |
| 165 | 165 | * Excludes decorators added by the "common" option from the account history order detail html client |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @see client/html/account/history/order/detail/decorators/excludes |
| 235 | 235 | * @see client/html/account/history/order/detail/decorators/global |
| 236 | 236 | */ |
| 237 | - return $this->createSubClient( 'account/history/order/detail/' . $type, $name ); |
|
| 237 | + return $this->createSubClient('account/history/order/detail/'.$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,17 +257,17 @@ 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 | - $view = parent::setViewParams( $view ); |
|
| 264 | + $view = parent::setViewParams($view); |
|
| 265 | 265 | |
| 266 | - if( $view->orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) { |
|
| 266 | + if ($view->orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus()) { |
|
| 267 | 267 | $view->summaryShowDownloadAttributes = true; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $view->summaryTaxRates = $this->getTaxRates( $view->summaryBasket ); |
|
| 270 | + $view->summaryTaxRates = $this->getTaxRates($view->summaryBasket); |
|
| 271 | 271 | |
| 272 | 272 | $this->cache = $view; |
| 273 | 273 | } |
@@ -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\Summary\Service\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Service\Base |
|
| 23 | 23 | { |
| 24 | - /** client/html/account/history/order/service/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the account history order service section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2015.11 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/account/history/order/service/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Returns the HTML code for insertion into the body. |
|
| 63 | - * |
|
| 64 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | - * @return string HTML code |
|
| 68 | - */ |
|
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | - { |
|
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | - |
|
| 73 | - $html = ''; |
|
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | - } |
|
| 77 | - $view->serviceBody = $html; |
|
| 78 | - |
|
| 79 | - /** client/html/account/history/order/service/standard/template-body |
|
| 80 | - * Relative path to the HTML body template of the account history order service client. |
|
| 81 | - * |
|
| 82 | - * The template file contains the HTML code and processing instructions |
|
| 83 | - * to generate the result shown in the body of the frontend. The |
|
| 84 | - * configuration string is the path to the template file relative |
|
| 85 | - * to the templates directory (usually in client/html/templates). |
|
| 86 | - * |
|
| 87 | - * You can overwrite the template file configuration in extensions and |
|
| 88 | - * provide alternative templates. These alternative templates should be |
|
| 89 | - * named like the default one but with the string "standard" replaced by |
|
| 90 | - * an unique name. You may use the name of your project for this. If |
|
| 91 | - * you've implemented an alternative client class as well, "standard" |
|
| 92 | - * (second one) should be replaced by the name of the new class in lower |
|
| 93 | - * case. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2015.11 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/account/history/order/service/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/account/history/order/service/standard/template-body'; |
|
| 101 | - $default = 'common/summary/service-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->serviceHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/account/history/order/service/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the account history order service client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * (second one) should be replaced by the name of the new class in lower |
|
| 140 | - * case. |
|
| 141 | - * |
|
| 142 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | - * @since 2015.11 |
|
| 144 | - * @category Developer |
|
| 145 | - * @see client/html/account/history/order/service/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/account/history/order/service/standard/template-header'; |
|
| 148 | - $default = 'common/summary/service-header-default.php'; |
|
| 149 | - |
|
| 150 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | - } |
|
| 152 | - |
|
| 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/account/history/order/service/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the account history order service 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/account/history/order/service/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/account/history/order/service/decorators/global |
|
| 186 | - * @see client/html/account/history/order/service/decorators/local |
|
| 187 | - */ |
|
| 188 | - |
|
| 189 | - /** client/html/account/history/order/service/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the account history order service 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/account/history/order/service/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/account/history/order/service/decorators/excludes |
|
| 210 | - * @see client/html/account/history/order/service/decorators/local |
|
| 211 | - */ |
|
| 212 | - |
|
| 213 | - /** client/html/account/history/order/service/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the account history order service 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\Basket\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/account/history/order/service/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Basket\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/account/history/order/service/decorators/excludes |
|
| 234 | - * @see client/html/account/history/order/service/decorators/global |
|
| 235 | - */ |
|
| 236 | - return $this->createSubClient( 'account/history/order/service/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 24 | + /** client/html/account/history/order/service/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the account history order service section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2015.11 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/account/history/order/service/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Returns the HTML code for insertion into the body. |
|
| 63 | + * |
|
| 64 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | + * @return string HTML code |
|
| 68 | + */ |
|
| 69 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + { |
|
| 71 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + |
|
| 73 | + $html = ''; |
|
| 74 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + } |
|
| 77 | + $view->serviceBody = $html; |
|
| 78 | + |
|
| 79 | + /** client/html/account/history/order/service/standard/template-body |
|
| 80 | + * Relative path to the HTML body template of the account history order service client. |
|
| 81 | + * |
|
| 82 | + * The template file contains the HTML code and processing instructions |
|
| 83 | + * to generate the result shown in the body of the frontend. The |
|
| 84 | + * configuration string is the path to the template file relative |
|
| 85 | + * to the templates directory (usually in client/html/templates). |
|
| 86 | + * |
|
| 87 | + * You can overwrite the template file configuration in extensions and |
|
| 88 | + * provide alternative templates. These alternative templates should be |
|
| 89 | + * named like the default one but with the string "standard" replaced by |
|
| 90 | + * an unique name. You may use the name of your project for this. If |
|
| 91 | + * you've implemented an alternative client class as well, "standard" |
|
| 92 | + * (second one) should be replaced by the name of the new class in lower |
|
| 93 | + * case. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2015.11 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/account/history/order/service/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/account/history/order/service/standard/template-body'; |
|
| 101 | + $default = 'common/summary/service-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->serviceHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/account/history/order/service/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the account history order service client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * (second one) should be replaced by the name of the new class in lower |
|
| 140 | + * case. |
|
| 141 | + * |
|
| 142 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 143 | + * @since 2015.11 |
|
| 144 | + * @category Developer |
|
| 145 | + * @see client/html/account/history/order/service/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/account/history/order/service/standard/template-header'; |
|
| 148 | + $default = 'common/summary/service-header-default.php'; |
|
| 149 | + |
|
| 150 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 151 | + } |
|
| 152 | + |
|
| 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/account/history/order/service/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the account history order service 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/account/history/order/service/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/account/history/order/service/decorators/global |
|
| 186 | + * @see client/html/account/history/order/service/decorators/local |
|
| 187 | + */ |
|
| 188 | + |
|
| 189 | + /** client/html/account/history/order/service/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the account history order service 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/account/history/order/service/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/account/history/order/service/decorators/excludes |
|
| 210 | + * @see client/html/account/history/order/service/decorators/local |
|
| 211 | + */ |
|
| 212 | + |
|
| 213 | + /** client/html/account/history/order/service/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the account history order service 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\Basket\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/account/history/order/service/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Basket\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/account/history/order/service/decorators/excludes |
|
| 234 | + * @see client/html/account/history/order/service/decorators/global |
|
| 235 | + */ |
|
| 236 | + return $this->createSubClient( 'account/history/order/service/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 67 | 67 | * @return string HTML code |
| 68 | 68 | */ |
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 70 | 70 | { |
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 72 | 72 | |
| 73 | 73 | $html = ''; |
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 74 | + foreach ($this->getSubClients() as $subclient) { |
|
| 75 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 76 | 76 | } |
| 77 | 77 | $view->serviceBody = $html; |
| 78 | 78 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/account/history/order/service/standard/template-body'; |
| 101 | 101 | $default = 'common/summary/service-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->serviceHeader = $html; |
| 124 | 124 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/account/history/order/service/standard/template-header'; |
| 148 | 148 | $default = 'common/summary/service-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/account/history/order/service/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the account history order service html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/account/history/order/service/decorators/excludes |
| 234 | 234 | * @see client/html/account/history/order/service/decorators/global |
| 235 | 235 | */ |
| 236 | - return $this->createSubClient( 'account/history/order/service/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('account/history/order/service/'.$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 |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 163 | 163 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 164 | 164 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 165 | - * @return string|null String including HTML tags for the header on error |
|
| 165 | + * @return string String including HTML tags for the header on error |
|
| 166 | 166 | */ |
| 167 | 167 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 168 | 168 | { |
@@ -19,336 +19,336 @@ |
||
| 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/account/history/order/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the account history order section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2015.02 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/account/history/order/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/account/history/order/address/name |
|
| 61 | - * Name of the address part used by the account history order client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Address\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 2015.02 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/account/history/order/service/name |
|
| 72 | - * Name of the service part used by the account history order client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Service\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 2015.02 |
|
| 79 | - * @category Developer |
|
| 80 | - */ |
|
| 81 | - |
|
| 82 | - /** client/html/account/history/order/coupon/name |
|
| 83 | - * Name of the coupon part used by the account history order client implementation |
|
| 84 | - * |
|
| 85 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Coupon\Myname". |
|
| 86 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | - * |
|
| 88 | - * @param string Last part of the client class name |
|
| 89 | - * @since 2015.02 |
|
| 90 | - * @category Developer |
|
| 91 | - */ |
|
| 92 | - |
|
| 93 | - /** client/html/account/history/order/detail/name |
|
| 94 | - * Name of the detail part used by the account history order client implementation |
|
| 95 | - * |
|
| 96 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Detail\Myname". |
|
| 97 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 98 | - * |
|
| 99 | - * @param string Last part of the client class name |
|
| 100 | - * @since 2015.02 |
|
| 101 | - * @category Developer |
|
| 102 | - */ |
|
| 103 | - private $subPartNames = array( 'address', 'service', 'coupon', 'detail' ); |
|
| 104 | - |
|
| 105 | - private $cache; |
|
| 106 | - |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * Returns the HTML code for insertion into the body. |
|
| 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 HTML code |
|
| 115 | - */ |
|
| 116 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | - { |
|
| 118 | - $view = $this->getView(); |
|
| 119 | - |
|
| 120 | - if( $view->param( 'his_action' ) != 'order' ) { |
|
| 121 | - return ''; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 125 | - |
|
| 126 | - $html = ''; |
|
| 127 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 128 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 129 | - } |
|
| 130 | - $view->orderBody = $html; |
|
| 131 | - |
|
| 132 | - /** client/html/account/history/order/standard/template-body |
|
| 133 | - * Relative path to the HTML body template of the account history order client. |
|
| 134 | - * |
|
| 135 | - * The template file contains the HTML code and processing instructions |
|
| 136 | - * to generate the result shown in the body of the frontend. The |
|
| 137 | - * configuration string is the path to the template file relative |
|
| 138 | - * to the templates directory (usually in client/html/templates). |
|
| 139 | - * |
|
| 140 | - * You can overwrite the template file configuration in extensions and |
|
| 141 | - * provide alternative templates. These alternative templates should be |
|
| 142 | - * named like the default one but with the string "standard" replaced by |
|
| 143 | - * an unique name. You may use the name of your project for this. If |
|
| 144 | - * you've implemented an alternative client class as well, "standard" |
|
| 145 | - * should be replaced by the name of the new class. |
|
| 146 | - * |
|
| 147 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 148 | - * @since 2015.02 |
|
| 149 | - * @category Developer |
|
| 150 | - * @see client/html/account/history/order/standard/template-header |
|
| 151 | - */ |
|
| 152 | - $tplconf = 'client/html/account/history/order/standard/template-body'; |
|
| 153 | - $default = 'account/history/order-body-default.php'; |
|
| 154 | - |
|
| 155 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * Returns the HTML string for insertion into the header. |
|
| 161 | - * |
|
| 162 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 163 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 164 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 165 | - * @return string|null String including HTML tags for the header on error |
|
| 166 | - */ |
|
| 167 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 168 | - { |
|
| 169 | - $view = $this->getView(); |
|
| 170 | - |
|
| 171 | - if( $view->param( 'his_action' ) != 'order' ) { |
|
| 172 | - return ''; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 176 | - |
|
| 177 | - $html = ''; |
|
| 178 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 179 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 180 | - } |
|
| 181 | - $view->orderHeader = $html; |
|
| 182 | - |
|
| 183 | - /** client/html/account/history/order/standard/template-header |
|
| 184 | - * Relative path to the HTML header template of the account history order client. |
|
| 185 | - * |
|
| 186 | - * The template file contains the HTML code and processing instructions |
|
| 187 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 188 | - * of the rendered page in the frontend. The configuration string is the |
|
| 189 | - * path to the template file relative to the templates directory (usually |
|
| 190 | - * in client/html/templates). |
|
| 191 | - * |
|
| 192 | - * You can overwrite the template file configuration in extensions and |
|
| 193 | - * provide alternative templates. These alternative templates should be |
|
| 194 | - * named like the default one but with the string "standard" replaced by |
|
| 195 | - * an unique name. You may use the name of your project for this. If |
|
| 196 | - * you've implemented an alternative client class as well, "standard" |
|
| 197 | - * should be replaced by the name of the new class. |
|
| 198 | - * |
|
| 199 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 200 | - * @since 2015.02 |
|
| 201 | - * @category Developer |
|
| 202 | - * @see client/html/account/history/order/standard/template-body |
|
| 203 | - */ |
|
| 204 | - $tplconf = 'client/html/account/history/order/standard/template-header'; |
|
| 205 | - $default = 'account/history/order-header-default.php'; |
|
| 206 | - |
|
| 207 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * Returns the sub-client given by its name. |
|
| 213 | - * |
|
| 214 | - * @param string $type Name of the client type |
|
| 215 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 216 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 217 | - */ |
|
| 218 | - public function getSubClient( $type, $name = null ) |
|
| 219 | - { |
|
| 220 | - /** client/html/account/history/order/decorators/excludes |
|
| 221 | - * Excludes decorators added by the "common" option from the account history order html client |
|
| 222 | - * |
|
| 223 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 224 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 225 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 226 | - * modify what is returned to the caller. |
|
| 227 | - * |
|
| 228 | - * This option allows you to remove a decorator added via |
|
| 229 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 230 | - * around the html client. |
|
| 231 | - * |
|
| 232 | - * client/html/account/history/order/decorators/excludes = array( 'decorator1' ) |
|
| 233 | - * |
|
| 234 | - * This would remove the decorator named "decorator1" from the list of |
|
| 235 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 236 | - * "client/html/common/decorators/default" to the html client. |
|
| 237 | - * |
|
| 238 | - * @param array List of decorator names |
|
| 239 | - * @since 2015.08 |
|
| 240 | - * @category Developer |
|
| 241 | - * @see client/html/common/decorators/default |
|
| 242 | - * @see client/html/account/history/order/decorators/global |
|
| 243 | - * @see client/html/account/history/order/decorators/local |
|
| 244 | - */ |
|
| 245 | - |
|
| 246 | - /** client/html/account/history/order/decorators/global |
|
| 247 | - * Adds a list of globally available decorators only to the account history order html client |
|
| 248 | - * |
|
| 249 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 250 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 251 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 252 | - * modify what is returned to the caller. |
|
| 253 | - * |
|
| 254 | - * This option allows you to wrap global decorators |
|
| 255 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 256 | - * |
|
| 257 | - * client/html/account/history/order/decorators/global = array( 'decorator1' ) |
|
| 258 | - * |
|
| 259 | - * This would add the decorator named "decorator1" defined by |
|
| 260 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 261 | - * |
|
| 262 | - * @param array List of decorator names |
|
| 263 | - * @since 2015.08 |
|
| 264 | - * @category Developer |
|
| 265 | - * @see client/html/common/decorators/default |
|
| 266 | - * @see client/html/account/history/order/decorators/excludes |
|
| 267 | - * @see client/html/account/history/order/decorators/local |
|
| 268 | - */ |
|
| 269 | - |
|
| 270 | - /** client/html/account/history/order/decorators/local |
|
| 271 | - * Adds a list of local decorators only to the account history order html client |
|
| 272 | - * |
|
| 273 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 274 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 275 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 276 | - * modify what is returned to the caller. |
|
| 277 | - * |
|
| 278 | - * This option allows you to wrap local decorators |
|
| 279 | - * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client. |
|
| 280 | - * |
|
| 281 | - * client/html/account/history/order/decorators/local = array( 'decorator2' ) |
|
| 282 | - * |
|
| 283 | - * This would add the decorator named "decorator2" defined by |
|
| 284 | - * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client. |
|
| 285 | - * |
|
| 286 | - * @param array List of decorator names |
|
| 287 | - * @since 2015.08 |
|
| 288 | - * @category Developer |
|
| 289 | - * @see client/html/common/decorators/default |
|
| 290 | - * @see client/html/account/history/order/decorators/excludes |
|
| 291 | - * @see client/html/account/history/order/decorators/global |
|
| 292 | - */ |
|
| 293 | - |
|
| 294 | - return $this->createSubClient( 'account/history/order/' . $type, $name ); |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * Returns the list of sub-client names configured for the client. |
|
| 300 | - * |
|
| 301 | - * @return array List of HTML client names |
|
| 302 | - */ |
|
| 303 | - protected function getSubClientNames() |
|
| 304 | - { |
|
| 305 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - |
|
| 309 | - /** |
|
| 310 | - * Sets the necessary parameter values in the view. |
|
| 311 | - * |
|
| 312 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 313 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 314 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 315 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 316 | - */ |
|
| 317 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 318 | - { |
|
| 319 | - if( !isset( $this->cache ) ) |
|
| 320 | - { |
|
| 321 | - $context = $this->getContext(); |
|
| 322 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 323 | - |
|
| 324 | - $orderId = $view->param( 'his_id', null ); |
|
| 325 | - |
|
| 326 | - if( $orderId !== null ) |
|
| 327 | - { |
|
| 328 | - $search = $manager->createSearch( true ); |
|
| 329 | - $expr = array( |
|
| 330 | - $search->getConditions(), |
|
| 331 | - $search->compare( '==', 'order.id', $orderId ), |
|
| 332 | - $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 333 | - ); |
|
| 334 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 335 | - |
|
| 336 | - $orderItems = $manager->searchItems( $search ); |
|
| 337 | - |
|
| 338 | - if( ( $orderItem = reset( $orderItems ) ) === false ) |
|
| 339 | - { |
|
| 340 | - $msg = $view->translate( 'client', 'Order with ID "%1$s" not found' ); |
|
| 341 | - throw new \Aimeos\Client\Html\Exception( sprintf( $msg, $orderId ) ); |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - $baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 345 | - $view->summaryBasket = $baseManager->load( $orderItem->getBaseId() ); |
|
| 346 | - $view->orderItem = $orderItem; |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - $this->cache = $view; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - return $this->cache; |
|
| 353 | - } |
|
| 25 | + /** client/html/account/history/order/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the account history order section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2015.02 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/account/history/order/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/account/history/order/address/name |
|
| 61 | + * Name of the address part used by the account history order client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Address\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 2015.02 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/account/history/order/service/name |
|
| 72 | + * Name of the service part used by the account history order client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Service\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 2015.02 |
|
| 79 | + * @category Developer |
|
| 80 | + */ |
|
| 81 | + |
|
| 82 | + /** client/html/account/history/order/coupon/name |
|
| 83 | + * Name of the coupon part used by the account history order client implementation |
|
| 84 | + * |
|
| 85 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Coupon\Myname". |
|
| 86 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | + * |
|
| 88 | + * @param string Last part of the client class name |
|
| 89 | + * @since 2015.02 |
|
| 90 | + * @category Developer |
|
| 91 | + */ |
|
| 92 | + |
|
| 93 | + /** client/html/account/history/order/detail/name |
|
| 94 | + * Name of the detail part used by the account history order client implementation |
|
| 95 | + * |
|
| 96 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Detail\Myname". |
|
| 97 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 98 | + * |
|
| 99 | + * @param string Last part of the client class name |
|
| 100 | + * @since 2015.02 |
|
| 101 | + * @category Developer |
|
| 102 | + */ |
|
| 103 | + private $subPartNames = array( 'address', 'service', 'coupon', 'detail' ); |
|
| 104 | + |
|
| 105 | + private $cache; |
|
| 106 | + |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * Returns the HTML code for insertion into the body. |
|
| 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 HTML code |
|
| 115 | + */ |
|
| 116 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + { |
|
| 118 | + $view = $this->getView(); |
|
| 119 | + |
|
| 120 | + if( $view->param( 'his_action' ) != 'order' ) { |
|
| 121 | + return ''; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 125 | + |
|
| 126 | + $html = ''; |
|
| 127 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 128 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 129 | + } |
|
| 130 | + $view->orderBody = $html; |
|
| 131 | + |
|
| 132 | + /** client/html/account/history/order/standard/template-body |
|
| 133 | + * Relative path to the HTML body template of the account history order client. |
|
| 134 | + * |
|
| 135 | + * The template file contains the HTML code and processing instructions |
|
| 136 | + * to generate the result shown in the body of the frontend. The |
|
| 137 | + * configuration string is the path to the template file relative |
|
| 138 | + * to the templates directory (usually in client/html/templates). |
|
| 139 | + * |
|
| 140 | + * You can overwrite the template file configuration in extensions and |
|
| 141 | + * provide alternative templates. These alternative templates should be |
|
| 142 | + * named like the default one but with the string "standard" replaced by |
|
| 143 | + * an unique name. You may use the name of your project for this. If |
|
| 144 | + * you've implemented an alternative client class as well, "standard" |
|
| 145 | + * should be replaced by the name of the new class. |
|
| 146 | + * |
|
| 147 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 148 | + * @since 2015.02 |
|
| 149 | + * @category Developer |
|
| 150 | + * @see client/html/account/history/order/standard/template-header |
|
| 151 | + */ |
|
| 152 | + $tplconf = 'client/html/account/history/order/standard/template-body'; |
|
| 153 | + $default = 'account/history/order-body-default.php'; |
|
| 154 | + |
|
| 155 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * Returns the HTML string for insertion into the header. |
|
| 161 | + * |
|
| 162 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 163 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 164 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 165 | + * @return string|null String including HTML tags for the header on error |
|
| 166 | + */ |
|
| 167 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 168 | + { |
|
| 169 | + $view = $this->getView(); |
|
| 170 | + |
|
| 171 | + if( $view->param( 'his_action' ) != 'order' ) { |
|
| 172 | + return ''; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 176 | + |
|
| 177 | + $html = ''; |
|
| 178 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 179 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 180 | + } |
|
| 181 | + $view->orderHeader = $html; |
|
| 182 | + |
|
| 183 | + /** client/html/account/history/order/standard/template-header |
|
| 184 | + * Relative path to the HTML header template of the account history order client. |
|
| 185 | + * |
|
| 186 | + * The template file contains the HTML code and processing instructions |
|
| 187 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 188 | + * of the rendered page in the frontend. The configuration string is the |
|
| 189 | + * path to the template file relative to the templates directory (usually |
|
| 190 | + * in client/html/templates). |
|
| 191 | + * |
|
| 192 | + * You can overwrite the template file configuration in extensions and |
|
| 193 | + * provide alternative templates. These alternative templates should be |
|
| 194 | + * named like the default one but with the string "standard" replaced by |
|
| 195 | + * an unique name. You may use the name of your project for this. If |
|
| 196 | + * you've implemented an alternative client class as well, "standard" |
|
| 197 | + * should be replaced by the name of the new class. |
|
| 198 | + * |
|
| 199 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 200 | + * @since 2015.02 |
|
| 201 | + * @category Developer |
|
| 202 | + * @see client/html/account/history/order/standard/template-body |
|
| 203 | + */ |
|
| 204 | + $tplconf = 'client/html/account/history/order/standard/template-header'; |
|
| 205 | + $default = 'account/history/order-header-default.php'; |
|
| 206 | + |
|
| 207 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * Returns the sub-client given by its name. |
|
| 213 | + * |
|
| 214 | + * @param string $type Name of the client type |
|
| 215 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 216 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 217 | + */ |
|
| 218 | + public function getSubClient( $type, $name = null ) |
|
| 219 | + { |
|
| 220 | + /** client/html/account/history/order/decorators/excludes |
|
| 221 | + * Excludes decorators added by the "common" option from the account history order html client |
|
| 222 | + * |
|
| 223 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 224 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 225 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 226 | + * modify what is returned to the caller. |
|
| 227 | + * |
|
| 228 | + * This option allows you to remove a decorator added via |
|
| 229 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 230 | + * around the html client. |
|
| 231 | + * |
|
| 232 | + * client/html/account/history/order/decorators/excludes = array( 'decorator1' ) |
|
| 233 | + * |
|
| 234 | + * This would remove the decorator named "decorator1" from the list of |
|
| 235 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 236 | + * "client/html/common/decorators/default" to the html client. |
|
| 237 | + * |
|
| 238 | + * @param array List of decorator names |
|
| 239 | + * @since 2015.08 |
|
| 240 | + * @category Developer |
|
| 241 | + * @see client/html/common/decorators/default |
|
| 242 | + * @see client/html/account/history/order/decorators/global |
|
| 243 | + * @see client/html/account/history/order/decorators/local |
|
| 244 | + */ |
|
| 245 | + |
|
| 246 | + /** client/html/account/history/order/decorators/global |
|
| 247 | + * Adds a list of globally available decorators only to the account history order html client |
|
| 248 | + * |
|
| 249 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 250 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 251 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 252 | + * modify what is returned to the caller. |
|
| 253 | + * |
|
| 254 | + * This option allows you to wrap global decorators |
|
| 255 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 256 | + * |
|
| 257 | + * client/html/account/history/order/decorators/global = array( 'decorator1' ) |
|
| 258 | + * |
|
| 259 | + * This would add the decorator named "decorator1" defined by |
|
| 260 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 261 | + * |
|
| 262 | + * @param array List of decorator names |
|
| 263 | + * @since 2015.08 |
|
| 264 | + * @category Developer |
|
| 265 | + * @see client/html/common/decorators/default |
|
| 266 | + * @see client/html/account/history/order/decorators/excludes |
|
| 267 | + * @see client/html/account/history/order/decorators/local |
|
| 268 | + */ |
|
| 269 | + |
|
| 270 | + /** client/html/account/history/order/decorators/local |
|
| 271 | + * Adds a list of local decorators only to the account history order html client |
|
| 272 | + * |
|
| 273 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 274 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 275 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 276 | + * modify what is returned to the caller. |
|
| 277 | + * |
|
| 278 | + * This option allows you to wrap local decorators |
|
| 279 | + * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client. |
|
| 280 | + * |
|
| 281 | + * client/html/account/history/order/decorators/local = array( 'decorator2' ) |
|
| 282 | + * |
|
| 283 | + * This would add the decorator named "decorator2" defined by |
|
| 284 | + * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client. |
|
| 285 | + * |
|
| 286 | + * @param array List of decorator names |
|
| 287 | + * @since 2015.08 |
|
| 288 | + * @category Developer |
|
| 289 | + * @see client/html/common/decorators/default |
|
| 290 | + * @see client/html/account/history/order/decorators/excludes |
|
| 291 | + * @see client/html/account/history/order/decorators/global |
|
| 292 | + */ |
|
| 293 | + |
|
| 294 | + return $this->createSubClient( 'account/history/order/' . $type, $name ); |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * Returns the list of sub-client names configured for the client. |
|
| 300 | + * |
|
| 301 | + * @return array List of HTML client names |
|
| 302 | + */ |
|
| 303 | + protected function getSubClientNames() |
|
| 304 | + { |
|
| 305 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + |
|
| 309 | + /** |
|
| 310 | + * Sets the necessary parameter values in the view. |
|
| 311 | + * |
|
| 312 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 313 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 314 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 315 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 316 | + */ |
|
| 317 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 318 | + { |
|
| 319 | + if( !isset( $this->cache ) ) |
|
| 320 | + { |
|
| 321 | + $context = $this->getContext(); |
|
| 322 | + $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 323 | + |
|
| 324 | + $orderId = $view->param( 'his_id', null ); |
|
| 325 | + |
|
| 326 | + if( $orderId !== null ) |
|
| 327 | + { |
|
| 328 | + $search = $manager->createSearch( true ); |
|
| 329 | + $expr = array( |
|
| 330 | + $search->getConditions(), |
|
| 331 | + $search->compare( '==', 'order.id', $orderId ), |
|
| 332 | + $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 333 | + ); |
|
| 334 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 335 | + |
|
| 336 | + $orderItems = $manager->searchItems( $search ); |
|
| 337 | + |
|
| 338 | + if( ( $orderItem = reset( $orderItems ) ) === false ) |
|
| 339 | + { |
|
| 340 | + $msg = $view->translate( 'client', 'Order with ID "%1$s" not found' ); |
|
| 341 | + throw new \Aimeos\Client\Html\Exception( sprintf( $msg, $orderId ) ); |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + $baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 345 | + $view->summaryBasket = $baseManager->load( $orderItem->getBaseId() ); |
|
| 346 | + $view->orderItem = $orderItem; |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + $this->cache = $view; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + return $this->cache; |
|
| 353 | + } |
|
| 354 | 354 | } |
| 355 | 355 | \ No newline at end of file |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @since 2015.02 |
| 101 | 101 | * @category Developer |
| 102 | 102 | */ |
| 103 | - private $subPartNames = array( 'address', 'service', 'coupon', 'detail' ); |
|
| 103 | + private $subPartNames = array('address', 'service', 'coupon', 'detail'); |
|
| 104 | 104 | |
| 105 | 105 | private $cache; |
| 106 | 106 | |
@@ -113,19 +113,19 @@ 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 HTML code |
| 115 | 115 | */ |
| 116 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 117 | 117 | { |
| 118 | 118 | $view = $this->getView(); |
| 119 | 119 | |
| 120 | - if( $view->param( 'his_action' ) != 'order' ) { |
|
| 120 | + if ($view->param('his_action') != 'order') { |
|
| 121 | 121 | return ''; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 124 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 125 | 125 | |
| 126 | 126 | $html = ''; |
| 127 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 128 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 127 | + foreach ($this->getSubClients() as $subclient) { |
|
| 128 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 129 | 129 | } |
| 130 | 130 | $view->orderBody = $html; |
| 131 | 131 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $tplconf = 'client/html/account/history/order/standard/template-body'; |
| 153 | 153 | $default = 'account/history/order-body-default.php'; |
| 154 | 154 | |
| 155 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 155 | + return $view->render($view->config($tplconf, $default)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -164,19 +164,19 @@ discard block |
||
| 164 | 164 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 165 | 165 | * @return string|null String including HTML tags for the header on error |
| 166 | 166 | */ |
| 167 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 167 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 168 | 168 | { |
| 169 | 169 | $view = $this->getView(); |
| 170 | 170 | |
| 171 | - if( $view->param( 'his_action' ) != 'order' ) { |
|
| 171 | + if ($view->param('his_action') != 'order') { |
|
| 172 | 172 | return ''; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 175 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 176 | 176 | |
| 177 | 177 | $html = ''; |
| 178 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 179 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 178 | + foreach ($this->getSubClients() as $subclient) { |
|
| 179 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 180 | 180 | } |
| 181 | 181 | $view->orderHeader = $html; |
| 182 | 182 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $tplconf = 'client/html/account/history/order/standard/template-header'; |
| 205 | 205 | $default = 'account/history/order-header-default.php'; |
| 206 | 206 | |
| 207 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 207 | + return $view->render($view->config($tplconf, $default)); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @param string|null $name Name of the sub-client (Default if null) |
| 216 | 216 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 217 | 217 | */ |
| 218 | - public function getSubClient( $type, $name = null ) |
|
| 218 | + public function getSubClient($type, $name = null) |
|
| 219 | 219 | { |
| 220 | 220 | /** client/html/account/history/order/decorators/excludes |
| 221 | 221 | * Excludes decorators added by the "common" option from the account history order html client |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @see client/html/account/history/order/decorators/global |
| 292 | 292 | */ |
| 293 | 293 | |
| 294 | - return $this->createSubClient( 'account/history/order/' . $type, $name ); |
|
| 294 | + return $this->createSubClient('account/history/order/'.$type, $name); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | protected function getSubClientNames() |
| 304 | 304 | { |
| 305 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 305 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -314,35 +314,35 @@ discard block |
||
| 314 | 314 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 315 | 315 | * @return \Aimeos\MW\View\Iface Modified view object |
| 316 | 316 | */ |
| 317 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 317 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 318 | 318 | { |
| 319 | - if( !isset( $this->cache ) ) |
|
| 319 | + if (!isset($this->cache)) |
|
| 320 | 320 | { |
| 321 | 321 | $context = $this->getContext(); |
| 322 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 322 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 323 | 323 | |
| 324 | - $orderId = $view->param( 'his_id', null ); |
|
| 324 | + $orderId = $view->param('his_id', null); |
|
| 325 | 325 | |
| 326 | - if( $orderId !== null ) |
|
| 326 | + if ($orderId !== null) |
|
| 327 | 327 | { |
| 328 | - $search = $manager->createSearch( true ); |
|
| 328 | + $search = $manager->createSearch(true); |
|
| 329 | 329 | $expr = array( |
| 330 | 330 | $search->getConditions(), |
| 331 | - $search->compare( '==', 'order.id', $orderId ), |
|
| 332 | - $search->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
| 331 | + $search->compare('==', 'order.id', $orderId), |
|
| 332 | + $search->compare('==', 'order.base.customerid', $context->getUserId()), |
|
| 333 | 333 | ); |
| 334 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 334 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 335 | 335 | |
| 336 | - $orderItems = $manager->searchItems( $search ); |
|
| 336 | + $orderItems = $manager->searchItems($search); |
|
| 337 | 337 | |
| 338 | - if( ( $orderItem = reset( $orderItems ) ) === false ) |
|
| 338 | + if (($orderItem = reset($orderItems)) === false) |
|
| 339 | 339 | { |
| 340 | - $msg = $view->translate( 'client', 'Order with ID "%1$s" not found' ); |
|
| 341 | - throw new \Aimeos\Client\Html\Exception( sprintf( $msg, $orderId ) ); |
|
| 340 | + $msg = $view->translate('client', 'Order with ID "%1$s" not found'); |
|
| 341 | + throw new \Aimeos\Client\Html\Exception(sprintf($msg, $orderId)); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - $baseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 345 | - $view->summaryBasket = $baseManager->load( $orderItem->getBaseId() ); |
|
| 344 | + $baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 345 | + $view->summaryBasket = $baseManager->load($orderItem->getBaseId()); |
|
| 346 | 346 | $view->orderItem = $orderItem; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -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,259 +19,259 @@ |
||
| 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/basket/mini/main/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the basket mini main section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/basket/mini/main/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/basket/mini/main/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the basket mini main section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/basket/mini/main/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->mainBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->mainBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/basket/mini/main/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the basket mini main 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/basket/mini/main/standard/template-header |
|
| 100 | - */ |
|
| 101 | - $tplconf = 'client/html/basket/mini/main/standard/template-body'; |
|
| 102 | - $default = 'basket/mini/main-body-default.php'; |
|
| 81 | + /** client/html/basket/mini/main/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the basket mini main 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/basket/mini/main/standard/template-header |
|
| 100 | + */ |
|
| 101 | + $tplconf = 'client/html/basket/mini/main/standard/template-body'; |
|
| 102 | + $default = 'basket/mini/main-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->mainHeader = $html; |
|
| 120 | + $html = ''; |
|
| 121 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 122 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 123 | + } |
|
| 124 | + $view->mainHeader = $html; |
|
| 125 | 125 | |
| 126 | - /** client/html/basket/mini/main/standard/template-header |
|
| 127 | - * Relative path to the HTML header template of the basket mini main 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/basket/mini/main/standard/template-body |
|
| 146 | - */ |
|
| 147 | - $tplconf = 'client/html/basket/mini/main/standard/template-header'; |
|
| 148 | - $default = 'basket/mini/main-header-default.php'; |
|
| 126 | + /** client/html/basket/mini/main/standard/template-header |
|
| 127 | + * Relative path to the HTML header template of the basket mini main 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/basket/mini/main/standard/template-body |
|
| 146 | + */ |
|
| 147 | + $tplconf = 'client/html/basket/mini/main/standard/template-header'; |
|
| 148 | + $default = 'basket/mini/main-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/basket/mini/main/decorators/excludes |
|
| 164 | - * Excludes decorators added by the "common" option from the basket mini main 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/basket/mini/main/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/basket/mini/main/decorators/global |
|
| 186 | - * @see client/html/basket/mini/main/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/basket/mini/main/decorators/excludes |
|
| 164 | + * Excludes decorators added by the "common" option from the basket mini main 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/basket/mini/main/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/basket/mini/main/decorators/global |
|
| 186 | + * @see client/html/basket/mini/main/decorators/local |
|
| 187 | + */ |
|
| 188 | 188 | |
| 189 | - /** client/html/basket/mini/main/decorators/global |
|
| 190 | - * Adds a list of globally available decorators only to the basket mini main 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/basket/mini/main/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/basket/mini/main/decorators/excludes |
|
| 210 | - * @see client/html/basket/mini/main/decorators/local |
|
| 211 | - */ |
|
| 189 | + /** client/html/basket/mini/main/decorators/global |
|
| 190 | + * Adds a list of globally available decorators only to the basket mini main 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/basket/mini/main/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/basket/mini/main/decorators/excludes |
|
| 210 | + * @see client/html/basket/mini/main/decorators/local |
|
| 211 | + */ |
|
| 212 | 212 | |
| 213 | - /** client/html/basket/mini/main/decorators/local |
|
| 214 | - * Adds a list of local decorators only to the basket mini main 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\Basket\Decorator\*") around the html client. |
|
| 223 | - * |
|
| 224 | - * client/html/basket/mini/main/decorators/local = array( 'decorator2' ) |
|
| 225 | - * |
|
| 226 | - * This would add the decorator named "decorator2" defined by |
|
| 227 | - * "\Aimeos\Client\Html\Basket\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/basket/mini/main/decorators/excludes |
|
| 234 | - * @see client/html/basket/mini/main/decorators/global |
|
| 235 | - */ |
|
| 236 | - return $this->createSubClient( 'basket/mini/main/' . $type, $name ); |
|
| 237 | - } |
|
| 213 | + /** client/html/basket/mini/main/decorators/local |
|
| 214 | + * Adds a list of local decorators only to the basket mini main 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\Basket\Decorator\*") around the html client. |
|
| 223 | + * |
|
| 224 | + * client/html/basket/mini/main/decorators/local = array( 'decorator2' ) |
|
| 225 | + * |
|
| 226 | + * This would add the decorator named "decorator2" defined by |
|
| 227 | + * "\Aimeos\Client\Html\Basket\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/basket/mini/main/decorators/excludes |
|
| 234 | + * @see client/html/basket/mini/main/decorators/global |
|
| 235 | + */ |
|
| 236 | + return $this->createSubClient( 'basket/mini/main/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 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 | - } |
|
| 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 | |
| 251 | - /** |
|
| 252 | - * Sets the necessary parameter values in the view. |
|
| 253 | - * |
|
| 254 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 255 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 256 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 257 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 258 | - */ |
|
| 259 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | - { |
|
| 261 | - if( !isset( $this->cache ) ) |
|
| 262 | - { |
|
| 263 | - $view->mainPriceItem = $view->miniBasket->getPrice(); |
|
| 251 | + /** |
|
| 252 | + * Sets the necessary parameter values in the view. |
|
| 253 | + * |
|
| 254 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 255 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 256 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 257 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 258 | + */ |
|
| 259 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + { |
|
| 261 | + if( !isset( $this->cache ) ) |
|
| 262 | + { |
|
| 263 | + $view->mainPriceItem = $view->miniBasket->getPrice(); |
|
| 264 | 264 | |
| 265 | - $count = 0; |
|
| 266 | - foreach( $view->miniBasket->getProducts() as $product ) { |
|
| 267 | - $count += $product->getQuantity(); |
|
| 268 | - } |
|
| 265 | + $count = 0; |
|
| 266 | + foreach( $view->miniBasket->getProducts() as $product ) { |
|
| 267 | + $count += $product->getQuantity(); |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - $view->mainQuantity = $count; |
|
| 270 | + $view->mainQuantity = $count; |
|
| 271 | 271 | |
| 272 | - $this->cache = $view; |
|
| 273 | - } |
|
| 272 | + $this->cache = $view; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - return $this->cache; |
|
| 276 | - } |
|
| 275 | + return $this->cache; |
|
| 276 | + } |
|
| 277 | 277 | } |
| 278 | 278 | \ No newline at end of file |
@@ -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->mainBody = $html; |
| 80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $tplconf = 'client/html/basket/mini/main/standard/template-body'; |
| 102 | 102 | $default = 'basket/mini/main-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->mainHeader = $html; |
| 125 | 125 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $tplconf = 'client/html/basket/mini/main/standard/template-header'; |
| 148 | 148 | $default = 'basket/mini/main-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/basket/mini/main/decorators/excludes |
| 164 | 164 | * Excludes decorators added by the "common" option from the basket mini main html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/basket/mini/main/decorators/excludes |
| 234 | 234 | * @see client/html/basket/mini/main/decorators/global |
| 235 | 235 | */ |
| 236 | - return $this->createSubClient( 'basket/mini/main/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('basket/mini/main/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,7 +244,7 @@ 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 | |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 257 | 257 | * @return \Aimeos\MW\View\Iface Modified view object |
| 258 | 258 | */ |
| 259 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 259 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 260 | 260 | { |
| 261 | - if( !isset( $this->cache ) ) |
|
| 261 | + if (!isset($this->cache)) |
|
| 262 | 262 | { |
| 263 | 263 | $view->mainPriceItem = $view->miniBasket->getPrice(); |
| 264 | 264 | |
| 265 | 265 | $count = 0; |
| 266 | - foreach( $view->miniBasket->getProducts() as $product ) { |
|
| 266 | + foreach ($view->miniBasket->getProducts() as $product) { |
|
| 267 | 267 | $count += $product->getQuantity(); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -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\Base |
|
| 22 | + extends \Aimeos\Client\Html\Base |
|
| 23 | 23 | { |
| 24 | - /** client/html/basket/mini/product/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the basket mini product section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2015.09 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/basket/mini/product/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - private $cache; |
|
| 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->productBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/basket/mini/product/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the basket mini product 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 2015.09 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/basket/mini/product/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/basket/mini/product/standard/template-body'; |
|
| 101 | - $default = 'basket/mini/product-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->productHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/basket/mini/product/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the basket mini product 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 2015.09 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/basket/mini/product/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/basket/mini/product/standard/template-header'; |
|
| 147 | - $default = 'basket/mini/product-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient($type, $name = null) |
|
| 161 | - { |
|
| 162 | - /** client/html/basket/mini/product/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the basket mini product html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/basket/mini/product/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/basket/mini/product/decorators/global |
|
| 185 | - * @see client/html/basket/mini/product/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/basket/mini/product/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the basket mini product html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/basket/mini/product/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/basket/mini/product/decorators/excludes |
|
| 209 | - * @see client/html/basket/mini/product/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/basket/mini/product/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the basket mini product html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/basket/mini/product/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/basket/mini/product/decorators/excludes |
|
| 233 | - * @see client/html/basket/mini/product/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'basket/mini/product/' . $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 | - } |
|
| 24 | + /** client/html/basket/mini/product/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the basket mini product section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2015.09 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/basket/mini/product/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + private $cache; |
|
| 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->productBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/basket/mini/product/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the basket mini product 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 2015.09 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/basket/mini/product/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/basket/mini/product/standard/template-body'; |
|
| 101 | + $default = 'basket/mini/product-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->productHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/basket/mini/product/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the basket mini product 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 2015.09 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/basket/mini/product/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/basket/mini/product/standard/template-header'; |
|
| 147 | + $default = 'basket/mini/product-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | + { |
|
| 162 | + /** client/html/basket/mini/product/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the basket mini product html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/basket/mini/product/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/basket/mini/product/decorators/global |
|
| 185 | + * @see client/html/basket/mini/product/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/basket/mini/product/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the basket mini product html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/basket/mini/product/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/basket/mini/product/decorators/excludes |
|
| 209 | + * @see client/html/basket/mini/product/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/basket/mini/product/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the basket mini product html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/basket/mini/product/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/basket/mini/product/decorators/excludes |
|
| 233 | + * @see client/html/basket/mini/product/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'basket/mini/product/' . $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 |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 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->productBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/basket/mini/product/standard/template-body'; |
| 101 | 101 | $default = 'basket/mini/product-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 | |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 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->productHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/basket/mini/product/standard/template-header'; |
| 147 | 147 | $default = 'basket/mini/product-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 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/basket/mini/product/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'basket/mini/product/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('basket/mini/product/'.$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 | { |
@@ -18,380 +18,380 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Basket\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Basket\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** client/html/basket/related/bought/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the basket related 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.03 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/basket/related/bought/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - private $cache; |
|
| 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->boughtBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/basket/related/bought/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the basket related bought client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/basket/related/bought/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/basket/related/bought/standard/template-body'; |
|
| 101 | - $default = 'basket/related/bought-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->boughtHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/basket/related/bought/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the basket related bought client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/basket/related/bought/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/basket/related/bought/standard/template-header'; |
|
| 147 | - $default = 'basket/related/bought-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/basket/related/bought/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the basket related bought html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/basket/related/bought/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 2014.05 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/basket/related/bought/decorators/global |
|
| 185 | - * @see client/html/basket/related/bought/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/basket/related/bought/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the basket related bought html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/basket/related/bought/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 2014.05 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/basket/related/bought/decorators/excludes |
|
| 209 | - * @see client/html/basket/related/bought/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/basket/related/bought/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the basket related bought html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/basket/related/bought/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2014.05 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/basket/related/bought/decorators/excludes |
|
| 233 | - * @see client/html/basket/related/bought/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'basket/related/bought/' . $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 | - |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * Sets the necessary parameter values in the view. |
|
| 253 | - * |
|
| 254 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 255 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 256 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 257 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 258 | - */ |
|
| 259 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | - { |
|
| 261 | - if( !isset( $this->cache ) ) |
|
| 262 | - { |
|
| 263 | - if( isset( $view->relatedBasket ) ) |
|
| 264 | - { |
|
| 265 | - $refIds = $items = array(); |
|
| 266 | - $context = $this->getContext(); |
|
| 267 | - |
|
| 268 | - $prodIds = $this->getProductIdsFromBasket( $view->relatedBasket ); |
|
| 269 | - |
|
| 270 | - foreach( $this->getListItems( $prodIds ) as $listItem ) |
|
| 271 | - { |
|
| 272 | - $refId = $listItem->getRefId(); |
|
| 273 | - |
|
| 274 | - if( !isset( $prodIds[$refId] ) ) { |
|
| 275 | - $refIds[$refId] = $refId; |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - $products = $this->getProductItems( $refIds ); |
|
| 280 | - |
|
| 281 | - foreach( $refIds as $id ) |
|
| 282 | - { |
|
| 283 | - if( isset( $products[$id] ) ) { |
|
| 284 | - $items[$id] = $products[$id]; |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** client/html/basket/related/bought/standard/limit |
|
| 289 | - * Number of items in the list of bought together products |
|
| 290 | - * |
|
| 291 | - * This option limits the number of suggested products in the |
|
| 292 | - * list of bought together products. The suggested items are |
|
| 293 | - * calculated using the products that are in the current basket |
|
| 294 | - * of the customer. |
|
| 295 | - * |
|
| 296 | - * Note: You need to start the job controller for calculating |
|
| 297 | - * the bought together products regularly to get up to date |
|
| 298 | - * product suggestions. |
|
| 299 | - * |
|
| 300 | - * @param integer Number of products |
|
| 301 | - * @since 2014.09 |
|
| 302 | - */ |
|
| 303 | - $size = $context->getConfig()->get( 'client/html/basket/related/bought/standard/limit', 6 ); |
|
| 304 | - |
|
| 305 | - |
|
| 306 | - $view->boughtItems = array_slice( $items, 0, $size, true ); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - $this->cache = $view; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - return $this->cache; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * Returns the list items of type "bought-together" associated to the given product IDs. |
|
| 318 | - * |
|
| 319 | - * @param string[] $prodIds List of product IDs |
|
| 320 | - * @return \Aimeos\MShop\Product\Item\Lists\Iface[] List of product list items |
|
| 321 | - */ |
|
| 322 | - protected function getListItems( array $prodIds ) |
|
| 323 | - { |
|
| 324 | - $typeItem = $this->getTypeItem( 'product/lists/type', 'product', 'bought-together' ); |
|
| 325 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
| 326 | - |
|
| 327 | - $search = $manager->createSearch( true ); |
|
| 328 | - $expr = array( |
|
| 329 | - $search->compare( '==', 'product.lists.parentid', $prodIds ), |
|
| 330 | - $search->compare( '==', 'product.lists.typeid', $typeItem->getId() ), |
|
| 331 | - $search->compare( '==', 'product.lists.domain', 'product' ), |
|
| 332 | - $search->getConditions(), |
|
| 333 | - ); |
|
| 334 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 335 | - $search->setSortations( array( $search->sort( '+', 'product.lists.position' ) ) ); |
|
| 336 | - |
|
| 337 | - return $manager->searchItems( $search ); |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * Returns the IDs of the products in the current basket. |
|
| 343 | - * |
|
| 344 | - * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
|
| 345 | - * @return string[] List of product IDs |
|
| 346 | - */ |
|
| 347 | - protected function getProductIdsFromBasket( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 348 | - { |
|
| 349 | - $list = array(); |
|
| 350 | - |
|
| 351 | - foreach( $basket->getProducts() as $orderProduct ) |
|
| 352 | - { |
|
| 353 | - $list[ $orderProduct->getProductId() ] = true; |
|
| 354 | - |
|
| 355 | - foreach( $orderProduct->getProducts() as $subProduct ) { |
|
| 356 | - $list[ $subProduct->getProductId() ] = true; |
|
| 357 | - } |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - return array_keys( $list ); |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - |
|
| 364 | - /** |
|
| 365 | - * Returns the product items for the given IDs. |
|
| 366 | - * |
|
| 367 | - * @param string[] $ids List of product IDs |
|
| 368 | - * @return \Aimeos\MShop\Product\Item\Iface[] List of product items |
|
| 369 | - */ |
|
| 370 | - protected function getProductItems( array $ids ) |
|
| 371 | - { |
|
| 372 | - $context = $this->getContext(); |
|
| 373 | - $config = $context->getConfig(); |
|
| 374 | - |
|
| 375 | - /** client/html/basket/related/bought/standard/domains |
|
| 376 | - * The list of domain names whose items should be available in the template for the products |
|
| 377 | - * |
|
| 378 | - * The templates rendering product details usually add the images, |
|
| 379 | - * prices and texts, etc. associated to the product |
|
| 380 | - * item. If you want to display additional or less content, you can |
|
| 381 | - * configure your own list of domains (attribute, media, price, product, |
|
| 382 | - * text, etc. are domains) whose items are fetched from the storage. |
|
| 383 | - * Please keep in mind that the more domains you add to the configuration, |
|
| 384 | - * the more time is required for fetching the content! |
|
| 385 | - * |
|
| 386 | - * @param array List of domain names |
|
| 387 | - * @since 2014.09 |
|
| 388 | - * @category Developer |
|
| 389 | - */ |
|
| 390 | - $domains = array( 'text', 'price', 'media' ); |
|
| 391 | - $domains = $config->get( 'client/html/basket/related/bought/standard/domains', $domains ); |
|
| 392 | - |
|
| 393 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 394 | - |
|
| 395 | - return $controller->getProductItems( $ids, $domains ); |
|
| 396 | - } |
|
| 24 | + /** client/html/basket/related/bought/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the basket related 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.03 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/basket/related/bought/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + private $cache; |
|
| 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->boughtBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/basket/related/bought/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the basket related bought client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/basket/related/bought/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/basket/related/bought/standard/template-body'; |
|
| 101 | + $default = 'basket/related/bought-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->boughtHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/basket/related/bought/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the basket related bought client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/basket/related/bought/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/basket/related/bought/standard/template-header'; |
|
| 147 | + $default = 'basket/related/bought-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/basket/related/bought/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the basket related bought html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/basket/related/bought/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 2014.05 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/basket/related/bought/decorators/global |
|
| 185 | + * @see client/html/basket/related/bought/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/basket/related/bought/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the basket related bought html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/basket/related/bought/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 2014.05 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/basket/related/bought/decorators/excludes |
|
| 209 | + * @see client/html/basket/related/bought/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/basket/related/bought/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the basket related bought html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/basket/related/bought/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2014.05 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/basket/related/bought/decorators/excludes |
|
| 233 | + * @see client/html/basket/related/bought/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'basket/related/bought/' . $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 | + |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * Sets the necessary parameter values in the view. |
|
| 253 | + * |
|
| 254 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 255 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 256 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 257 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 258 | + */ |
|
| 259 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 260 | + { |
|
| 261 | + if( !isset( $this->cache ) ) |
|
| 262 | + { |
|
| 263 | + if( isset( $view->relatedBasket ) ) |
|
| 264 | + { |
|
| 265 | + $refIds = $items = array(); |
|
| 266 | + $context = $this->getContext(); |
|
| 267 | + |
|
| 268 | + $prodIds = $this->getProductIdsFromBasket( $view->relatedBasket ); |
|
| 269 | + |
|
| 270 | + foreach( $this->getListItems( $prodIds ) as $listItem ) |
|
| 271 | + { |
|
| 272 | + $refId = $listItem->getRefId(); |
|
| 273 | + |
|
| 274 | + if( !isset( $prodIds[$refId] ) ) { |
|
| 275 | + $refIds[$refId] = $refId; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + $products = $this->getProductItems( $refIds ); |
|
| 280 | + |
|
| 281 | + foreach( $refIds as $id ) |
|
| 282 | + { |
|
| 283 | + if( isset( $products[$id] ) ) { |
|
| 284 | + $items[$id] = $products[$id]; |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** client/html/basket/related/bought/standard/limit |
|
| 289 | + * Number of items in the list of bought together products |
|
| 290 | + * |
|
| 291 | + * This option limits the number of suggested products in the |
|
| 292 | + * list of bought together products. The suggested items are |
|
| 293 | + * calculated using the products that are in the current basket |
|
| 294 | + * of the customer. |
|
| 295 | + * |
|
| 296 | + * Note: You need to start the job controller for calculating |
|
| 297 | + * the bought together products regularly to get up to date |
|
| 298 | + * product suggestions. |
|
| 299 | + * |
|
| 300 | + * @param integer Number of products |
|
| 301 | + * @since 2014.09 |
|
| 302 | + */ |
|
| 303 | + $size = $context->getConfig()->get( 'client/html/basket/related/bought/standard/limit', 6 ); |
|
| 304 | + |
|
| 305 | + |
|
| 306 | + $view->boughtItems = array_slice( $items, 0, $size, true ); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + $this->cache = $view; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + return $this->cache; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * Returns the list items of type "bought-together" associated to the given product IDs. |
|
| 318 | + * |
|
| 319 | + * @param string[] $prodIds List of product IDs |
|
| 320 | + * @return \Aimeos\MShop\Product\Item\Lists\Iface[] List of product list items |
|
| 321 | + */ |
|
| 322 | + protected function getListItems( array $prodIds ) |
|
| 323 | + { |
|
| 324 | + $typeItem = $this->getTypeItem( 'product/lists/type', 'product', 'bought-together' ); |
|
| 325 | + $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
| 326 | + |
|
| 327 | + $search = $manager->createSearch( true ); |
|
| 328 | + $expr = array( |
|
| 329 | + $search->compare( '==', 'product.lists.parentid', $prodIds ), |
|
| 330 | + $search->compare( '==', 'product.lists.typeid', $typeItem->getId() ), |
|
| 331 | + $search->compare( '==', 'product.lists.domain', 'product' ), |
|
| 332 | + $search->getConditions(), |
|
| 333 | + ); |
|
| 334 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 335 | + $search->setSortations( array( $search->sort( '+', 'product.lists.position' ) ) ); |
|
| 336 | + |
|
| 337 | + return $manager->searchItems( $search ); |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * Returns the IDs of the products in the current basket. |
|
| 343 | + * |
|
| 344 | + * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
|
| 345 | + * @return string[] List of product IDs |
|
| 346 | + */ |
|
| 347 | + protected function getProductIdsFromBasket( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 348 | + { |
|
| 349 | + $list = array(); |
|
| 350 | + |
|
| 351 | + foreach( $basket->getProducts() as $orderProduct ) |
|
| 352 | + { |
|
| 353 | + $list[ $orderProduct->getProductId() ] = true; |
|
| 354 | + |
|
| 355 | + foreach( $orderProduct->getProducts() as $subProduct ) { |
|
| 356 | + $list[ $subProduct->getProductId() ] = true; |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + return array_keys( $list ); |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + |
|
| 364 | + /** |
|
| 365 | + * Returns the product items for the given IDs. |
|
| 366 | + * |
|
| 367 | + * @param string[] $ids List of product IDs |
|
| 368 | + * @return \Aimeos\MShop\Product\Item\Iface[] List of product items |
|
| 369 | + */ |
|
| 370 | + protected function getProductItems( array $ids ) |
|
| 371 | + { |
|
| 372 | + $context = $this->getContext(); |
|
| 373 | + $config = $context->getConfig(); |
|
| 374 | + |
|
| 375 | + /** client/html/basket/related/bought/standard/domains |
|
| 376 | + * The list of domain names whose items should be available in the template for the products |
|
| 377 | + * |
|
| 378 | + * The templates rendering product details usually add the images, |
|
| 379 | + * prices and texts, etc. associated to the product |
|
| 380 | + * item. If you want to display additional or less content, you can |
|
| 381 | + * configure your own list of domains (attribute, media, price, product, |
|
| 382 | + * text, etc. are domains) whose items are fetched from the storage. |
|
| 383 | + * Please keep in mind that the more domains you add to the configuration, |
|
| 384 | + * the more time is required for fetching the content! |
|
| 385 | + * |
|
| 386 | + * @param array List of domain names |
|
| 387 | + * @since 2014.09 |
|
| 388 | + * @category Developer |
|
| 389 | + */ |
|
| 390 | + $domains = array( 'text', 'price', 'media' ); |
|
| 391 | + $domains = $config->get( 'client/html/basket/related/bought/standard/domains', $domains ); |
|
| 392 | + |
|
| 393 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 394 | + |
|
| 395 | + return $controller->getProductItems( $ids, $domains ); |
|
| 396 | + } |
|
| 397 | 397 | } |
| 398 | 398 | \ 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->boughtBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/basket/related/bought/standard/template-body'; |
| 101 | 101 | $default = 'basket/related/bought-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->boughtHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/basket/related/bought/standard/template-header'; |
| 147 | 147 | $default = 'basket/related/bought-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/basket/related/bought/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the basket related bought html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/basket/related/bought/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'basket/related/bought/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('basket/related/bought/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,7 +244,7 @@ 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 | |
@@ -256,31 +256,31 @@ discard block |
||
| 256 | 256 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 257 | 257 | * @return \Aimeos\MW\View\Iface Modified view object |
| 258 | 258 | */ |
| 259 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 259 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 260 | 260 | { |
| 261 | - if( !isset( $this->cache ) ) |
|
| 261 | + if (!isset($this->cache)) |
|
| 262 | 262 | { |
| 263 | - if( isset( $view->relatedBasket ) ) |
|
| 263 | + if (isset($view->relatedBasket)) |
|
| 264 | 264 | { |
| 265 | 265 | $refIds = $items = array(); |
| 266 | 266 | $context = $this->getContext(); |
| 267 | 267 | |
| 268 | - $prodIds = $this->getProductIdsFromBasket( $view->relatedBasket ); |
|
| 268 | + $prodIds = $this->getProductIdsFromBasket($view->relatedBasket); |
|
| 269 | 269 | |
| 270 | - foreach( $this->getListItems( $prodIds ) as $listItem ) |
|
| 270 | + foreach ($this->getListItems($prodIds) as $listItem) |
|
| 271 | 271 | { |
| 272 | 272 | $refId = $listItem->getRefId(); |
| 273 | 273 | |
| 274 | - if( !isset( $prodIds[$refId] ) ) { |
|
| 274 | + if (!isset($prodIds[$refId])) { |
|
| 275 | 275 | $refIds[$refId] = $refId; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $products = $this->getProductItems( $refIds ); |
|
| 279 | + $products = $this->getProductItems($refIds); |
|
| 280 | 280 | |
| 281 | - foreach( $refIds as $id ) |
|
| 281 | + foreach ($refIds as $id) |
|
| 282 | 282 | { |
| 283 | - if( isset( $products[$id] ) ) { |
|
| 283 | + if (isset($products[$id])) { |
|
| 284 | 284 | $items[$id] = $products[$id]; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -300,10 +300,10 @@ discard block |
||
| 300 | 300 | * @param integer Number of products |
| 301 | 301 | * @since 2014.09 |
| 302 | 302 | */ |
| 303 | - $size = $context->getConfig()->get( 'client/html/basket/related/bought/standard/limit', 6 ); |
|
| 303 | + $size = $context->getConfig()->get('client/html/basket/related/bought/standard/limit', 6); |
|
| 304 | 304 | |
| 305 | 305 | |
| 306 | - $view->boughtItems = array_slice( $items, 0, $size, true ); |
|
| 306 | + $view->boughtItems = array_slice($items, 0, $size, true); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | $this->cache = $view; |
@@ -319,22 +319,22 @@ discard block |
||
| 319 | 319 | * @param string[] $prodIds List of product IDs |
| 320 | 320 | * @return \Aimeos\MShop\Product\Item\Lists\Iface[] List of product list items |
| 321 | 321 | */ |
| 322 | - protected function getListItems( array $prodIds ) |
|
| 322 | + protected function getListItems(array $prodIds) |
|
| 323 | 323 | { |
| 324 | - $typeItem = $this->getTypeItem( 'product/lists/type', 'product', 'bought-together' ); |
|
| 325 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
| 324 | + $typeItem = $this->getTypeItem('product/lists/type', 'product', 'bought-together'); |
|
| 325 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
| 326 | 326 | |
| 327 | - $search = $manager->createSearch( true ); |
|
| 327 | + $search = $manager->createSearch(true); |
|
| 328 | 328 | $expr = array( |
| 329 | - $search->compare( '==', 'product.lists.parentid', $prodIds ), |
|
| 330 | - $search->compare( '==', 'product.lists.typeid', $typeItem->getId() ), |
|
| 331 | - $search->compare( '==', 'product.lists.domain', 'product' ), |
|
| 329 | + $search->compare('==', 'product.lists.parentid', $prodIds), |
|
| 330 | + $search->compare('==', 'product.lists.typeid', $typeItem->getId()), |
|
| 331 | + $search->compare('==', 'product.lists.domain', 'product'), |
|
| 332 | 332 | $search->getConditions(), |
| 333 | 333 | ); |
| 334 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 335 | - $search->setSortations( array( $search->sort( '+', 'product.lists.position' ) ) ); |
|
| 334 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 335 | + $search->setSortations(array($search->sort('+', 'product.lists.position'))); |
|
| 336 | 336 | |
| 337 | - return $manager->searchItems( $search ); |
|
| 337 | + return $manager->searchItems($search); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
@@ -344,20 +344,20 @@ discard block |
||
| 344 | 344 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
| 345 | 345 | * @return string[] List of product IDs |
| 346 | 346 | */ |
| 347 | - protected function getProductIdsFromBasket( \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 347 | + protected function getProductIdsFromBasket(\Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 348 | 348 | { |
| 349 | 349 | $list = array(); |
| 350 | 350 | |
| 351 | - foreach( $basket->getProducts() as $orderProduct ) |
|
| 351 | + foreach ($basket->getProducts() as $orderProduct) |
|
| 352 | 352 | { |
| 353 | - $list[ $orderProduct->getProductId() ] = true; |
|
| 353 | + $list[$orderProduct->getProductId()] = true; |
|
| 354 | 354 | |
| 355 | - foreach( $orderProduct->getProducts() as $subProduct ) { |
|
| 356 | - $list[ $subProduct->getProductId() ] = true; |
|
| 355 | + foreach ($orderProduct->getProducts() as $subProduct) { |
|
| 356 | + $list[$subProduct->getProductId()] = true; |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - return array_keys( $list ); |
|
| 360 | + return array_keys($list); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @param string[] $ids List of product IDs |
| 368 | 368 | * @return \Aimeos\MShop\Product\Item\Iface[] List of product items |
| 369 | 369 | */ |
| 370 | - protected function getProductItems( array $ids ) |
|
| 370 | + protected function getProductItems(array $ids) |
|
| 371 | 371 | { |
| 372 | 372 | $context = $this->getContext(); |
| 373 | 373 | $config = $context->getConfig(); |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | * @since 2014.09 |
| 388 | 388 | * @category Developer |
| 389 | 389 | */ |
| 390 | - $domains = array( 'text', 'price', 'media' ); |
|
| 391 | - $domains = $config->get( 'client/html/basket/related/bought/standard/domains', $domains ); |
|
| 390 | + $domains = array('text', 'price', 'media'); |
|
| 391 | + $domains = $config->get('client/html/basket/related/bought/standard/domains', $domains); |
|
| 392 | 392 | |
| 393 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' ); |
|
| 393 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); |
|
| 394 | 394 | |
| 395 | - return $controller->getProductItems( $ids, $domains ); |
|
| 395 | + return $controller->getProductItems($ids, $domains); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | \ No newline at end of file |