Completed
Push — master ( b384ce...7658b0 )
by Aimeos
05:56
created
client/html/src/Client/Html/Catalog/Lists/Promo/Standard.php 1 patch
Indentation   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -19,315 +19,315 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/lists/promo/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog list promo section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/lists/promo/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $tags = array();
61
-	private $expire;
62
-	private $cache;
63
-
64
-
65
-	/**
66
-	 * Returns the HTML code for insertion into the body.
67
-	 *
68
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
-	 * @param array &$tags Result array for the list of tags that are associated to the output
70
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
-	 * @return string HTML code
72
-	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
-	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
76
-
77
-		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
-		}
81
-		$view->promoBody = $html;
82
-
83
-		/** client/html/catalog/lists/promo/standard/template-body
84
-		 * Relative path to the HTML body template of the catalog list promotion client.
85
-		 *
86
-		 * The template file contains the HTML code and processing instructions
87
-		 * to generate the result shown in the body of the frontend. The
88
-		 * configuration string is the path to the template file relative
89
-		 * to the templates directory (usually in client/html/templates).
90
-		 *
91
-		 * You can overwrite the template file configuration in extensions and
92
-		 * provide alternative templates. These alternative templates should be
93
-		 * named like the default one but with the string "standard" replaced by
94
-		 * an unique name. You may use the name of your project for this. If
95
-		 * you've implemented an alternative client class as well, "standard"
96
-		 * should be replaced by the name of the new class.
97
-		 *
98
-		 * @param string Relative path to the template creating code for the HTML page body
99
-		 * @since 2014.03
100
-		 * @category Developer
101
-		 * @see client/html/catalog/lists/promo/standard/template-header
102
-		 */
103
-		$tplconf = 'client/html/catalog/lists/promo/standard/template-body';
104
-		$default = 'catalog/lists/promo-body-default.php';
105
-
106
-		return $view->render( $view->config( $tplconf, $default ) );
107
-	}
108
-
109
-
110
-	/**
111
-	 * Returns the HTML string for insertion into the header.
112
-	 *
113
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
-	 * @param array &$tags Result array for the list of tags that are associated to the output
115
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
117
-	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
-	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
121
-
122
-		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
-		}
126
-		$view->promoHeader = $html;
127
-
128
-		/** client/html/catalog/lists/promo/standard/template-header
129
-		 * Relative path to the HTML header template of the catalog list promotion client.
130
-		 *
131
-		 * The template file contains the HTML code and processing instructions
132
-		 * to generate the HTML code that is inserted into the HTML page header
133
-		 * of the rendered page in the frontend. The configuration string is the
134
-		 * path to the template file relative to the templates directory (usually
135
-		 * in client/html/templates).
136
-		 *
137
-		 * You can overwrite the template file configuration in extensions and
138
-		 * provide alternative templates. These alternative templates should be
139
-		 * named like the default one but with the string "standard" replaced by
140
-		 * an unique name. You may use the name of your project for this. If
141
-		 * you've implemented an alternative client class as well, "standard"
142
-		 * should be replaced by the name of the new class.
143
-		 *
144
-		 * @param string Relative path to the template creating code for the HTML page head
145
-		 * @since 2014.03
146
-		 * @category Developer
147
-		 * @see client/html/catalog/lists/promo/standard/template-body
148
-		 */
149
-		$tplconf = 'client/html/catalog/lists/promo/standard/template-header';
150
-		$default = 'catalog/lists/promo-header-default.php';
151
-
152
-		return $view->render( $view->config( $tplconf, $default ) );
153
-	}
154
-
155
-
156
-	/**
157
-	 * Returns the sub-client given by its name.
158
-	 *
159
-	 * @param string $type Name of the client type
160
-	 * @param string|null $name Name of the sub-client (Default if null)
161
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
162
-	 */
163
-	public function getSubClient( $type, $name = null )
164
-	{
165
-		/** client/html/catalog/lists/promo/decorators/excludes
166
-		 * Excludes decorators added by the "common" option from the catalog list promo html client
167
-		 *
168
-		 * Decorators extend the functionality of a class by adding new aspects
169
-		 * (e.g. log what is currently done), executing the methods of the underlying
170
-		 * class only in certain conditions (e.g. only for logged in users) or
171
-		 * modify what is returned to the caller.
172
-		 *
173
-		 * This option allows you to remove a decorator added via
174
-		 * "client/html/common/decorators/default" before they are wrapped
175
-		 * around the html client.
176
-		 *
177
-		 *  client/html/catalog/lists/promo/decorators/excludes = array( 'decorator1' )
178
-		 *
179
-		 * This would remove the decorator named "decorator1" from the list of
180
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
-		 * "client/html/common/decorators/default" to the html client.
182
-		 *
183
-		 * @param array List of decorator names
184
-		 * @since 2015.08
185
-		 * @category Developer
186
-		 * @see client/html/common/decorators/default
187
-		 * @see client/html/catalog/lists/promo/decorators/global
188
-		 * @see client/html/catalog/lists/promo/decorators/local
189
-		 */
190
-
191
-		/** client/html/catalog/lists/promo/decorators/global
192
-		 * Adds a list of globally available decorators only to the catalog list promo html client
193
-		 *
194
-		 * Decorators extend the functionality of a class by adding new aspects
195
-		 * (e.g. log what is currently done), executing the methods of the underlying
196
-		 * class only in certain conditions (e.g. only for logged in users) or
197
-		 * modify what is returned to the caller.
198
-		 *
199
-		 * This option allows you to wrap global decorators
200
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
-		 *
202
-		 *  client/html/catalog/lists/promo/decorators/global = array( 'decorator1' )
203
-		 *
204
-		 * This would add the decorator named "decorator1" defined by
205
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
-		 *
207
-		 * @param array List of decorator names
208
-		 * @since 2015.08
209
-		 * @category Developer
210
-		 * @see client/html/common/decorators/default
211
-		 * @see client/html/catalog/lists/promo/decorators/excludes
212
-		 * @see client/html/catalog/lists/promo/decorators/local
213
-		 */
214
-
215
-		/** client/html/catalog/lists/promo/decorators/local
216
-		 * Adds a list of local decorators only to the catalog list promo html client
217
-		 *
218
-		 * Decorators extend the functionality of a class by adding new aspects
219
-		 * (e.g. log what is currently done), executing the methods of the underlying
220
-		 * class only in certain conditions (e.g. only for logged in users) or
221
-		 * modify what is returned to the caller.
222
-		 *
223
-		 * This option allows you to wrap local decorators
224
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
-		 *
226
-		 *  client/html/catalog/lists/promo/decorators/local = array( 'decorator2' )
227
-		 *
228
-		 * This would add the decorator named "decorator2" defined by
229
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
-		 *
231
-		 * @param array List of decorator names
232
-		 * @since 2015.08
233
-		 * @category Developer
234
-		 * @see client/html/common/decorators/default
235
-		 * @see client/html/catalog/lists/promo/decorators/excludes
236
-		 * @see client/html/catalog/lists/promo/decorators/global
237
-		 */
238
-
239
-		return $this->createSubClient( 'catalog/lists/promo/' . $type, $name );
240
-	}
241
-
242
-
243
-	/**
244
-	 * Returns the list of sub-client names configured for the client.
245
-	 *
246
-	 * @return array List of HTML client names
247
-	 */
248
-	protected function getSubClientNames()
249
-	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
-	}
252
-
253
-
254
-	/**
255
-	 * Sets the necessary parameter values in the view.
256
-	 *
257
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
-	 * @param array &$tags Result array for the list of tags that are associated to the output
259
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
-	 * @return \Aimeos\MW\View\Iface Modified view object
261
-	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
-	{
264
-		if( !isset( $this->cache ) )
265
-		{
266
-			$products = array();
267
-			$context = $this->getContext();
268
-			$config = $context->getConfig();
269
-
270
-			if( isset( $view->listCurrentCatItem ) ) {
271
-				$catId = $view->listCurrentCatItem->getId();
272
-			} else {
273
-				$catId = $config->get( 'client/html/catalog/lists/catid-default', '' );
274
-			}
275
-
276
-			if( $catId != '' )
277
-			{
278
-				/** client/html/catalog/lists/promo/size
279
-				 * The maximum number of products that should be shown in the promotion section
280
-				 *
281
-				 * Each product list can render a list of promoted products on
282
-				 * top if there are any products associated to that category whose
283
-				 * list type is "promotion". This option limits the maximum number
284
-				 * of products that are displayed. It takes only effect if more
285
-				 * promotional products are added to this category than the set
286
-				 * value.
287
-				 *
288
-				 * @param integer Number of promotion products
289
-				 * @since 2014.03
290
-				 * @category User
291
-				 * @category Developer
292
-				 */
293
-				$size = $config->get( 'client/html/catalog/lists/promo/size', 6 );
294
-				$domains = $config->get( 'client/html/catalog/lists/domains', array( 'media', 'price', 'text' ) );
295
-
296
-				$total = null;
297
-
298
-				$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
299
-				$filter = $controller->createIndexFilterCategory( $catId, 'relevance', '+', 0, $size, 'promotion' );
300
-				$products = $controller->getIndexItems( $filter, $domains, $total );
301
-			}
302
-
303
-
304
-			if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true )
305
-			{
306
-				$stockTarget = $config->get( 'client/html/catalog/stock/url/target' );
307
-				$stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' );
308
-				$stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' );
309
-				$stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() );
310
-
311
-				$productIds = array_keys( $products );
312
-				sort( $productIds );
313
-
314
-				$params = array( 's_prodid' => implode( ' ', $productIds ) );
315
-				$view->promoStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig );
316
-			}
317
-
318
-
319
-			$this->addMetaItem( $products, 'product', $this->expire, $this->tags );
320
-			$this->addMetaList( array_keys( $products ), 'product', $this->expire );
321
-
322
-
323
-			$view->promoItems = $products;
324
-
325
-			$this->cache = $view;
326
-		}
327
-
328
-		$expire = $this->expires( $this->expire, $expire );
329
-		$tags = array_merge( $tags, $this->tags );
330
-
331
-		return $this->cache;
332
-	}
25
+    /** client/html/catalog/lists/promo/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog list promo section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/lists/promo/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $tags = array();
61
+    private $expire;
62
+    private $cache;
63
+
64
+
65
+    /**
66
+     * Returns the HTML code for insertion into the body.
67
+     *
68
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
+     * @param array &$tags Result array for the list of tags that are associated to the output
70
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
+     * @return string HTML code
72
+     */
73
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
+    {
75
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
76
+
77
+        $html = '';
78
+        foreach( $this->getSubClients() as $subclient ) {
79
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
+        }
81
+        $view->promoBody = $html;
82
+
83
+        /** client/html/catalog/lists/promo/standard/template-body
84
+         * Relative path to the HTML body template of the catalog list promotion client.
85
+         *
86
+         * The template file contains the HTML code and processing instructions
87
+         * to generate the result shown in the body of the frontend. The
88
+         * configuration string is the path to the template file relative
89
+         * to the templates directory (usually in client/html/templates).
90
+         *
91
+         * You can overwrite the template file configuration in extensions and
92
+         * provide alternative templates. These alternative templates should be
93
+         * named like the default one but with the string "standard" replaced by
94
+         * an unique name. You may use the name of your project for this. If
95
+         * you've implemented an alternative client class as well, "standard"
96
+         * should be replaced by the name of the new class.
97
+         *
98
+         * @param string Relative path to the template creating code for the HTML page body
99
+         * @since 2014.03
100
+         * @category Developer
101
+         * @see client/html/catalog/lists/promo/standard/template-header
102
+         */
103
+        $tplconf = 'client/html/catalog/lists/promo/standard/template-body';
104
+        $default = 'catalog/lists/promo-body-default.php';
105
+
106
+        return $view->render( $view->config( $tplconf, $default ) );
107
+    }
108
+
109
+
110
+    /**
111
+     * Returns the HTML string for insertion into the header.
112
+     *
113
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
+     * @param array &$tags Result array for the list of tags that are associated to the output
115
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
+     * @return string|null String including HTML tags for the header on error
117
+     */
118
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
+    {
120
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
121
+
122
+        $html = '';
123
+        foreach( $this->getSubClients() as $subclient ) {
124
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
+        }
126
+        $view->promoHeader = $html;
127
+
128
+        /** client/html/catalog/lists/promo/standard/template-header
129
+         * Relative path to the HTML header template of the catalog list promotion client.
130
+         *
131
+         * The template file contains the HTML code and processing instructions
132
+         * to generate the HTML code that is inserted into the HTML page header
133
+         * of the rendered page in the frontend. The configuration string is the
134
+         * path to the template file relative to the templates directory (usually
135
+         * in client/html/templates).
136
+         *
137
+         * You can overwrite the template file configuration in extensions and
138
+         * provide alternative templates. These alternative templates should be
139
+         * named like the default one but with the string "standard" replaced by
140
+         * an unique name. You may use the name of your project for this. If
141
+         * you've implemented an alternative client class as well, "standard"
142
+         * should be replaced by the name of the new class.
143
+         *
144
+         * @param string Relative path to the template creating code for the HTML page head
145
+         * @since 2014.03
146
+         * @category Developer
147
+         * @see client/html/catalog/lists/promo/standard/template-body
148
+         */
149
+        $tplconf = 'client/html/catalog/lists/promo/standard/template-header';
150
+        $default = 'catalog/lists/promo-header-default.php';
151
+
152
+        return $view->render( $view->config( $tplconf, $default ) );
153
+    }
154
+
155
+
156
+    /**
157
+     * Returns the sub-client given by its name.
158
+     *
159
+     * @param string $type Name of the client type
160
+     * @param string|null $name Name of the sub-client (Default if null)
161
+     * @return \Aimeos\Client\Html\Iface Sub-client object
162
+     */
163
+    public function getSubClient( $type, $name = null )
164
+    {
165
+        /** client/html/catalog/lists/promo/decorators/excludes
166
+         * Excludes decorators added by the "common" option from the catalog list promo html client
167
+         *
168
+         * Decorators extend the functionality of a class by adding new aspects
169
+         * (e.g. log what is currently done), executing the methods of the underlying
170
+         * class only in certain conditions (e.g. only for logged in users) or
171
+         * modify what is returned to the caller.
172
+         *
173
+         * This option allows you to remove a decorator added via
174
+         * "client/html/common/decorators/default" before they are wrapped
175
+         * around the html client.
176
+         *
177
+         *  client/html/catalog/lists/promo/decorators/excludes = array( 'decorator1' )
178
+         *
179
+         * This would remove the decorator named "decorator1" from the list of
180
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
+         * "client/html/common/decorators/default" to the html client.
182
+         *
183
+         * @param array List of decorator names
184
+         * @since 2015.08
185
+         * @category Developer
186
+         * @see client/html/common/decorators/default
187
+         * @see client/html/catalog/lists/promo/decorators/global
188
+         * @see client/html/catalog/lists/promo/decorators/local
189
+         */
190
+
191
+        /** client/html/catalog/lists/promo/decorators/global
192
+         * Adds a list of globally available decorators only to the catalog list promo html client
193
+         *
194
+         * Decorators extend the functionality of a class by adding new aspects
195
+         * (e.g. log what is currently done), executing the methods of the underlying
196
+         * class only in certain conditions (e.g. only for logged in users) or
197
+         * modify what is returned to the caller.
198
+         *
199
+         * This option allows you to wrap global decorators
200
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
+         *
202
+         *  client/html/catalog/lists/promo/decorators/global = array( 'decorator1' )
203
+         *
204
+         * This would add the decorator named "decorator1" defined by
205
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
+         *
207
+         * @param array List of decorator names
208
+         * @since 2015.08
209
+         * @category Developer
210
+         * @see client/html/common/decorators/default
211
+         * @see client/html/catalog/lists/promo/decorators/excludes
212
+         * @see client/html/catalog/lists/promo/decorators/local
213
+         */
214
+
215
+        /** client/html/catalog/lists/promo/decorators/local
216
+         * Adds a list of local decorators only to the catalog list promo html client
217
+         *
218
+         * Decorators extend the functionality of a class by adding new aspects
219
+         * (e.g. log what is currently done), executing the methods of the underlying
220
+         * class only in certain conditions (e.g. only for logged in users) or
221
+         * modify what is returned to the caller.
222
+         *
223
+         * This option allows you to wrap local decorators
224
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
+         *
226
+         *  client/html/catalog/lists/promo/decorators/local = array( 'decorator2' )
227
+         *
228
+         * This would add the decorator named "decorator2" defined by
229
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
+         *
231
+         * @param array List of decorator names
232
+         * @since 2015.08
233
+         * @category Developer
234
+         * @see client/html/common/decorators/default
235
+         * @see client/html/catalog/lists/promo/decorators/excludes
236
+         * @see client/html/catalog/lists/promo/decorators/global
237
+         */
238
+
239
+        return $this->createSubClient( 'catalog/lists/promo/' . $type, $name );
240
+    }
241
+
242
+
243
+    /**
244
+     * Returns the list of sub-client names configured for the client.
245
+     *
246
+     * @return array List of HTML client names
247
+     */
248
+    protected function getSubClientNames()
249
+    {
250
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
+    }
252
+
253
+
254
+    /**
255
+     * Sets the necessary parameter values in the view.
256
+     *
257
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
+     * @param array &$tags Result array for the list of tags that are associated to the output
259
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
+     * @return \Aimeos\MW\View\Iface Modified view object
261
+     */
262
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
+    {
264
+        if( !isset( $this->cache ) )
265
+        {
266
+            $products = array();
267
+            $context = $this->getContext();
268
+            $config = $context->getConfig();
269
+
270
+            if( isset( $view->listCurrentCatItem ) ) {
271
+                $catId = $view->listCurrentCatItem->getId();
272
+            } else {
273
+                $catId = $config->get( 'client/html/catalog/lists/catid-default', '' );
274
+            }
275
+
276
+            if( $catId != '' )
277
+            {
278
+                /** client/html/catalog/lists/promo/size
279
+                 * The maximum number of products that should be shown in the promotion section
280
+                 *
281
+                 * Each product list can render a list of promoted products on
282
+                 * top if there are any products associated to that category whose
283
+                 * list type is "promotion". This option limits the maximum number
284
+                 * of products that are displayed. It takes only effect if more
285
+                 * promotional products are added to this category than the set
286
+                 * value.
287
+                 *
288
+                 * @param integer Number of promotion products
289
+                 * @since 2014.03
290
+                 * @category User
291
+                 * @category Developer
292
+                 */
293
+                $size = $config->get( 'client/html/catalog/lists/promo/size', 6 );
294
+                $domains = $config->get( 'client/html/catalog/lists/domains', array( 'media', 'price', 'text' ) );
295
+
296
+                $total = null;
297
+
298
+                $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
299
+                $filter = $controller->createIndexFilterCategory( $catId, 'relevance', '+', 0, $size, 'promotion' );
300
+                $products = $controller->getIndexItems( $filter, $domains, $total );
301
+            }
302
+
303
+
304
+            if( !empty( $products ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true )
305
+            {
306
+                $stockTarget = $config->get( 'client/html/catalog/stock/url/target' );
307
+                $stockController = $config->get( 'client/html/catalog/stock/url/controller', 'catalog' );
308
+                $stockAction = $config->get( 'client/html/catalog/stock/url/action', 'stock' );
309
+                $stockConfig = $config->get( 'client/html/catalog/stock/url/config', array() );
310
+
311
+                $productIds = array_keys( $products );
312
+                sort( $productIds );
313
+
314
+                $params = array( 's_prodid' => implode( ' ', $productIds ) );
315
+                $view->promoStockUrl = $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig );
316
+            }
317
+
318
+
319
+            $this->addMetaItem( $products, 'product', $this->expire, $this->tags );
320
+            $this->addMetaList( array_keys( $products ), 'product', $this->expire );
321
+
322
+
323
+            $view->promoItems = $products;
324
+
325
+            $this->cache = $view;
326
+        }
327
+
328
+        $expire = $this->expires( $this->expire, $expire );
329
+        $tags = array_merge( $tags, $this->tags );
330
+
331
+        return $this->cache;
332
+    }
333 333
 }
334 334
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Lists/Pagination/Standard.php 1 patch
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -19,267 +19,267 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/lists/pagination/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog list pagination section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/lists/pagination/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $header;
61
-	private $cache;
25
+    /** client/html/catalog/lists/pagination/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog list pagination section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/lists/pagination/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $header;
61
+    private $cache;
62 62
 
63 63
 
64
-	/**
65
-	 * Returns the HTML code for insertion into the body.
66
-	 *
67
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
68
-	 * @param array &$tags Result array for the list of tags that are associated to the output
69
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
70
-	 * @return string HTML code
71
-	 */
72
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
-	{
74
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
64
+    /**
65
+     * Returns the HTML code for insertion into the body.
66
+     *
67
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
68
+     * @param array &$tags Result array for the list of tags that are associated to the output
69
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
70
+     * @return string HTML code
71
+     */
72
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
+    {
74
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
75 75
 
76
-		$html = '';
77
-		foreach( $this->getSubClients() as $subclient ) {
78
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
79
-		}
80
-		$view->pagiBody = $html;
76
+        $html = '';
77
+        foreach( $this->getSubClients() as $subclient ) {
78
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
79
+        }
80
+        $view->pagiBody = $html;
81 81
 
82
-		/** client/html/catalog/lists/pagination/standard/template-body
83
-		 * Relative path to the HTML body template of the catalog list pagination client.
84
-		 *
85
-		 * The template file contains the HTML code and processing instructions
86
-		 * to generate the result shown in the body of the frontend. The
87
-		 * configuration string is the path to the template file relative
88
-		 * to the templates directory (usually in client/html/templates).
89
-		 *
90
-		 * You can overwrite the template file configuration in extensions and
91
-		 * provide alternative templates. These alternative templates should be
92
-		 * named like the default one but with the string "standard" replaced by
93
-		 * an unique name. You may use the name of your project for this. If
94
-		 * you've implemented an alternative client class as well, "standard"
95
-		 * should be replaced by the name of the new class.
96
-		 *
97
-		 * @param string Relative path to the template creating code for the HTML page body
98
-		 * @since 2014.03
99
-		 * @category Developer
100
-		 * @see client/html/catalog/lists/pagination/standard/template-header
101
-		 */
102
-		$tplconf = 'client/html/catalog/lists/pagination/standard/template-body';
103
-		$default = 'catalog/lists/pagination-body-default.php';
82
+        /** client/html/catalog/lists/pagination/standard/template-body
83
+         * Relative path to the HTML body template of the catalog list pagination client.
84
+         *
85
+         * The template file contains the HTML code and processing instructions
86
+         * to generate the result shown in the body of the frontend. The
87
+         * configuration string is the path to the template file relative
88
+         * to the templates directory (usually in client/html/templates).
89
+         *
90
+         * You can overwrite the template file configuration in extensions and
91
+         * provide alternative templates. These alternative templates should be
92
+         * named like the default one but with the string "standard" replaced by
93
+         * an unique name. You may use the name of your project for this. If
94
+         * you've implemented an alternative client class as well, "standard"
95
+         * should be replaced by the name of the new class.
96
+         *
97
+         * @param string Relative path to the template creating code for the HTML page body
98
+         * @since 2014.03
99
+         * @category Developer
100
+         * @see client/html/catalog/lists/pagination/standard/template-header
101
+         */
102
+        $tplconf = 'client/html/catalog/lists/pagination/standard/template-body';
103
+        $default = 'catalog/lists/pagination-body-default.php';
104 104
 
105
-		return $view->render( $view->config( $tplconf, $default ) );
106
-	}
105
+        return $view->render( $view->config( $tplconf, $default ) );
106
+    }
107 107
 
108 108
 
109
-	/**
110
-	 * Returns the HTML string for insertion into the header.
111
-	 *
112
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
113
-	 * @param array &$tags Result array for the list of tags that are associated to the output
114
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
115
-	 * @return string|null String including HTML tags for the header on error
116
-	 */
117
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
-	{
119
-		// output header only once
120
-		if( $this->header !== null ) {
121
-			return '';
122
-		}
109
+    /**
110
+     * Returns the HTML string for insertion into the header.
111
+     *
112
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
113
+     * @param array &$tags Result array for the list of tags that are associated to the output
114
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
115
+     * @return string|null String including HTML tags for the header on error
116
+     */
117
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
+    {
119
+        // output header only once
120
+        if( $this->header !== null ) {
121
+            return '';
122
+        }
123 123
 
124
-		$this->header = true;
125
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
124
+        $this->header = true;
125
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
126 126
 
127
-		$html = '';
128
-		foreach( $this->getSubClients() as $subclient ) {
129
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
130
-		}
131
-		$view->pagiHeader = $html;
127
+        $html = '';
128
+        foreach( $this->getSubClients() as $subclient ) {
129
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
130
+        }
131
+        $view->pagiHeader = $html;
132 132
 
133
-		/** client/html/catalog/lists/pagination/standard/template-header
134
-		 * Relative path to the HTML header template of the catalog list pagination client.
135
-		 *
136
-		 * The template file contains the HTML code and processing instructions
137
-		 * to generate the HTML code that is inserted into the HTML page header
138
-		 * of the rendered page in the frontend. The configuration string is the
139
-		 * path to the template file relative to the templates directory (usually
140
-		 * in client/html/templates).
141
-		 *
142
-		 * You can overwrite the template file configuration in extensions and
143
-		 * provide alternative templates. These alternative templates should be
144
-		 * named like the default one but with the string "standard" replaced by
145
-		 * an unique name. You may use the name of your project for this. If
146
-		 * you've implemented an alternative client class as well, "standard"
147
-		 * should be replaced by the name of the new class.
148
-		 *
149
-		 * @param string Relative path to the template creating code for the HTML page head
150
-		 * @since 2014.03
151
-		 * @category Developer
152
-		 * @see client/html/catalog/lists/pagination/standard/template-body
153
-		 */
154
-		$tplconf = 'client/html/catalog/lists/pagination/standard/template-header';
155
-		$default = 'catalog/lists/pagination-header-default.php';
133
+        /** client/html/catalog/lists/pagination/standard/template-header
134
+         * Relative path to the HTML header template of the catalog list pagination client.
135
+         *
136
+         * The template file contains the HTML code and processing instructions
137
+         * to generate the HTML code that is inserted into the HTML page header
138
+         * of the rendered page in the frontend. The configuration string is the
139
+         * path to the template file relative to the templates directory (usually
140
+         * in client/html/templates).
141
+         *
142
+         * You can overwrite the template file configuration in extensions and
143
+         * provide alternative templates. These alternative templates should be
144
+         * named like the default one but with the string "standard" replaced by
145
+         * an unique name. You may use the name of your project for this. If
146
+         * you've implemented an alternative client class as well, "standard"
147
+         * should be replaced by the name of the new class.
148
+         *
149
+         * @param string Relative path to the template creating code for the HTML page head
150
+         * @since 2014.03
151
+         * @category Developer
152
+         * @see client/html/catalog/lists/pagination/standard/template-body
153
+         */
154
+        $tplconf = 'client/html/catalog/lists/pagination/standard/template-header';
155
+        $default = 'catalog/lists/pagination-header-default.php';
156 156
 
157
-		return $view->render( $view->config( $tplconf, $default ) );
158
-	}
157
+        return $view->render( $view->config( $tplconf, $default ) );
158
+    }
159 159
 
160 160
 
161
-	/**
162
-	 * Returns the sub-client given by its name.
163
-	 *
164
-	 * @param string $type Name of the client type
165
-	 * @param string|null $name Name of the sub-client (Default if null)
166
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
167
-	 */
168
-	public function getSubClient( $type, $name = null )
169
-	{
170
-		/** client/html/catalog/lists/pagination/decorators/excludes
171
-		 * Excludes decorators added by the "common" option from the catalog list pagination html client
172
-		 *
173
-		 * Decorators extend the functionality of a class by adding new aspects
174
-		 * (e.g. log what is currently done), executing the methods of the underlying
175
-		 * class only in certain conditions (e.g. only for logged in users) or
176
-		 * modify what is returned to the caller.
177
-		 *
178
-		 * This option allows you to remove a decorator added via
179
-		 * "client/html/common/decorators/default" before they are wrapped
180
-		 * around the html client.
181
-		 *
182
-		 *  client/html/catalog/lists/pagination/decorators/excludes = array( 'decorator1' )
183
-		 *
184
-		 * This would remove the decorator named "decorator1" from the list of
185
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
186
-		 * "client/html/common/decorators/default" to the html client.
187
-		 *
188
-		 * @param array List of decorator names
189
-		 * @since 2015.08
190
-		 * @category Developer
191
-		 * @see client/html/common/decorators/default
192
-		 * @see client/html/catalog/lists/pagination/decorators/global
193
-		 * @see client/html/catalog/lists/pagination/decorators/local
194
-		 */
161
+    /**
162
+     * Returns the sub-client given by its name.
163
+     *
164
+     * @param string $type Name of the client type
165
+     * @param string|null $name Name of the sub-client (Default if null)
166
+     * @return \Aimeos\Client\Html\Iface Sub-client object
167
+     */
168
+    public function getSubClient( $type, $name = null )
169
+    {
170
+        /** client/html/catalog/lists/pagination/decorators/excludes
171
+         * Excludes decorators added by the "common" option from the catalog list pagination html client
172
+         *
173
+         * Decorators extend the functionality of a class by adding new aspects
174
+         * (e.g. log what is currently done), executing the methods of the underlying
175
+         * class only in certain conditions (e.g. only for logged in users) or
176
+         * modify what is returned to the caller.
177
+         *
178
+         * This option allows you to remove a decorator added via
179
+         * "client/html/common/decorators/default" before they are wrapped
180
+         * around the html client.
181
+         *
182
+         *  client/html/catalog/lists/pagination/decorators/excludes = array( 'decorator1' )
183
+         *
184
+         * This would remove the decorator named "decorator1" from the list of
185
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
186
+         * "client/html/common/decorators/default" to the html client.
187
+         *
188
+         * @param array List of decorator names
189
+         * @since 2015.08
190
+         * @category Developer
191
+         * @see client/html/common/decorators/default
192
+         * @see client/html/catalog/lists/pagination/decorators/global
193
+         * @see client/html/catalog/lists/pagination/decorators/local
194
+         */
195 195
 
196
-		/** client/html/catalog/lists/pagination/decorators/global
197
-		 * Adds a list of globally available decorators only to the catalog list pagination html client
198
-		 *
199
-		 * Decorators extend the functionality of a class by adding new aspects
200
-		 * (e.g. log what is currently done), executing the methods of the underlying
201
-		 * class only in certain conditions (e.g. only for logged in users) or
202
-		 * modify what is returned to the caller.
203
-		 *
204
-		 * This option allows you to wrap global decorators
205
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
206
-		 *
207
-		 *  client/html/catalog/lists/pagination/decorators/global = array( 'decorator1' )
208
-		 *
209
-		 * This would add the decorator named "decorator1" defined by
210
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
211
-		 *
212
-		 * @param array List of decorator names
213
-		 * @since 2015.08
214
-		 * @category Developer
215
-		 * @see client/html/common/decorators/default
216
-		 * @see client/html/catalog/lists/pagination/decorators/excludes
217
-		 * @see client/html/catalog/lists/pagination/decorators/local
218
-		 */
196
+        /** client/html/catalog/lists/pagination/decorators/global
197
+         * Adds a list of globally available decorators only to the catalog list pagination html client
198
+         *
199
+         * Decorators extend the functionality of a class by adding new aspects
200
+         * (e.g. log what is currently done), executing the methods of the underlying
201
+         * class only in certain conditions (e.g. only for logged in users) or
202
+         * modify what is returned to the caller.
203
+         *
204
+         * This option allows you to wrap global decorators
205
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
206
+         *
207
+         *  client/html/catalog/lists/pagination/decorators/global = array( 'decorator1' )
208
+         *
209
+         * This would add the decorator named "decorator1" defined by
210
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
211
+         *
212
+         * @param array List of decorator names
213
+         * @since 2015.08
214
+         * @category Developer
215
+         * @see client/html/common/decorators/default
216
+         * @see client/html/catalog/lists/pagination/decorators/excludes
217
+         * @see client/html/catalog/lists/pagination/decorators/local
218
+         */
219 219
 
220
-		/** client/html/catalog/lists/pagination/decorators/local
221
-		 * Adds a list of local decorators only to the catalog list pagination 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 wrap local decorators
229
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
230
-		 *
231
-		 *  client/html/catalog/lists/pagination/decorators/local = array( 'decorator2' )
232
-		 *
233
-		 * This would add the decorator named "decorator2" defined by
234
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
235
-		 *
236
-		 * @param array List of decorator names
237
-		 * @since 2015.08
238
-		 * @category Developer
239
-		 * @see client/html/common/decorators/default
240
-		 * @see client/html/catalog/lists/pagination/decorators/excludes
241
-		 * @see client/html/catalog/lists/pagination/decorators/global
242
-		 */
220
+        /** client/html/catalog/lists/pagination/decorators/local
221
+         * Adds a list of local decorators only to the catalog list pagination 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 wrap local decorators
229
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
230
+         *
231
+         *  client/html/catalog/lists/pagination/decorators/local = array( 'decorator2' )
232
+         *
233
+         * This would add the decorator named "decorator2" defined by
234
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
235
+         *
236
+         * @param array List of decorator names
237
+         * @since 2015.08
238
+         * @category Developer
239
+         * @see client/html/common/decorators/default
240
+         * @see client/html/catalog/lists/pagination/decorators/excludes
241
+         * @see client/html/catalog/lists/pagination/decorators/global
242
+         */
243 243
 
244
-		return $this->createSubClient( 'catalog/lists/pagination/' . $type, $name );
245
-	}
244
+        return $this->createSubClient( 'catalog/lists/pagination/' . $type, $name );
245
+    }
246 246
 
247 247
 
248
-	/**
249
-	 * Returns the list of sub-client names configured for the client.
250
-	 *
251
-	 * @return array List of HTML client names
252
-	 */
253
-	protected function getSubClientNames()
254
-	{
255
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
256
-	}
248
+    /**
249
+     * Returns the list of sub-client names configured for the client.
250
+     *
251
+     * @return array List of HTML client names
252
+     */
253
+    protected function getSubClientNames()
254
+    {
255
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
256
+    }
257 257
 
258 258
 
259
-	/**
260
-	 * Sets the necessary parameter values in the view.
261
-	 *
262
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
263
-	 * @param array &$tags Result array for the list of tags that are associated to the output
264
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
265
-	 * @return \Aimeos\MW\View\Iface Modified view object
266
-	 */
267
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
268
-	{
269
-		if( !isset( $this->cache ) )
270
-		{
271
-			$total = $view->listProductTotal;
272
-			$current = $view->listPageCurr;
273
-			$last = ( $total != 0 ? ceil( $total / $view->listPageSize ) : 1 );
259
+    /**
260
+     * Sets the necessary parameter values in the view.
261
+     *
262
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
263
+     * @param array &$tags Result array for the list of tags that are associated to the output
264
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
265
+     * @return \Aimeos\MW\View\Iface Modified view object
266
+     */
267
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
268
+    {
269
+        if( !isset( $this->cache ) )
270
+        {
271
+            $total = $view->listProductTotal;
272
+            $current = $view->listPageCurr;
273
+            $last = ( $total != 0 ? ceil( $total / $view->listPageSize ) : 1 );
274 274
 
275
-			$view->pagiPageFirst = 1;
276
-			$view->pagiPagePrev = ( $current > 1 ? $current - 1 : 1 );
277
-			$view->pagiPageNext = ( $current < $last ? $current + 1 : $last );
278
-			$view->pagiPageLast = $last;
275
+            $view->pagiPageFirst = 1;
276
+            $view->pagiPagePrev = ( $current > 1 ? $current - 1 : 1 );
277
+            $view->pagiPageNext = ( $current < $last ? $current + 1 : $last );
278
+            $view->pagiPageLast = $last;
279 279
 
280
-			$this->cache = $view;
281
-		}
280
+            $this->cache = $view;
281
+        }
282 282
 
283
-		return $this->cache;
284
-	}
283
+        return $this->cache;
284
+    }
285 285
 }
286 286
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Lists/Items/Standard.php 1 patch
Indentation   +457 added lines, -457 removed lines patch added patch discarded remove patch
@@ -19,462 +19,462 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Catalog\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Catalog\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/lists/items/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog list items section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/lists/items/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $tags = array();
61
-	private $expire;
62
-	private $view;
63
-
64
-
65
-	/**
66
-	 * Returns the HTML code for insertion into the body.
67
-	 *
68
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
-	 * @param array &$tags Result array for the list of tags that are associated to the output
70
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
-	 * @return string HTML code
72
-	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
-	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
76
-
77
-		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
-		}
81
-		$view->itemsBody = $html;
82
-
83
-		/** client/html/catalog/lists/items/standard/template-body
84
-		 * Relative path to the HTML body template of the catalog list items client.
85
-		 *
86
-		 * The template file contains the HTML code and processing instructions
87
-		 * to generate the result shown in the body of the frontend. The
88
-		 * configuration string is the path to the template file relative
89
-		 * to the templates directory (usually in client/html/templates).
90
-		 *
91
-		 * You can overwrite the template file configuration in extensions and
92
-		 * provide alternative templates. These alternative templates should be
93
-		 * named like the default one but with the string "standard" replaced by
94
-		 * an unique name. You may use the name of your project for this. If
95
-		 * you've implemented an alternative client class as well, "standard"
96
-		 * should be replaced by the name of the new class.
97
-		 *
98
-		 * @param string Relative path to the template creating code for the HTML page body
99
-		 * @since 2014.03
100
-		 * @category Developer
101
-		 * @see client/html/catalog/lists/items/standard/template-header
102
-		 */
103
-		$tplconf = 'client/html/catalog/lists/items/standard/template-body';
104
-		$default = 'catalog/lists/items-body-default.php';
105
-
106
-		return $view->render( $view->config( $tplconf, $default ) );
107
-	}
108
-
109
-
110
-	/**
111
-	 * Returns the HTML string for insertion into the header.
112
-	 *
113
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
-	 * @param array &$tags Result array for the list of tags that are associated to the output
115
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
117
-	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
-	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
121
-
122
-		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
-		}
126
-		$view->itemsHeader = $html;
127
-
128
-		/** client/html/catalog/lists/items/standard/template-header
129
-		 * Relative path to the HTML header template of the catalog list items client.
130
-		 *
131
-		 * The template file contains the HTML code and processing instructions
132
-		 * to generate the HTML code that is inserted into the HTML page header
133
-		 * of the rendered page in the frontend. The configuration string is the
134
-		 * path to the template file relative to the templates directory (usually
135
-		 * in client/html/templates).
136
-		 *
137
-		 * You can overwrite the template file configuration in extensions and
138
-		 * provide alternative templates. These alternative templates should be
139
-		 * named like the default one but with the string "standard" replaced by
140
-		 * an unique name. You may use the name of your project for this. If
141
-		 * you've implemented an alternative client class as well, "standard"
142
-		 * should be replaced by the name of the new class.
143
-		 *
144
-		 * @param string Relative path to the template creating code for the HTML page head
145
-		 * @since 2014.03
146
-		 * @category Developer
147
-		 * @see client/html/catalog/lists/items/standard/template-body
148
-		 */
149
-		$tplconf = 'client/html/catalog/lists/items/standard/template-header';
150
-		$default = 'catalog/lists/items-header-default.php';
151
-
152
-		return $view->render( $view->config( $tplconf, $default ) );
153
-	}
154
-
155
-
156
-	/**
157
-	 * Returns the sub-client given by its name.
158
-	 *
159
-	 * @param string $type Name of the client type
160
-	 * @param string|null $name Name of the sub-client (Default if null)
161
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
162
-	 */
163
-	public function getSubClient( $type, $name = null )
164
-	{
165
-		/** client/html/catalog/lists/items/decorators/excludes
166
-		 * Excludes decorators added by the "common" option from the catalog list items html client
167
-		 *
168
-		 * Decorators extend the functionality of a class by adding new aspects
169
-		 * (e.g. log what is currently done), executing the methods of the underlying
170
-		 * class only in certain conditions (e.g. only for logged in users) or
171
-		 * modify what is returned to the caller.
172
-		 *
173
-		 * This option allows you to remove a decorator added via
174
-		 * "client/html/common/decorators/default" before they are wrapped
175
-		 * around the html client.
176
-		 *
177
-		 *  client/html/catalog/lists/items/decorators/excludes = array( 'decorator1' )
178
-		 *
179
-		 * This would remove the decorator named "decorator1" from the list of
180
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
-		 * "client/html/common/decorators/default" to the html client.
182
-		 *
183
-		 * @param array List of decorator names
184
-		 * @since 2015.08
185
-		 * @category Developer
186
-		 * @see client/html/common/decorators/default
187
-		 * @see client/html/catalog/lists/items/decorators/global
188
-		 * @see client/html/catalog/lists/items/decorators/local
189
-		 */
190
-
191
-		/** client/html/catalog/lists/items/decorators/global
192
-		 * Adds a list of globally available decorators only to the catalog list items html client
193
-		 *
194
-		 * Decorators extend the functionality of a class by adding new aspects
195
-		 * (e.g. log what is currently done), executing the methods of the underlying
196
-		 * class only in certain conditions (e.g. only for logged in users) or
197
-		 * modify what is returned to the caller.
198
-		 *
199
-		 * This option allows you to wrap global decorators
200
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
-		 *
202
-		 *  client/html/catalog/lists/items/decorators/global = array( 'decorator1' )
203
-		 *
204
-		 * This would add the decorator named "decorator1" defined by
205
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
-		 *
207
-		 * @param array List of decorator names
208
-		 * @since 2015.08
209
-		 * @category Developer
210
-		 * @see client/html/common/decorators/default
211
-		 * @see client/html/catalog/lists/items/decorators/excludes
212
-		 * @see client/html/catalog/lists/items/decorators/local
213
-		 */
214
-
215
-		/** client/html/catalog/lists/items/decorators/local
216
-		 * Adds a list of local decorators only to the catalog list items html client
217
-		 *
218
-		 * Decorators extend the functionality of a class by adding new aspects
219
-		 * (e.g. log what is currently done), executing the methods of the underlying
220
-		 * class only in certain conditions (e.g. only for logged in users) or
221
-		 * modify what is returned to the caller.
222
-		 *
223
-		 * This option allows you to wrap local decorators
224
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
-		 *
226
-		 *  client/html/catalog/lists/items/decorators/local = array( 'decorator2' )
227
-		 *
228
-		 * This would add the decorator named "decorator2" defined by
229
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
-		 *
231
-		 * @param array List of decorator names
232
-		 * @since 2015.08
233
-		 * @category Developer
234
-		 * @see client/html/common/decorators/default
235
-		 * @see client/html/catalog/lists/items/decorators/excludes
236
-		 * @see client/html/catalog/lists/items/decorators/global
237
-		 */
238
-
239
-		return $this->createSubClient( 'catalog/lists/items/' . $type, $name );
240
-	}
241
-
242
-
243
-	/**
244
-	 * Returns the list of sub-client names configured for the client.
245
-	 *
246
-	 * @return array List of HTML client names
247
-	 */
248
-	protected function getSubClientNames()
249
-	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
-	}
252
-
253
-
254
-	/**
255
-	 * Modifies the cached body content to replace content based on sessions or cookies.
256
-	 *
257
-	 * @param string $content Cached content
258
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
259
-	 * @return string Modified body content
260
-	 */
261
-	public function modifyBody( $content, $uid )
262
-	{
263
-		$content = parent::modifyBody( $content, $uid );
264
-
265
-		return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf' );
266
-	}
267
-
268
-
269
-	/**
270
-	 * Sets the necessary parameter values in the view.
271
-	 *
272
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
273
-	 * @param array &$tags Result array for the list of tags that are associated to the output
274
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
275
-	 * @return \Aimeos\MW\View\Iface Modified view object
276
-	 */
277
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
278
-	{
279
-		if( !isset( $this->view ) )
280
-		{
281
-			$view->itemPosition = ( $this->getProductListPage( $view ) - 1 ) * $this->getProductListSize( $view );
282
-
283
-			if( $this->getContext()->getConfig()->get( 'client/html/catalog/lists/basket-add', false ) )
284
-			{
285
-				$view = $this->addSelectionProducts( $view, $tags, $expire );
286
-				$view = $this->addConfigAttributes( $view, $tags, $expire );
287
-			}
288
-
289
-			$this->view = $view;
290
-		}
291
-
292
-		return $this->view;
293
-	}
294
-
295
-
296
-	/**
297
-	 * Adds the necessary view parameters for adding selection products to the basket
298
-	 *
299
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
300
-	 * @param array &$tags Result array for the list of tags that are associated to the output
301
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
302
-	 * @return \Aimeos\MW\View\Iface Modified view object
303
-	 */
304
-	protected function addSelectionProducts( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
305
-	{
306
-		$context = $this->getContext();
307
-		$config = $context->getConfig();
308
-		$subProdMap = $prodMap = $prodIds = array();
309
-
310
-		foreach( (array) $view->get( 'listProductItems', array() ) as $product )
311
-		{
312
-			if( $product->getType() === 'select' )
313
-			{
314
-				foreach( $product->getListItems( 'product', 'default' ) as $listItem )
315
-				{
316
-					$prodMap[$listItem->getParentId()][] = $listItem->getRefId();
317
-					$prodIds[$listItem->getRefId()] = null;
318
-				}
319
-			}
320
-		}
321
-
322
-		$prodIds = array_keys( $prodIds );
323
-
324
-
325
-		$domains = array( 'text', 'price', 'media', 'attribute' );
326
-		$domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains );
327
-
328
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
329
-		$subproducts = $controller->getProductItems( $prodIds, $domains );
330
-		$attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array();
331
-
332
-		foreach( $prodMap as $prodId => $list )
333
-		{
334
-			foreach( $list as $subProdId )
335
-			{
336
-				if( isset( $subproducts[$subProdId] ) )
337
-				{
338
-					$subProduct = $subproducts[$subProdId];
339
-					$subProdMap[$prodId][$subProdId] = $subProduct;
340
-
341
-					foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem )
342
-					{
343
-						$attrTypeDeps[$prodId][$attrItem->getType()][$attrId] = $attrItem->getPosition();
344
-						$attrDeps[$prodId][$attrId][] = $subProdId;
345
-						$prodDeps[$prodId][$subProdId][] = $attrId;
346
-						$attrIds[$attrId] = null;
347
-					}
348
-				}
349
-			}
350
-
351
-			ksort( $attrTypeDeps[$prodId] );
352
-		}
353
-
354
-		$this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags );
355
-		$this->addMetaList( array_keys( $subproducts ), 'product', $this->expire );
356
-
357
-
358
-		$attrManager = $controller->createManager( 'attribute' );
359
-
360
-		$search = $attrManager->createSearch( true );
361
-		$expr = array(
362
-			$search->compare( '==', 'attribute.id', array_keys( $attrIds ) ),
363
-			$search->getConditions(),
364
-		);
365
-		$search->setConditions( $search->combine( '&&', $expr ) );
366
-
367
-		$domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) );
368
-		$attributes = $attrManager->searchItems( $search, $domains );
369
-
370
-		$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
371
-		$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
372
-
373
-
374
-		if( !empty( $prodIds ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) {
375
-			$view->itemsStockUrl = $this->getStockUrl( $view, $prodIds );
376
-		}
377
-
378
-		$view->itemsSelectionProducts = $subProdMap;
379
-		$view->itemsSelectionProductDependencies = $prodDeps;
380
-		$view->itemsSelectionAttributeDependencies = $attrDeps;
381
-		$view->itemsSelectionAttributeTypeDependencies = $attrTypeDeps;
382
-		$view->itemsSelectionAttributeItems = $attributes;
383
-
384
-		return $view;
385
-	}
386
-
387
-
388
-	/**
389
-	 * Adds the necessary view parameters for adding config attributes to the basket
390
-	 *
391
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
392
-	 * @param array &$tags Result array for the list of tags that are associated to the output
393
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
394
-	 * @return \Aimeos\MW\View\Iface Modified view object
395
-	 */
396
-	protected function addConfigAttributes( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
397
-	{
398
-		$context = $this->getContext();
399
-		$config = $context->getConfig();
400
-		$attrIds = $attributeTypes = array();
401
-
402
-		foreach( (array) $view->get( 'listProductItems', array() ) as $product )
403
-		{
404
-			foreach( $product->getListItems( 'attribute' ) as $listItem ) {
405
-				$attrIds[$listItem->getRefId()] = null;
406
-			}
407
-		}
408
-
409
-
410
-		/** client/html/catalog/lists/items/domains-attributes
411
-		 * A list of domain names whose items should be available for the attributes
412
-		 * in the "items" part of the catalog list view templates
413
-		 *
414
-		 * The templates rendering attributes usually add images, texts and
415
-		 * maybe prices associated to each item. If you want to display
416
-		 * additional content like the attributes, you can configure your own
417
-		 * list of domains (attribute, media, price, product, text, etc. are
418
-		 * domains) whose items are fetched from the storage.
419
-		 *
420
-		 * Please keep in mind that the more domains you add to the
421
-		 * configuration, the more time is required for fetching the content!
422
-		 *
423
-		 * @param array List of domain names
424
-		 * @since 2016.01
425
-		 * @category Developer
426
-		 */
427
-		$domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) );
428
-
429
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
430
-		$attrManager = $controller->createManager( 'attribute' );
431
-
432
-		$search = $attrManager->createSearch( true );
433
-		$expr = array(
434
-			$search->compare( '==', 'attribute.id', array_keys( $attrIds ) ),
435
-			$search->getConditions(),
436
-		);
437
-		$search->setConditions( $search->combine( '&&', $expr ) );
438
-
439
-		$attrItems = $attrManager->searchItems( $search, $domains );
440
-
441
-		$this->addMetaItem( $attrItems, 'attribute', $this->expire, $this->tags );
442
-		$this->addMetaList( array_keys( $attrItems ), 'attribute', $this->expire );
443
-
444
-
445
-		foreach( (array) $view->get( 'listProductItems', array() ) as $prodId => $product )
446
-		{
447
-			foreach( $product->getRefItems( 'attribute', null, 'config' ) as $id => $attribute )
448
-			{
449
-				if( isset( $attrItems[$id] ) ) {
450
-					$attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id];
451
-				}
452
-			}
453
-		}
454
-
455
-		$view->itemsAttributeConfigItems = $attributeTypes;
456
-
457
-		return $view;
458
-	}
459
-
460
-
461
-	/**
462
-	 * Returns the URL to fetch the stock level details of the given products
463
-	 *
464
-	 * @param \Aimeos\MW\View\Iface $view View object
465
-	 * @param array $productIds List of product IDs
466
-	 * @return string Generated stock level URL
467
-	 */
468
-	protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds )
469
-	{
470
-		$stockTarget = $view->config( 'client/html/catalog/stock/url/target' );
471
-		$stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' );
472
-		$stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' );
473
-		$stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() );
474
-
475
-		sort( $productIds );
476
-
477
-		$params = array( 's_prodid' => implode( ' ', $productIds ) );
478
-		return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig );
479
-	}
25
+    /** client/html/catalog/lists/items/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog list items section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/lists/items/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $tags = array();
61
+    private $expire;
62
+    private $view;
63
+
64
+
65
+    /**
66
+     * Returns the HTML code for insertion into the body.
67
+     *
68
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
+     * @param array &$tags Result array for the list of tags that are associated to the output
70
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
+     * @return string HTML code
72
+     */
73
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
+    {
75
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
76
+
77
+        $html = '';
78
+        foreach( $this->getSubClients() as $subclient ) {
79
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
+        }
81
+        $view->itemsBody = $html;
82
+
83
+        /** client/html/catalog/lists/items/standard/template-body
84
+         * Relative path to the HTML body template of the catalog list items client.
85
+         *
86
+         * The template file contains the HTML code and processing instructions
87
+         * to generate the result shown in the body of the frontend. The
88
+         * configuration string is the path to the template file relative
89
+         * to the templates directory (usually in client/html/templates).
90
+         *
91
+         * You can overwrite the template file configuration in extensions and
92
+         * provide alternative templates. These alternative templates should be
93
+         * named like the default one but with the string "standard" replaced by
94
+         * an unique name. You may use the name of your project for this. If
95
+         * you've implemented an alternative client class as well, "standard"
96
+         * should be replaced by the name of the new class.
97
+         *
98
+         * @param string Relative path to the template creating code for the HTML page body
99
+         * @since 2014.03
100
+         * @category Developer
101
+         * @see client/html/catalog/lists/items/standard/template-header
102
+         */
103
+        $tplconf = 'client/html/catalog/lists/items/standard/template-body';
104
+        $default = 'catalog/lists/items-body-default.php';
105
+
106
+        return $view->render( $view->config( $tplconf, $default ) );
107
+    }
108
+
109
+
110
+    /**
111
+     * Returns the HTML string for insertion into the header.
112
+     *
113
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
+     * @param array &$tags Result array for the list of tags that are associated to the output
115
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
+     * @return string|null String including HTML tags for the header on error
117
+     */
118
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
+    {
120
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
121
+
122
+        $html = '';
123
+        foreach( $this->getSubClients() as $subclient ) {
124
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
+        }
126
+        $view->itemsHeader = $html;
127
+
128
+        /** client/html/catalog/lists/items/standard/template-header
129
+         * Relative path to the HTML header template of the catalog list items client.
130
+         *
131
+         * The template file contains the HTML code and processing instructions
132
+         * to generate the HTML code that is inserted into the HTML page header
133
+         * of the rendered page in the frontend. The configuration string is the
134
+         * path to the template file relative to the templates directory (usually
135
+         * in client/html/templates).
136
+         *
137
+         * You can overwrite the template file configuration in extensions and
138
+         * provide alternative templates. These alternative templates should be
139
+         * named like the default one but with the string "standard" replaced by
140
+         * an unique name. You may use the name of your project for this. If
141
+         * you've implemented an alternative client class as well, "standard"
142
+         * should be replaced by the name of the new class.
143
+         *
144
+         * @param string Relative path to the template creating code for the HTML page head
145
+         * @since 2014.03
146
+         * @category Developer
147
+         * @see client/html/catalog/lists/items/standard/template-body
148
+         */
149
+        $tplconf = 'client/html/catalog/lists/items/standard/template-header';
150
+        $default = 'catalog/lists/items-header-default.php';
151
+
152
+        return $view->render( $view->config( $tplconf, $default ) );
153
+    }
154
+
155
+
156
+    /**
157
+     * Returns the sub-client given by its name.
158
+     *
159
+     * @param string $type Name of the client type
160
+     * @param string|null $name Name of the sub-client (Default if null)
161
+     * @return \Aimeos\Client\Html\Iface Sub-client object
162
+     */
163
+    public function getSubClient( $type, $name = null )
164
+    {
165
+        /** client/html/catalog/lists/items/decorators/excludes
166
+         * Excludes decorators added by the "common" option from the catalog list items html client
167
+         *
168
+         * Decorators extend the functionality of a class by adding new aspects
169
+         * (e.g. log what is currently done), executing the methods of the underlying
170
+         * class only in certain conditions (e.g. only for logged in users) or
171
+         * modify what is returned to the caller.
172
+         *
173
+         * This option allows you to remove a decorator added via
174
+         * "client/html/common/decorators/default" before they are wrapped
175
+         * around the html client.
176
+         *
177
+         *  client/html/catalog/lists/items/decorators/excludes = array( 'decorator1' )
178
+         *
179
+         * This would remove the decorator named "decorator1" from the list of
180
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
+         * "client/html/common/decorators/default" to the html client.
182
+         *
183
+         * @param array List of decorator names
184
+         * @since 2015.08
185
+         * @category Developer
186
+         * @see client/html/common/decorators/default
187
+         * @see client/html/catalog/lists/items/decorators/global
188
+         * @see client/html/catalog/lists/items/decorators/local
189
+         */
190
+
191
+        /** client/html/catalog/lists/items/decorators/global
192
+         * Adds a list of globally available decorators only to the catalog list items html client
193
+         *
194
+         * Decorators extend the functionality of a class by adding new aspects
195
+         * (e.g. log what is currently done), executing the methods of the underlying
196
+         * class only in certain conditions (e.g. only for logged in users) or
197
+         * modify what is returned to the caller.
198
+         *
199
+         * This option allows you to wrap global decorators
200
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
+         *
202
+         *  client/html/catalog/lists/items/decorators/global = array( 'decorator1' )
203
+         *
204
+         * This would add the decorator named "decorator1" defined by
205
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
+         *
207
+         * @param array List of decorator names
208
+         * @since 2015.08
209
+         * @category Developer
210
+         * @see client/html/common/decorators/default
211
+         * @see client/html/catalog/lists/items/decorators/excludes
212
+         * @see client/html/catalog/lists/items/decorators/local
213
+         */
214
+
215
+        /** client/html/catalog/lists/items/decorators/local
216
+         * Adds a list of local decorators only to the catalog list items html client
217
+         *
218
+         * Decorators extend the functionality of a class by adding new aspects
219
+         * (e.g. log what is currently done), executing the methods of the underlying
220
+         * class only in certain conditions (e.g. only for logged in users) or
221
+         * modify what is returned to the caller.
222
+         *
223
+         * This option allows you to wrap local decorators
224
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
+         *
226
+         *  client/html/catalog/lists/items/decorators/local = array( 'decorator2' )
227
+         *
228
+         * This would add the decorator named "decorator2" defined by
229
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
+         *
231
+         * @param array List of decorator names
232
+         * @since 2015.08
233
+         * @category Developer
234
+         * @see client/html/common/decorators/default
235
+         * @see client/html/catalog/lists/items/decorators/excludes
236
+         * @see client/html/catalog/lists/items/decorators/global
237
+         */
238
+
239
+        return $this->createSubClient( 'catalog/lists/items/' . $type, $name );
240
+    }
241
+
242
+
243
+    /**
244
+     * Returns the list of sub-client names configured for the client.
245
+     *
246
+     * @return array List of HTML client names
247
+     */
248
+    protected function getSubClientNames()
249
+    {
250
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
+    }
252
+
253
+
254
+    /**
255
+     * Modifies the cached body content to replace content based on sessions or cookies.
256
+     *
257
+     * @param string $content Cached content
258
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
259
+     * @return string Modified body content
260
+     */
261
+    public function modifyBody( $content, $uid )
262
+    {
263
+        $content = parent::modifyBody( $content, $uid );
264
+
265
+        return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf' );
266
+    }
267
+
268
+
269
+    /**
270
+     * Sets the necessary parameter values in the view.
271
+     *
272
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
273
+     * @param array &$tags Result array for the list of tags that are associated to the output
274
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
275
+     * @return \Aimeos\MW\View\Iface Modified view object
276
+     */
277
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
278
+    {
279
+        if( !isset( $this->view ) )
280
+        {
281
+            $view->itemPosition = ( $this->getProductListPage( $view ) - 1 ) * $this->getProductListSize( $view );
282
+
283
+            if( $this->getContext()->getConfig()->get( 'client/html/catalog/lists/basket-add', false ) )
284
+            {
285
+                $view = $this->addSelectionProducts( $view, $tags, $expire );
286
+                $view = $this->addConfigAttributes( $view, $tags, $expire );
287
+            }
288
+
289
+            $this->view = $view;
290
+        }
291
+
292
+        return $this->view;
293
+    }
294
+
295
+
296
+    /**
297
+     * Adds the necessary view parameters for adding selection products to the basket
298
+     *
299
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
300
+     * @param array &$tags Result array for the list of tags that are associated to the output
301
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
302
+     * @return \Aimeos\MW\View\Iface Modified view object
303
+     */
304
+    protected function addSelectionProducts( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
305
+    {
306
+        $context = $this->getContext();
307
+        $config = $context->getConfig();
308
+        $subProdMap = $prodMap = $prodIds = array();
309
+
310
+        foreach( (array) $view->get( 'listProductItems', array() ) as $product )
311
+        {
312
+            if( $product->getType() === 'select' )
313
+            {
314
+                foreach( $product->getListItems( 'product', 'default' ) as $listItem )
315
+                {
316
+                    $prodMap[$listItem->getParentId()][] = $listItem->getRefId();
317
+                    $prodIds[$listItem->getRefId()] = null;
318
+                }
319
+            }
320
+        }
321
+
322
+        $prodIds = array_keys( $prodIds );
323
+
324
+
325
+        $domains = array( 'text', 'price', 'media', 'attribute' );
326
+        $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains );
327
+
328
+        $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
329
+        $subproducts = $controller->getProductItems( $prodIds, $domains );
330
+        $attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array();
331
+
332
+        foreach( $prodMap as $prodId => $list )
333
+        {
334
+            foreach( $list as $subProdId )
335
+            {
336
+                if( isset( $subproducts[$subProdId] ) )
337
+                {
338
+                    $subProduct = $subproducts[$subProdId];
339
+                    $subProdMap[$prodId][$subProdId] = $subProduct;
340
+
341
+                    foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem )
342
+                    {
343
+                        $attrTypeDeps[$prodId][$attrItem->getType()][$attrId] = $attrItem->getPosition();
344
+                        $attrDeps[$prodId][$attrId][] = $subProdId;
345
+                        $prodDeps[$prodId][$subProdId][] = $attrId;
346
+                        $attrIds[$attrId] = null;
347
+                    }
348
+                }
349
+            }
350
+
351
+            ksort( $attrTypeDeps[$prodId] );
352
+        }
353
+
354
+        $this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags );
355
+        $this->addMetaList( array_keys( $subproducts ), 'product', $this->expire );
356
+
357
+
358
+        $attrManager = $controller->createManager( 'attribute' );
359
+
360
+        $search = $attrManager->createSearch( true );
361
+        $expr = array(
362
+            $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ),
363
+            $search->getConditions(),
364
+        );
365
+        $search->setConditions( $search->combine( '&&', $expr ) );
366
+
367
+        $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) );
368
+        $attributes = $attrManager->searchItems( $search, $domains );
369
+
370
+        $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
371
+        $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
372
+
373
+
374
+        if( !empty( $prodIds ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) {
375
+            $view->itemsStockUrl = $this->getStockUrl( $view, $prodIds );
376
+        }
377
+
378
+        $view->itemsSelectionProducts = $subProdMap;
379
+        $view->itemsSelectionProductDependencies = $prodDeps;
380
+        $view->itemsSelectionAttributeDependencies = $attrDeps;
381
+        $view->itemsSelectionAttributeTypeDependencies = $attrTypeDeps;
382
+        $view->itemsSelectionAttributeItems = $attributes;
383
+
384
+        return $view;
385
+    }
386
+
387
+
388
+    /**
389
+     * Adds the necessary view parameters for adding config attributes to the basket
390
+     *
391
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
392
+     * @param array &$tags Result array for the list of tags that are associated to the output
393
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
394
+     * @return \Aimeos\MW\View\Iface Modified view object
395
+     */
396
+    protected function addConfigAttributes( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
397
+    {
398
+        $context = $this->getContext();
399
+        $config = $context->getConfig();
400
+        $attrIds = $attributeTypes = array();
401
+
402
+        foreach( (array) $view->get( 'listProductItems', array() ) as $product )
403
+        {
404
+            foreach( $product->getListItems( 'attribute' ) as $listItem ) {
405
+                $attrIds[$listItem->getRefId()] = null;
406
+            }
407
+        }
408
+
409
+
410
+        /** client/html/catalog/lists/items/domains-attributes
411
+         * A list of domain names whose items should be available for the attributes
412
+         * in the "items" part of the catalog list view templates
413
+         *
414
+         * The templates rendering attributes usually add images, texts and
415
+         * maybe prices associated to each item. If you want to display
416
+         * additional content like the attributes, you can configure your own
417
+         * list of domains (attribute, media, price, product, text, etc. are
418
+         * domains) whose items are fetched from the storage.
419
+         *
420
+         * Please keep in mind that the more domains you add to the
421
+         * configuration, the more time is required for fetching the content!
422
+         *
423
+         * @param array List of domain names
424
+         * @since 2016.01
425
+         * @category Developer
426
+         */
427
+        $domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) );
428
+
429
+        $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
430
+        $attrManager = $controller->createManager( 'attribute' );
431
+
432
+        $search = $attrManager->createSearch( true );
433
+        $expr = array(
434
+            $search->compare( '==', 'attribute.id', array_keys( $attrIds ) ),
435
+            $search->getConditions(),
436
+        );
437
+        $search->setConditions( $search->combine( '&&', $expr ) );
438
+
439
+        $attrItems = $attrManager->searchItems( $search, $domains );
440
+
441
+        $this->addMetaItem( $attrItems, 'attribute', $this->expire, $this->tags );
442
+        $this->addMetaList( array_keys( $attrItems ), 'attribute', $this->expire );
443
+
444
+
445
+        foreach( (array) $view->get( 'listProductItems', array() ) as $prodId => $product )
446
+        {
447
+            foreach( $product->getRefItems( 'attribute', null, 'config' ) as $id => $attribute )
448
+            {
449
+                if( isset( $attrItems[$id] ) ) {
450
+                    $attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id];
451
+                }
452
+            }
453
+        }
454
+
455
+        $view->itemsAttributeConfigItems = $attributeTypes;
456
+
457
+        return $view;
458
+    }
459
+
460
+
461
+    /**
462
+     * Returns the URL to fetch the stock level details of the given products
463
+     *
464
+     * @param \Aimeos\MW\View\Iface $view View object
465
+     * @param array $productIds List of product IDs
466
+     * @return string Generated stock level URL
467
+     */
468
+    protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds )
469
+    {
470
+        $stockTarget = $view->config( 'client/html/catalog/stock/url/target' );
471
+        $stockController = $view->config( 'client/html/catalog/stock/url/controller', 'catalog' );
472
+        $stockAction = $view->config( 'client/html/catalog/stock/url/action', 'stock' );
473
+        $stockConfig = $view->config( 'client/html/catalog/stock/url/config', array() );
474
+
475
+        sort( $productIds );
476
+
477
+        $params = array( 's_prodid' => implode( ' ', $productIds ) );
478
+        return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig );
479
+    }
480 480
 }
481 481
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Lists/Quote/Standard.php 1 patch
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -19,260 +19,260 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/lists/quote/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog list quote section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/lists/quote/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $cache;
25
+    /** client/html/catalog/lists/quote/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog list quote section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/lists/quote/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->quoteBody = $html;
75
+        $html = '';
76
+        foreach( $this->getSubClients() as $subclient ) {
77
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
+        }
79
+        $view->quoteBody = $html;
80 80
 
81
-		/** client/html/catalog/lists/quote/standard/template-body
82
-		 * Relative path to the HTML body template of the catalog list quote client.
83
-		 *
84
-		 * The template file contains the HTML code and processing instructions
85
-		 * to generate the result shown in the body of the frontend. The
86
-		 * configuration string is the path to the template file relative
87
-		 * to the templates directory (usually in client/html/templates).
88
-		 *
89
-		 * You can overwrite the template file configuration in extensions and
90
-		 * provide alternative templates. These alternative templates should be
91
-		 * named like the default one but with the string "standard" replaced by
92
-		 * an unique name. You may use the name of your project for this. If
93
-		 * you've implemented an alternative client class as well, "standard"
94
-		 * should be replaced by the name of the new class.
95
-		 *
96
-		 * @param string Relative path to the template creating code for the HTML page body
97
-		 * @since 2014.03
98
-		 * @category Developer
99
-		 * @see client/html/catalog/lists/quote/standard/template-header
100
-		 */
101
-		$tplconf = 'client/html/catalog/lists/quote/standard/template-body';
102
-		$default = 'catalog/lists/quote-body-default.php';
81
+        /** client/html/catalog/lists/quote/standard/template-body
82
+         * Relative path to the HTML body template of the catalog list quote client.
83
+         *
84
+         * The template file contains the HTML code and processing instructions
85
+         * to generate the result shown in the body of the frontend. The
86
+         * configuration string is the path to the template file relative
87
+         * to the templates directory (usually in client/html/templates).
88
+         *
89
+         * You can overwrite the template file configuration in extensions and
90
+         * provide alternative templates. These alternative templates should be
91
+         * named like the default one but with the string "standard" replaced by
92
+         * an unique name. You may use the name of your project for this. If
93
+         * you've implemented an alternative client class as well, "standard"
94
+         * should be replaced by the name of the new class.
95
+         *
96
+         * @param string Relative path to the template creating code for the HTML page body
97
+         * @since 2014.03
98
+         * @category Developer
99
+         * @see client/html/catalog/lists/quote/standard/template-header
100
+         */
101
+        $tplconf = 'client/html/catalog/lists/quote/standard/template-body';
102
+        $default = 'catalog/lists/quote-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->quoteHeader = $html;
120
+        $html = '';
121
+        foreach( $this->getSubClients() as $subclient ) {
122
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+        }
124
+        $view->quoteHeader = $html;
125 125
 
126
-		/** client/html/catalog/lists/quote/standard/template-header
127
-		 * Relative path to the HTML header template of the catalog list quote client.
128
-		 *
129
-		 * The template file contains the HTML code and processing instructions
130
-		 * to generate the HTML code that is inserted into the HTML page header
131
-		 * of the rendered page in the frontend. The configuration string is the
132
-		 * path to the template file relative to the templates directory (usually
133
-		 * in client/html/templates).
134
-		 *
135
-		 * You can overwrite the template file configuration in extensions and
136
-		 * provide alternative templates. These alternative templates should be
137
-		 * named like the default one but with the string "standard" replaced by
138
-		 * an unique name. You may use the name of your project for this. If
139
-		 * you've implemented an alternative client class as well, "standard"
140
-		 * should be replaced by the name of the new class.
141
-		 *
142
-		 * @param string Relative path to the template creating code for the HTML page head
143
-		 * @since 2014.03
144
-		 * @category Developer
145
-		 * @see client/html/catalog/lists/quote/standard/template-body
146
-		 */
147
-		$tplconf = 'client/html/catalog/lists/quote/standard/template-header';
148
-		$default = 'catalog/lists/quote-header-default.php';
126
+        /** client/html/catalog/lists/quote/standard/template-header
127
+         * Relative path to the HTML header template of the catalog list quote client.
128
+         *
129
+         * The template file contains the HTML code and processing instructions
130
+         * to generate the HTML code that is inserted into the HTML page header
131
+         * of the rendered page in the frontend. The configuration string is the
132
+         * path to the template file relative to the templates directory (usually
133
+         * in client/html/templates).
134
+         *
135
+         * You can overwrite the template file configuration in extensions and
136
+         * provide alternative templates. These alternative templates should be
137
+         * named like the default one but with the string "standard" replaced by
138
+         * an unique name. You may use the name of your project for this. If
139
+         * you've implemented an alternative client class as well, "standard"
140
+         * should be replaced by the name of the new class.
141
+         *
142
+         * @param string Relative path to the template creating code for the HTML page head
143
+         * @since 2014.03
144
+         * @category Developer
145
+         * @see client/html/catalog/lists/quote/standard/template-body
146
+         */
147
+        $tplconf = 'client/html/catalog/lists/quote/standard/template-header';
148
+        $default = 'catalog/lists/quote-header-default.php';
149 149
 
150
-		return $view->render( $view->config( $tplconf, $default ) );
151
-	}
150
+        return $view->render( $view->config( $tplconf, $default ) );
151
+    }
152 152
 
153 153
 
154
-	/**
155
-	 * Returns the sub-client given by its name.
156
-	 *
157
-	 * @param string $type Name of the client type
158
-	 * @param string|null $name Name of the sub-client (Default if null)
159
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
160
-	 */
161
-	public function getSubClient( $type, $name = null )
162
-	{
163
-		/** client/html/catalog/lists/quote/decorators/excludes
164
-		 * Excludes decorators added by the "common" option from the catalog list quote html client
165
-		 *
166
-		 * Decorators extend the functionality of a class by adding new aspects
167
-		 * (e.g. log what is currently done), executing the methods of the underlying
168
-		 * class only in certain conditions (e.g. only for logged in users) or
169
-		 * modify what is returned to the caller.
170
-		 *
171
-		 * This option allows you to remove a decorator added via
172
-		 * "client/html/common/decorators/default" before they are wrapped
173
-		 * around the html client.
174
-		 *
175
-		 *  client/html/catalog/lists/quote/decorators/excludes = array( 'decorator1' )
176
-		 *
177
-		 * This would remove the decorator named "decorator1" from the list of
178
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
179
-		 * "client/html/common/decorators/default" to the html client.
180
-		 *
181
-		 * @param array List of decorator names
182
-		 * @since 2015.08
183
-		 * @category Developer
184
-		 * @see client/html/common/decorators/default
185
-		 * @see client/html/catalog/lists/quote/decorators/global
186
-		 * @see client/html/catalog/lists/quote/decorators/local
187
-		 */
154
+    /**
155
+     * Returns the sub-client given by its name.
156
+     *
157
+     * @param string $type Name of the client type
158
+     * @param string|null $name Name of the sub-client (Default if null)
159
+     * @return \Aimeos\Client\Html\Iface Sub-client object
160
+     */
161
+    public function getSubClient( $type, $name = null )
162
+    {
163
+        /** client/html/catalog/lists/quote/decorators/excludes
164
+         * Excludes decorators added by the "common" option from the catalog list quote html client
165
+         *
166
+         * Decorators extend the functionality of a class by adding new aspects
167
+         * (e.g. log what is currently done), executing the methods of the underlying
168
+         * class only in certain conditions (e.g. only for logged in users) or
169
+         * modify what is returned to the caller.
170
+         *
171
+         * This option allows you to remove a decorator added via
172
+         * "client/html/common/decorators/default" before they are wrapped
173
+         * around the html client.
174
+         *
175
+         *  client/html/catalog/lists/quote/decorators/excludes = array( 'decorator1' )
176
+         *
177
+         * This would remove the decorator named "decorator1" from the list of
178
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
179
+         * "client/html/common/decorators/default" to the html client.
180
+         *
181
+         * @param array List of decorator names
182
+         * @since 2015.08
183
+         * @category Developer
184
+         * @see client/html/common/decorators/default
185
+         * @see client/html/catalog/lists/quote/decorators/global
186
+         * @see client/html/catalog/lists/quote/decorators/local
187
+         */
188 188
 
189
-		/** client/html/catalog/lists/quote/decorators/global
190
-		 * Adds a list of globally available decorators only to the catalog list quote html client
191
-		 *
192
-		 * Decorators extend the functionality of a class by adding new aspects
193
-		 * (e.g. log what is currently done), executing the methods of the underlying
194
-		 * class only in certain conditions (e.g. only for logged in users) or
195
-		 * modify what is returned to the caller.
196
-		 *
197
-		 * This option allows you to wrap global decorators
198
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
199
-		 *
200
-		 *  client/html/catalog/lists/quote/decorators/global = array( 'decorator1' )
201
-		 *
202
-		 * This would add the decorator named "decorator1" defined by
203
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
204
-		 *
205
-		 * @param array List of decorator names
206
-		 * @since 2015.08
207
-		 * @category Developer
208
-		 * @see client/html/common/decorators/default
209
-		 * @see client/html/catalog/lists/quote/decorators/excludes
210
-		 * @see client/html/catalog/lists/quote/decorators/local
211
-		 */
189
+        /** client/html/catalog/lists/quote/decorators/global
190
+         * Adds a list of globally available decorators only to the catalog list quote html client
191
+         *
192
+         * Decorators extend the functionality of a class by adding new aspects
193
+         * (e.g. log what is currently done), executing the methods of the underlying
194
+         * class only in certain conditions (e.g. only for logged in users) or
195
+         * modify what is returned to the caller.
196
+         *
197
+         * This option allows you to wrap global decorators
198
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
199
+         *
200
+         *  client/html/catalog/lists/quote/decorators/global = array( 'decorator1' )
201
+         *
202
+         * This would add the decorator named "decorator1" defined by
203
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
204
+         *
205
+         * @param array List of decorator names
206
+         * @since 2015.08
207
+         * @category Developer
208
+         * @see client/html/common/decorators/default
209
+         * @see client/html/catalog/lists/quote/decorators/excludes
210
+         * @see client/html/catalog/lists/quote/decorators/local
211
+         */
212 212
 
213
-		/** client/html/catalog/lists/quote/decorators/local
214
-		 * Adds a list of local decorators only to the catalog list quote html client
215
-		 *
216
-		 * Decorators extend the functionality of a class by adding new aspects
217
-		 * (e.g. log what is currently done), executing the methods of the underlying
218
-		 * class only in certain conditions (e.g. only for logged in users) or
219
-		 * modify what is returned to the caller.
220
-		 *
221
-		 * This option allows you to wrap local decorators
222
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
223
-		 *
224
-		 *  client/html/catalog/lists/quote/decorators/local = array( 'decorator2' )
225
-		 *
226
-		 * This would add the decorator named "decorator2" defined by
227
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
228
-		 *
229
-		 * @param array List of decorator names
230
-		 * @since 2015.08
231
-		 * @category Developer
232
-		 * @see client/html/common/decorators/default
233
-		 * @see client/html/catalog/lists/quote/decorators/excludes
234
-		 * @see client/html/catalog/lists/quote/decorators/global
235
-		 */
213
+        /** client/html/catalog/lists/quote/decorators/local
214
+         * Adds a list of local decorators only to the catalog list quote html client
215
+         *
216
+         * Decorators extend the functionality of a class by adding new aspects
217
+         * (e.g. log what is currently done), executing the methods of the underlying
218
+         * class only in certain conditions (e.g. only for logged in users) or
219
+         * modify what is returned to the caller.
220
+         *
221
+         * This option allows you to wrap local decorators
222
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
223
+         *
224
+         *  client/html/catalog/lists/quote/decorators/local = array( 'decorator2' )
225
+         *
226
+         * This would add the decorator named "decorator2" defined by
227
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
228
+         *
229
+         * @param array List of decorator names
230
+         * @since 2015.08
231
+         * @category Developer
232
+         * @see client/html/common/decorators/default
233
+         * @see client/html/catalog/lists/quote/decorators/excludes
234
+         * @see client/html/catalog/lists/quote/decorators/global
235
+         */
236 236
 
237
-		return $this->createSubClient( 'catalog/lists/quote/' . $type, $name );
238
-	}
237
+        return $this->createSubClient( 'catalog/lists/quote/' . $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->quoteItems = array();
265
-			if( isset( $view->listCatPath ) )
266
-			{
267
-				$catPath = $view->listCatPath;
268
-				if( ( $catItem = end( $catPath ) ) !== false ) {
269
-					$view->quoteItems = $catItem->getRefItems( 'text', 'quote', 'default' );
270
-				}
271
-			}
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->quoteItems = array();
265
+            if( isset( $view->listCatPath ) )
266
+            {
267
+                $catPath = $view->listCatPath;
268
+                if( ( $catItem = end( $catPath ) ) !== false ) {
269
+                    $view->quoteItems = $catItem->getRefItems( 'text', 'quote', 'default' );
270
+                }
271
+            }
272 272
 
273
-			$this->cache = $view;
274
-		}
273
+            $this->cache = $view;
274
+        }
275 275
 
276
-		return $this->cache;
277
-	}
276
+        return $this->cache;
277
+    }
278 278
 }
279 279
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Detail/Bought/Standard.php 1 patch
Indentation   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -18,302 +18,302 @@
 block discarded – undo
18 18
  * @subpackage Html
19 19
  */
20 20
 class Standard
21
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
22
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
21
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
22
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
23 23
 {
24
-	/** client/html/catalog/detail/bought/standard/subparts
25
-	 * List of HTML sub-clients rendered within the catalog detail bought section
26
-	 *
27
-	 * The output of the frontend is composed of the code generated by the HTML
28
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
29
-	 * that are responsible for rendering certain sub-parts of the output. The
30
-	 * sub-clients can contain HTML clients themselves and therefore a
31
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
32
-	 * the output that is placed inside the container of its parent.
33
-	 *
34
-	 * At first, always the HTML code generated by the parent is printed, then
35
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
36
-	 * determines the order of the output of these sub-clients inside the parent
37
-	 * container. If the configured list of clients is
38
-	 *
39
-	 *  array( "subclient1", "subclient2" )
40
-	 *
41
-	 * you can easily change the order of the output by reordering the subparts:
42
-	 *
43
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
44
-	 *
45
-	 * You can also remove one or more parts if they shouldn't be rendered:
46
-	 *
47
-	 *  client/html/<clients>/subparts = array( "subclient1" )
48
-	 *
49
-	 * As the clients only generates structural HTML, the layout defined via CSS
50
-	 * should support adding, removing or reordering content by a fluid like
51
-	 * design.
52
-	 *
53
-	 * @param array List of sub-client names
54
-	 * @since 2014.09
55
-	 * @category Developer
56
-	 */
57
-	private $subPartPath = 'client/html/catalog/detail/bought/standard/subparts';
58
-	private $subPartNames = array();
59
-	private $tags = array();
60
-	private $expire;
61
-	private $cache;
62
-
63
-
64
-	/**
65
-	 * Returns the HTML code for insertion into the body.
66
-	 *
67
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
68
-	 * @param array &$tags Result array for the list of tags that are associated to the output
69
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
70
-	 * @return string HTML code
71
-	 */
72
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
-	{
74
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
75
-
76
-		$html = '';
77
-		foreach( $this->getSubClients() as $subclient ) {
78
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
79
-		}
80
-		$view->boughtBody = $html;
81
-
82
-		/** client/html/catalog/detail/bought/standard/template-body
83
-		 * Relative path to the HTML body template of the catalog detail bought client.
84
-		 *
85
-		 * The template file contains the HTML code and processing instructions
86
-		 * to generate the result shown in the body of the frontend. The
87
-		 * configuration string is the path to the template file relative
88
-		 * to the templates directory (usually in client/html/templates).
89
-		 *
90
-		 * You can overwrite the template file configuration in extensions and
91
-		 * provide alternative templates. These alternative templates should be
92
-		 * named like the default one but with the string "standard" replaced by
93
-		 * an unique name. You may use the name of your project for this. If
94
-		 * you've implemented an alternative client class as well, "standard"
95
-		 * should be replaced by the name of the new class.
96
-		 *
97
-		 * @param string Relative path to the template creating code for the HTML page body
98
-		 * @since 2014.03
99
-		 * @category Developer
100
-		 * @see client/html/catalog/detail/bought/standard/template-header
101
-		 */
102
-		$tplconf = 'client/html/catalog/detail/bought/standard/template-body';
103
-		$default = 'catalog/detail/bought-body-default.php';
104
-
105
-		return $view->render( $view->config( $tplconf, $default ) );
106
-	}
107
-
108
-
109
-	/**
110
-	 * Returns the HTML string for insertion into the header.
111
-	 *
112
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
113
-	 * @param array &$tags Result array for the list of tags that are associated to the output
114
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
115
-	 * @return string|null String including HTML tags for the header on error
116
-	 */
117
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
-	{
119
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
120
-
121
-		$html = '';
122
-		foreach( $this->getSubClients() as $subclient ) {
123
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
124
-		}
125
-		$view->boughtHeader = $html;
126
-
127
-		/** client/html/catalog/detail/bought/standard/template-header
128
-		 * Relative path to the HTML header template of the catalog detail bought client.
129
-		 *
130
-		 * The template file contains the HTML code and processing instructions
131
-		 * to generate the HTML code that is inserted into the HTML page header
132
-		 * of the rendered page in the frontend. The configuration string is the
133
-		 * path to the template file relative to the templates directory (usually
134
-		 * in client/html/templates).
135
-		 *
136
-		 * You can overwrite the template file configuration in extensions and
137
-		 * provide alternative templates. These alternative templates should be
138
-		 * named like the default one but with the string "standard" replaced by
139
-		 * an unique name. You may use the name of your project for this. If
140
-		 * you've implemented an alternative client class as well, "standard"
141
-		 * should be replaced by the name of the new class.
142
-		 *
143
-		 * @param string Relative path to the template creating code for the HTML page head
144
-		 * @since 2014.03
145
-		 * @category Developer
146
-		 * @see client/html/catalog/detail/bought/standard/template-body
147
-		 */
148
-		$tplconf = 'client/html/catalog/detail/bought/standard/template-header';
149
-		$default = 'catalog/detail/bought-header-default.php';
150
-
151
-		return $view->render( $view->config( $tplconf, $default ) );
152
-	}
153
-
154
-
155
-	/**
156
-	 * Returns the sub-client given by its name.
157
-	 *
158
-	 * @param string $type Name of the client type
159
-	 * @param string|null $name Name of the sub-client (Default if null)
160
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
161
-	 */
162
-	public function getSubClient( $type, $name = null )
163
-	{
164
-		/** client/html/catalog/detail/bought/decorators/excludes
165
-		 * Excludes decorators added by the "common" option from the catalog detail bought html client
166
-		 *
167
-		 * Decorators extend the functionality of a class by adding new aspects
168
-		 * (e.g. log what is currently done), executing the methods of the underlying
169
-		 * class only in certain conditions (e.g. only for logged in users) or
170
-		 * modify what is returned to the caller.
171
-		 *
172
-		 * This option allows you to remove a decorator added via
173
-		 * "client/html/common/decorators/default" before they are wrapped
174
-		 * around the html client.
175
-		 *
176
-		 *  client/html/catalog/detail/bought/decorators/excludes = array( 'decorator1' )
177
-		 *
178
-		 * This would remove the decorator named "decorator1" from the list of
179
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
-		 * "client/html/common/decorators/default" to the html client.
181
-		 *
182
-		 * @param array List of decorator names
183
-		 * @since 2015.08
184
-		 * @category Developer
185
-		 * @see client/html/common/decorators/default
186
-		 * @see client/html/catalog/detail/bought/decorators/global
187
-		 * @see client/html/catalog/detail/bought/decorators/local
188
-		 */
189
-
190
-		/** client/html/catalog/detail/bought/decorators/global
191
-		 * Adds a list of globally available decorators only to the catalog detail bought html client
192
-		 *
193
-		 * Decorators extend the functionality of a class by adding new aspects
194
-		 * (e.g. log what is currently done), executing the methods of the underlying
195
-		 * class only in certain conditions (e.g. only for logged in users) or
196
-		 * modify what is returned to the caller.
197
-		 *
198
-		 * This option allows you to wrap global decorators
199
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
-		 *
201
-		 *  client/html/catalog/detail/bought/decorators/global = array( 'decorator1' )
202
-		 *
203
-		 * This would add the decorator named "decorator1" defined by
204
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
-		 *
206
-		 * @param array List of decorator names
207
-		 * @since 2015.08
208
-		 * @category Developer
209
-		 * @see client/html/common/decorators/default
210
-		 * @see client/html/catalog/detail/bought/decorators/excludes
211
-		 * @see client/html/catalog/detail/bought/decorators/local
212
-		 */
213
-
214
-		/** client/html/catalog/detail/bought/decorators/local
215
-		 * Adds a list of local decorators only to the catalog detail bought html client
216
-		 *
217
-		 * Decorators extend the functionality of a class by adding new aspects
218
-		 * (e.g. log what is currently done), executing the methods of the underlying
219
-		 * class only in certain conditions (e.g. only for logged in users) or
220
-		 * modify what is returned to the caller.
221
-		 *
222
-		 * This option allows you to wrap local decorators
223
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
224
-		 *
225
-		 *  client/html/catalog/detail/bought/decorators/local = array( 'decorator2' )
226
-		 *
227
-		 * This would add the decorator named "decorator2" defined by
228
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
229
-		 *
230
-		 * @param array List of decorator names
231
-		 * @since 2015.08
232
-		 * @category Developer
233
-		 * @see client/html/common/decorators/default
234
-		 * @see client/html/catalog/detail/bought/decorators/excludes
235
-		 * @see client/html/catalog/detail/bought/decorators/global
236
-		 */
237
-
238
-		return $this->createSubClient( 'catalog/detail/bought/' . $type, $name );
239
-	}
240
-
241
-
242
-	/**
243
-	 * Returns the list of sub-client names configured for the client.
244
-	 *
245
-	 * @return array List of HTML client names
246
-	 */
247
-	protected function getSubClientNames()
248
-	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
-	}
251
-
252
-
253
-	/**
254
-	 * Sets the necessary parameter values in the view.
255
-	 *
256
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
257
-	 * @param array &$tags Result array for the list of tags that are associated to the output
258
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
259
-	 * @return \Aimeos\MW\View\Iface Modified view object
260
-	 */
261
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
-	{
263
-		if( !isset( $this->cache ) )
264
-		{
265
-			if( isset( $view->detailProductItem ) )
266
-			{
267
-				$context = $this->getContext();
268
-				$config = $context->getConfig();
269
-				$domains = array( 'text', 'price', 'media' );
270
-				$products = $view->detailProductItem->getRefItems( 'product', null, 'bought-together' );
271
-
272
-				/** client/html/catalog/detail/domains
273
-				 * A list of domain names whose items should be available in the catalog view templates
274
-				 *
275
-				 * @see client/html/catalog/detail/domains
276
-				 */
277
-				$domains = $config->get( 'client/html/catalog/detail/domains', $domains );
278
-
279
-				/** client/html/catalog/detail/bought/domains
280
-				 * A list of domain names whose items should be available in the bought part of the catalog detail view templates
281
-				 *
282
-				 * The templates rendering bought related data usually add
283
-				 * the images and texts associated to each item. If you want to
284
-				 * display additional content like the attributes, you can configure
285
-				 * your own list of domains (attribute, media, price, product, text,
286
-				 * etc. are domains) whose items are fetched from the storage.
287
-				 * Please keep in mind that the more domains you add to the
288
-				 * configuration, the more time is required for fetching the content!
289
-				 *
290
-				 * This configuration option can be overwritten by the
291
-				 * "client/html/catalog/detail/domains" configuration option that
292
-				 * allows to configure the domain names of the items fetched
293
-				 * specifically for all types of product listings.
294
-				 *
295
-				 * @param array List of domain names
296
-				 * @since 2015.09
297
-				 * @category Developer
298
-				 * @see client/html/catalog/detail/domains
299
-				*/
300
-				$domains = $config->get( 'client/html/catalog/detail/bought/domains', $domains );
301
-
302
-				$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
303
-
304
-				$view->boughtItems = $controller->getProductItems( array_keys( $products ), $domains );
305
-				$view->boughtPosItems = $products;
306
-
307
-				$this->addMetaItem( $view->boughtItems, 'product', $this->expire, $this->tags );
308
-				$this->addMetaList( array_keys( $view->boughtItems ), 'product', $this->expire );
309
-			}
310
-
311
-			$this->cache = $view;
312
-		}
313
-
314
-		$expire = $this->expires( $this->expire, $expire );
315
-		$tags = array_merge( $tags, $this->tags );
316
-
317
-		return $this->cache;
318
-	}
24
+    /** client/html/catalog/detail/bought/standard/subparts
25
+     * List of HTML sub-clients rendered within the catalog detail bought section
26
+     *
27
+     * The output of the frontend is composed of the code generated by the HTML
28
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
29
+     * that are responsible for rendering certain sub-parts of the output. The
30
+     * sub-clients can contain HTML clients themselves and therefore a
31
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
32
+     * the output that is placed inside the container of its parent.
33
+     *
34
+     * At first, always the HTML code generated by the parent is printed, then
35
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
36
+     * determines the order of the output of these sub-clients inside the parent
37
+     * container. If the configured list of clients is
38
+     *
39
+     *  array( "subclient1", "subclient2" )
40
+     *
41
+     * you can easily change the order of the output by reordering the subparts:
42
+     *
43
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
44
+     *
45
+     * You can also remove one or more parts if they shouldn't be rendered:
46
+     *
47
+     *  client/html/<clients>/subparts = array( "subclient1" )
48
+     *
49
+     * As the clients only generates structural HTML, the layout defined via CSS
50
+     * should support adding, removing or reordering content by a fluid like
51
+     * design.
52
+     *
53
+     * @param array List of sub-client names
54
+     * @since 2014.09
55
+     * @category Developer
56
+     */
57
+    private $subPartPath = 'client/html/catalog/detail/bought/standard/subparts';
58
+    private $subPartNames = array();
59
+    private $tags = array();
60
+    private $expire;
61
+    private $cache;
62
+
63
+
64
+    /**
65
+     * Returns the HTML code for insertion into the body.
66
+     *
67
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
68
+     * @param array &$tags Result array for the list of tags that are associated to the output
69
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
70
+     * @return string HTML code
71
+     */
72
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
+    {
74
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
75
+
76
+        $html = '';
77
+        foreach( $this->getSubClients() as $subclient ) {
78
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
79
+        }
80
+        $view->boughtBody = $html;
81
+
82
+        /** client/html/catalog/detail/bought/standard/template-body
83
+         * Relative path to the HTML body template of the catalog detail bought client.
84
+         *
85
+         * The template file contains the HTML code and processing instructions
86
+         * to generate the result shown in the body of the frontend. The
87
+         * configuration string is the path to the template file relative
88
+         * to the templates directory (usually in client/html/templates).
89
+         *
90
+         * You can overwrite the template file configuration in extensions and
91
+         * provide alternative templates. These alternative templates should be
92
+         * named like the default one but with the string "standard" replaced by
93
+         * an unique name. You may use the name of your project for this. If
94
+         * you've implemented an alternative client class as well, "standard"
95
+         * should be replaced by the name of the new class.
96
+         *
97
+         * @param string Relative path to the template creating code for the HTML page body
98
+         * @since 2014.03
99
+         * @category Developer
100
+         * @see client/html/catalog/detail/bought/standard/template-header
101
+         */
102
+        $tplconf = 'client/html/catalog/detail/bought/standard/template-body';
103
+        $default = 'catalog/detail/bought-body-default.php';
104
+
105
+        return $view->render( $view->config( $tplconf, $default ) );
106
+    }
107
+
108
+
109
+    /**
110
+     * Returns the HTML string for insertion into the header.
111
+     *
112
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
113
+     * @param array &$tags Result array for the list of tags that are associated to the output
114
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
115
+     * @return string|null String including HTML tags for the header on error
116
+     */
117
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
+    {
119
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
120
+
121
+        $html = '';
122
+        foreach( $this->getSubClients() as $subclient ) {
123
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
124
+        }
125
+        $view->boughtHeader = $html;
126
+
127
+        /** client/html/catalog/detail/bought/standard/template-header
128
+         * Relative path to the HTML header template of the catalog detail bought client.
129
+         *
130
+         * The template file contains the HTML code and processing instructions
131
+         * to generate the HTML code that is inserted into the HTML page header
132
+         * of the rendered page in the frontend. The configuration string is the
133
+         * path to the template file relative to the templates directory (usually
134
+         * in client/html/templates).
135
+         *
136
+         * You can overwrite the template file configuration in extensions and
137
+         * provide alternative templates. These alternative templates should be
138
+         * named like the default one but with the string "standard" replaced by
139
+         * an unique name. You may use the name of your project for this. If
140
+         * you've implemented an alternative client class as well, "standard"
141
+         * should be replaced by the name of the new class.
142
+         *
143
+         * @param string Relative path to the template creating code for the HTML page head
144
+         * @since 2014.03
145
+         * @category Developer
146
+         * @see client/html/catalog/detail/bought/standard/template-body
147
+         */
148
+        $tplconf = 'client/html/catalog/detail/bought/standard/template-header';
149
+        $default = 'catalog/detail/bought-header-default.php';
150
+
151
+        return $view->render( $view->config( $tplconf, $default ) );
152
+    }
153
+
154
+
155
+    /**
156
+     * Returns the sub-client given by its name.
157
+     *
158
+     * @param string $type Name of the client type
159
+     * @param string|null $name Name of the sub-client (Default if null)
160
+     * @return \Aimeos\Client\Html\Iface Sub-client object
161
+     */
162
+    public function getSubClient( $type, $name = null )
163
+    {
164
+        /** client/html/catalog/detail/bought/decorators/excludes
165
+         * Excludes decorators added by the "common" option from the catalog detail bought html client
166
+         *
167
+         * Decorators extend the functionality of a class by adding new aspects
168
+         * (e.g. log what is currently done), executing the methods of the underlying
169
+         * class only in certain conditions (e.g. only for logged in users) or
170
+         * modify what is returned to the caller.
171
+         *
172
+         * This option allows you to remove a decorator added via
173
+         * "client/html/common/decorators/default" before they are wrapped
174
+         * around the html client.
175
+         *
176
+         *  client/html/catalog/detail/bought/decorators/excludes = array( 'decorator1' )
177
+         *
178
+         * This would remove the decorator named "decorator1" from the list of
179
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
+         * "client/html/common/decorators/default" to the html client.
181
+         *
182
+         * @param array List of decorator names
183
+         * @since 2015.08
184
+         * @category Developer
185
+         * @see client/html/common/decorators/default
186
+         * @see client/html/catalog/detail/bought/decorators/global
187
+         * @see client/html/catalog/detail/bought/decorators/local
188
+         */
189
+
190
+        /** client/html/catalog/detail/bought/decorators/global
191
+         * Adds a list of globally available decorators only to the catalog detail bought html client
192
+         *
193
+         * Decorators extend the functionality of a class by adding new aspects
194
+         * (e.g. log what is currently done), executing the methods of the underlying
195
+         * class only in certain conditions (e.g. only for logged in users) or
196
+         * modify what is returned to the caller.
197
+         *
198
+         * This option allows you to wrap global decorators
199
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
+         *
201
+         *  client/html/catalog/detail/bought/decorators/global = array( 'decorator1' )
202
+         *
203
+         * This would add the decorator named "decorator1" defined by
204
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
+         *
206
+         * @param array List of decorator names
207
+         * @since 2015.08
208
+         * @category Developer
209
+         * @see client/html/common/decorators/default
210
+         * @see client/html/catalog/detail/bought/decorators/excludes
211
+         * @see client/html/catalog/detail/bought/decorators/local
212
+         */
213
+
214
+        /** client/html/catalog/detail/bought/decorators/local
215
+         * Adds a list of local decorators only to the catalog detail bought html client
216
+         *
217
+         * Decorators extend the functionality of a class by adding new aspects
218
+         * (e.g. log what is currently done), executing the methods of the underlying
219
+         * class only in certain conditions (e.g. only for logged in users) or
220
+         * modify what is returned to the caller.
221
+         *
222
+         * This option allows you to wrap local decorators
223
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
224
+         *
225
+         *  client/html/catalog/detail/bought/decorators/local = array( 'decorator2' )
226
+         *
227
+         * This would add the decorator named "decorator2" defined by
228
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
229
+         *
230
+         * @param array List of decorator names
231
+         * @since 2015.08
232
+         * @category Developer
233
+         * @see client/html/common/decorators/default
234
+         * @see client/html/catalog/detail/bought/decorators/excludes
235
+         * @see client/html/catalog/detail/bought/decorators/global
236
+         */
237
+
238
+        return $this->createSubClient( 'catalog/detail/bought/' . $type, $name );
239
+    }
240
+
241
+
242
+    /**
243
+     * Returns the list of sub-client names configured for the client.
244
+     *
245
+     * @return array List of HTML client names
246
+     */
247
+    protected function getSubClientNames()
248
+    {
249
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+    }
251
+
252
+
253
+    /**
254
+     * Sets the necessary parameter values in the view.
255
+     *
256
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
257
+     * @param array &$tags Result array for the list of tags that are associated to the output
258
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
259
+     * @return \Aimeos\MW\View\Iface Modified view object
260
+     */
261
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
+    {
263
+        if( !isset( $this->cache ) )
264
+        {
265
+            if( isset( $view->detailProductItem ) )
266
+            {
267
+                $context = $this->getContext();
268
+                $config = $context->getConfig();
269
+                $domains = array( 'text', 'price', 'media' );
270
+                $products = $view->detailProductItem->getRefItems( 'product', null, 'bought-together' );
271
+
272
+                /** client/html/catalog/detail/domains
273
+                 * A list of domain names whose items should be available in the catalog view templates
274
+                 *
275
+                 * @see client/html/catalog/detail/domains
276
+                 */
277
+                $domains = $config->get( 'client/html/catalog/detail/domains', $domains );
278
+
279
+                /** client/html/catalog/detail/bought/domains
280
+                 * A list of domain names whose items should be available in the bought part of the catalog detail view templates
281
+                 *
282
+                 * The templates rendering bought related data usually add
283
+                 * the images and texts associated to each item. If you want to
284
+                 * display additional content like the attributes, you can configure
285
+                 * your own list of domains (attribute, media, price, product, text,
286
+                 * etc. are domains) whose items are fetched from the storage.
287
+                 * Please keep in mind that the more domains you add to the
288
+                 * configuration, the more time is required for fetching the content!
289
+                 *
290
+                 * This configuration option can be overwritten by the
291
+                 * "client/html/catalog/detail/domains" configuration option that
292
+                 * allows to configure the domain names of the items fetched
293
+                 * specifically for all types of product listings.
294
+                 *
295
+                 * @param array List of domain names
296
+                 * @since 2015.09
297
+                 * @category Developer
298
+                 * @see client/html/catalog/detail/domains
299
+                 */
300
+                $domains = $config->get( 'client/html/catalog/detail/bought/domains', $domains );
301
+
302
+                $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
303
+
304
+                $view->boughtItems = $controller->getProductItems( array_keys( $products ), $domains );
305
+                $view->boughtPosItems = $products;
306
+
307
+                $this->addMetaItem( $view->boughtItems, 'product', $this->expire, $this->tags );
308
+                $this->addMetaList( array_keys( $view->boughtItems ), 'product', $this->expire );
309
+            }
310
+
311
+            $this->cache = $view;
312
+        }
313
+
314
+        $expire = $this->expires( $this->expire, $expire );
315
+        $tags = array_merge( $tags, $this->tags );
316
+
317
+        return $this->cache;
318
+    }
319 319
 }
320 320
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Detail/Social/Standard.php 1 patch
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -19,231 +19,231 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/detail/social/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog detail social section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.09
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/detail/social/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->socialBody = $html;
79
-
80
-		/** client/html/catalog/detail/social/standard/template-body
81
-		 * Relative path to the HTML body template of the catalog detail social 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.09
97
-		 * @category Developer
98
-		 * @see client/html/catalog/detail/social/standard/template-header
99
-		 */
100
-		$tplconf = 'client/html/catalog/detail/social/standard/template-body';
101
-		$default = 'catalog/detail/social-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->socialHeader = $html;
124
-
125
-		/** client/html/catalog/detail/social/standard/template-header
126
-		 * Relative path to the HTML header template of the catalog detail social 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.09
143
-		 * @category Developer
144
-		 * @see client/html/catalog/detail/social/standard/template-body
145
-		 */
146
-		$tplconf = 'client/html/catalog/detail/social/standard/template-header';
147
-		$default = 'catalog/detail/social-header-default.php';
148
-
149
-		return $view->render( $view->config( $tplconf, $default ) );
150
-	}
151
-
152
-
153
-	/**
154
-	 * Returns the sub-client given by its name.
155
-	 *
156
-	 * @param string $type Name of the client type
157
-	 * @param string|null $name Name of the sub-client (Default if null)
158
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
159
-	 */
160
-	public function getSubClient( $type, $name = null )
161
-	{
162
-		/** client/html/catalog/detail/social/decorators/excludes
163
-		 * Excludes decorators added by the "common" option from the catalog detail social html client
164
-		 *
165
-		 * Decorators extend the functionality of a class by adding new aspects
166
-		 * (e.g. log what is currently done), executing the methods of the underlying
167
-		 * class only in certain conditions (e.g. only for logged in users) or
168
-		 * modify what is returned to the caller.
169
-		 *
170
-		 * This option allows you to remove a decorator added via
171
-		 * "client/html/common/decorators/default" before they are wrapped
172
-		 * around the html client.
173
-		 *
174
-		 *  client/html/catalog/detail/social/decorators/excludes = array( 'decorator1' )
175
-		 *
176
-		 * This would remove the decorator named "decorator1" from the list of
177
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
178
-		 * "client/html/common/decorators/default" to the html client.
179
-		 *
180
-		 * @param array List of decorator names
181
-		 * @since 2015.08
182
-		 * @category Developer
183
-		 * @see client/html/common/decorators/default
184
-		 * @see client/html/catalog/detail/social/decorators/global
185
-		 * @see client/html/catalog/detail/social/decorators/local
186
-		 */
187
-
188
-		/** client/html/catalog/detail/social/decorators/global
189
-		 * Adds a list of globally available decorators only to the catalog detail social html client
190
-		 *
191
-		 * Decorators extend the functionality of a class by adding new aspects
192
-		 * (e.g. log what is currently done), executing the methods of the underlying
193
-		 * class only in certain conditions (e.g. only for logged in users) or
194
-		 * modify what is returned to the caller.
195
-		 *
196
-		 * This option allows you to wrap global decorators
197
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
198
-		 *
199
-		 *  client/html/catalog/detail/social/decorators/global = array( 'decorator1' )
200
-		 *
201
-		 * This would add the decorator named "decorator1" defined by
202
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
203
-		 *
204
-		 * @param array List of decorator names
205
-		 * @since 2015.08
206
-		 * @category Developer
207
-		 * @see client/html/common/decorators/default
208
-		 * @see client/html/catalog/detail/social/decorators/excludes
209
-		 * @see client/html/catalog/detail/social/decorators/local
210
-		 */
211
-
212
-		/** client/html/catalog/detail/social/decorators/local
213
-		 * Adds a list of local decorators only to the catalog detail social html client
214
-		 *
215
-		 * Decorators extend the functionality of a class by adding new aspects
216
-		 * (e.g. log what is currently done), executing the methods of the underlying
217
-		 * class only in certain conditions (e.g. only for logged in users) or
218
-		 * modify what is returned to the caller.
219
-		 *
220
-		 * This option allows you to wrap local decorators
221
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
222
-		 *
223
-		 *  client/html/catalog/detail/social/decorators/local = array( 'decorator2' )
224
-		 *
225
-		 * This would add the decorator named "decorator2" defined by
226
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
227
-		 *
228
-		 * @param array List of decorator names
229
-		 * @since 2015.08
230
-		 * @category Developer
231
-		 * @see client/html/common/decorators/default
232
-		 * @see client/html/catalog/detail/social/decorators/excludes
233
-		 * @see client/html/catalog/detail/social/decorators/global
234
-		 */
235
-
236
-		return $this->createSubClient( 'catalog/detail/social/' . $type, $name );
237
-	}
238
-
239
-
240
-	/**
241
-	 * Returns the list of sub-client names configured for the client.
242
-	 *
243
-	 * @return array List of HTML client names
244
-	 */
245
-	protected function getSubClientNames()
246
-	{
247
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
248
-	}
25
+    /** client/html/catalog/detail/social/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog detail social section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.09
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/detail/social/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->socialBody = $html;
79
+
80
+        /** client/html/catalog/detail/social/standard/template-body
81
+         * Relative path to the HTML body template of the catalog detail social 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.09
97
+         * @category Developer
98
+         * @see client/html/catalog/detail/social/standard/template-header
99
+         */
100
+        $tplconf = 'client/html/catalog/detail/social/standard/template-body';
101
+        $default = 'catalog/detail/social-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->socialHeader = $html;
124
+
125
+        /** client/html/catalog/detail/social/standard/template-header
126
+         * Relative path to the HTML header template of the catalog detail social 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.09
143
+         * @category Developer
144
+         * @see client/html/catalog/detail/social/standard/template-body
145
+         */
146
+        $tplconf = 'client/html/catalog/detail/social/standard/template-header';
147
+        $default = 'catalog/detail/social-header-default.php';
148
+
149
+        return $view->render( $view->config( $tplconf, $default ) );
150
+    }
151
+
152
+
153
+    /**
154
+     * Returns the sub-client given by its name.
155
+     *
156
+     * @param string $type Name of the client type
157
+     * @param string|null $name Name of the sub-client (Default if null)
158
+     * @return \Aimeos\Client\Html\Iface Sub-client object
159
+     */
160
+    public function getSubClient( $type, $name = null )
161
+    {
162
+        /** client/html/catalog/detail/social/decorators/excludes
163
+         * Excludes decorators added by the "common" option from the catalog detail social html client
164
+         *
165
+         * Decorators extend the functionality of a class by adding new aspects
166
+         * (e.g. log what is currently done), executing the methods of the underlying
167
+         * class only in certain conditions (e.g. only for logged in users) or
168
+         * modify what is returned to the caller.
169
+         *
170
+         * This option allows you to remove a decorator added via
171
+         * "client/html/common/decorators/default" before they are wrapped
172
+         * around the html client.
173
+         *
174
+         *  client/html/catalog/detail/social/decorators/excludes = array( 'decorator1' )
175
+         *
176
+         * This would remove the decorator named "decorator1" from the list of
177
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
178
+         * "client/html/common/decorators/default" to the html client.
179
+         *
180
+         * @param array List of decorator names
181
+         * @since 2015.08
182
+         * @category Developer
183
+         * @see client/html/common/decorators/default
184
+         * @see client/html/catalog/detail/social/decorators/global
185
+         * @see client/html/catalog/detail/social/decorators/local
186
+         */
187
+
188
+        /** client/html/catalog/detail/social/decorators/global
189
+         * Adds a list of globally available decorators only to the catalog detail social html client
190
+         *
191
+         * Decorators extend the functionality of a class by adding new aspects
192
+         * (e.g. log what is currently done), executing the methods of the underlying
193
+         * class only in certain conditions (e.g. only for logged in users) or
194
+         * modify what is returned to the caller.
195
+         *
196
+         * This option allows you to wrap global decorators
197
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
198
+         *
199
+         *  client/html/catalog/detail/social/decorators/global = array( 'decorator1' )
200
+         *
201
+         * This would add the decorator named "decorator1" defined by
202
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
203
+         *
204
+         * @param array List of decorator names
205
+         * @since 2015.08
206
+         * @category Developer
207
+         * @see client/html/common/decorators/default
208
+         * @see client/html/catalog/detail/social/decorators/excludes
209
+         * @see client/html/catalog/detail/social/decorators/local
210
+         */
211
+
212
+        /** client/html/catalog/detail/social/decorators/local
213
+         * Adds a list of local decorators only to the catalog detail social html client
214
+         *
215
+         * Decorators extend the functionality of a class by adding new aspects
216
+         * (e.g. log what is currently done), executing the methods of the underlying
217
+         * class only in certain conditions (e.g. only for logged in users) or
218
+         * modify what is returned to the caller.
219
+         *
220
+         * This option allows you to wrap local decorators
221
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
222
+         *
223
+         *  client/html/catalog/detail/social/decorators/local = array( 'decorator2' )
224
+         *
225
+         * This would add the decorator named "decorator2" defined by
226
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
227
+         *
228
+         * @param array List of decorator names
229
+         * @since 2015.08
230
+         * @category Developer
231
+         * @see client/html/common/decorators/default
232
+         * @see client/html/catalog/detail/social/decorators/excludes
233
+         * @see client/html/catalog/detail/social/decorators/global
234
+         */
235
+
236
+        return $this->createSubClient( 'catalog/detail/social/' . $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
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Detail/Actions/Standard.php 1 patch
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -19,267 +19,267 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/detail/actions/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog detail actions section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.09
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/detail/actions/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $cache;
25
+    /** client/html/catalog/detail/actions/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog detail actions section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.09
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/detail/actions/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $cache;
61 61
 
62 62
 
63
-	/**
64
-	 * Returns the HTML code for insertion into the body.
65
-	 *
66
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
67
-	 * @param array &$tags Result array for the list of tags that are associated to the output
68
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
69
-	 * @return string HTML code
70
-	 */
71
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
72
-	{
73
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
63
+    /**
64
+     * Returns the HTML code for insertion into the body.
65
+     *
66
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
67
+     * @param array &$tags Result array for the list of tags that are associated to the output
68
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
69
+     * @return string HTML code
70
+     */
71
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
72
+    {
73
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
74 74
 
75
-		$html = '';
76
-		foreach( $this->getSubClients() as $subclient ) {
77
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
-		}
79
-		$view->actionsBody = $html;
75
+        $html = '';
76
+        foreach( $this->getSubClients() as $subclient ) {
77
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
+        }
79
+        $view->actionsBody = $html;
80 80
 
81
-		/** client/html/catalog/detail/actions/standard/template-body
82
-		 * Relative path to the HTML body template of the catalog detail actions client.
83
-		 *
84
-		 * The template file contains the HTML code and processing instructions
85
-		 * to generate the result shown in the body of the frontend. The
86
-		 * configuration string is the path to the template file relative
87
-		 * to the templates directory (usually in client/html/templates).
88
-		 *
89
-		 * You can overwrite the template file configuration in extensions and
90
-		 * provide alternative templates. These alternative templates should be
91
-		 * named like the default one but with the string "standard" replaced by
92
-		 * an unique name. You may use the name of your project for this. If
93
-		 * you've implemented an alternative client class as well, "standard"
94
-		 * should be replaced by the name of the new class.
95
-		 *
96
-		 * @param string Relative path to the template creating code for the HTML page body
97
-		 * @since 2014.09
98
-		 * @category Developer
99
-		 * @see client/html/catalog/detail/actions/standard/template-header
100
-		 */
101
-		$tplconf = 'client/html/catalog/detail/actions/standard/template-body';
102
-		$default = 'catalog/detail/actions-body-default.php';
81
+        /** client/html/catalog/detail/actions/standard/template-body
82
+         * Relative path to the HTML body template of the catalog detail actions client.
83
+         *
84
+         * The template file contains the HTML code and processing instructions
85
+         * to generate the result shown in the body of the frontend. The
86
+         * configuration string is the path to the template file relative
87
+         * to the templates directory (usually in client/html/templates).
88
+         *
89
+         * You can overwrite the template file configuration in extensions and
90
+         * provide alternative templates. These alternative templates should be
91
+         * named like the default one but with the string "standard" replaced by
92
+         * an unique name. You may use the name of your project for this. If
93
+         * you've implemented an alternative client class as well, "standard"
94
+         * should be replaced by the name of the new class.
95
+         *
96
+         * @param string Relative path to the template creating code for the HTML page body
97
+         * @since 2014.09
98
+         * @category Developer
99
+         * @see client/html/catalog/detail/actions/standard/template-header
100
+         */
101
+        $tplconf = 'client/html/catalog/detail/actions/standard/template-body';
102
+        $default = 'catalog/detail/actions-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
105
-	}
104
+        return $view->render( $view->config( $tplconf, $default ) );
105
+    }
106 106
 
107 107
 
108
-	/**
109
-	 * Returns the HTML string for insertion into the header.
110
-	 *
111
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
-	 * @param array &$tags Result array for the list of tags that are associated to the output
113
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
-	 * @return string|null String including HTML tags for the header on error
115
-	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
-	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
108
+    /**
109
+     * Returns the HTML string for insertion into the header.
110
+     *
111
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
+     * @param array &$tags Result array for the list of tags that are associated to the output
113
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
+     * @return string|null String including HTML tags for the header on error
115
+     */
116
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
+    {
118
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
119 119
 
120
-		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
-		}
124
-		$view->actionsHeader = $html;
120
+        $html = '';
121
+        foreach( $this->getSubClients() as $subclient ) {
122
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+        }
124
+        $view->actionsHeader = $html;
125 125
 
126
-		/** client/html/catalog/detail/actions/standard/template-header
127
-		 * Relative path to the HTML header template of the catalog detail actions client.
128
-		 *
129
-		 * The template file contains the HTML code and processing instructions
130
-		 * to generate the HTML code that is inserted into the HTML page header
131
-		 * of the rendered page in the frontend. The configuration string is the
132
-		 * path to the template file relative to the templates directory (usually
133
-		 * in client/html/templates).
134
-		 *
135
-		 * You can overwrite the template file configuration in extensions and
136
-		 * provide alternative templates. These alternative templates should be
137
-		 * named like the default one but with the string "standard" replaced by
138
-		 * an unique name. You may use the name of your project for this. If
139
-		 * you've implemented an alternative client class as well, "standard"
140
-		 * should be replaced by the name of the new class.
141
-		 *
142
-		 * @param string Relative path to the template creating code for the HTML page head
143
-		 * @since 2014.09
144
-		 * @category Developer
145
-		 * @see client/html/catalog/detail/actions/standard/template-body
146
-		 */
147
-		$tplconf = 'client/html/catalog/detail/actions/standard/template-header';
148
-		$default = 'catalog/detail/actions-header-default.php';
126
+        /** client/html/catalog/detail/actions/standard/template-header
127
+         * Relative path to the HTML header template of the catalog detail actions client.
128
+         *
129
+         * The template file contains the HTML code and processing instructions
130
+         * to generate the HTML code that is inserted into the HTML page header
131
+         * of the rendered page in the frontend. The configuration string is the
132
+         * path to the template file relative to the templates directory (usually
133
+         * in client/html/templates).
134
+         *
135
+         * You can overwrite the template file configuration in extensions and
136
+         * provide alternative templates. These alternative templates should be
137
+         * named like the default one but with the string "standard" replaced by
138
+         * an unique name. You may use the name of your project for this. If
139
+         * you've implemented an alternative client class as well, "standard"
140
+         * should be replaced by the name of the new class.
141
+         *
142
+         * @param string Relative path to the template creating code for the HTML page head
143
+         * @since 2014.09
144
+         * @category Developer
145
+         * @see client/html/catalog/detail/actions/standard/template-body
146
+         */
147
+        $tplconf = 'client/html/catalog/detail/actions/standard/template-header';
148
+        $default = 'catalog/detail/actions-header-default.php';
149 149
 
150
-		return $view->render( $view->config( $tplconf, $default ) );
151
-	}
150
+        return $view->render( $view->config( $tplconf, $default ) );
151
+    }
152 152
 
153 153
 
154
-	/**
155
-	 * Modifies the cached body content to replace content based on sessions or cookies.
156
-	 *
157
-	 * @param string $content Cached content
158
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
159
-	 * @return string Modified body content
160
-	 */
161
-	public function modifyBody( $content, $uid )
162
-	{
163
-		return $this->replaceSection( $content, $this->getBody( $uid ), 'catalog.detail.actions' );
164
-	}
154
+    /**
155
+     * Modifies the cached body content to replace content based on sessions or cookies.
156
+     *
157
+     * @param string $content Cached content
158
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
159
+     * @return string Modified body content
160
+     */
161
+    public function modifyBody( $content, $uid )
162
+    {
163
+        return $this->replaceSection( $content, $this->getBody( $uid ), 'catalog.detail.actions' );
164
+    }
165 165
 
166 166
 
167
-	/**
168
-	 * Returns the sub-client given by its name.
169
-	 *
170
-	 * @param string $type Name of the client type
171
-	 * @param string|null $name Name of the sub-client (Default if null)
172
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
173
-	 */
174
-	public function getSubClient( $type, $name = null )
175
-	{
176
-		/** client/html/catalog/detail/actions/decorators/excludes
177
-		 * Excludes decorators added by the "common" option from the catalog detail actions html client
178
-		 *
179
-		 * Decorators extend the functionality of a class by adding new aspects
180
-		 * (e.g. log what is currently done), executing the methods of the underlying
181
-		 * class only in certain conditions (e.g. only for logged in users) or
182
-		 * modify what is returned to the caller.
183
-		 *
184
-		 * This option allows you to remove a decorator added via
185
-		 * "client/html/common/decorators/default" before they are wrapped
186
-		 * around the html client.
187
-		 *
188
-		 *  client/html/catalog/detail/actions/decorators/excludes = array( 'decorator1' )
189
-		 *
190
-		 * This would remove the decorator named "decorator1" from the list of
191
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
192
-		 * "client/html/common/decorators/default" to the html client.
193
-		 *
194
-		 * @param array List of decorator names
195
-		 * @since 2015.08
196
-		 * @category Developer
197
-		 * @see client/html/common/decorators/default
198
-		 * @see client/html/catalog/detail/actions/decorators/global
199
-		 * @see client/html/catalog/detail/actions/decorators/local
200
-		 */
167
+    /**
168
+     * Returns the sub-client given by its name.
169
+     *
170
+     * @param string $type Name of the client type
171
+     * @param string|null $name Name of the sub-client (Default if null)
172
+     * @return \Aimeos\Client\Html\Iface Sub-client object
173
+     */
174
+    public function getSubClient( $type, $name = null )
175
+    {
176
+        /** client/html/catalog/detail/actions/decorators/excludes
177
+         * Excludes decorators added by the "common" option from the catalog detail actions html client
178
+         *
179
+         * Decorators extend the functionality of a class by adding new aspects
180
+         * (e.g. log what is currently done), executing the methods of the underlying
181
+         * class only in certain conditions (e.g. only for logged in users) or
182
+         * modify what is returned to the caller.
183
+         *
184
+         * This option allows you to remove a decorator added via
185
+         * "client/html/common/decorators/default" before they are wrapped
186
+         * around the html client.
187
+         *
188
+         *  client/html/catalog/detail/actions/decorators/excludes = array( 'decorator1' )
189
+         *
190
+         * This would remove the decorator named "decorator1" from the list of
191
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
192
+         * "client/html/common/decorators/default" to the html client.
193
+         *
194
+         * @param array List of decorator names
195
+         * @since 2015.08
196
+         * @category Developer
197
+         * @see client/html/common/decorators/default
198
+         * @see client/html/catalog/detail/actions/decorators/global
199
+         * @see client/html/catalog/detail/actions/decorators/local
200
+         */
201 201
 
202
-		/** client/html/catalog/detail/actions/decorators/global
203
-		 * Adds a list of globally available decorators only to the catalog detail actions html client
204
-		 *
205
-		 * Decorators extend the functionality of a class by adding new aspects
206
-		 * (e.g. log what is currently done), executing the methods of the underlying
207
-		 * class only in certain conditions (e.g. only for logged in users) or
208
-		 * modify what is returned to the caller.
209
-		 *
210
-		 * This option allows you to wrap global decorators
211
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
212
-		 *
213
-		 *  client/html/catalog/detail/actions/decorators/global = array( 'decorator1' )
214
-		 *
215
-		 * This would add the decorator named "decorator1" defined by
216
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
217
-		 *
218
-		 * @param array List of decorator names
219
-		 * @since 2015.08
220
-		 * @category Developer
221
-		 * @see client/html/common/decorators/default
222
-		 * @see client/html/catalog/detail/actions/decorators/excludes
223
-		 * @see client/html/catalog/detail/actions/decorators/local
224
-		 */
202
+        /** client/html/catalog/detail/actions/decorators/global
203
+         * Adds a list of globally available decorators only to the catalog detail actions html client
204
+         *
205
+         * Decorators extend the functionality of a class by adding new aspects
206
+         * (e.g. log what is currently done), executing the methods of the underlying
207
+         * class only in certain conditions (e.g. only for logged in users) or
208
+         * modify what is returned to the caller.
209
+         *
210
+         * This option allows you to wrap global decorators
211
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
212
+         *
213
+         *  client/html/catalog/detail/actions/decorators/global = array( 'decorator1' )
214
+         *
215
+         * This would add the decorator named "decorator1" defined by
216
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
217
+         *
218
+         * @param array List of decorator names
219
+         * @since 2015.08
220
+         * @category Developer
221
+         * @see client/html/common/decorators/default
222
+         * @see client/html/catalog/detail/actions/decorators/excludes
223
+         * @see client/html/catalog/detail/actions/decorators/local
224
+         */
225 225
 
226
-		/** client/html/catalog/detail/actions/decorators/local
227
-		 * Adds a list of local decorators only to the catalog detail actions html client
228
-		 *
229
-		 * Decorators extend the functionality of a class by adding new aspects
230
-		 * (e.g. log what is currently done), executing the methods of the underlying
231
-		 * class only in certain conditions (e.g. only for logged in users) or
232
-		 * modify what is returned to the caller.
233
-		 *
234
-		 * This option allows you to wrap local decorators
235
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
236
-		 *
237
-		 *  client/html/catalog/detail/actions/decorators/local = array( 'decorator2' )
238
-		 *
239
-		 * This would add the decorator named "decorator2" defined by
240
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
241
-		 *
242
-		 * @param array List of decorator names
243
-		 * @since 2015.08
244
-		 * @category Developer
245
-		 * @see client/html/common/decorators/default
246
-		 * @see client/html/catalog/detail/actions/decorators/excludes
247
-		 * @see client/html/catalog/detail/actions/decorators/global
248
-		 */
226
+        /** client/html/catalog/detail/actions/decorators/local
227
+         * Adds a list of local decorators only to the catalog detail actions html client
228
+         *
229
+         * Decorators extend the functionality of a class by adding new aspects
230
+         * (e.g. log what is currently done), executing the methods of the underlying
231
+         * class only in certain conditions (e.g. only for logged in users) or
232
+         * modify what is returned to the caller.
233
+         *
234
+         * This option allows you to wrap local decorators
235
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
236
+         *
237
+         *  client/html/catalog/detail/actions/decorators/local = array( 'decorator2' )
238
+         *
239
+         * This would add the decorator named "decorator2" defined by
240
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
241
+         *
242
+         * @param array List of decorator names
243
+         * @since 2015.08
244
+         * @category Developer
245
+         * @see client/html/common/decorators/default
246
+         * @see client/html/catalog/detail/actions/decorators/excludes
247
+         * @see client/html/catalog/detail/actions/decorators/global
248
+         */
249 249
 
250
-		return $this->createSubClient( 'catalog/detail/actions/' . $type, $name );
251
-	}
250
+        return $this->createSubClient( 'catalog/detail/actions/' . $type, $name );
251
+    }
252 252
 
253 253
 
254
-	/**
255
-	 * Returns the list of sub-client names configured for the client.
256
-	 *
257
-	 * @return array List of HTML client names
258
-	 */
259
-	protected function getSubClientNames()
260
-	{
261
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
262
-	}
254
+    /**
255
+     * Returns the list of sub-client names configured for the client.
256
+     *
257
+     * @return array List of HTML client names
258
+     */
259
+    protected function getSubClientNames()
260
+    {
261
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
262
+    }
263 263
 
264 264
 
265
-	/**
266
-	 * Sets the necessary parameter values in the view.
267
-	 *
268
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
269
-	 * @param array &$tags Result array for the list of tags that are associated to the output
270
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
271
-	 * @return \Aimeos\MW\View\Iface Modified view object
272
-	 */
273
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
274
-	{
275
-		if( !isset( $this->cache ) )
276
-		{
277
-			$view->actionsParams = $this->getClientParams( $view->param() );
278
-			$view->actionsUserId = $this->getContext()->getUserId();
265
+    /**
266
+     * Sets the necessary parameter values in the view.
267
+     *
268
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
269
+     * @param array &$tags Result array for the list of tags that are associated to the output
270
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
271
+     * @return \Aimeos\MW\View\Iface Modified view object
272
+     */
273
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
274
+    {
275
+        if( !isset( $this->cache ) )
276
+        {
277
+            $view->actionsParams = $this->getClientParams( $view->param() );
278
+            $view->actionsUserId = $this->getContext()->getUserId();
279 279
 
280
-			$this->cache = $view;
281
-		}
280
+            $this->cache = $view;
281
+        }
282 282
 
283
-		return $this->cache;
284
-	}
283
+        return $this->cache;
284
+    }
285 285
 }
286 286
\ No newline at end of file
Please login to merge, or discard this patch.
html/src/Client/Html/Catalog/Detail/Additional/Attribute/Standard.php 1 patch
Indentation   +368 added lines, -368 removed lines patch added patch discarded remove patch
@@ -19,373 +19,373 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/detail/additional/attribute/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog detail additional attribute section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/detail/additional/attribute/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $tags = array();
61
-	private $expire;
62
-	private $cache;
63
-
64
-
65
-	/**
66
-	 * Returns the HTML code for insertion into the body.
67
-	 *
68
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
-	 * @param array &$tags Result array for the list of tags that are associated to the output
70
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
-	 * @return string HTML code
72
-	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
-	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
76
-
77
-		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
-		}
81
-		$view->attributeBody = $html;
82
-
83
-		/** client/html/catalog/detail/additional/attribute/standard/template-body
84
-		 * Relative path to the HTML body template of the catalog detail additional attribute client.
85
-		 *
86
-		 * The template file contains the HTML code and processing instructions
87
-		 * to generate the result shown in the body of the frontend. The
88
-		 * configuration string is the path to the template file relative
89
-		 * to the templates directory (usually in client/html/templates).
90
-		 *
91
-		 * You can overwrite the template file configuration in extensions and
92
-		 * provide alternative templates. These alternative templates should be
93
-		 * named like the default one but with the string "standard" replaced by
94
-		 * an unique name. You may use the name of your project for this. If
95
-		 * you've implemented an alternative client class as well, "standard"
96
-		 * should be replaced by the name of the new class.
97
-		 *
98
-		 * @param string Relative path to the template creating code for the HTML page body
99
-		 * @since 2014.03
100
-		 * @category Developer
101
-		 * @see client/html/catalog/detail/additional/attribute/standard/template-header
102
-		 */
103
-		$tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-body';
104
-		$default = 'catalog/detail/additional-attribute-body-default.php';
105
-
106
-		return $view->render( $view->config( $tplconf, $default ) );
107
-	}
108
-
109
-
110
-	/**
111
-	 * Returns the HTML string for insertion into the header.
112
-	 *
113
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
-	 * @param array &$tags Result array for the list of tags that are associated to the output
115
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
117
-	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
-	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
121
-
122
-		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
-		}
126
-		$view->attributeHeader = $html;
127
-
128
-		/** client/html/catalog/detail/additional/attribute/standard/template-header
129
-		 * Relative path to the HTML header template of the catalog detail additional attribute client.
130
-		 *
131
-		 * The template file contains the HTML code and processing instructions
132
-		 * to generate the HTML code that is inserted into the HTML page header
133
-		 * of the rendered page in the frontend. The configuration string is the
134
-		 * path to the template file relative to the templates directory (usually
135
-		 * in client/html/templates).
136
-		 *
137
-		 * You can overwrite the template file configuration in extensions and
138
-		 * provide alternative templates. These alternative templates should be
139
-		 * named like the default one but with the string "standard" replaced by
140
-		 * an unique name. You may use the name of your project for this. If
141
-		 * you've implemented an alternative client class as well, "standard"
142
-		 * should be replaced by the name of the new class.
143
-		 *
144
-		 * @param string Relative path to the template creating code for the HTML page head
145
-		 * @since 2014.03
146
-		 * @category Developer
147
-		 * @see client/html/catalog/detail/additional/attribute/standard/template-body
148
-		 */
149
-		$tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-header';
150
-		$default = 'catalog/detail/additional-attribute-header-default.php';
151
-
152
-		return $view->render( $view->config( $tplconf, $default ) );
153
-	}
154
-
155
-
156
-	/**
157
-	 * Returns the sub-client given by its name.
158
-	 *
159
-	 * @param string $type Name of the client type
160
-	 * @param string|null $name Name of the sub-client (Default if null)
161
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
162
-	 */
163
-	public function getSubClient( $type, $name = null )
164
-	{
165
-		/** client/html/catalog/detail/additional/attribute/decorators/excludes
166
-		 * Excludes decorators added by the "common" option from the catalog detail additional attribute html client
167
-		 *
168
-		 * Decorators extend the functionality of a class by adding new aspects
169
-		 * (e.g. log what is currently done), executing the methods of the underlying
170
-		 * class only in certain conditions (e.g. only for logged in users) or
171
-		 * modify what is returned to the caller.
172
-		 *
173
-		 * This option allows you to remove a decorator added via
174
-		 * "client/html/common/decorators/default" before they are wrapped
175
-		 * around the html client.
176
-		 *
177
-		 *  client/html/catalog/detail/additional/attribute/decorators/excludes = array( 'decorator1' )
178
-		 *
179
-		 * This would remove the decorator named "decorator1" from the list of
180
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
-		 * "client/html/common/decorators/default" to the html client.
182
-		 *
183
-		 * @param array List of decorator names
184
-		 * @since 2015.08
185
-		 * @category Developer
186
-		 * @see client/html/common/decorators/default
187
-		 * @see client/html/catalog/detail/additional/attribute/decorators/global
188
-		 * @see client/html/catalog/detail/additional/attribute/decorators/local
189
-		 */
190
-
191
-		/** client/html/catalog/detail/additional/attribute/decorators/global
192
-		 * Adds a list of globally available decorators only to the catalog detail additional attribute html client
193
-		 *
194
-		 * Decorators extend the functionality of a class by adding new aspects
195
-		 * (e.g. log what is currently done), executing the methods of the underlying
196
-		 * class only in certain conditions (e.g. only for logged in users) or
197
-		 * modify what is returned to the caller.
198
-		 *
199
-		 * This option allows you to wrap global decorators
200
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
-		 *
202
-		 *  client/html/catalog/detail/additional/attribute/decorators/global = array( 'decorator1' )
203
-		 *
204
-		 * This would add the decorator named "decorator1" defined by
205
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
-		 *
207
-		 * @param array List of decorator names
208
-		 * @since 2015.08
209
-		 * @category Developer
210
-		 * @see client/html/common/decorators/default
211
-		 * @see client/html/catalog/detail/additional/attribute/decorators/excludes
212
-		 * @see client/html/catalog/detail/additional/attribute/decorators/local
213
-		 */
214
-
215
-		/** client/html/catalog/detail/additional/attribute/decorators/local
216
-		 * Adds a list of local decorators only to the catalog detail additional attribute html client
217
-		 *
218
-		 * Decorators extend the functionality of a class by adding new aspects
219
-		 * (e.g. log what is currently done), executing the methods of the underlying
220
-		 * class only in certain conditions (e.g. only for logged in users) or
221
-		 * modify what is returned to the caller.
222
-		 *
223
-		 * This option allows you to wrap local decorators
224
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
-		 *
226
-		 *  client/html/catalog/detail/additional/attribute/decorators/local = array( 'decorator2' )
227
-		 *
228
-		 * This would add the decorator named "decorator2" defined by
229
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
-		 *
231
-		 * @param array List of decorator names
232
-		 * @since 2015.08
233
-		 * @category Developer
234
-		 * @see client/html/common/decorators/default
235
-		 * @see client/html/catalog/detail/additional/attribute/decorators/excludes
236
-		 * @see client/html/catalog/detail/additional/attribute/decorators/global
237
-		 */
238
-
239
-		return $this->createSubClient( 'catalog/detail/additional/attribute/' . $type, $name );
240
-	}
241
-
242
-
243
-	/**
244
-	 * Returns the list of sub-client names configured for the client.
245
-	 *
246
-	 * @return array List of HTML client names
247
-	 */
248
-	protected function getSubClientNames()
249
-	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
-	}
252
-
253
-
254
-	/**
255
-	 * Sets the necessary parameter values in the view.
256
-	 *
257
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
-	 * @param array &$tags Result array for the list of tags that are associated to the output
259
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
-	 * @return \Aimeos\MW\View\Iface Modified view object
261
-	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
-	{
264
-		if( !isset( $this->cache ) )
265
-		{
266
-			$context = $this->getContext();
267
-			$config = $context->getConfig();
268
-			$attrIds = $attributeMap = $subAttrDeps = array();
269
-
270
-			/** client/html/catalog/detail/additional/attribute/variants
271
-			 * If variant attributes should be displayed in the additional section too
272
-			 *
273
-			 * The additional attribute section of the catalog details views contains
274
-			 * all attributes of type "default" that have been assigned to the product.
275
-			 * By default, this also includes variant attributes assigned to the article
276
-			 * of selection products and the ones for the selected variant are displayed
277
-			 * as well.
278
-			 *
279
-			 * This setting can disable displaying them in the additional attribute
280
-			 * section.
281
-			 *
282
-			 * @param boolean True to also display variant attibutes, false to hide them
283
-			 * @since 2016.05
284
-			 * @category Developer
285
-			*/
286
-			$variants = (bool) $config->get( 'client/html/catalog/detail/additional/attribute/variants', true );
287
-
288
-			if( isset( $view->detailProductItem ) )
289
-			{
290
-				$attrIds = array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'default' ) );
291
-
292
-				if( $variants === true ) {
293
-					$attrIds += array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'variant' ) );
294
-				}
295
-			}
296
-
297
-
298
-			$products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' );
299
-
300
-			/** client/html/catalog/detail/additional/attribute/domains
301
-			 * A list of domain names whose items should be available in the additional attribute part of the catalog detail view templates
302
-			 *
303
-			 * The templates rendering additional attribute related data usually add
304
-			 * the images and texts associated to each item. If you want to
305
-			 * display additional content like the attributes, you can configure
306
-			 * your own list of domains (attribute, media, price, product, text,
307
-			 * etc. are domains) whose items are fetched from the storage.
308
-			 * Please keep in mind that the more domains you add to the
309
-			 * configuration, the more time is required for fetching the content!
310
-			 *
311
-			 * @param array List of domain names
312
-			 * @since 2015.09
313
-			 * @category Developer
314
-			 * @see client/html/catalog/detail/basket/selection/domains-attributes
315
-			*/
316
-			$domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', array( 'attribute' ) );
317
-
318
-			// find regular attributes from sub-products
319
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
320
-			$products = $controller->getProductItems( array_keys( $products ), $domains );
321
-
322
-			foreach( $products as $subProdId => $subProduct )
323
-			{
324
-				$subItems = $subProduct->getRefItems( 'attribute', null, 'default' );
325
-
326
-				if( $variants === true ) {
327
-					$subItems += $subProduct->getRefItems( 'attribute', null, 'variant' );
328
-				}
329
-
330
-				foreach( $subItems as $attrId => $attrItem )
331
-				{
332
-					$subAttrDeps[$attrId][] = $subProdId;
333
-					$attrIds[] = $attrId;
334
-				}
335
-			}
336
-
337
-			$this->addMetaItem( $products, 'product', $this->expire, $this->tags );
338
-			$this->addMetaList( array_keys( $products ), 'product', $this->expire );
339
-
340
-
341
-			$attrManager = $controller->createManager( 'attribute' );
342
-
343
-			$search = $attrManager->createSearch( true );
344
-			$expr = array(
345
-				$search->compare( '==', 'attribute.id', $attrIds ),
346
-				$search->getConditions(),
347
-			);
348
-			$search->setConditions( $search->combine( '&&', $expr ) );
349
-
350
-
351
-			/** client/html/catalog/detail/basket/selection/domains-attributes
352
-			 * A list of domain names whose items should be available for the attributes in the
353
-			 * additional attribute part of the catalog detail view templates
354
-			 *
355
-			 * The templates rendering additional attribute related data usually add
356
-			 * the images and texts associated to each item. If you want to
357
-			 * display additional content like the attributes, you can configure
358
-			 * your own list of domains (attribute, media, price, product, text,
359
-			 * etc. are domains) whose items are fetched from the storage.
360
-			 * Please keep in mind that the more domains you add to the
361
-			 * configuration, the more time is required for fetching the content!
362
-			 *
363
-			 * @param array List of domain names
364
-			 * @since 2015.09
365
-			 * @category Developer
366
-			 * @see client/html/catalog/detail/basket/selection/domains
367
-			*/
368
-			$domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', array( 'text', 'media' ) );
369
-
370
-			$attributes = $attrManager->searchItems( $search, $domains );
371
-
372
-			foreach( $attributes as $id => $item ) {
373
-				$attributeMap[$item->getType()][$id] = $item;
374
-			}
375
-
376
-			$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
377
-			$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
378
-
379
-
380
-			$view->attributeMap = $attributeMap;
381
-			$view->subAttributeDependencies = $subAttrDeps;
382
-
383
-			$this->cache = $view;
384
-		}
385
-
386
-		$expire = $this->expires( $this->expire, $expire );
387
-		$tags = array_merge( $tags, $this->tags );
388
-
389
-		return $this->cache;
390
-	}
25
+    /** client/html/catalog/detail/additional/attribute/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog detail additional attribute section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/detail/additional/attribute/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $tags = array();
61
+    private $expire;
62
+    private $cache;
63
+
64
+
65
+    /**
66
+     * Returns the HTML code for insertion into the body.
67
+     *
68
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
+     * @param array &$tags Result array for the list of tags that are associated to the output
70
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
+     * @return string HTML code
72
+     */
73
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
+    {
75
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
76
+
77
+        $html = '';
78
+        foreach( $this->getSubClients() as $subclient ) {
79
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
+        }
81
+        $view->attributeBody = $html;
82
+
83
+        /** client/html/catalog/detail/additional/attribute/standard/template-body
84
+         * Relative path to the HTML body template of the catalog detail additional attribute client.
85
+         *
86
+         * The template file contains the HTML code and processing instructions
87
+         * to generate the result shown in the body of the frontend. The
88
+         * configuration string is the path to the template file relative
89
+         * to the templates directory (usually in client/html/templates).
90
+         *
91
+         * You can overwrite the template file configuration in extensions and
92
+         * provide alternative templates. These alternative templates should be
93
+         * named like the default one but with the string "standard" replaced by
94
+         * an unique name. You may use the name of your project for this. If
95
+         * you've implemented an alternative client class as well, "standard"
96
+         * should be replaced by the name of the new class.
97
+         *
98
+         * @param string Relative path to the template creating code for the HTML page body
99
+         * @since 2014.03
100
+         * @category Developer
101
+         * @see client/html/catalog/detail/additional/attribute/standard/template-header
102
+         */
103
+        $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-body';
104
+        $default = 'catalog/detail/additional-attribute-body-default.php';
105
+
106
+        return $view->render( $view->config( $tplconf, $default ) );
107
+    }
108
+
109
+
110
+    /**
111
+     * Returns the HTML string for insertion into the header.
112
+     *
113
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
+     * @param array &$tags Result array for the list of tags that are associated to the output
115
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
+     * @return string|null String including HTML tags for the header on error
117
+     */
118
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
+    {
120
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
121
+
122
+        $html = '';
123
+        foreach( $this->getSubClients() as $subclient ) {
124
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
+        }
126
+        $view->attributeHeader = $html;
127
+
128
+        /** client/html/catalog/detail/additional/attribute/standard/template-header
129
+         * Relative path to the HTML header template of the catalog detail additional attribute client.
130
+         *
131
+         * The template file contains the HTML code and processing instructions
132
+         * to generate the HTML code that is inserted into the HTML page header
133
+         * of the rendered page in the frontend. The configuration string is the
134
+         * path to the template file relative to the templates directory (usually
135
+         * in client/html/templates).
136
+         *
137
+         * You can overwrite the template file configuration in extensions and
138
+         * provide alternative templates. These alternative templates should be
139
+         * named like the default one but with the string "standard" replaced by
140
+         * an unique name. You may use the name of your project for this. If
141
+         * you've implemented an alternative client class as well, "standard"
142
+         * should be replaced by the name of the new class.
143
+         *
144
+         * @param string Relative path to the template creating code for the HTML page head
145
+         * @since 2014.03
146
+         * @category Developer
147
+         * @see client/html/catalog/detail/additional/attribute/standard/template-body
148
+         */
149
+        $tplconf = 'client/html/catalog/detail/additional/attribute/standard/template-header';
150
+        $default = 'catalog/detail/additional-attribute-header-default.php';
151
+
152
+        return $view->render( $view->config( $tplconf, $default ) );
153
+    }
154
+
155
+
156
+    /**
157
+     * Returns the sub-client given by its name.
158
+     *
159
+     * @param string $type Name of the client type
160
+     * @param string|null $name Name of the sub-client (Default if null)
161
+     * @return \Aimeos\Client\Html\Iface Sub-client object
162
+     */
163
+    public function getSubClient( $type, $name = null )
164
+    {
165
+        /** client/html/catalog/detail/additional/attribute/decorators/excludes
166
+         * Excludes decorators added by the "common" option from the catalog detail additional attribute html client
167
+         *
168
+         * Decorators extend the functionality of a class by adding new aspects
169
+         * (e.g. log what is currently done), executing the methods of the underlying
170
+         * class only in certain conditions (e.g. only for logged in users) or
171
+         * modify what is returned to the caller.
172
+         *
173
+         * This option allows you to remove a decorator added via
174
+         * "client/html/common/decorators/default" before they are wrapped
175
+         * around the html client.
176
+         *
177
+         *  client/html/catalog/detail/additional/attribute/decorators/excludes = array( 'decorator1' )
178
+         *
179
+         * This would remove the decorator named "decorator1" from the list of
180
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
+         * "client/html/common/decorators/default" to the html client.
182
+         *
183
+         * @param array List of decorator names
184
+         * @since 2015.08
185
+         * @category Developer
186
+         * @see client/html/common/decorators/default
187
+         * @see client/html/catalog/detail/additional/attribute/decorators/global
188
+         * @see client/html/catalog/detail/additional/attribute/decorators/local
189
+         */
190
+
191
+        /** client/html/catalog/detail/additional/attribute/decorators/global
192
+         * Adds a list of globally available decorators only to the catalog detail additional attribute html client
193
+         *
194
+         * Decorators extend the functionality of a class by adding new aspects
195
+         * (e.g. log what is currently done), executing the methods of the underlying
196
+         * class only in certain conditions (e.g. only for logged in users) or
197
+         * modify what is returned to the caller.
198
+         *
199
+         * This option allows you to wrap global decorators
200
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
+         *
202
+         *  client/html/catalog/detail/additional/attribute/decorators/global = array( 'decorator1' )
203
+         *
204
+         * This would add the decorator named "decorator1" defined by
205
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
+         *
207
+         * @param array List of decorator names
208
+         * @since 2015.08
209
+         * @category Developer
210
+         * @see client/html/common/decorators/default
211
+         * @see client/html/catalog/detail/additional/attribute/decorators/excludes
212
+         * @see client/html/catalog/detail/additional/attribute/decorators/local
213
+         */
214
+
215
+        /** client/html/catalog/detail/additional/attribute/decorators/local
216
+         * Adds a list of local decorators only to the catalog detail additional attribute html client
217
+         *
218
+         * Decorators extend the functionality of a class by adding new aspects
219
+         * (e.g. log what is currently done), executing the methods of the underlying
220
+         * class only in certain conditions (e.g. only for logged in users) or
221
+         * modify what is returned to the caller.
222
+         *
223
+         * This option allows you to wrap local decorators
224
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
+         *
226
+         *  client/html/catalog/detail/additional/attribute/decorators/local = array( 'decorator2' )
227
+         *
228
+         * This would add the decorator named "decorator2" defined by
229
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
+         *
231
+         * @param array List of decorator names
232
+         * @since 2015.08
233
+         * @category Developer
234
+         * @see client/html/common/decorators/default
235
+         * @see client/html/catalog/detail/additional/attribute/decorators/excludes
236
+         * @see client/html/catalog/detail/additional/attribute/decorators/global
237
+         */
238
+
239
+        return $this->createSubClient( 'catalog/detail/additional/attribute/' . $type, $name );
240
+    }
241
+
242
+
243
+    /**
244
+     * Returns the list of sub-client names configured for the client.
245
+     *
246
+     * @return array List of HTML client names
247
+     */
248
+    protected function getSubClientNames()
249
+    {
250
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
+    }
252
+
253
+
254
+    /**
255
+     * Sets the necessary parameter values in the view.
256
+     *
257
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
+     * @param array &$tags Result array for the list of tags that are associated to the output
259
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
+     * @return \Aimeos\MW\View\Iface Modified view object
261
+     */
262
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
+    {
264
+        if( !isset( $this->cache ) )
265
+        {
266
+            $context = $this->getContext();
267
+            $config = $context->getConfig();
268
+            $attrIds = $attributeMap = $subAttrDeps = array();
269
+
270
+            /** client/html/catalog/detail/additional/attribute/variants
271
+             * If variant attributes should be displayed in the additional section too
272
+             *
273
+             * The additional attribute section of the catalog details views contains
274
+             * all attributes of type "default" that have been assigned to the product.
275
+             * By default, this also includes variant attributes assigned to the article
276
+             * of selection products and the ones for the selected variant are displayed
277
+             * as well.
278
+             *
279
+             * This setting can disable displaying them in the additional attribute
280
+             * section.
281
+             *
282
+             * @param boolean True to also display variant attibutes, false to hide them
283
+             * @since 2016.05
284
+             * @category Developer
285
+             */
286
+            $variants = (bool) $config->get( 'client/html/catalog/detail/additional/attribute/variants', true );
287
+
288
+            if( isset( $view->detailProductItem ) )
289
+            {
290
+                $attrIds = array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'default' ) );
291
+
292
+                if( $variants === true ) {
293
+                    $attrIds += array_keys( $view->detailProductItem->getRefItems( 'attribute', null, 'variant' ) );
294
+                }
295
+            }
296
+
297
+
298
+            $products = $view->detailProductItem->getRefItems( 'product', 'default', 'default' );
299
+
300
+            /** client/html/catalog/detail/additional/attribute/domains
301
+             * A list of domain names whose items should be available in the additional attribute part of the catalog detail view templates
302
+             *
303
+             * The templates rendering additional attribute related data usually add
304
+             * the images and texts associated to each item. If you want to
305
+             * display additional content like the attributes, you can configure
306
+             * your own list of domains (attribute, media, price, product, text,
307
+             * etc. are domains) whose items are fetched from the storage.
308
+             * Please keep in mind that the more domains you add to the
309
+             * configuration, the more time is required for fetching the content!
310
+             *
311
+             * @param array List of domain names
312
+             * @since 2015.09
313
+             * @category Developer
314
+             * @see client/html/catalog/detail/basket/selection/domains-attributes
315
+             */
316
+            $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', array( 'attribute' ) );
317
+
318
+            // find regular attributes from sub-products
319
+            $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
320
+            $products = $controller->getProductItems( array_keys( $products ), $domains );
321
+
322
+            foreach( $products as $subProdId => $subProduct )
323
+            {
324
+                $subItems = $subProduct->getRefItems( 'attribute', null, 'default' );
325
+
326
+                if( $variants === true ) {
327
+                    $subItems += $subProduct->getRefItems( 'attribute', null, 'variant' );
328
+                }
329
+
330
+                foreach( $subItems as $attrId => $attrItem )
331
+                {
332
+                    $subAttrDeps[$attrId][] = $subProdId;
333
+                    $attrIds[] = $attrId;
334
+                }
335
+            }
336
+
337
+            $this->addMetaItem( $products, 'product', $this->expire, $this->tags );
338
+            $this->addMetaList( array_keys( $products ), 'product', $this->expire );
339
+
340
+
341
+            $attrManager = $controller->createManager( 'attribute' );
342
+
343
+            $search = $attrManager->createSearch( true );
344
+            $expr = array(
345
+                $search->compare( '==', 'attribute.id', $attrIds ),
346
+                $search->getConditions(),
347
+            );
348
+            $search->setConditions( $search->combine( '&&', $expr ) );
349
+
350
+
351
+            /** client/html/catalog/detail/basket/selection/domains-attributes
352
+             * A list of domain names whose items should be available for the attributes in the
353
+             * additional attribute part of the catalog detail view templates
354
+             *
355
+             * The templates rendering additional attribute related data usually add
356
+             * the images and texts associated to each item. If you want to
357
+             * display additional content like the attributes, you can configure
358
+             * your own list of domains (attribute, media, price, product, text,
359
+             * etc. are domains) whose items are fetched from the storage.
360
+             * Please keep in mind that the more domains you add to the
361
+             * configuration, the more time is required for fetching the content!
362
+             *
363
+             * @param array List of domain names
364
+             * @since 2015.09
365
+             * @category Developer
366
+             * @see client/html/catalog/detail/basket/selection/domains
367
+             */
368
+            $domains = $config->get( 'client/html/catalog/detail/basket/selection/domains-attributes', array( 'text', 'media' ) );
369
+
370
+            $attributes = $attrManager->searchItems( $search, $domains );
371
+
372
+            foreach( $attributes as $id => $item ) {
373
+                $attributeMap[$item->getType()][$id] = $item;
374
+            }
375
+
376
+            $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
377
+            $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
378
+
379
+
380
+            $view->attributeMap = $attributeMap;
381
+            $view->subAttributeDependencies = $subAttrDeps;
382
+
383
+            $this->cache = $view;
384
+        }
385
+
386
+        $expire = $this->expires( $this->expire, $expire );
387
+        $tags = array_merge( $tags, $this->tags );
388
+
389
+        return $this->cache;
390
+    }
391 391
 }
392 392
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Detail/Additional/Download/Standard.php 1 patch
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -19,231 +19,231 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/catalog/detail/additional/download/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog detail additional download section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/detail/additional/download/standard/subparts';
59
-	private $subPartNames = array();
60
-
61
-
62
-	/**
63
-	 * Returns the HTML code for insertion into the body.
64
-	 *
65
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
66
-	 * @param array &$tags Result array for the list of tags that are associated to the output
67
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68
-	 * @return string HTML code
69
-	 */
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
-	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
73
-
74
-		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
77
-		}
78
-		$view->downloadBody = $html;
79
-
80
-		/** client/html/catalog/detail/additional/download/standard/template-body
81
-		 * Relative path to the HTML body template of the catalog detail additional download client.
82
-		 *
83
-		 * The template file contains the HTML code and processing instructions
84
-		 * to generate the result shown in the body of the frontend. The
85
-		 * configuration string is the path to the template file relative
86
-		 * to the templates directory (usually in client/html/templates).
87
-		 *
88
-		 * You can overwrite the template file configuration in extensions and
89
-		 * provide alternative templates. These alternative templates should be
90
-		 * named like the default one but with the string "standard" replaced by
91
-		 * an unique name. You may use the name of your project for this. If
92
-		 * you've implemented an alternative client class as well, "standard"
93
-		 * should be replaced by the name of the new class.
94
-		 *
95
-		 * @param string Relative path to the template creating code for the HTML page body
96
-		 * @since 2014.03
97
-		 * @category Developer
98
-		 * @see client/html/catalog/detail/additional/download/standard/template-header
99
-		 */
100
-		$tplconf = 'client/html/catalog/detail/additional/download/standard/template-body';
101
-		$default = 'catalog/detail/additional-download-body-default.php';
102
-
103
-		return $view->render( $view->config( $tplconf, $default ) );
104
-	}
105
-
106
-
107
-	/**
108
-	 * Returns the HTML string for insertion into the header.
109
-	 *
110
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111
-	 * @param array &$tags Result array for the list of tags that are associated to the output
112
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
-	 * @return string|null String including HTML tags for the header on error
114
-	 */
115
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
-	{
117
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
-
119
-		$html = '';
120
-		foreach( $this->getSubClients() as $subclient ) {
121
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
122
-		}
123
-		$view->downloadHeader = $html;
124
-
125
-		/** client/html/catalog/detail/additional/download/standard/template-header
126
-		 * Relative path to the HTML header template of the catalog detail additional download client.
127
-		 *
128
-		 * The template file contains the HTML code and processing instructions
129
-		 * to generate the HTML code that is inserted into the HTML page header
130
-		 * of the rendered page in the frontend. The configuration string is the
131
-		 * path to the template file relative to the templates directory (usually
132
-		 * in client/html/templates).
133
-		 *
134
-		 * You can overwrite the template file configuration in extensions and
135
-		 * provide alternative templates. These alternative templates should be
136
-		 * named like the default one but with the string "standard" replaced by
137
-		 * an unique name. You may use the name of your project for this. If
138
-		 * you've implemented an alternative client class as well, "standard"
139
-		 * should be replaced by the name of the new class.
140
-		 *
141
-		 * @param string Relative path to the template creating code for the HTML page head
142
-		 * @since 2014.03
143
-		 * @category Developer
144
-		 * @see client/html/catalog/detail/additional/download/standard/template-body
145
-		 */
146
-		$tplconf = 'client/html/catalog/detail/additional/download/standard/template-header';
147
-		$default = 'catalog/detail/additional-download-header-default.php';
148
-
149
-		return $view->render( $view->config( $tplconf, $default ) );
150
-	}
151
-
152
-
153
-	/**
154
-	 * Returns the sub-client given by its name.
155
-	 *
156
-	 * @param string $type Name of the client type
157
-	 * @param string|null $name Name of the sub-client (Default if null)
158
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
159
-	 */
160
-	public function getSubClient( $type, $name = null )
161
-	{
162
-		/** client/html/catalog/detail/additional/download/decorators/excludes
163
-		 * Excludes decorators added by the "common" option from the catalog detail additional download html client
164
-		 *
165
-		 * Decorators extend the functionality of a class by adding new aspects
166
-		 * (e.g. log what is currently done), executing the methods of the underlying
167
-		 * class only in certain conditions (e.g. only for logged in users) or
168
-		 * modify what is returned to the caller.
169
-		 *
170
-		 * This option allows you to remove a decorator added via
171
-		 * "client/html/common/decorators/default" before they are wrapped
172
-		 * around the html client.
173
-		 *
174
-		 *  client/html/catalog/detail/additional/download/decorators/excludes = array( 'decorator1' )
175
-		 *
176
-		 * This would remove the decorator named "decorator1" from the list of
177
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
178
-		 * "client/html/common/decorators/default" to the html client.
179
-		 *
180
-		 * @param array List of decorator names
181
-		 * @since 2015.08
182
-		 * @category Developer
183
-		 * @see client/html/common/decorators/default
184
-		 * @see client/html/catalog/detail/additional/download/decorators/global
185
-		 * @see client/html/catalog/detail/additional/download/decorators/local
186
-		 */
187
-
188
-		/** client/html/catalog/detail/additional/download/decorators/global
189
-		 * Adds a list of globally available decorators only to the catalog detail additional download html client
190
-		 *
191
-		 * Decorators extend the functionality of a class by adding new aspects
192
-		 * (e.g. log what is currently done), executing the methods of the underlying
193
-		 * class only in certain conditions (e.g. only for logged in users) or
194
-		 * modify what is returned to the caller.
195
-		 *
196
-		 * This option allows you to wrap global decorators
197
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
198
-		 *
199
-		 *  client/html/catalog/detail/additional/download/decorators/global = array( 'decorator1' )
200
-		 *
201
-		 * This would add the decorator named "decorator1" defined by
202
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
203
-		 *
204
-		 * @param array List of decorator names
205
-		 * @since 2015.08
206
-		 * @category Developer
207
-		 * @see client/html/common/decorators/default
208
-		 * @see client/html/catalog/detail/additional/download/decorators/excludes
209
-		 * @see client/html/catalog/detail/additional/download/decorators/local
210
-		 */
211
-
212
-		/** client/html/catalog/detail/additional/download/decorators/local
213
-		 * Adds a list of local decorators only to the catalog detail additional download html client
214
-		 *
215
-		 * Decorators extend the functionality of a class by adding new aspects
216
-		 * (e.g. log what is currently done), executing the methods of the underlying
217
-		 * class only in certain conditions (e.g. only for logged in users) or
218
-		 * modify what is returned to the caller.
219
-		 *
220
-		 * This option allows you to wrap local decorators
221
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
222
-		 *
223
-		 *  client/html/catalog/detail/additional/download/decorators/local = array( 'decorator2' )
224
-		 *
225
-		 * This would add the decorator named "decorator2" defined by
226
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
227
-		 *
228
-		 * @param array List of decorator names
229
-		 * @since 2015.08
230
-		 * @category Developer
231
-		 * @see client/html/common/decorators/default
232
-		 * @see client/html/catalog/detail/additional/download/decorators/excludes
233
-		 * @see client/html/catalog/detail/additional/download/decorators/global
234
-		 */
235
-
236
-		return $this->createSubClient( 'catalog/detail/additional/download/' . $type, $name );
237
-	}
238
-
239
-
240
-	/**
241
-	 * Returns the list of sub-client names configured for the client.
242
-	 *
243
-	 * @return array List of HTML client names
244
-	 */
245
-	protected function getSubClientNames()
246
-	{
247
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
248
-	}
25
+    /** client/html/catalog/detail/additional/download/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog detail additional download section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/detail/additional/download/standard/subparts';
59
+    private $subPartNames = array();
60
+
61
+
62
+    /**
63
+     * Returns the HTML code for insertion into the body.
64
+     *
65
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
66
+     * @param array &$tags Result array for the list of tags that are associated to the output
67
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68
+     * @return string HTML code
69
+     */
70
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
+    {
72
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
73
+
74
+        $html = '';
75
+        foreach( $this->getSubClients() as $subclient ) {
76
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
77
+        }
78
+        $view->downloadBody = $html;
79
+
80
+        /** client/html/catalog/detail/additional/download/standard/template-body
81
+         * Relative path to the HTML body template of the catalog detail additional download client.
82
+         *
83
+         * The template file contains the HTML code and processing instructions
84
+         * to generate the result shown in the body of the frontend. The
85
+         * configuration string is the path to the template file relative
86
+         * to the templates directory (usually in client/html/templates).
87
+         *
88
+         * You can overwrite the template file configuration in extensions and
89
+         * provide alternative templates. These alternative templates should be
90
+         * named like the default one but with the string "standard" replaced by
91
+         * an unique name. You may use the name of your project for this. If
92
+         * you've implemented an alternative client class as well, "standard"
93
+         * should be replaced by the name of the new class.
94
+         *
95
+         * @param string Relative path to the template creating code for the HTML page body
96
+         * @since 2014.03
97
+         * @category Developer
98
+         * @see client/html/catalog/detail/additional/download/standard/template-header
99
+         */
100
+        $tplconf = 'client/html/catalog/detail/additional/download/standard/template-body';
101
+        $default = 'catalog/detail/additional-download-body-default.php';
102
+
103
+        return $view->render( $view->config( $tplconf, $default ) );
104
+    }
105
+
106
+
107
+    /**
108
+     * Returns the HTML string for insertion into the header.
109
+     *
110
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111
+     * @param array &$tags Result array for the list of tags that are associated to the output
112
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
+     * @return string|null String including HTML tags for the header on error
114
+     */
115
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+    {
117
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+
119
+        $html = '';
120
+        foreach( $this->getSubClients() as $subclient ) {
121
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
122
+        }
123
+        $view->downloadHeader = $html;
124
+
125
+        /** client/html/catalog/detail/additional/download/standard/template-header
126
+         * Relative path to the HTML header template of the catalog detail additional download client.
127
+         *
128
+         * The template file contains the HTML code and processing instructions
129
+         * to generate the HTML code that is inserted into the HTML page header
130
+         * of the rendered page in the frontend. The configuration string is the
131
+         * path to the template file relative to the templates directory (usually
132
+         * in client/html/templates).
133
+         *
134
+         * You can overwrite the template file configuration in extensions and
135
+         * provide alternative templates. These alternative templates should be
136
+         * named like the default one but with the string "standard" replaced by
137
+         * an unique name. You may use the name of your project for this. If
138
+         * you've implemented an alternative client class as well, "standard"
139
+         * should be replaced by the name of the new class.
140
+         *
141
+         * @param string Relative path to the template creating code for the HTML page head
142
+         * @since 2014.03
143
+         * @category Developer
144
+         * @see client/html/catalog/detail/additional/download/standard/template-body
145
+         */
146
+        $tplconf = 'client/html/catalog/detail/additional/download/standard/template-header';
147
+        $default = 'catalog/detail/additional-download-header-default.php';
148
+
149
+        return $view->render( $view->config( $tplconf, $default ) );
150
+    }
151
+
152
+
153
+    /**
154
+     * Returns the sub-client given by its name.
155
+     *
156
+     * @param string $type Name of the client type
157
+     * @param string|null $name Name of the sub-client (Default if null)
158
+     * @return \Aimeos\Client\Html\Iface Sub-client object
159
+     */
160
+    public function getSubClient( $type, $name = null )
161
+    {
162
+        /** client/html/catalog/detail/additional/download/decorators/excludes
163
+         * Excludes decorators added by the "common" option from the catalog detail additional download html client
164
+         *
165
+         * Decorators extend the functionality of a class by adding new aspects
166
+         * (e.g. log what is currently done), executing the methods of the underlying
167
+         * class only in certain conditions (e.g. only for logged in users) or
168
+         * modify what is returned to the caller.
169
+         *
170
+         * This option allows you to remove a decorator added via
171
+         * "client/html/common/decorators/default" before they are wrapped
172
+         * around the html client.
173
+         *
174
+         *  client/html/catalog/detail/additional/download/decorators/excludes = array( 'decorator1' )
175
+         *
176
+         * This would remove the decorator named "decorator1" from the list of
177
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
178
+         * "client/html/common/decorators/default" to the html client.
179
+         *
180
+         * @param array List of decorator names
181
+         * @since 2015.08
182
+         * @category Developer
183
+         * @see client/html/common/decorators/default
184
+         * @see client/html/catalog/detail/additional/download/decorators/global
185
+         * @see client/html/catalog/detail/additional/download/decorators/local
186
+         */
187
+
188
+        /** client/html/catalog/detail/additional/download/decorators/global
189
+         * Adds a list of globally available decorators only to the catalog detail additional download html client
190
+         *
191
+         * Decorators extend the functionality of a class by adding new aspects
192
+         * (e.g. log what is currently done), executing the methods of the underlying
193
+         * class only in certain conditions (e.g. only for logged in users) or
194
+         * modify what is returned to the caller.
195
+         *
196
+         * This option allows you to wrap global decorators
197
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
198
+         *
199
+         *  client/html/catalog/detail/additional/download/decorators/global = array( 'decorator1' )
200
+         *
201
+         * This would add the decorator named "decorator1" defined by
202
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
203
+         *
204
+         * @param array List of decorator names
205
+         * @since 2015.08
206
+         * @category Developer
207
+         * @see client/html/common/decorators/default
208
+         * @see client/html/catalog/detail/additional/download/decorators/excludes
209
+         * @see client/html/catalog/detail/additional/download/decorators/local
210
+         */
211
+
212
+        /** client/html/catalog/detail/additional/download/decorators/local
213
+         * Adds a list of local decorators only to the catalog detail additional download html client
214
+         *
215
+         * Decorators extend the functionality of a class by adding new aspects
216
+         * (e.g. log what is currently done), executing the methods of the underlying
217
+         * class only in certain conditions (e.g. only for logged in users) or
218
+         * modify what is returned to the caller.
219
+         *
220
+         * This option allows you to wrap local decorators
221
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
222
+         *
223
+         *  client/html/catalog/detail/additional/download/decorators/local = array( 'decorator2' )
224
+         *
225
+         * This would add the decorator named "decorator2" defined by
226
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
227
+         *
228
+         * @param array List of decorator names
229
+         * @since 2015.08
230
+         * @category Developer
231
+         * @see client/html/common/decorators/default
232
+         * @see client/html/catalog/detail/additional/download/decorators/excludes
233
+         * @see client/html/catalog/detail/additional/download/decorators/global
234
+         */
235
+
236
+        return $this->createSubClient( 'catalog/detail/additional/download/' . $type, $name );
237
+    }
238
+
239
+
240
+    /**
241
+     * Returns the list of sub-client names configured for the client.
242
+     *
243
+     * @return array List of HTML client names
244
+     */
245
+    protected function getSubClientNames()
246
+    {
247
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
248
+    }
249 249
 }
250 250
\ No newline at end of file
Please login to merge, or discard this patch.