Completed
Push — master ( 86ce10...3f6ef7 )
by Aimeos
07:57
created
client/html/src/Client/Html/Catalog/Detail/Social/Standard.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111 111
 	 * @param array &$tags Result array for the list of tags that are associated to the output
112 112
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
-	 * @return string|null String including HTML tags for the header on error
113
+	 * @return string String including HTML tags for the header on error
114 114
 	 */
115 115
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116 116
 	{
Please login to merge, or discard this 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.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68 68
 	 * @return string HTML code
69 69
 	 */
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
71 71
 	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
72
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
73 73
 
74 74
 		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
75
+		foreach ($this->getSubClients() as $subclient) {
76
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
77 77
 		}
78 78
 		$view->socialBody = $html;
79 79
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$tplconf = 'client/html/catalog/detail/social/standard/template-body';
101 101
 		$default = 'catalog/detail/social-body-default.php';
102 102
 
103
-		return $view->render( $view->config( $tplconf, $default ) );
103
+		return $view->render($view->config($tplconf, $default));
104 104
 	}
105 105
 
106 106
 
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113 113
 	 * @return string|null String including HTML tags for the header on error
114 114
 	 */
115
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
115
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
116 116
 	{
117
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
117
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
118 118
 
119 119
 		$html = '';
120
-		foreach( $this->getSubClients() as $subclient ) {
121
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
120
+		foreach ($this->getSubClients() as $subclient) {
121
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
122 122
 		}
123 123
 		$view->socialHeader = $html;
124 124
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$tplconf = 'client/html/catalog/detail/social/standard/template-header';
147 147
 		$default = 'catalog/detail/social-header-default.php';
148 148
 
149
-		return $view->render( $view->config( $tplconf, $default ) );
149
+		return $view->render($view->config($tplconf, $default));
150 150
 	}
151 151
 
152 152
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param string|null $name Name of the sub-client (Default if null)
158 158
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
159 159
 	 */
160
-	public function getSubClient( $type, $name = null )
160
+	public function getSubClient($type, $name = null)
161 161
 	{
162 162
 		/** client/html/catalog/detail/social/decorators/excludes
163 163
 		 * Excludes decorators added by the "common" option from the catalog detail social html client
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		 * @see client/html/catalog/detail/social/decorators/global
234 234
 		 */
235 235
 
236
-		return $this->createSubClient( 'catalog/detail/social/' . $type, $name );
236
+		return $this->createSubClient('catalog/detail/social/'.$type, $name);
237 237
 	}
238 238
 
239 239
 
@@ -244,6 +244,6 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	protected function getSubClientNames()
246 246
 	{
247
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
247
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
248 248
 	}
249 249
 }
250 250
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Detail/Standard.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@
 block discarded – undo
277 277
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
278 278
 	 * @param array &$tags Result array for the list of tags that are associated to the output
279 279
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
280
-	 * @return string|null String including HTML tags for the header on error
280
+	 * @return string String including HTML tags for the header on error
281 281
 	 */
282 282
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
283 283
 	{
Please login to merge, or discard this patch.
Indentation   +596 added lines, -596 removed lines patch added patch discarded remove patch
@@ -19,601 +19,601 @@
 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/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog detail 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/standard/subparts';
59
-
60
-	/** client/html/catalog/detail/social/name
61
-	 * Name of the social part used by the catalog detail client implementation
62
-	 *
63
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Social\Myname".
64
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
65
-	 *
66
-	 * @param string Last part of the client class name
67
-	 * @since 2014.09
68
-	 * @category Developer
69
-	 */
70
-
71
-	/** client/html/catalog/detail/image/name
72
-	 * Name of the image part used by the catalog detail client implementation
73
-	 *
74
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Image\Myname".
75
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
76
-	 *
77
-	 * @param string Last part of the client class name
78
-	 * @since 2014.03
79
-	 * @category Developer
80
-	 */
81
-
82
-	/** client/html/catalog/detail/basic/name
83
-	 * Name of the basic part used by the catalog detail client implementation
84
-	 *
85
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basic\Myname".
86
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
87
-	 *
88
-	 * @param string Last part of the client class name
89
-	 * @since 2014.03
90
-	 * @category Developer
91
-	 */
92
-
93
-	/** client/html/catalog/detail/actions/name
94
-	 * Name of the actions part used by the catalog detail client implementation
95
-	 *
96
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Actions\Myname".
97
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
98
-	 *
99
-	 * @param string Last part of the client class name
100
-	 * @since 2014.09
101
-	 * @category Developer
102
-	 */
103
-
104
-	/** client/html/catalog/detail/basket/name
105
-	 * Name of the basket part used by the catalog detail client implementation
106
-	 *
107
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basket\Myname".
108
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
109
-	 *
110
-	 * @param string Last part of the client class name
111
-	 * @since 2014.03
112
-	 * @category Developer
113
-	 */
114
-
115
-	/** client/html/catalog/detail/bundle/name
116
-	 * Name of the bundle part used by the catalog detail client implementation
117
-	 *
118
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Bundle\Myname".
119
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
120
-	 *
121
-	 * @param string Last part of the client class name
122
-	 * @since 2014.11
123
-	 * @category Developer
124
-	 */
125
-
126
-	/** client/html/catalog/detail/additional/name
127
-	 * Name of the additional part used by the catalog detail client implementation
128
-	 *
129
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Additional\Myname".
130
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
131
-	 *
132
-	 * @param string Last part of the client class name
133
-	 * @since 2014.03
134
-	 * @category Developer
135
-	 */
136
-
137
-	/** client/html/catalog/detail/suggest/name
138
-	 * Name of the suggest part used by the catalog detail client implementation
139
-	 *
140
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Suggest\Myname".
141
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
142
-	 *
143
-	 * @param string Last part of the client class name
144
-	 * @since 2014.03
145
-	 * @category Developer
146
-	 */
147
-
148
-	/** client/html/catalog/detail/bought/name
149
-	 * Name of the bought together part used by the catalog detail client implementation
150
-	 *
151
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Bought\Myname".
152
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
153
-	 *
154
-	 * @param string Last part of the client class name
155
-	 * @since 2014.09
156
-	 * @category Developer
157
-	 */
158
-
159
-	/** client/html/catalog/detail/seen/name
160
-	 * Name of the seen part used by the catalog detail client implementation
161
-	 *
162
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Seen\Myname".
163
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
164
-	 *
165
-	 * @param string Last part of the client class name
166
-	 * @since 2014.03
167
-	 * @category Developer
168
-	 */
169
-	private $subPartNames = array( 'image', 'basic', 'basket', 'actions', 'social', 'bundle', 'additional', 'suggest', 'bought', 'seen' );
170
-
171
-	private $tags = array();
172
-	private $expire;
173
-	private $cache;
174
-
175
-
176
-	/**
177
-	 * Returns the HTML code for insertion into the body.
178
-	 *
179
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
180
-	 * @param array &$tags Result array for the list of tags that are associated to the output
181
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
182
-	 * @return string HTML code
183
-	 */
184
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
185
-	{
186
-		$prefixes = array( 'd' );
187
-		$context = $this->getContext();
188
-
189
-		/** client/html/catalog/detail
190
-		 * All parameters defined for the catalog detail component and its subparts
191
-		 *
192
-		 * This returns all settings related to the detail component.
193
-		 * Please refer to the single settings for details.
194
-		 *
195
-		 * @param array Associative list of name/value settings
196
-		 * @category Developer
197
-		 * @see client/html/catalog#detail
198
-		 */
199
-		$confkey = 'client/html/catalog/detail';
200
-
201
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null )
202
-		{
203
-			$view = $this->getView();
204
-
205
-			try
206
-			{
207
-				$view = $this->setViewParams( $view, $tags, $expire );
208
-
209
-				$output = '';
210
-				foreach( $this->getSubClients() as $subclient ) {
211
-					$output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
212
-				}
213
-				$view->detailBody = $output;
214
-			}
215
-			catch( \Aimeos\Client\Html\Exception $e )
216
-			{
217
-				$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
218
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
219
-			}
220
-			catch( \Aimeos\Controller\Frontend\Exception $e )
221
-			{
222
-				$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
223
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
224
-			}
225
-			catch( \Aimeos\MShop\Exception $e )
226
-			{
227
-				$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
228
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
229
-			}
230
-			catch( \Exception $e )
231
-			{
232
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
233
-
234
-				$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
235
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
236
-			}
237
-
238
-			/** client/html/catalog/detail/standard/template-body
239
-			 * Relative path to the HTML body template of the catalog detail client.
240
-			 *
241
-			 * The template file contains the HTML code and processing instructions
242
-			 * to generate the result shown in the body of the frontend. The
243
-			 * configuration string is the path to the template file relative
244
-			 * to the templates directory (usually in client/html/templates).
245
-			 *
246
-			 * You can overwrite the template file configuration in extensions and
247
-			 * provide alternative templates. These alternative templates should be
248
-			 * named like the default one but with the string "standard" replaced by
249
-			 * an unique name. You may use the name of your project for this. If
250
-			 * you've implemented an alternative client class as well, "standard"
251
-			 * should be replaced by the name of the new class.
252
-			 *
253
-			 * @param string Relative path to the template creating code for the HTML page body
254
-			 * @since 2014.03
255
-			 * @category Developer
256
-			 * @see client/html/catalog/detail/standard/template-header
257
-			 */
258
-			$tplconf = 'client/html/catalog/detail/standard/template-body';
259
-			$default = 'catalog/detail/body-default.php';
260
-
261
-			$html = $view->render( $view->config( $tplconf, $default ) );
262
-
263
-			$this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
264
-		}
265
-		else
266
-		{
267
-			$html = $this->modifyBody( $html, $uid );
268
-		}
269
-
270
-		return $html;
271
-	}
272
-
273
-
274
-	/**
275
-	 * Returns the HTML string for insertion into the header.
276
-	 *
277
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
278
-	 * @param array &$tags Result array for the list of tags that are associated to the output
279
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
280
-	 * @return string|null String including HTML tags for the header on error
281
-	 */
282
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
283
-	{
284
-		$prefixes = array( 'd' );
285
-		$context = $this->getContext();
286
-		$confkey = 'client/html/catalog/detail';
287
-
288
-
289
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null )
290
-		{
291
-			$view = $this->getView();
292
-
293
-			try
294
-			{
295
-				$view = $this->setViewParams( $view, $tags, $expire );
296
-
297
-				$output = '';
298
-				foreach( $this->getSubClients() as $subclient ) {
299
-					$output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
300
-				}
301
-				$view->detailHeader = $output;
302
-			}
303
-			catch( \Exception $e )
304
-			{
305
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
306
-			}
307
-
308
-			/** client/html/catalog/detail/standard/template-header
309
-			 * Relative path to the HTML header template of the catalog detail client.
310
-			 *
311
-			 * The template file contains the HTML code and processing instructions
312
-			 * to generate the HTML code that is inserted into the HTML page header
313
-			 * of the rendered page in the frontend. The configuration string is the
314
-			 * path to the template file relative to the templates directory (usually
315
-			 * in client/html/templates).
316
-			 *
317
-			 * You can overwrite the template file configuration in extensions and
318
-			 * provide alternative templates. These alternative templates should be
319
-			 * named like the default one but with the string "standard" replaced by
320
-			 * an unique name. You may use the name of your project for this. If
321
-			 * you've implemented an alternative client class as well, "standard"
322
-			 * should be replaced by the name of the new class.
323
-			 *
324
-			 * @param string Relative path to the template creating code for the HTML page head
325
-			 * @since 2014.03
326
-			 * @category Developer
327
-			 * @see client/html/catalog/detail/standard/template-body
328
-			 */
329
-			$tplconf = 'client/html/catalog/detail/standard/template-header';
330
-			$default = 'catalog/detail/header-default.php';
331
-
332
-			$html = $view->render( $view->config( $tplconf, $default ) );
333
-
334
-			$this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
335
-		}
336
-		else
337
-		{
338
-			$html = $this->modifyHeader( $html, $uid );
339
-		}
340
-
341
-		return $html;
342
-	}
343
-
344
-
345
-	/**
346
-	 * Returns the sub-client given by its name.
347
-	 *
348
-	 * @param string $type Name of the client type
349
-	 * @param string|null $name Name of the sub-client (Default if null)
350
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
351
-	 */
352
-	public function getSubClient( $type, $name = null )
353
-	{
354
-		/** client/html/catalog/detail/decorators/excludes
355
-		 * Excludes decorators added by the "common" option from the catalog detail html client
356
-		 *
357
-		 * Decorators extend the functionality of a class by adding new aspects
358
-		 * (e.g. log what is currently done), executing the methods of the underlying
359
-		 * class only in certain conditions (e.g. only for logged in users) or
360
-		 * modify what is returned to the caller.
361
-		 *
362
-		 * This option allows you to remove a decorator added via
363
-		 * "client/html/common/decorators/default" before they are wrapped
364
-		 * around the html client.
365
-		 *
366
-		 *  client/html/catalog/detail/decorators/excludes = array( 'decorator1' )
367
-		 *
368
-		 * This would remove the decorator named "decorator1" from the list of
369
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
370
-		 * "client/html/common/decorators/default" to the html client.
371
-		 *
372
-		 * @param array List of decorator names
373
-		 * @since 2014.05
374
-		 * @category Developer
375
-		 * @see client/html/common/decorators/default
376
-		 * @see client/html/catalog/detail/decorators/global
377
-		 * @see client/html/catalog/detail/decorators/local
378
-		 */
379
-
380
-		/** client/html/catalog/detail/decorators/global
381
-		 * Adds a list of globally available decorators only to the catalog detail html client
382
-		 *
383
-		 * Decorators extend the functionality of a class by adding new aspects
384
-		 * (e.g. log what is currently done), executing the methods of the underlying
385
-		 * class only in certain conditions (e.g. only for logged in users) or
386
-		 * modify what is returned to the caller.
387
-		 *
388
-		 * This option allows you to wrap global decorators
389
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
390
-		 *
391
-		 *  client/html/catalog/detail/decorators/global = array( 'decorator1' )
392
-		 *
393
-		 * This would add the decorator named "decorator1" defined by
394
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
395
-		 *
396
-		 * @param array List of decorator names
397
-		 * @since 2014.05
398
-		 * @category Developer
399
-		 * @see client/html/common/decorators/default
400
-		 * @see client/html/catalog/detail/decorators/excludes
401
-		 * @see client/html/catalog/detail/decorators/local
402
-		 */
403
-
404
-		/** client/html/catalog/detail/decorators/local
405
-		 * Adds a list of local decorators only to the catalog detail html client
406
-		 *
407
-		 * Decorators extend the functionality of a class by adding new aspects
408
-		 * (e.g. log what is currently done), executing the methods of the underlying
409
-		 * class only in certain conditions (e.g. only for logged in users) or
410
-		 * modify what is returned to the caller.
411
-		 *
412
-		 * This option allows you to wrap local decorators
413
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
414
-		 *
415
-		 *  client/html/catalog/detail/decorators/local = array( 'decorator2' )
416
-		 *
417
-		 * This would add the decorator named "decorator2" defined by
418
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
419
-		 *
420
-		 * @param array List of decorator names
421
-		 * @since 2014.05
422
-		 * @category Developer
423
-		 * @see client/html/common/decorators/default
424
-		 * @see client/html/catalog/detail/decorators/excludes
425
-		 * @see client/html/catalog/detail/decorators/global
426
-		 */
427
-
428
-		return $this->createSubClient( 'catalog/detail/' . $type, $name );
429
-	}
430
-
431
-
432
-	/**
433
-	 * Processes the input, e.g. store given values.
434
-	 * A view must be available and this method doesn't generate any output
435
-	 * besides setting view variables.
436
-	 */
437
-	public function process()
438
-	{
439
-		$context = $this->getContext();
440
-		$view = $this->getView();
441
-
442
-		try
443
-		{
444
-			$site = $context->getLocale()->getSite()->getCode();
445
-			$params = $this->getClientParams( $view->param() );
446
-			$context->getSession()->set( 'aimeos/catalog/detail/params/last' . $site, $params );
447
-
448
-			parent::process();
449
-		}
450
-		catch( \Aimeos\Client\Html\Exception $e )
451
-		{
452
-			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
453
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
454
-		}
455
-		catch( \Aimeos\Controller\Frontend\Exception $e )
456
-		{
457
-			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
458
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
459
-		}
460
-		catch( \Aimeos\MShop\Exception $e )
461
-		{
462
-			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
463
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
464
-		}
465
-		catch( \Exception $e )
466
-		{
467
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
468
-
469
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
470
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
471
-		}
472
-	}
473
-
474
-
475
-	/**
476
-	 * Returns the list of sub-client names configured for the client.
477
-	 *
478
-	 * @return array List of HTML client names
479
-	 */
480
-	protected function getSubClientNames()
481
-	{
482
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
483
-	}
484
-
485
-
486
-	/**
487
-	 * Sets the necessary parameter values in the view.
488
-	 *
489
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
490
-	 * @param array &$tags Result array for the list of tags that are associated to the output
491
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
492
-	 * @return \Aimeos\MW\View\Iface Modified view object
493
-	 */
494
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
495
-	{
496
-		if( !isset( $this->cache ) )
497
-		{
498
-			$context = $this->getContext();
499
-			$domains = array( 'media', 'price', 'text', 'attribute', 'product' );
500
-			$productItem = $this->getProductItem( $view->param( 'd_prodid' ), $domains );
501
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
502
-
503
-
504
-			$attrManager = $controller->createManager( 'attribute' );
505
-			$attrSearch = $attrManager->createSearch( true );
506
-			$expr = array(
507
-				$attrSearch->compare( '==', 'attribute.id', array_keys( $productItem->getRefItems( 'attribute' ) ) ),
508
-				$attrSearch->getConditions(),
509
-			);
510
-			$attrSearch->setConditions( $attrSearch->combine( '&&', $expr ) );
511
-			$attributes = $attrManager->searchItems( $attrSearch, $domains );
512
-
513
-			$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
514
-			$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
515
-
516
-
517
-			$mediaManager = $controller->createManager( 'media' );
518
-			$mediaSearch = $mediaManager->createSearch( true );
519
-			$expr = array(
520
-				$mediaSearch->compare( '==', 'media.id', array_keys( $productItem->getRefItems( 'media' ) ) ),
521
-				$mediaSearch->getConditions(),
522
-			);
523
-			$mediaSearch->setConditions( $mediaSearch->combine( '&&', $expr ) );
524
-			$media = $mediaManager->searchItems( $mediaSearch, $domains );
525
-
526
-			$this->addMetaItem( $media, 'media', $this->expire, $this->tags );
527
-			$this->addMetaList( array_keys( $media ), 'media', $this->expire );
528
-
529
-
530
-			$view->detailProductItem = $productItem;
531
-			$view->detailProductAttributeItems = $attributes;
532
-			$view->detailProductMediaItems = $media;
533
-			$view->detailParams = $this->getClientParams( $view->param() );
534
-
535
-			$this->cache = $view;
536
-		}
537
-
538
-		$expire = $this->expires( $this->expire, $expire );
539
-		$tags = array_merge( $tags, $this->tags );
540
-
541
-		return $this->cache;
542
-	}
543
-
544
-
545
-	/**
546
-	 * Returns the product item for the given ID including the domain items
547
-	 *
548
-	 * @param string $prodid Unique product ID
549
-	 * @param array List of domain items that should be fetched too
550
-	 * @throws \Aimeos\Client\Html\Exception If no product item was found
551
-	 * @return \Aimeos\MShop\Product\Item\Iface Product item object
552
-	 */
553
-	protected function getProductItem( $prodid, array $domains )
554
-	{
555
-		$context = $this->getContext();
556
-		$config = $context->getConfig();
557
-
558
-		if( $prodid == '' )
559
-		{
560
-			/** client/html/catalog/detail/prodid-default
561
-			 * The default product ID used if none is given as parameter
562
-			 *
563
-			 * To display a product detail view or a part of it for a specific
564
-			 * product, you can configure its ID using this setting. This is
565
-			 * most useful in a CMS where the product ID can be configured
566
-			 * separately for each content node.
567
-			 *
568
-			 * @param string Product ID
569
-			 * @since 2016.01
570
-			 * @category User
571
-			 * @category Developer
572
-			 * @see client/html/catalog/lists/catid-default
573
-			 */
574
-			$prodid = $config->get( 'client/html/catalog/detail/prodid-default', '' );
575
-		}
576
-
577
-		/** client/html/catalog/domains
578
-		 * A list of domain names whose items should be available in the catalog view templates
579
-		 *
580
-		 * @see client/html/catalog/detail/domains
581
-		 */
582
-		$domains = $config->get( 'client/html/catalog/domains', $domains );
583
-
584
-		/** client/html/catalog/detail/domains
585
-		 * A list of domain names whose items should be available in the product detail view template
586
-		 *
587
-		 * The templates rendering product details usually add the images,
588
-		 * prices, texts, attributes, products, etc. associated to the product
589
-		 * item. If you want to display additional or less content, you can
590
-		 * configure your own list of domains (attribute, media, price, product,
591
-		 * text, etc. are domains) whose items are fetched from the storage.
592
-		 * Please keep in mind that the more domains you add to the configuration,
593
-		 * the more time is required for fetching the content!
594
-		 *
595
-		 * Since version 2014.05 this configuration option overwrites the
596
-		 * "client/html/catalog/domains" option that allows to configure the
597
-		 * domain names of the items fetched for all catalog related data.
598
-		 *
599
-		 * @param array List of domain names
600
-		 * @since 2014.03
601
-		 * @category Developer
602
-		 * @see client/html/catalog/domains
603
-		 * @see client/html/catalog/lists/domains
604
-		 */
605
-		$domains = $config->get( 'client/html/catalog/detail/domains', $domains );
606
-
607
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
608
-		$items = $controller->getProductItems( array( $prodid ), $domains );
609
-
610
-		if( ( $item = reset( $items ) ) === false ) {
611
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'No product with ID "%1$s" found', $prodid ) );
612
-		}
613
-
614
-		$this->addMetaItem( $item, 'product', $this->expire, $this->tags );
615
-		$this->addMetaList( $prodid, 'product', $this->expire );
616
-
617
-		return $item;
618
-	}
25
+    /** client/html/catalog/detail/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog detail 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/standard/subparts';
59
+
60
+    /** client/html/catalog/detail/social/name
61
+     * Name of the social part used by the catalog detail client implementation
62
+     *
63
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Social\Myname".
64
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
65
+     *
66
+     * @param string Last part of the client class name
67
+     * @since 2014.09
68
+     * @category Developer
69
+     */
70
+
71
+    /** client/html/catalog/detail/image/name
72
+     * Name of the image part used by the catalog detail client implementation
73
+     *
74
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Image\Myname".
75
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
76
+     *
77
+     * @param string Last part of the client class name
78
+     * @since 2014.03
79
+     * @category Developer
80
+     */
81
+
82
+    /** client/html/catalog/detail/basic/name
83
+     * Name of the basic part used by the catalog detail client implementation
84
+     *
85
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basic\Myname".
86
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
87
+     *
88
+     * @param string Last part of the client class name
89
+     * @since 2014.03
90
+     * @category Developer
91
+     */
92
+
93
+    /** client/html/catalog/detail/actions/name
94
+     * Name of the actions part used by the catalog detail client implementation
95
+     *
96
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Actions\Myname".
97
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
98
+     *
99
+     * @param string Last part of the client class name
100
+     * @since 2014.09
101
+     * @category Developer
102
+     */
103
+
104
+    /** client/html/catalog/detail/basket/name
105
+     * Name of the basket part used by the catalog detail client implementation
106
+     *
107
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Basket\Myname".
108
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
109
+     *
110
+     * @param string Last part of the client class name
111
+     * @since 2014.03
112
+     * @category Developer
113
+     */
114
+
115
+    /** client/html/catalog/detail/bundle/name
116
+     * Name of the bundle part used by the catalog detail client implementation
117
+     *
118
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Bundle\Myname".
119
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
120
+     *
121
+     * @param string Last part of the client class name
122
+     * @since 2014.11
123
+     * @category Developer
124
+     */
125
+
126
+    /** client/html/catalog/detail/additional/name
127
+     * Name of the additional part used by the catalog detail client implementation
128
+     *
129
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Additional\Myname".
130
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
131
+     *
132
+     * @param string Last part of the client class name
133
+     * @since 2014.03
134
+     * @category Developer
135
+     */
136
+
137
+    /** client/html/catalog/detail/suggest/name
138
+     * Name of the suggest part used by the catalog detail client implementation
139
+     *
140
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Suggest\Myname".
141
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
142
+     *
143
+     * @param string Last part of the client class name
144
+     * @since 2014.03
145
+     * @category Developer
146
+     */
147
+
148
+    /** client/html/catalog/detail/bought/name
149
+     * Name of the bought together part used by the catalog detail client implementation
150
+     *
151
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Bought\Myname".
152
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
153
+     *
154
+     * @param string Last part of the client class name
155
+     * @since 2014.09
156
+     * @category Developer
157
+     */
158
+
159
+    /** client/html/catalog/detail/seen/name
160
+     * Name of the seen part used by the catalog detail client implementation
161
+     *
162
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Detail\Seen\Myname".
163
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
164
+     *
165
+     * @param string Last part of the client class name
166
+     * @since 2014.03
167
+     * @category Developer
168
+     */
169
+    private $subPartNames = array( 'image', 'basic', 'basket', 'actions', 'social', 'bundle', 'additional', 'suggest', 'bought', 'seen' );
170
+
171
+    private $tags = array();
172
+    private $expire;
173
+    private $cache;
174
+
175
+
176
+    /**
177
+     * Returns the HTML code for insertion into the body.
178
+     *
179
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
180
+     * @param array &$tags Result array for the list of tags that are associated to the output
181
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
182
+     * @return string HTML code
183
+     */
184
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
185
+    {
186
+        $prefixes = array( 'd' );
187
+        $context = $this->getContext();
188
+
189
+        /** client/html/catalog/detail
190
+         * All parameters defined for the catalog detail component and its subparts
191
+         *
192
+         * This returns all settings related to the detail component.
193
+         * Please refer to the single settings for details.
194
+         *
195
+         * @param array Associative list of name/value settings
196
+         * @category Developer
197
+         * @see client/html/catalog#detail
198
+         */
199
+        $confkey = 'client/html/catalog/detail';
200
+
201
+        if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null )
202
+        {
203
+            $view = $this->getView();
204
+
205
+            try
206
+            {
207
+                $view = $this->setViewParams( $view, $tags, $expire );
208
+
209
+                $output = '';
210
+                foreach( $this->getSubClients() as $subclient ) {
211
+                    $output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
212
+                }
213
+                $view->detailBody = $output;
214
+            }
215
+            catch( \Aimeos\Client\Html\Exception $e )
216
+            {
217
+                $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
218
+                $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
219
+            }
220
+            catch( \Aimeos\Controller\Frontend\Exception $e )
221
+            {
222
+                $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
223
+                $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
224
+            }
225
+            catch( \Aimeos\MShop\Exception $e )
226
+            {
227
+                $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
228
+                $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
229
+            }
230
+            catch( \Exception $e )
231
+            {
232
+                $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
233
+
234
+                $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
235
+                $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
236
+            }
237
+
238
+            /** client/html/catalog/detail/standard/template-body
239
+             * Relative path to the HTML body template of the catalog detail client.
240
+             *
241
+             * The template file contains the HTML code and processing instructions
242
+             * to generate the result shown in the body of the frontend. The
243
+             * configuration string is the path to the template file relative
244
+             * to the templates directory (usually in client/html/templates).
245
+             *
246
+             * You can overwrite the template file configuration in extensions and
247
+             * provide alternative templates. These alternative templates should be
248
+             * named like the default one but with the string "standard" replaced by
249
+             * an unique name. You may use the name of your project for this. If
250
+             * you've implemented an alternative client class as well, "standard"
251
+             * should be replaced by the name of the new class.
252
+             *
253
+             * @param string Relative path to the template creating code for the HTML page body
254
+             * @since 2014.03
255
+             * @category Developer
256
+             * @see client/html/catalog/detail/standard/template-header
257
+             */
258
+            $tplconf = 'client/html/catalog/detail/standard/template-body';
259
+            $default = 'catalog/detail/body-default.php';
260
+
261
+            $html = $view->render( $view->config( $tplconf, $default ) );
262
+
263
+            $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
264
+        }
265
+        else
266
+        {
267
+            $html = $this->modifyBody( $html, $uid );
268
+        }
269
+
270
+        return $html;
271
+    }
272
+
273
+
274
+    /**
275
+     * Returns the HTML string for insertion into the header.
276
+     *
277
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
278
+     * @param array &$tags Result array for the list of tags that are associated to the output
279
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
280
+     * @return string|null String including HTML tags for the header on error
281
+     */
282
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
283
+    {
284
+        $prefixes = array( 'd' );
285
+        $context = $this->getContext();
286
+        $confkey = 'client/html/catalog/detail';
287
+
288
+
289
+        if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null )
290
+        {
291
+            $view = $this->getView();
292
+
293
+            try
294
+            {
295
+                $view = $this->setViewParams( $view, $tags, $expire );
296
+
297
+                $output = '';
298
+                foreach( $this->getSubClients() as $subclient ) {
299
+                    $output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
300
+                }
301
+                $view->detailHeader = $output;
302
+            }
303
+            catch( \Exception $e )
304
+            {
305
+                $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
306
+            }
307
+
308
+            /** client/html/catalog/detail/standard/template-header
309
+             * Relative path to the HTML header template of the catalog detail client.
310
+             *
311
+             * The template file contains the HTML code and processing instructions
312
+             * to generate the HTML code that is inserted into the HTML page header
313
+             * of the rendered page in the frontend. The configuration string is the
314
+             * path to the template file relative to the templates directory (usually
315
+             * in client/html/templates).
316
+             *
317
+             * You can overwrite the template file configuration in extensions and
318
+             * provide alternative templates. These alternative templates should be
319
+             * named like the default one but with the string "standard" replaced by
320
+             * an unique name. You may use the name of your project for this. If
321
+             * you've implemented an alternative client class as well, "standard"
322
+             * should be replaced by the name of the new class.
323
+             *
324
+             * @param string Relative path to the template creating code for the HTML page head
325
+             * @since 2014.03
326
+             * @category Developer
327
+             * @see client/html/catalog/detail/standard/template-body
328
+             */
329
+            $tplconf = 'client/html/catalog/detail/standard/template-header';
330
+            $default = 'catalog/detail/header-default.php';
331
+
332
+            $html = $view->render( $view->config( $tplconf, $default ) );
333
+
334
+            $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
335
+        }
336
+        else
337
+        {
338
+            $html = $this->modifyHeader( $html, $uid );
339
+        }
340
+
341
+        return $html;
342
+    }
343
+
344
+
345
+    /**
346
+     * Returns the sub-client given by its name.
347
+     *
348
+     * @param string $type Name of the client type
349
+     * @param string|null $name Name of the sub-client (Default if null)
350
+     * @return \Aimeos\Client\Html\Iface Sub-client object
351
+     */
352
+    public function getSubClient( $type, $name = null )
353
+    {
354
+        /** client/html/catalog/detail/decorators/excludes
355
+         * Excludes decorators added by the "common" option from the catalog detail html client
356
+         *
357
+         * Decorators extend the functionality of a class by adding new aspects
358
+         * (e.g. log what is currently done), executing the methods of the underlying
359
+         * class only in certain conditions (e.g. only for logged in users) or
360
+         * modify what is returned to the caller.
361
+         *
362
+         * This option allows you to remove a decorator added via
363
+         * "client/html/common/decorators/default" before they are wrapped
364
+         * around the html client.
365
+         *
366
+         *  client/html/catalog/detail/decorators/excludes = array( 'decorator1' )
367
+         *
368
+         * This would remove the decorator named "decorator1" from the list of
369
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
370
+         * "client/html/common/decorators/default" to the html client.
371
+         *
372
+         * @param array List of decorator names
373
+         * @since 2014.05
374
+         * @category Developer
375
+         * @see client/html/common/decorators/default
376
+         * @see client/html/catalog/detail/decorators/global
377
+         * @see client/html/catalog/detail/decorators/local
378
+         */
379
+
380
+        /** client/html/catalog/detail/decorators/global
381
+         * Adds a list of globally available decorators only to the catalog detail html client
382
+         *
383
+         * Decorators extend the functionality of a class by adding new aspects
384
+         * (e.g. log what is currently done), executing the methods of the underlying
385
+         * class only in certain conditions (e.g. only for logged in users) or
386
+         * modify what is returned to the caller.
387
+         *
388
+         * This option allows you to wrap global decorators
389
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
390
+         *
391
+         *  client/html/catalog/detail/decorators/global = array( 'decorator1' )
392
+         *
393
+         * This would add the decorator named "decorator1" defined by
394
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
395
+         *
396
+         * @param array List of decorator names
397
+         * @since 2014.05
398
+         * @category Developer
399
+         * @see client/html/common/decorators/default
400
+         * @see client/html/catalog/detail/decorators/excludes
401
+         * @see client/html/catalog/detail/decorators/local
402
+         */
403
+
404
+        /** client/html/catalog/detail/decorators/local
405
+         * Adds a list of local decorators only to the catalog detail html client
406
+         *
407
+         * Decorators extend the functionality of a class by adding new aspects
408
+         * (e.g. log what is currently done), executing the methods of the underlying
409
+         * class only in certain conditions (e.g. only for logged in users) or
410
+         * modify what is returned to the caller.
411
+         *
412
+         * This option allows you to wrap local decorators
413
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
414
+         *
415
+         *  client/html/catalog/detail/decorators/local = array( 'decorator2' )
416
+         *
417
+         * This would add the decorator named "decorator2" defined by
418
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
419
+         *
420
+         * @param array List of decorator names
421
+         * @since 2014.05
422
+         * @category Developer
423
+         * @see client/html/common/decorators/default
424
+         * @see client/html/catalog/detail/decorators/excludes
425
+         * @see client/html/catalog/detail/decorators/global
426
+         */
427
+
428
+        return $this->createSubClient( 'catalog/detail/' . $type, $name );
429
+    }
430
+
431
+
432
+    /**
433
+     * Processes the input, e.g. store given values.
434
+     * A view must be available and this method doesn't generate any output
435
+     * besides setting view variables.
436
+     */
437
+    public function process()
438
+    {
439
+        $context = $this->getContext();
440
+        $view = $this->getView();
441
+
442
+        try
443
+        {
444
+            $site = $context->getLocale()->getSite()->getCode();
445
+            $params = $this->getClientParams( $view->param() );
446
+            $context->getSession()->set( 'aimeos/catalog/detail/params/last' . $site, $params );
447
+
448
+            parent::process();
449
+        }
450
+        catch( \Aimeos\Client\Html\Exception $e )
451
+        {
452
+            $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
453
+            $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
454
+        }
455
+        catch( \Aimeos\Controller\Frontend\Exception $e )
456
+        {
457
+            $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
458
+            $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
459
+        }
460
+        catch( \Aimeos\MShop\Exception $e )
461
+        {
462
+            $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
463
+            $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
464
+        }
465
+        catch( \Exception $e )
466
+        {
467
+            $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
468
+
469
+            $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
470
+            $view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
471
+        }
472
+    }
473
+
474
+
475
+    /**
476
+     * Returns the list of sub-client names configured for the client.
477
+     *
478
+     * @return array List of HTML client names
479
+     */
480
+    protected function getSubClientNames()
481
+    {
482
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
483
+    }
484
+
485
+
486
+    /**
487
+     * Sets the necessary parameter values in the view.
488
+     *
489
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
490
+     * @param array &$tags Result array for the list of tags that are associated to the output
491
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
492
+     * @return \Aimeos\MW\View\Iface Modified view object
493
+     */
494
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
495
+    {
496
+        if( !isset( $this->cache ) )
497
+        {
498
+            $context = $this->getContext();
499
+            $domains = array( 'media', 'price', 'text', 'attribute', 'product' );
500
+            $productItem = $this->getProductItem( $view->param( 'd_prodid' ), $domains );
501
+            $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
502
+
503
+
504
+            $attrManager = $controller->createManager( 'attribute' );
505
+            $attrSearch = $attrManager->createSearch( true );
506
+            $expr = array(
507
+                $attrSearch->compare( '==', 'attribute.id', array_keys( $productItem->getRefItems( 'attribute' ) ) ),
508
+                $attrSearch->getConditions(),
509
+            );
510
+            $attrSearch->setConditions( $attrSearch->combine( '&&', $expr ) );
511
+            $attributes = $attrManager->searchItems( $attrSearch, $domains );
512
+
513
+            $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
514
+            $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
515
+
516
+
517
+            $mediaManager = $controller->createManager( 'media' );
518
+            $mediaSearch = $mediaManager->createSearch( true );
519
+            $expr = array(
520
+                $mediaSearch->compare( '==', 'media.id', array_keys( $productItem->getRefItems( 'media' ) ) ),
521
+                $mediaSearch->getConditions(),
522
+            );
523
+            $mediaSearch->setConditions( $mediaSearch->combine( '&&', $expr ) );
524
+            $media = $mediaManager->searchItems( $mediaSearch, $domains );
525
+
526
+            $this->addMetaItem( $media, 'media', $this->expire, $this->tags );
527
+            $this->addMetaList( array_keys( $media ), 'media', $this->expire );
528
+
529
+
530
+            $view->detailProductItem = $productItem;
531
+            $view->detailProductAttributeItems = $attributes;
532
+            $view->detailProductMediaItems = $media;
533
+            $view->detailParams = $this->getClientParams( $view->param() );
534
+
535
+            $this->cache = $view;
536
+        }
537
+
538
+        $expire = $this->expires( $this->expire, $expire );
539
+        $tags = array_merge( $tags, $this->tags );
540
+
541
+        return $this->cache;
542
+    }
543
+
544
+
545
+    /**
546
+     * Returns the product item for the given ID including the domain items
547
+     *
548
+     * @param string $prodid Unique product ID
549
+     * @param array List of domain items that should be fetched too
550
+     * @throws \Aimeos\Client\Html\Exception If no product item was found
551
+     * @return \Aimeos\MShop\Product\Item\Iface Product item object
552
+     */
553
+    protected function getProductItem( $prodid, array $domains )
554
+    {
555
+        $context = $this->getContext();
556
+        $config = $context->getConfig();
557
+
558
+        if( $prodid == '' )
559
+        {
560
+            /** client/html/catalog/detail/prodid-default
561
+             * The default product ID used if none is given as parameter
562
+             *
563
+             * To display a product detail view or a part of it for a specific
564
+             * product, you can configure its ID using this setting. This is
565
+             * most useful in a CMS where the product ID can be configured
566
+             * separately for each content node.
567
+             *
568
+             * @param string Product ID
569
+             * @since 2016.01
570
+             * @category User
571
+             * @category Developer
572
+             * @see client/html/catalog/lists/catid-default
573
+             */
574
+            $prodid = $config->get( 'client/html/catalog/detail/prodid-default', '' );
575
+        }
576
+
577
+        /** client/html/catalog/domains
578
+         * A list of domain names whose items should be available in the catalog view templates
579
+         *
580
+         * @see client/html/catalog/detail/domains
581
+         */
582
+        $domains = $config->get( 'client/html/catalog/domains', $domains );
583
+
584
+        /** client/html/catalog/detail/domains
585
+         * A list of domain names whose items should be available in the product detail view template
586
+         *
587
+         * The templates rendering product details usually add the images,
588
+         * prices, texts, attributes, products, etc. associated to the product
589
+         * item. If you want to display additional or less content, you can
590
+         * configure your own list of domains (attribute, media, price, product,
591
+         * text, etc. are domains) whose items are fetched from the storage.
592
+         * Please keep in mind that the more domains you add to the configuration,
593
+         * the more time is required for fetching the content!
594
+         *
595
+         * Since version 2014.05 this configuration option overwrites the
596
+         * "client/html/catalog/domains" option that allows to configure the
597
+         * domain names of the items fetched for all catalog related data.
598
+         *
599
+         * @param array List of domain names
600
+         * @since 2014.03
601
+         * @category Developer
602
+         * @see client/html/catalog/domains
603
+         * @see client/html/catalog/lists/domains
604
+         */
605
+        $domains = $config->get( 'client/html/catalog/detail/domains', $domains );
606
+
607
+        $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
608
+        $items = $controller->getProductItems( array( $prodid ), $domains );
609
+
610
+        if( ( $item = reset( $items ) ) === false ) {
611
+            throw new \Aimeos\Client\Html\Exception( sprintf( 'No product with ID "%1$s" found', $prodid ) );
612
+        }
613
+
614
+        $this->addMetaItem( $item, 'product', $this->expire, $this->tags );
615
+        $this->addMetaList( $prodid, 'product', $this->expire );
616
+
617
+        return $item;
618
+    }
619 619
 }
620 620
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @since 2014.03
167 167
 	 * @category Developer
168 168
 	 */
169
-	private $subPartNames = array( 'image', 'basic', 'basket', 'actions', 'social', 'bundle', 'additional', 'suggest', 'bought', 'seen' );
169
+	private $subPartNames = array('image', 'basic', 'basket', 'actions', 'social', 'bundle', 'additional', 'suggest', 'bought', 'seen');
170 170
 
171 171
 	private $tags = array();
172 172
 	private $expire;
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
182 182
 	 * @return string HTML code
183 183
 	 */
184
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
184
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
185 185
 	{
186
-		$prefixes = array( 'd' );
186
+		$prefixes = array('d');
187 187
 		$context = $this->getContext();
188 188
 
189 189
 		/** client/html/catalog/detail
@@ -198,41 +198,41 @@  discard block
 block discarded – undo
198 198
 		 */
199 199
 		$confkey = 'client/html/catalog/detail';
200 200
 
201
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null )
201
+		if ($context->getUserId() != null || ($html = $this->getCached('body', $uid, $prefixes, $confkey)) === null)
202 202
 		{
203 203
 			$view = $this->getView();
204 204
 
205 205
 			try
206 206
 			{
207
-				$view = $this->setViewParams( $view, $tags, $expire );
207
+				$view = $this->setViewParams($view, $tags, $expire);
208 208
 
209 209
 				$output = '';
210
-				foreach( $this->getSubClients() as $subclient ) {
211
-					$output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
210
+				foreach ($this->getSubClients() as $subclient) {
211
+					$output .= $subclient->setView($view)->getBody($uid, $tags, $expire);
212 212
 				}
213 213
 				$view->detailBody = $output;
214 214
 			}
215
-			catch( \Aimeos\Client\Html\Exception $e )
215
+			catch (\Aimeos\Client\Html\Exception $e)
216 216
 			{
217
-				$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
218
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
217
+				$error = array($context->getI18n()->dt('client', $e->getMessage()));
218
+				$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
219 219
 			}
220
-			catch( \Aimeos\Controller\Frontend\Exception $e )
220
+			catch (\Aimeos\Controller\Frontend\Exception $e)
221 221
 			{
222
-				$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
223
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
222
+				$error = array($context->getI18n()->dt('controller/frontend', $e->getMessage()));
223
+				$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
224 224
 			}
225
-			catch( \Aimeos\MShop\Exception $e )
225
+			catch (\Aimeos\MShop\Exception $e)
226 226
 			{
227
-				$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
228
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
227
+				$error = array($context->getI18n()->dt('mshop', $e->getMessage()));
228
+				$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
229 229
 			}
230
-			catch( \Exception $e )
230
+			catch (\Exception $e)
231 231
 			{
232
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
232
+				$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
233 233
 
234
-				$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
235
-				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
234
+				$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
235
+				$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
236 236
 			}
237 237
 
238 238
 			/** client/html/catalog/detail/standard/template-body
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 			$tplconf = 'client/html/catalog/detail/standard/template-body';
259 259
 			$default = 'catalog/detail/body-default.php';
260 260
 
261
-			$html = $view->render( $view->config( $tplconf, $default ) );
261
+			$html = $view->render($view->config($tplconf, $default));
262 262
 
263
-			$this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
263
+			$this->setCached('body', $uid, $prefixes, $confkey, $html, $tags, $expire);
264 264
 		}
265 265
 		else
266 266
 		{
267
-			$html = $this->modifyBody( $html, $uid );
267
+			$html = $this->modifyBody($html, $uid);
268 268
 		}
269 269
 
270 270
 		return $html;
@@ -279,30 +279,30 @@  discard block
 block discarded – undo
279 279
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
280 280
 	 * @return string|null String including HTML tags for the header on error
281 281
 	 */
282
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
282
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
283 283
 	{
284
-		$prefixes = array( 'd' );
284
+		$prefixes = array('d');
285 285
 		$context = $this->getContext();
286 286
 		$confkey = 'client/html/catalog/detail';
287 287
 
288 288
 
289
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null )
289
+		if ($context->getUserId() != null || ($html = $this->getCached('header', $uid, $prefixes, $confkey)) === null)
290 290
 		{
291 291
 			$view = $this->getView();
292 292
 
293 293
 			try
294 294
 			{
295
-				$view = $this->setViewParams( $view, $tags, $expire );
295
+				$view = $this->setViewParams($view, $tags, $expire);
296 296
 
297 297
 				$output = '';
298
-				foreach( $this->getSubClients() as $subclient ) {
299
-					$output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
298
+				foreach ($this->getSubClients() as $subclient) {
299
+					$output .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
300 300
 				}
301 301
 				$view->detailHeader = $output;
302 302
 			}
303
-			catch( \Exception $e )
303
+			catch (\Exception $e)
304 304
 			{
305
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
305
+				$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
306 306
 			}
307 307
 
308 308
 			/** client/html/catalog/detail/standard/template-header
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
 			$tplconf = 'client/html/catalog/detail/standard/template-header';
330 330
 			$default = 'catalog/detail/header-default.php';
331 331
 
332
-			$html = $view->render( $view->config( $tplconf, $default ) );
332
+			$html = $view->render($view->config($tplconf, $default));
333 333
 
334
-			$this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
334
+			$this->setCached('header', $uid, $prefixes, $confkey, $html, $tags, $expire);
335 335
 		}
336 336
 		else
337 337
 		{
338
-			$html = $this->modifyHeader( $html, $uid );
338
+			$html = $this->modifyHeader($html, $uid);
339 339
 		}
340 340
 
341 341
 		return $html;
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 * @param string|null $name Name of the sub-client (Default if null)
350 350
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
351 351
 	 */
352
-	public function getSubClient( $type, $name = null )
352
+	public function getSubClient($type, $name = null)
353 353
 	{
354 354
 		/** client/html/catalog/detail/decorators/excludes
355 355
 		 * Excludes decorators added by the "common" option from the catalog detail html client
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 		 * @see client/html/catalog/detail/decorators/global
426 426
 		 */
427 427
 
428
-		return $this->createSubClient( 'catalog/detail/' . $type, $name );
428
+		return $this->createSubClient('catalog/detail/'.$type, $name);
429 429
 	}
430 430
 
431 431
 
@@ -442,32 +442,32 @@  discard block
 block discarded – undo
442 442
 		try
443 443
 		{
444 444
 			$site = $context->getLocale()->getSite()->getCode();
445
-			$params = $this->getClientParams( $view->param() );
446
-			$context->getSession()->set( 'aimeos/catalog/detail/params/last' . $site, $params );
445
+			$params = $this->getClientParams($view->param());
446
+			$context->getSession()->set('aimeos/catalog/detail/params/last'.$site, $params);
447 447
 
448 448
 			parent::process();
449 449
 		}
450
-		catch( \Aimeos\Client\Html\Exception $e )
450
+		catch (\Aimeos\Client\Html\Exception $e)
451 451
 		{
452
-			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
453
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
452
+			$error = array($context->getI18n()->dt('client', $e->getMessage()));
453
+			$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
454 454
 		}
455
-		catch( \Aimeos\Controller\Frontend\Exception $e )
455
+		catch (\Aimeos\Controller\Frontend\Exception $e)
456 456
 		{
457
-			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
458
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
457
+			$error = array($context->getI18n()->dt('controller/frontend', $e->getMessage()));
458
+			$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
459 459
 		}
460
-		catch( \Aimeos\MShop\Exception $e )
460
+		catch (\Aimeos\MShop\Exception $e)
461 461
 		{
462
-			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
463
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
462
+			$error = array($context->getI18n()->dt('mshop', $e->getMessage()));
463
+			$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
464 464
 		}
465
-		catch( \Exception $e )
465
+		catch (\Exception $e)
466 466
 		{
467
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
467
+			$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
468 468
 
469
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
470
-			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
469
+			$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
470
+			$view->detailErrorList = $view->get('detailErrorList', array()) + $error;
471 471
 		}
472 472
 	}
473 473
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	protected function getSubClientNames()
481 481
 	{
482
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
482
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
483 483
 	}
484 484
 
485 485
 
@@ -491,52 +491,52 @@  discard block
 block discarded – undo
491 491
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
492 492
 	 * @return \Aimeos\MW\View\Iface Modified view object
493 493
 	 */
494
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
494
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
495 495
 	{
496
-		if( !isset( $this->cache ) )
496
+		if (!isset($this->cache))
497 497
 		{
498 498
 			$context = $this->getContext();
499
-			$domains = array( 'media', 'price', 'text', 'attribute', 'product' );
500
-			$productItem = $this->getProductItem( $view->param( 'd_prodid' ), $domains );
501
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
499
+			$domains = array('media', 'price', 'text', 'attribute', 'product');
500
+			$productItem = $this->getProductItem($view->param('d_prodid'), $domains);
501
+			$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
502 502
 
503 503
 
504
-			$attrManager = $controller->createManager( 'attribute' );
505
-			$attrSearch = $attrManager->createSearch( true );
504
+			$attrManager = $controller->createManager('attribute');
505
+			$attrSearch = $attrManager->createSearch(true);
506 506
 			$expr = array(
507
-				$attrSearch->compare( '==', 'attribute.id', array_keys( $productItem->getRefItems( 'attribute' ) ) ),
507
+				$attrSearch->compare('==', 'attribute.id', array_keys($productItem->getRefItems('attribute'))),
508 508
 				$attrSearch->getConditions(),
509 509
 			);
510
-			$attrSearch->setConditions( $attrSearch->combine( '&&', $expr ) );
511
-			$attributes = $attrManager->searchItems( $attrSearch, $domains );
510
+			$attrSearch->setConditions($attrSearch->combine('&&', $expr));
511
+			$attributes = $attrManager->searchItems($attrSearch, $domains);
512 512
 
513
-			$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
514
-			$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
513
+			$this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags);
514
+			$this->addMetaList(array_keys($attributes), 'attribute', $this->expire);
515 515
 
516 516
 
517
-			$mediaManager = $controller->createManager( 'media' );
518
-			$mediaSearch = $mediaManager->createSearch( true );
517
+			$mediaManager = $controller->createManager('media');
518
+			$mediaSearch = $mediaManager->createSearch(true);
519 519
 			$expr = array(
520
-				$mediaSearch->compare( '==', 'media.id', array_keys( $productItem->getRefItems( 'media' ) ) ),
520
+				$mediaSearch->compare('==', 'media.id', array_keys($productItem->getRefItems('media'))),
521 521
 				$mediaSearch->getConditions(),
522 522
 			);
523
-			$mediaSearch->setConditions( $mediaSearch->combine( '&&', $expr ) );
524
-			$media = $mediaManager->searchItems( $mediaSearch, $domains );
523
+			$mediaSearch->setConditions($mediaSearch->combine('&&', $expr));
524
+			$media = $mediaManager->searchItems($mediaSearch, $domains);
525 525
 
526
-			$this->addMetaItem( $media, 'media', $this->expire, $this->tags );
527
-			$this->addMetaList( array_keys( $media ), 'media', $this->expire );
526
+			$this->addMetaItem($media, 'media', $this->expire, $this->tags);
527
+			$this->addMetaList(array_keys($media), 'media', $this->expire);
528 528
 
529 529
 
530 530
 			$view->detailProductItem = $productItem;
531 531
 			$view->detailProductAttributeItems = $attributes;
532 532
 			$view->detailProductMediaItems = $media;
533
-			$view->detailParams = $this->getClientParams( $view->param() );
533
+			$view->detailParams = $this->getClientParams($view->param());
534 534
 
535 535
 			$this->cache = $view;
536 536
 		}
537 537
 
538
-		$expire = $this->expires( $this->expire, $expire );
539
-		$tags = array_merge( $tags, $this->tags );
538
+		$expire = $this->expires($this->expire, $expire);
539
+		$tags = array_merge($tags, $this->tags);
540 540
 
541 541
 		return $this->cache;
542 542
 	}
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
 	 * @throws \Aimeos\Client\Html\Exception If no product item was found
551 551
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item object
552 552
 	 */
553
-	protected function getProductItem( $prodid, array $domains )
553
+	protected function getProductItem($prodid, array $domains)
554 554
 	{
555 555
 		$context = $this->getContext();
556 556
 		$config = $context->getConfig();
557 557
 
558
-		if( $prodid == '' )
558
+		if ($prodid == '')
559 559
 		{
560 560
 			/** client/html/catalog/detail/prodid-default
561 561
 			 * The default product ID used if none is given as parameter
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 			 * @category Developer
572 572
 			 * @see client/html/catalog/lists/catid-default
573 573
 			 */
574
-			$prodid = $config->get( 'client/html/catalog/detail/prodid-default', '' );
574
+			$prodid = $config->get('client/html/catalog/detail/prodid-default', '');
575 575
 		}
576 576
 
577 577
 		/** client/html/catalog/domains
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 		 *
580 580
 		 * @see client/html/catalog/detail/domains
581 581
 		 */
582
-		$domains = $config->get( 'client/html/catalog/domains', $domains );
582
+		$domains = $config->get('client/html/catalog/domains', $domains);
583 583
 
584 584
 		/** client/html/catalog/detail/domains
585 585
 		 * A list of domain names whose items should be available in the product detail view template
@@ -602,17 +602,17 @@  discard block
 block discarded – undo
602 602
 		 * @see client/html/catalog/domains
603 603
 		 * @see client/html/catalog/lists/domains
604 604
 		 */
605
-		$domains = $config->get( 'client/html/catalog/detail/domains', $domains );
605
+		$domains = $config->get('client/html/catalog/detail/domains', $domains);
606 606
 
607
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
608
-		$items = $controller->getProductItems( array( $prodid ), $domains );
607
+		$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
608
+		$items = $controller->getProductItems(array($prodid), $domains);
609 609
 
610
-		if( ( $item = reset( $items ) ) === false ) {
611
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'No product with ID "%1$s" found', $prodid ) );
610
+		if (($item = reset($items)) === false) {
611
+			throw new \Aimeos\Client\Html\Exception(sprintf('No product with ID "%1$s" found', $prodid));
612 612
 		}
613 613
 
614
-		$this->addMetaItem( $item, 'product', $this->expire, $this->tags );
615
-		$this->addMetaList( $prodid, 'product', $this->expire );
614
+		$this->addMetaItem($item, 'product', $this->expire, $this->tags);
615
+		$this->addMetaList($prodid, 'product', $this->expire);
616 616
 
617 617
 		return $item;
618 618
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -211,23 +211,19 @@  discard block
 block discarded – undo
211 211
 					$output .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
212 212
 				}
213 213
 				$view->detailBody = $output;
214
-			}
215
-			catch( \Aimeos\Client\Html\Exception $e )
214
+			} catch( \Aimeos\Client\Html\Exception $e )
216 215
 			{
217 216
 				$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
218 217
 				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
219
-			}
220
-			catch( \Aimeos\Controller\Frontend\Exception $e )
218
+			} catch( \Aimeos\Controller\Frontend\Exception $e )
221 219
 			{
222 220
 				$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
223 221
 				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
224
-			}
225
-			catch( \Aimeos\MShop\Exception $e )
222
+			} catch( \Aimeos\MShop\Exception $e )
226 223
 			{
227 224
 				$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
228 225
 				$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
229
-			}
230
-			catch( \Exception $e )
226
+			} catch( \Exception $e )
231 227
 			{
232 228
 				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
233 229
 
@@ -261,8 +257,7 @@  discard block
 block discarded – undo
261 257
 			$html = $view->render( $view->config( $tplconf, $default ) );
262 258
 
263 259
 			$this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
264
-		}
265
-		else
260
+		} else
266 261
 		{
267 262
 			$html = $this->modifyBody( $html, $uid );
268 263
 		}
@@ -299,8 +294,7 @@  discard block
 block discarded – undo
299 294
 					$output .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
300 295
 				}
301 296
 				$view->detailHeader = $output;
302
-			}
303
-			catch( \Exception $e )
297
+			} catch( \Exception $e )
304 298
 			{
305 299
 				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
306 300
 			}
@@ -332,8 +326,7 @@  discard block
 block discarded – undo
332 326
 			$html = $view->render( $view->config( $tplconf, $default ) );
333 327
 
334 328
 			$this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
335
-		}
336
-		else
329
+		} else
337 330
 		{
338 331
 			$html = $this->modifyHeader( $html, $uid );
339 332
 		}
@@ -446,23 +439,19 @@  discard block
 block discarded – undo
446 439
 			$context->getSession()->set( 'aimeos/catalog/detail/params/last' . $site, $params );
447 440
 
448 441
 			parent::process();
449
-		}
450
-		catch( \Aimeos\Client\Html\Exception $e )
442
+		} catch( \Aimeos\Client\Html\Exception $e )
451 443
 		{
452 444
 			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
453 445
 			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
454
-		}
455
-		catch( \Aimeos\Controller\Frontend\Exception $e )
446
+		} catch( \Aimeos\Controller\Frontend\Exception $e )
456 447
 		{
457 448
 			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
458 449
 			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
459
-		}
460
-		catch( \Aimeos\MShop\Exception $e )
450
+		} catch( \Aimeos\MShop\Exception $e )
461 451
 		{
462 452
 			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
463 453
 			$view->detailErrorList = $view->get( 'detailErrorList', array() ) + $error;
464
-		}
465
-		catch( \Exception $e )
454
+		} catch( \Exception $e )
466 455
 		{
467 456
 			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
468 457
 
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Detail/Suggest/Standard.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114 114
 	 * @param array &$tags Result array for the list of tags that are associated to the output
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
116
+	 * @return string String including HTML tags for the header on error
117 117
 	 */
118 118
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119 119
 	{
Please login to merge, or discard this patch.
Indentation   +297 added lines, -297 removed lines patch added patch discarded remove patch
@@ -19,302 +19,302 @@
 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/suggest/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog detail suggest 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/suggest/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->suggestBody = $html;
82
-
83
-		/** client/html/catalog/detail/suggest/standard/template-body
84
-		 * Relative path to the HTML body template of the catalog detail suggest 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/suggest/standard/template-header
102
-		 */
103
-		$tplconf = 'client/html/catalog/detail/suggest/standard/template-body';
104
-		$default = 'catalog/detail/suggest-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->suggestHeader = $html;
127
-
128
-		/** client/html/catalog/detail/suggest/standard/template-header
129
-		 * Relative path to the HTML header template of the catalog detail suggest 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/suggest/standard/template-body
148
-		 */
149
-		$tplconf = 'client/html/catalog/detail/suggest/standard/template-header';
150
-		$default = 'catalog/detail/suggest-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/suggest/decorators/excludes
166
-		 * Excludes decorators added by the "common" option from the catalog detail suggest 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/suggest/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/suggest/decorators/global
188
-		 * @see client/html/catalog/detail/suggest/decorators/local
189
-		 */
190
-
191
-		/** client/html/catalog/detail/suggest/decorators/global
192
-		 * Adds a list of globally available decorators only to the catalog detail suggest 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/suggest/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/suggest/decorators/excludes
212
-		 * @see client/html/catalog/detail/suggest/decorators/local
213
-		 */
214
-
215
-		/** client/html/catalog/detail/suggest/decorators/local
216
-		 * Adds a list of local decorators only to the catalog detail suggest html client
217
-		 *
218
-		 * Decorators extend the functionality of a class by adding new aspects
219
-		 * (e.g. log what is currently done), executing the methods of the underlying
220
-		 * class only in certain conditions (e.g. only for logged in users) or
221
-		 * modify what is returned to the caller.
222
-		 *
223
-		 * This option allows you to wrap local decorators
224
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
-		 *
226
-		 *  client/html/catalog/detail/suggest/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/suggest/decorators/excludes
236
-		 * @see client/html/catalog/detail/suggest/decorators/global
237
-		 */
238
-
239
-		return $this->createSubClient( 'catalog/detail/suggest/' . $type, $name );
240
-	}
241
-
242
-
243
-	/**
244
-	 * Returns the list of sub-client names configured for the client.
245
-	 *
246
-	 * @return array List of HTML client names
247
-	 */
248
-	protected function getSubClientNames()
249
-	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
-	}
252
-
253
-
254
-	/**
255
-	 * Sets the necessary parameter values in the view.
256
-	 *
257
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
-	 * @param array &$tags Result array for the list of tags that are associated to the output
259
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
-	 * @return \Aimeos\MW\View\Iface Modified view object
261
-	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
-	{
264
-		if( !isset( $this->cache ) )
265
-		{
266
-			if( isset( $view->detailProductItem ) )
267
-			{
268
-				$context = $this->getContext();
269
-				$config = $context->getConfig();
270
-				$domains = array( 'text', 'price', 'media' );
271
-				$products = $view->detailProductItem->getRefItems( 'product', null, 'suggestion' );
272
-
273
-				$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
274
-
275
-				/** client/html/catalog/detail/domains
276
-				 * A list of domain names whose items should be available in the catalog view templates
277
-				 *
278
-				 * @see client/html/catalog/detail/domains
279
-				 */
280
-				$domains = $config->get( 'client/html/catalog/detail/domains', $domains );
281
-
282
-				/** client/html/catalog/detail/suggest/domains
283
-				 * A list of domain names whose items should be available in the suggestion part of the catalog detail view templates
284
-				 *
285
-				 * The templates rendering suggestion related data usually add
286
-				 * the images and texts associated to each item. If you want to
287
-				 * display additional content like the attributes, you can configure
288
-				 * your own list of domains (attribute, media, price, product, text,
289
-				 * etc. are domains) whose items are fetched from the storage.
290
-				 * Please keep in mind that the more domains you add to the
291
-				 * configuration, the more time is required for fetching the content!
292
-				 *
293
-				 * This configuration option can be overwritten by the
294
-				 * "client/html/catalog/detail/domains" configuration option that
295
-				 * allows to configure the domain names of the items fetched
296
-				 * specifically for all types of product listings.
297
-				 *
298
-				 * @param array List of domain names
299
-				 * @since 2015.09
300
-				 * @category Developer
301
-				 * @see client/html/catalog/detail/domains
302
-				 */
303
-				$domains = $config->get( 'client/html/catalog/detail/suggest/domains', $domains );
304
-
305
-				$view->suggestItems = $controller->getProductItems( array_keys( $products ), $domains );
306
-				$view->suggestPosItems = $products;
307
-
308
-				$this->addMetaItem( $view->suggestItems, 'product', $this->expire, $this->tags );
309
-				$this->addMetaList( array_keys( $view->suggestItems ), 'product', $this->expire );
310
-			}
311
-
312
-			$this->cache = $view;
313
-		}
314
-
315
-		$expire = $this->expires( $this->expire, $expire );
316
-		$tags = array_merge( $tags, $this->tags );
317
-
318
-		return $this->cache;
319
-	}
25
+    /** client/html/catalog/detail/suggest/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog detail suggest 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/suggest/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->suggestBody = $html;
82
+
83
+        /** client/html/catalog/detail/suggest/standard/template-body
84
+         * Relative path to the HTML body template of the catalog detail suggest 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/suggest/standard/template-header
102
+         */
103
+        $tplconf = 'client/html/catalog/detail/suggest/standard/template-body';
104
+        $default = 'catalog/detail/suggest-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->suggestHeader = $html;
127
+
128
+        /** client/html/catalog/detail/suggest/standard/template-header
129
+         * Relative path to the HTML header template of the catalog detail suggest 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/suggest/standard/template-body
148
+         */
149
+        $tplconf = 'client/html/catalog/detail/suggest/standard/template-header';
150
+        $default = 'catalog/detail/suggest-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/suggest/decorators/excludes
166
+         * Excludes decorators added by the "common" option from the catalog detail suggest 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/suggest/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/suggest/decorators/global
188
+         * @see client/html/catalog/detail/suggest/decorators/local
189
+         */
190
+
191
+        /** client/html/catalog/detail/suggest/decorators/global
192
+         * Adds a list of globally available decorators only to the catalog detail suggest 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/suggest/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/suggest/decorators/excludes
212
+         * @see client/html/catalog/detail/suggest/decorators/local
213
+         */
214
+
215
+        /** client/html/catalog/detail/suggest/decorators/local
216
+         * Adds a list of local decorators only to the catalog detail suggest html client
217
+         *
218
+         * Decorators extend the functionality of a class by adding new aspects
219
+         * (e.g. log what is currently done), executing the methods of the underlying
220
+         * class only in certain conditions (e.g. only for logged in users) or
221
+         * modify what is returned to the caller.
222
+         *
223
+         * This option allows you to wrap local decorators
224
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
+         *
226
+         *  client/html/catalog/detail/suggest/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/suggest/decorators/excludes
236
+         * @see client/html/catalog/detail/suggest/decorators/global
237
+         */
238
+
239
+        return $this->createSubClient( 'catalog/detail/suggest/' . $type, $name );
240
+    }
241
+
242
+
243
+    /**
244
+     * Returns the list of sub-client names configured for the client.
245
+     *
246
+     * @return array List of HTML client names
247
+     */
248
+    protected function getSubClientNames()
249
+    {
250
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
+    }
252
+
253
+
254
+    /**
255
+     * Sets the necessary parameter values in the view.
256
+     *
257
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
+     * @param array &$tags Result array for the list of tags that are associated to the output
259
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
+     * @return \Aimeos\MW\View\Iface Modified view object
261
+     */
262
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
+    {
264
+        if( !isset( $this->cache ) )
265
+        {
266
+            if( isset( $view->detailProductItem ) )
267
+            {
268
+                $context = $this->getContext();
269
+                $config = $context->getConfig();
270
+                $domains = array( 'text', 'price', 'media' );
271
+                $products = $view->detailProductItem->getRefItems( 'product', null, 'suggestion' );
272
+
273
+                $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
274
+
275
+                /** client/html/catalog/detail/domains
276
+                 * A list of domain names whose items should be available in the catalog view templates
277
+                 *
278
+                 * @see client/html/catalog/detail/domains
279
+                 */
280
+                $domains = $config->get( 'client/html/catalog/detail/domains', $domains );
281
+
282
+                /** client/html/catalog/detail/suggest/domains
283
+                 * A list of domain names whose items should be available in the suggestion part of the catalog detail view templates
284
+                 *
285
+                 * The templates rendering suggestion related data usually add
286
+                 * the images and texts associated to each item. If you want to
287
+                 * display additional content like the attributes, you can configure
288
+                 * your own list of domains (attribute, media, price, product, text,
289
+                 * etc. are domains) whose items are fetched from the storage.
290
+                 * Please keep in mind that the more domains you add to the
291
+                 * configuration, the more time is required for fetching the content!
292
+                 *
293
+                 * This configuration option can be overwritten by the
294
+                 * "client/html/catalog/detail/domains" configuration option that
295
+                 * allows to configure the domain names of the items fetched
296
+                 * specifically for all types of product listings.
297
+                 *
298
+                 * @param array List of domain names
299
+                 * @since 2015.09
300
+                 * @category Developer
301
+                 * @see client/html/catalog/detail/domains
302
+                 */
303
+                $domains = $config->get( 'client/html/catalog/detail/suggest/domains', $domains );
304
+
305
+                $view->suggestItems = $controller->getProductItems( array_keys( $products ), $domains );
306
+                $view->suggestPosItems = $products;
307
+
308
+                $this->addMetaItem( $view->suggestItems, 'product', $this->expire, $this->tags );
309
+                $this->addMetaList( array_keys( $view->suggestItems ), 'product', $this->expire );
310
+            }
311
+
312
+            $this->cache = $view;
313
+        }
314
+
315
+        $expire = $this->expires( $this->expire, $expire );
316
+        $tags = array_merge( $tags, $this->tags );
317
+
318
+        return $this->cache;
319
+    }
320 320
 }
321 321
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71 71
 	 * @return string HTML code
72 72
 	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
74 74
 	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
75
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
76 76
 
77 77
 		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
+		foreach ($this->getSubClients() as $subclient) {
79
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
80 80
 		}
81 81
 		$view->suggestBody = $html;
82 82
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$tplconf = 'client/html/catalog/detail/suggest/standard/template-body';
104 104
 		$default = 'catalog/detail/suggest-body-default.php';
105 105
 
106
-		return $view->render( $view->config( $tplconf, $default ) );
106
+		return $view->render($view->config($tplconf, $default));
107 107
 	}
108 108
 
109 109
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116 116
 	 * @return string|null String including HTML tags for the header on error
117 117
 	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
119 119
 	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
120
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
121 121
 
122 122
 		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+		foreach ($this->getSubClients() as $subclient) {
124
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
125 125
 		}
126 126
 		$view->suggestHeader = $html;
127 127
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$tplconf = 'client/html/catalog/detail/suggest/standard/template-header';
150 150
 		$default = 'catalog/detail/suggest-header-default.php';
151 151
 
152
-		return $view->render( $view->config( $tplconf, $default ) );
152
+		return $view->render($view->config($tplconf, $default));
153 153
 	}
154 154
 
155 155
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @param string|null $name Name of the sub-client (Default if null)
161 161
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
162 162
 	 */
163
-	public function getSubClient( $type, $name = null )
163
+	public function getSubClient($type, $name = null)
164 164
 	{
165 165
 		/** client/html/catalog/detail/suggest/decorators/excludes
166 166
 		 * Excludes decorators added by the "common" option from the catalog detail suggest html client
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		 * @see client/html/catalog/detail/suggest/decorators/global
237 237
 		 */
238 238
 
239
-		return $this->createSubClient( 'catalog/detail/suggest/' . $type, $name );
239
+		return $this->createSubClient('catalog/detail/suggest/'.$type, $name);
240 240
 	}
241 241
 
242 242
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function getSubClientNames()
249 249
 	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
251 251
 	}
252 252
 
253 253
 
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260 260
 	 * @return \Aimeos\MW\View\Iface Modified view object
261 261
 	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
263 263
 	{
264
-		if( !isset( $this->cache ) )
264
+		if (!isset($this->cache))
265 265
 		{
266
-			if( isset( $view->detailProductItem ) )
266
+			if (isset($view->detailProductItem))
267 267
 			{
268 268
 				$context = $this->getContext();
269 269
 				$config = $context->getConfig();
270
-				$domains = array( 'text', 'price', 'media' );
271
-				$products = $view->detailProductItem->getRefItems( 'product', null, 'suggestion' );
270
+				$domains = array('text', 'price', 'media');
271
+				$products = $view->detailProductItem->getRefItems('product', null, 'suggestion');
272 272
 
273
-				$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
273
+				$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
274 274
 
275 275
 				/** client/html/catalog/detail/domains
276 276
 				 * A list of domain names whose items should be available in the catalog view templates
277 277
 				 *
278 278
 				 * @see client/html/catalog/detail/domains
279 279
 				 */
280
-				$domains = $config->get( 'client/html/catalog/detail/domains', $domains );
280
+				$domains = $config->get('client/html/catalog/detail/domains', $domains);
281 281
 
282 282
 				/** client/html/catalog/detail/suggest/domains
283 283
 				 * A list of domain names whose items should be available in the suggestion part of the catalog detail view templates
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
 				 * @category Developer
301 301
 				 * @see client/html/catalog/detail/domains
302 302
 				 */
303
-				$domains = $config->get( 'client/html/catalog/detail/suggest/domains', $domains );
303
+				$domains = $config->get('client/html/catalog/detail/suggest/domains', $domains);
304 304
 
305
-				$view->suggestItems = $controller->getProductItems( array_keys( $products ), $domains );
305
+				$view->suggestItems = $controller->getProductItems(array_keys($products), $domains);
306 306
 				$view->suggestPosItems = $products;
307 307
 
308
-				$this->addMetaItem( $view->suggestItems, 'product', $this->expire, $this->tags );
309
-				$this->addMetaList( array_keys( $view->suggestItems ), 'product', $this->expire );
308
+				$this->addMetaItem($view->suggestItems, 'product', $this->expire, $this->tags);
309
+				$this->addMetaList(array_keys($view->suggestItems), 'product', $this->expire);
310 310
 			}
311 311
 
312 312
 			$this->cache = $view;
313 313
 		}
314 314
 
315
-		$expire = $this->expires( $this->expire, $expire );
316
-		$tags = array_merge( $tags, $this->tags );
315
+		$expire = $this->expires($this->expire, $expire);
316
+		$tags = array_merge($tags, $this->tags);
317 317
 
318 318
 		return $this->cache;
319 319
 	}
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Filter/Attribute/Standard.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114 114
 	 * @param array &$tags Result array for the list of tags that are associated to the output
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
116
+	 * @return string String including HTML tags for the header on error
117 117
 	 */
118 118
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119 119
 	{
Please login to merge, or discard this patch.
Indentation   +344 added lines, -344 removed lines patch added patch discarded remove patch
@@ -19,349 +19,349 @@
 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/filter/attribute/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog filter attribute section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/filter/attribute/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $tags = array();
61
-	private $expire;
62
-	private $cache;
63
-
64
-
65
-	/**
66
-	 * Returns the HTML code for insertion into the body.
67
-	 *
68
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
-	 * @param array &$tags Result array for the list of tags that are associated to the output
70
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
-	 * @return string HTML code
72
-	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
-	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
76
-
77
-		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
-		}
81
-		$view->attributeBody = $html;
82
-
83
-		/** client/html/catalog/filter/attribute/standard/template-body
84
-		 * Relative path to the HTML body template of the catalog filter attribute client.
85
-		 *
86
-		 * The template file contains the HTML code and processing instructions
87
-		 * to generate the result shown in the body of the frontend. The
88
-		 * configuration string is the path to the template file relative
89
-		 * to the templates directory (usually in client/html/templates).
90
-		 *
91
-		 * You can overwrite the template file configuration in extensions and
92
-		 * provide alternative templates. These alternative templates should be
93
-		 * named like the default one but with the string "standard" replaced by
94
-		 * an unique name. You may use the name of your project for this. If
95
-		 * you've implemented an alternative client class as well, "standard"
96
-		 * should be replaced by the name of the new class.
97
-		 *
98
-		 * @param string Relative path to the template creating code for the HTML page body
99
-		 * @since 2014.03
100
-		 * @category Developer
101
-		 * @see client/html/catalog/filter/attribute/standard/template-header
102
-		 */
103
-		$tplconf = 'client/html/catalog/filter/attribute/standard/template-body';
104
-		$default = 'catalog/filter/attribute-body-default.php';
105
-
106
-		return $view->render( $view->config( $tplconf, $default ) );
107
-	}
108
-
109
-
110
-	/**
111
-	 * Returns the HTML string for insertion into the header.
112
-	 *
113
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
-	 * @param array &$tags Result array for the list of tags that are associated to the output
115
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
117
-	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
-	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
121
-
122
-		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
-		}
126
-		$view->attributeHeader = $html;
127
-
128
-		/** client/html/catalog/filter/attribute/standard/template-header
129
-		 * Relative path to the HTML header template of the catalog filter attribute client.
130
-		 *
131
-		 * The template file contains the HTML code and processing instructions
132
-		 * to generate the HTML code that is inserted into the HTML page header
133
-		 * of the rendered page in the frontend. The configuration string is the
134
-		 * path to the template file relative to the templates directory (usually
135
-		 * in client/html/templates).
136
-		 *
137
-		 * You can overwrite the template file configuration in extensions and
138
-		 * provide alternative templates. These alternative templates should be
139
-		 * named like the default one but with the string "standard" replaced by
140
-		 * an unique name. You may use the name of your project for this. If
141
-		 * you've implemented an alternative client class as well, "standard"
142
-		 * should be replaced by the name of the new class.
143
-		 *
144
-		 * @param string Relative path to the template creating code for the HTML page head
145
-		 * @since 2014.03
146
-		 * @category Developer
147
-		 * @see client/html/catalog/filter/attribute/standard/template-body
148
-		 */
149
-		$tplconf = 'client/html/catalog/filter/attribute/standard/template-header';
150
-		$default = 'catalog/filter/attribute-header-default.php';
151
-
152
-		return $view->render( $view->config( $tplconf, $default ) );
153
-	}
154
-
155
-
156
-	/**
157
-	 * Returns the sub-client given by its name.
158
-	 *
159
-	 * @param string $type Name of the client type
160
-	 * @param string|null $name Name of the sub-client (Default if null)
161
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
162
-	 */
163
-	public function getSubClient( $type, $name = null )
164
-	{
165
-		/** client/html/catalog/filter/attribute/decorators/excludes
166
-		 * Excludes decorators added by the "common" option from the catalog filter attribute html client
167
-		 *
168
-		 * Decorators extend the functionality of a class by adding new aspects
169
-		 * (e.g. log what is currently done), executing the methods of the underlying
170
-		 * class only in certain conditions (e.g. only for logged in users) or
171
-		 * modify what is returned to the caller.
172
-		 *
173
-		 * This option allows you to remove a decorator added via
174
-		 * "client/html/common/decorators/default" before they are wrapped
175
-		 * around the html client.
176
-		 *
177
-		 *  client/html/catalog/filter/attribute/decorators/excludes = array( 'decorator1' )
178
-		 *
179
-		 * This would remove the decorator named "decorator1" from the list of
180
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
-		 * "client/html/common/decorators/default" to the html client.
182
-		 *
183
-		 * @param array List of decorator names
184
-		 * @since 2015.08
185
-		 * @category Developer
186
-		 * @see client/html/common/decorators/default
187
-		 * @see client/html/catalog/filter/attribute/decorators/global
188
-		 * @see client/html/catalog/filter/attribute/decorators/local
189
-		 */
190
-
191
-		/** client/html/catalog/filter/attribute/decorators/global
192
-		 * Adds a list of globally available decorators only to the catalog filter attribute html client
193
-		 *
194
-		 * Decorators extend the functionality of a class by adding new aspects
195
-		 * (e.g. log what is currently done), executing the methods of the underlying
196
-		 * class only in certain conditions (e.g. only for logged in users) or
197
-		 * modify what is returned to the caller.
198
-		 *
199
-		 * This option allows you to wrap global decorators
200
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
-		 *
202
-		 *  client/html/catalog/filter/attribute/decorators/global = array( 'decorator1' )
203
-		 *
204
-		 * This would add the decorator named "decorator1" defined by
205
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
-		 *
207
-		 * @param array List of decorator names
208
-		 * @since 2015.08
209
-		 * @category Developer
210
-		 * @see client/html/common/decorators/default
211
-		 * @see client/html/catalog/filter/attribute/decorators/excludes
212
-		 * @see client/html/catalog/filter/attribute/decorators/local
213
-		 */
214
-
215
-		/** client/html/catalog/filter/attribute/decorators/local
216
-		 * Adds a list of local decorators only to the catalog filter attribute html client
217
-		 *
218
-		 * Decorators extend the functionality of a class by adding new aspects
219
-		 * (e.g. log what is currently done), executing the methods of the underlying
220
-		 * class only in certain conditions (e.g. only for logged in users) or
221
-		 * modify what is returned to the caller.
222
-		 *
223
-		 * This option allows you to wrap local decorators
224
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
-		 *
226
-		 *  client/html/catalog/filter/attribute/decorators/local = array( 'decorator2' )
227
-		 *
228
-		 * This would add the decorator named "decorator2" defined by
229
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
-		 *
231
-		 * @param array List of decorator names
232
-		 * @since 2015.08
233
-		 * @category Developer
234
-		 * @see client/html/common/decorators/default
235
-		 * @see client/html/catalog/filter/attribute/decorators/excludes
236
-		 * @see client/html/catalog/filter/attribute/decorators/global
237
-		 */
238
-
239
-		return $this->createSubClient( 'catalog/filter/attribute/' . $type, $name );
240
-	}
241
-
242
-
243
-	/**
244
-	 * Returns the list of sub-client names configured for the client.
245
-	 *
246
-	 * @return array List of HTML client names
247
-	 */
248
-	protected function getSubClientNames()
249
-	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
-	}
252
-
253
-
254
-	/**
255
-	 * Sets the necessary parameter values in the view.
256
-	 *
257
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
-	 * @param array &$tags Result array for the list of tags that are associated to the output
259
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
-	 * @return \Aimeos\MW\View\Iface Modified view object
261
-	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
-	{
264
-		if( !isset( $this->cache ) )
265
-		{
266
-			$attrMap = array();
267
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
268
-
269
-			/** client/html/catalog/filter/attribute/types
270
-			 * List of attribute types that should be displayed in this order in the catalog filter
271
-			 *
272
-			 * The attribute section in the catalog filter component can display
273
-			 * all attributes a visitor can use to reduce the listed products
274
-			 * to those that contains one or more attributes. By default, all
275
-			 * available attributes will be displayed and ordered by their
276
-			 * attribute type.
277
-			 *
278
-			 * With this setting, you can limit the attribute types to only thoses
279
-			 * whose names are part of the setting value. Furthermore, a particular
280
-			 * order for the attribute types can be enforced that is different
281
-			 * from the standard order.
282
-			 *
283
-			 * @param array List of attribute type codes
284
-			 * @since 2015.05
285
-			 * @category User
286
-			 * @category Developer
287
-			 * @see client/html/catalog/filter/attribute/domains
288
-			 */
289
-			$attrTypes = $view->config( 'client/html/catalog/filter/attribute/types', array() );
290
-
291
-			$manager = $controller->createManager( 'attribute' );
292
-			$search = $manager->createSearch( true );
293
-
294
-			$expr = array();
295
-			if( !empty( $attrTypes ) ) {
296
-				$expr[] = $search->compare( '==', 'attribute.type.code', $attrTypes );
297
-			}
298
-
299
-			$expr[] = $search->compare( '==', 'attribute.domain', 'product' );
300
-			$expr[] = $search->getConditions();
301
-
302
-			$sort = array( $search->sort( '+', 'attribute.position' ) );
303
-
304
-			$search->setConditions( $search->combine( '&&', $expr ) );
305
-			$search->setSortations( $sort );
306
-			$search->setSlice( 0, 0x7fffffff );
307
-
308
-			/** client/html/catalog/filter/attribute/domains
309
-			 * List of domain names whose items should be fetched with the filter attributes
310
-			 *
311
-			 * The templates rendering the attributes in the catalog filter usually
312
-			 * add the images and texts associated to each item. If you want to
313
-			 * display additional content, you can configure your own list of
314
-			 * domains (attribute, media, price, product, text, etc. are domains)
315
-			 * whose items are fetched from the storage. Please keep in mind that
316
-			 * the more domains you add to the configuration, the more time is
317
-			 * required for fetching the content!
318
-			 *
319
-			 * @param array List of domain item names
320
-			 * @since 2015.05
321
-			 * @category Developer
322
-			 * @see client/html/catalog/filter/attribute/types
323
-			 */
324
-			$domains = $view->config( 'client/html/catalog/filter/attribute/domains', array( 'text', 'media' ) );
325
-
326
-			$attributes = $manager->searchItems( $search, $domains );
327
-
328
-			foreach( $attributes as $id => $item ) {
329
-				$attrMap[$item->getType()][$id] = $item;
330
-			}
331
-
332
-			if( !empty( $attrTypes ) )
333
-			{
334
-				$sortedMap = array();
335
-
336
-				foreach( $attrTypes as $type )
337
-				{
338
-					if( isset( $attrMap[$type] ) ) {
339
-						$sortedMap[$type] = $attrMap[$type];
340
-					}
341
-				}
342
-
343
-				$attrMap = $sortedMap;
344
-			}
345
-			else
346
-			{
347
-				ksort( $attrMap );
348
-			}
349
-
350
-			$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
351
-			$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
352
-
353
-			// Delete cache when attributes are added or deleted even in "tag-all" mode
354
-			$this->tags[] = 'attribute';
355
-
356
-
357
-			$view->attributeMap = $attrMap;
358
-
359
-			$this->cache = $view;
360
-		}
361
-
362
-		$expire = $this->expires( $this->expire, $expire );
363
-		$tags = array_merge( $tags, $this->tags );
364
-
365
-		return $this->cache;
366
-	}
25
+    /** client/html/catalog/filter/attribute/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog filter attribute section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/filter/attribute/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $tags = array();
61
+    private $expire;
62
+    private $cache;
63
+
64
+
65
+    /**
66
+     * Returns the HTML code for insertion into the body.
67
+     *
68
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
69
+     * @param array &$tags Result array for the list of tags that are associated to the output
70
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71
+     * @return string HTML code
72
+     */
73
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
74
+    {
75
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
76
+
77
+        $html = '';
78
+        foreach( $this->getSubClients() as $subclient ) {
79
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
80
+        }
81
+        $view->attributeBody = $html;
82
+
83
+        /** client/html/catalog/filter/attribute/standard/template-body
84
+         * Relative path to the HTML body template of the catalog filter attribute client.
85
+         *
86
+         * The template file contains the HTML code and processing instructions
87
+         * to generate the result shown in the body of the frontend. The
88
+         * configuration string is the path to the template file relative
89
+         * to the templates directory (usually in client/html/templates).
90
+         *
91
+         * You can overwrite the template file configuration in extensions and
92
+         * provide alternative templates. These alternative templates should be
93
+         * named like the default one but with the string "standard" replaced by
94
+         * an unique name. You may use the name of your project for this. If
95
+         * you've implemented an alternative client class as well, "standard"
96
+         * should be replaced by the name of the new class.
97
+         *
98
+         * @param string Relative path to the template creating code for the HTML page body
99
+         * @since 2014.03
100
+         * @category Developer
101
+         * @see client/html/catalog/filter/attribute/standard/template-header
102
+         */
103
+        $tplconf = 'client/html/catalog/filter/attribute/standard/template-body';
104
+        $default = 'catalog/filter/attribute-body-default.php';
105
+
106
+        return $view->render( $view->config( $tplconf, $default ) );
107
+    }
108
+
109
+
110
+    /**
111
+     * Returns the HTML string for insertion into the header.
112
+     *
113
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114
+     * @param array &$tags Result array for the list of tags that are associated to the output
115
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
+     * @return string|null String including HTML tags for the header on error
117
+     */
118
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119
+    {
120
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
121
+
122
+        $html = '';
123
+        foreach( $this->getSubClients() as $subclient ) {
124
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
125
+        }
126
+        $view->attributeHeader = $html;
127
+
128
+        /** client/html/catalog/filter/attribute/standard/template-header
129
+         * Relative path to the HTML header template of the catalog filter attribute client.
130
+         *
131
+         * The template file contains the HTML code and processing instructions
132
+         * to generate the HTML code that is inserted into the HTML page header
133
+         * of the rendered page in the frontend. The configuration string is the
134
+         * path to the template file relative to the templates directory (usually
135
+         * in client/html/templates).
136
+         *
137
+         * You can overwrite the template file configuration in extensions and
138
+         * provide alternative templates. These alternative templates should be
139
+         * named like the default one but with the string "standard" replaced by
140
+         * an unique name. You may use the name of your project for this. If
141
+         * you've implemented an alternative client class as well, "standard"
142
+         * should be replaced by the name of the new class.
143
+         *
144
+         * @param string Relative path to the template creating code for the HTML page head
145
+         * @since 2014.03
146
+         * @category Developer
147
+         * @see client/html/catalog/filter/attribute/standard/template-body
148
+         */
149
+        $tplconf = 'client/html/catalog/filter/attribute/standard/template-header';
150
+        $default = 'catalog/filter/attribute-header-default.php';
151
+
152
+        return $view->render( $view->config( $tplconf, $default ) );
153
+    }
154
+
155
+
156
+    /**
157
+     * Returns the sub-client given by its name.
158
+     *
159
+     * @param string $type Name of the client type
160
+     * @param string|null $name Name of the sub-client (Default if null)
161
+     * @return \Aimeos\Client\Html\Iface Sub-client object
162
+     */
163
+    public function getSubClient( $type, $name = null )
164
+    {
165
+        /** client/html/catalog/filter/attribute/decorators/excludes
166
+         * Excludes decorators added by the "common" option from the catalog filter attribute html client
167
+         *
168
+         * Decorators extend the functionality of a class by adding new aspects
169
+         * (e.g. log what is currently done), executing the methods of the underlying
170
+         * class only in certain conditions (e.g. only for logged in users) or
171
+         * modify what is returned to the caller.
172
+         *
173
+         * This option allows you to remove a decorator added via
174
+         * "client/html/common/decorators/default" before they are wrapped
175
+         * around the html client.
176
+         *
177
+         *  client/html/catalog/filter/attribute/decorators/excludes = array( 'decorator1' )
178
+         *
179
+         * This would remove the decorator named "decorator1" from the list of
180
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
+         * "client/html/common/decorators/default" to the html client.
182
+         *
183
+         * @param array List of decorator names
184
+         * @since 2015.08
185
+         * @category Developer
186
+         * @see client/html/common/decorators/default
187
+         * @see client/html/catalog/filter/attribute/decorators/global
188
+         * @see client/html/catalog/filter/attribute/decorators/local
189
+         */
190
+
191
+        /** client/html/catalog/filter/attribute/decorators/global
192
+         * Adds a list of globally available decorators only to the catalog filter attribute html client
193
+         *
194
+         * Decorators extend the functionality of a class by adding new aspects
195
+         * (e.g. log what is currently done), executing the methods of the underlying
196
+         * class only in certain conditions (e.g. only for logged in users) or
197
+         * modify what is returned to the caller.
198
+         *
199
+         * This option allows you to wrap global decorators
200
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
+         *
202
+         *  client/html/catalog/filter/attribute/decorators/global = array( 'decorator1' )
203
+         *
204
+         * This would add the decorator named "decorator1" defined by
205
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
+         *
207
+         * @param array List of decorator names
208
+         * @since 2015.08
209
+         * @category Developer
210
+         * @see client/html/common/decorators/default
211
+         * @see client/html/catalog/filter/attribute/decorators/excludes
212
+         * @see client/html/catalog/filter/attribute/decorators/local
213
+         */
214
+
215
+        /** client/html/catalog/filter/attribute/decorators/local
216
+         * Adds a list of local decorators only to the catalog filter attribute html client
217
+         *
218
+         * Decorators extend the functionality of a class by adding new aspects
219
+         * (e.g. log what is currently done), executing the methods of the underlying
220
+         * class only in certain conditions (e.g. only for logged in users) or
221
+         * modify what is returned to the caller.
222
+         *
223
+         * This option allows you to wrap local decorators
224
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
+         *
226
+         *  client/html/catalog/filter/attribute/decorators/local = array( 'decorator2' )
227
+         *
228
+         * This would add the decorator named "decorator2" defined by
229
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
+         *
231
+         * @param array List of decorator names
232
+         * @since 2015.08
233
+         * @category Developer
234
+         * @see client/html/common/decorators/default
235
+         * @see client/html/catalog/filter/attribute/decorators/excludes
236
+         * @see client/html/catalog/filter/attribute/decorators/global
237
+         */
238
+
239
+        return $this->createSubClient( 'catalog/filter/attribute/' . $type, $name );
240
+    }
241
+
242
+
243
+    /**
244
+     * Returns the list of sub-client names configured for the client.
245
+     *
246
+     * @return array List of HTML client names
247
+     */
248
+    protected function getSubClientNames()
249
+    {
250
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
251
+    }
252
+
253
+
254
+    /**
255
+     * Sets the necessary parameter values in the view.
256
+     *
257
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
258
+     * @param array &$tags Result array for the list of tags that are associated to the output
259
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260
+     * @return \Aimeos\MW\View\Iface Modified view object
261
+     */
262
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
263
+    {
264
+        if( !isset( $this->cache ) )
265
+        {
266
+            $attrMap = array();
267
+            $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
268
+
269
+            /** client/html/catalog/filter/attribute/types
270
+             * List of attribute types that should be displayed in this order in the catalog filter
271
+             *
272
+             * The attribute section in the catalog filter component can display
273
+             * all attributes a visitor can use to reduce the listed products
274
+             * to those that contains one or more attributes. By default, all
275
+             * available attributes will be displayed and ordered by their
276
+             * attribute type.
277
+             *
278
+             * With this setting, you can limit the attribute types to only thoses
279
+             * whose names are part of the setting value. Furthermore, a particular
280
+             * order for the attribute types can be enforced that is different
281
+             * from the standard order.
282
+             *
283
+             * @param array List of attribute type codes
284
+             * @since 2015.05
285
+             * @category User
286
+             * @category Developer
287
+             * @see client/html/catalog/filter/attribute/domains
288
+             */
289
+            $attrTypes = $view->config( 'client/html/catalog/filter/attribute/types', array() );
290
+
291
+            $manager = $controller->createManager( 'attribute' );
292
+            $search = $manager->createSearch( true );
293
+
294
+            $expr = array();
295
+            if( !empty( $attrTypes ) ) {
296
+                $expr[] = $search->compare( '==', 'attribute.type.code', $attrTypes );
297
+            }
298
+
299
+            $expr[] = $search->compare( '==', 'attribute.domain', 'product' );
300
+            $expr[] = $search->getConditions();
301
+
302
+            $sort = array( $search->sort( '+', 'attribute.position' ) );
303
+
304
+            $search->setConditions( $search->combine( '&&', $expr ) );
305
+            $search->setSortations( $sort );
306
+            $search->setSlice( 0, 0x7fffffff );
307
+
308
+            /** client/html/catalog/filter/attribute/domains
309
+             * List of domain names whose items should be fetched with the filter attributes
310
+             *
311
+             * The templates rendering the attributes in the catalog filter usually
312
+             * add the images and texts associated to each item. If you want to
313
+             * display additional content, you can configure your own list of
314
+             * domains (attribute, media, price, product, text, etc. are domains)
315
+             * whose items are fetched from the storage. Please keep in mind that
316
+             * the more domains you add to the configuration, the more time is
317
+             * required for fetching the content!
318
+             *
319
+             * @param array List of domain item names
320
+             * @since 2015.05
321
+             * @category Developer
322
+             * @see client/html/catalog/filter/attribute/types
323
+             */
324
+            $domains = $view->config( 'client/html/catalog/filter/attribute/domains', array( 'text', 'media' ) );
325
+
326
+            $attributes = $manager->searchItems( $search, $domains );
327
+
328
+            foreach( $attributes as $id => $item ) {
329
+                $attrMap[$item->getType()][$id] = $item;
330
+            }
331
+
332
+            if( !empty( $attrTypes ) )
333
+            {
334
+                $sortedMap = array();
335
+
336
+                foreach( $attrTypes as $type )
337
+                {
338
+                    if( isset( $attrMap[$type] ) ) {
339
+                        $sortedMap[$type] = $attrMap[$type];
340
+                    }
341
+                }
342
+
343
+                $attrMap = $sortedMap;
344
+            }
345
+            else
346
+            {
347
+                ksort( $attrMap );
348
+            }
349
+
350
+            $this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
351
+            $this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
352
+
353
+            // Delete cache when attributes are added or deleted even in "tag-all" mode
354
+            $this->tags[] = 'attribute';
355
+
356
+
357
+            $view->attributeMap = $attrMap;
358
+
359
+            $this->cache = $view;
360
+        }
361
+
362
+        $expire = $this->expires( $this->expire, $expire );
363
+        $tags = array_merge( $tags, $this->tags );
364
+
365
+        return $this->cache;
366
+    }
367 367
 }
368 368
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71 71
 	 * @return string HTML code
72 72
 	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
74 74
 	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
75
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
76 76
 
77 77
 		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
+		foreach ($this->getSubClients() as $subclient) {
79
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
80 80
 		}
81 81
 		$view->attributeBody = $html;
82 82
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$tplconf = 'client/html/catalog/filter/attribute/standard/template-body';
104 104
 		$default = 'catalog/filter/attribute-body-default.php';
105 105
 
106
-		return $view->render( $view->config( $tplconf, $default ) );
106
+		return $view->render($view->config($tplconf, $default));
107 107
 	}
108 108
 
109 109
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116 116
 	 * @return string|null String including HTML tags for the header on error
117 117
 	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
119 119
 	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
120
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
121 121
 
122 122
 		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+		foreach ($this->getSubClients() as $subclient) {
124
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
125 125
 		}
126 126
 		$view->attributeHeader = $html;
127 127
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$tplconf = 'client/html/catalog/filter/attribute/standard/template-header';
150 150
 		$default = 'catalog/filter/attribute-header-default.php';
151 151
 
152
-		return $view->render( $view->config( $tplconf, $default ) );
152
+		return $view->render($view->config($tplconf, $default));
153 153
 	}
154 154
 
155 155
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @param string|null $name Name of the sub-client (Default if null)
161 161
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
162 162
 	 */
163
-	public function getSubClient( $type, $name = null )
163
+	public function getSubClient($type, $name = null)
164 164
 	{
165 165
 		/** client/html/catalog/filter/attribute/decorators/excludes
166 166
 		 * Excludes decorators added by the "common" option from the catalog filter attribute html client
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		 * @see client/html/catalog/filter/attribute/decorators/global
237 237
 		 */
238 238
 
239
-		return $this->createSubClient( 'catalog/filter/attribute/' . $type, $name );
239
+		return $this->createSubClient('catalog/filter/attribute/'.$type, $name);
240 240
 	}
241 241
 
242 242
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function getSubClientNames()
249 249
 	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
251 251
 	}
252 252
 
253 253
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260 260
 	 * @return \Aimeos\MW\View\Iface Modified view object
261 261
 	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
263 263
 	{
264
-		if( !isset( $this->cache ) )
264
+		if (!isset($this->cache))
265 265
 		{
266 266
 			$attrMap = array();
267
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' );
267
+			$controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
268 268
 
269 269
 			/** client/html/catalog/filter/attribute/types
270 270
 			 * List of attribute types that should be displayed in this order in the catalog filter
@@ -286,24 +286,24 @@  discard block
 block discarded – undo
286 286
 			 * @category Developer
287 287
 			 * @see client/html/catalog/filter/attribute/domains
288 288
 			 */
289
-			$attrTypes = $view->config( 'client/html/catalog/filter/attribute/types', array() );
289
+			$attrTypes = $view->config('client/html/catalog/filter/attribute/types', array());
290 290
 
291
-			$manager = $controller->createManager( 'attribute' );
292
-			$search = $manager->createSearch( true );
291
+			$manager = $controller->createManager('attribute');
292
+			$search = $manager->createSearch(true);
293 293
 
294 294
 			$expr = array();
295
-			if( !empty( $attrTypes ) ) {
296
-				$expr[] = $search->compare( '==', 'attribute.type.code', $attrTypes );
295
+			if (!empty($attrTypes)) {
296
+				$expr[] = $search->compare('==', 'attribute.type.code', $attrTypes);
297 297
 			}
298 298
 
299
-			$expr[] = $search->compare( '==', 'attribute.domain', 'product' );
299
+			$expr[] = $search->compare('==', 'attribute.domain', 'product');
300 300
 			$expr[] = $search->getConditions();
301 301
 
302
-			$sort = array( $search->sort( '+', 'attribute.position' ) );
302
+			$sort = array($search->sort('+', 'attribute.position'));
303 303
 
304
-			$search->setConditions( $search->combine( '&&', $expr ) );
305
-			$search->setSortations( $sort );
306
-			$search->setSlice( 0, 0x7fffffff );
304
+			$search->setConditions($search->combine('&&', $expr));
305
+			$search->setSortations($sort);
306
+			$search->setSlice(0, 0x7fffffff);
307 307
 
308 308
 			/** client/html/catalog/filter/attribute/domains
309 309
 			 * List of domain names whose items should be fetched with the filter attributes
@@ -321,21 +321,21 @@  discard block
 block discarded – undo
321 321
 			 * @category Developer
322 322
 			 * @see client/html/catalog/filter/attribute/types
323 323
 			 */
324
-			$domains = $view->config( 'client/html/catalog/filter/attribute/domains', array( 'text', 'media' ) );
324
+			$domains = $view->config('client/html/catalog/filter/attribute/domains', array('text', 'media'));
325 325
 
326
-			$attributes = $manager->searchItems( $search, $domains );
326
+			$attributes = $manager->searchItems($search, $domains);
327 327
 
328
-			foreach( $attributes as $id => $item ) {
328
+			foreach ($attributes as $id => $item) {
329 329
 				$attrMap[$item->getType()][$id] = $item;
330 330
 			}
331 331
 
332
-			if( !empty( $attrTypes ) )
332
+			if (!empty($attrTypes))
333 333
 			{
334 334
 				$sortedMap = array();
335 335
 
336
-				foreach( $attrTypes as $type )
336
+				foreach ($attrTypes as $type)
337 337
 				{
338
-					if( isset( $attrMap[$type] ) ) {
338
+					if (isset($attrMap[$type])) {
339 339
 						$sortedMap[$type] = $attrMap[$type];
340 340
 					}
341 341
 				}
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 			}
345 345
 			else
346 346
 			{
347
-				ksort( $attrMap );
347
+				ksort($attrMap);
348 348
 			}
349 349
 
350
-			$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
351
-			$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
350
+			$this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags);
351
+			$this->addMetaList(array_keys($attributes), 'attribute', $this->expire);
352 352
 
353 353
 			// Delete cache when attributes are added or deleted even in "tag-all" mode
354 354
 			$this->tags[] = 'attribute';
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
 			$this->cache = $view;
360 360
 		}
361 361
 
362
-		$expire = $this->expires( $this->expire, $expire );
363
-		$tags = array_merge( $tags, $this->tags );
362
+		$expire = $this->expires($this->expire, $expire);
363
+		$tags = array_merge($tags, $this->tags);
364 364
 
365 365
 		return $this->cache;
366 366
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,8 +341,7 @@
 block discarded – undo
341 341
 				}
342 342
 
343 343
 				$attrMap = $sortedMap;
344
-			}
345
-			else
344
+			} else
346 345
 			{
347 346
 				ksort( $attrMap );
348 347
 			}
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Filter/Search/Standard.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111 111
 	 * @param array &$tags Result array for the list of tags that are associated to the output
112 112
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
-	 * @return string|null String including HTML tags for the header on error
113
+	 * @return string String including HTML tags for the header on error
114 114
 	 */
115 115
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116 116
 	{
Please login to merge, or discard this 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/filter/search/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog filter search section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/filter/search/standard/subparts';
59
-	private $subPartNames = array();
60
-
61
-
62
-	/**
63
-	 * Returns the HTML code for insertion into the body.
64
-	 *
65
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
66
-	 * @param array &$tags Result array for the list of tags that are associated to the output
67
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68
-	 * @return string HTML code
69
-	 */
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
-	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
73
-
74
-		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
77
-		}
78
-		$view->searchBody = $html;
79
-
80
-		/** client/html/catalog/filter/search/standard/template-body
81
-		 * Relative path to the HTML body template of the catalog filter search client.
82
-		 *
83
-		 * The template file contains the HTML code and processing instructions
84
-		 * to generate the result shown in the body of the frontend. The
85
-		 * configuration string is the path to the template file relative
86
-		 * to the templates directory (usually in client/html/templates).
87
-		 *
88
-		 * You can overwrite the template file configuration in extensions and
89
-		 * provide alternative templates. These alternative templates should be
90
-		 * named like the default one but with the string "standard" replaced by
91
-		 * an unique name. You may use the name of your project for this. If
92
-		 * you've implemented an alternative client class as well, "standard"
93
-		 * should be replaced by the name of the new class.
94
-		 *
95
-		 * @param string Relative path to the template creating code for the HTML page body
96
-		 * @since 2014.03
97
-		 * @category Developer
98
-		 * @see client/html/catalog/filter/search/standard/template-header
99
-		 */
100
-		$tplconf = 'client/html/catalog/filter/search/standard/template-body';
101
-		$default = 'catalog/filter/search-body-default.php';
102
-
103
-		return $view->render( $view->config( $tplconf, $default ) );
104
-	}
105
-
106
-
107
-	/**
108
-	 * Returns the HTML string for insertion into the header.
109
-	 *
110
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111
-	 * @param array &$tags Result array for the list of tags that are associated to the output
112
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
-	 * @return string|null String including HTML tags for the header on error
114
-	 */
115
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
-	{
117
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
-
119
-		$html = '';
120
-		foreach( $this->getSubClients() as $subclient ) {
121
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
122
-		}
123
-		$view->searchHeader = $html;
124
-
125
-		/** client/html/catalog/filter/search/standard/template-header
126
-		 * Relative path to the HTML header template of the catalog filter search client.
127
-		 *
128
-		 * The template file contains the HTML code and processing instructions
129
-		 * to generate the HTML code that is inserted into the HTML page header
130
-		 * of the rendered page in the frontend. The configuration string is the
131
-		 * path to the template file relative to the templates directory (usually
132
-		 * in client/html/templates).
133
-		 *
134
-		 * You can overwrite the template file configuration in extensions and
135
-		 * provide alternative templates. These alternative templates should be
136
-		 * named like the default one but with the string "standard" replaced by
137
-		 * an unique name. You may use the name of your project for this. If
138
-		 * you've implemented an alternative client class as well, "standard"
139
-		 * should be replaced by the name of the new class.
140
-		 *
141
-		 * @param string Relative path to the template creating code for the HTML page head
142
-		 * @since 2014.03
143
-		 * @category Developer
144
-		 * @see client/html/catalog/filter/search/standard/template-body
145
-		 */
146
-		$tplconf = 'client/html/catalog/filter/search/standard/template-header';
147
-		$default = 'catalog/filter/search-header-default.php';
148
-
149
-		return $view->render( $view->config( $tplconf, $default ) );
150
-	}
151
-
152
-
153
-	/**
154
-	 * Returns the sub-client given by its name.
155
-	 *
156
-	 * @param string $type Name of the client type
157
-	 * @param string|null $name Name of the sub-client (Default if null)
158
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
159
-	 */
160
-	public function getSubClient( $type, $name = null )
161
-	{
162
-		/** client/html/catalog/filter/search/decorators/excludes
163
-		 * Excludes decorators added by the "common" option from the catalog filter search html client
164
-		 *
165
-		 * Decorators extend the functionality of a class by adding new aspects
166
-		 * (e.g. log what is currently done), executing the methods of the underlying
167
-		 * class only in certain conditions (e.g. only for logged in users) or
168
-		 * modify what is returned to the caller.
169
-		 *
170
-		 * This option allows you to remove a decorator added via
171
-		 * "client/html/common/decorators/default" before they are wrapped
172
-		 * around the html client.
173
-		 *
174
-		 *  client/html/catalog/filter/search/decorators/excludes = array( 'decorator1' )
175
-		 *
176
-		 * This would remove the decorator named "decorator1" from the list of
177
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
178
-		 * "client/html/common/decorators/default" to the html client.
179
-		 *
180
-		 * @param array List of decorator names
181
-		 * @since 2015.08
182
-		 * @category Developer
183
-		 * @see client/html/common/decorators/default
184
-		 * @see client/html/catalog/filter/search/decorators/global
185
-		 * @see client/html/catalog/filter/search/decorators/local
186
-		 */
187
-
188
-		/** client/html/catalog/filter/search/decorators/global
189
-		 * Adds a list of globally available decorators only to the catalog filter search html client
190
-		 *
191
-		 * Decorators extend the functionality of a class by adding new aspects
192
-		 * (e.g. log what is currently done), executing the methods of the underlying
193
-		 * class only in certain conditions (e.g. only for logged in users) or
194
-		 * modify what is returned to the caller.
195
-		 *
196
-		 * This option allows you to wrap global decorators
197
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
198
-		 *
199
-		 *  client/html/catalog/filter/search/decorators/global = array( 'decorator1' )
200
-		 *
201
-		 * This would add the decorator named "decorator1" defined by
202
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
203
-		 *
204
-		 * @param array List of decorator names
205
-		 * @since 2015.08
206
-		 * @category Developer
207
-		 * @see client/html/common/decorators/default
208
-		 * @see client/html/catalog/filter/search/decorators/excludes
209
-		 * @see client/html/catalog/filter/search/decorators/local
210
-		 */
211
-
212
-		/** client/html/catalog/filter/search/decorators/local
213
-		 * Adds a list of local decorators only to the catalog filter search html client
214
-		 *
215
-		 * Decorators extend the functionality of a class by adding new aspects
216
-		 * (e.g. log what is currently done), executing the methods of the underlying
217
-		 * class only in certain conditions (e.g. only for logged in users) or
218
-		 * modify what is returned to the caller.
219
-		 *
220
-		 * This option allows you to wrap local decorators
221
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
222
-		 *
223
-		 *  client/html/catalog/filter/search/decorators/local = array( 'decorator2' )
224
-		 *
225
-		 * This would add the decorator named "decorator2" defined by
226
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
227
-		 *
228
-		 * @param array List of decorator names
229
-		 * @since 2015.08
230
-		 * @category Developer
231
-		 * @see client/html/common/decorators/default
232
-		 * @see client/html/catalog/filter/search/decorators/excludes
233
-		 * @see client/html/catalog/filter/search/decorators/global
234
-		 */
235
-
236
-		return $this->createSubClient( 'catalog/filter/search/' . $type, $name );
237
-	}
238
-
239
-
240
-	/**
241
-	 * Returns the list of sub-client names configured for the client.
242
-	 *
243
-	 * @return array List of HTML client names
244
-	 */
245
-	protected function getSubClientNames()
246
-	{
247
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
248
-	}
25
+    /** client/html/catalog/filter/search/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog filter search section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/filter/search/standard/subparts';
59
+    private $subPartNames = array();
60
+
61
+
62
+    /**
63
+     * Returns the HTML code for insertion into the body.
64
+     *
65
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
66
+     * @param array &$tags Result array for the list of tags that are associated to the output
67
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68
+     * @return string HTML code
69
+     */
70
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
+    {
72
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
73
+
74
+        $html = '';
75
+        foreach( $this->getSubClients() as $subclient ) {
76
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
77
+        }
78
+        $view->searchBody = $html;
79
+
80
+        /** client/html/catalog/filter/search/standard/template-body
81
+         * Relative path to the HTML body template of the catalog filter search client.
82
+         *
83
+         * The template file contains the HTML code and processing instructions
84
+         * to generate the result shown in the body of the frontend. The
85
+         * configuration string is the path to the template file relative
86
+         * to the templates directory (usually in client/html/templates).
87
+         *
88
+         * You can overwrite the template file configuration in extensions and
89
+         * provide alternative templates. These alternative templates should be
90
+         * named like the default one but with the string "standard" replaced by
91
+         * an unique name. You may use the name of your project for this. If
92
+         * you've implemented an alternative client class as well, "standard"
93
+         * should be replaced by the name of the new class.
94
+         *
95
+         * @param string Relative path to the template creating code for the HTML page body
96
+         * @since 2014.03
97
+         * @category Developer
98
+         * @see client/html/catalog/filter/search/standard/template-header
99
+         */
100
+        $tplconf = 'client/html/catalog/filter/search/standard/template-body';
101
+        $default = 'catalog/filter/search-body-default.php';
102
+
103
+        return $view->render( $view->config( $tplconf, $default ) );
104
+    }
105
+
106
+
107
+    /**
108
+     * Returns the HTML string for insertion into the header.
109
+     *
110
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111
+     * @param array &$tags Result array for the list of tags that are associated to the output
112
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
+     * @return string|null String including HTML tags for the header on error
114
+     */
115
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+    {
117
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+
119
+        $html = '';
120
+        foreach( $this->getSubClients() as $subclient ) {
121
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
122
+        }
123
+        $view->searchHeader = $html;
124
+
125
+        /** client/html/catalog/filter/search/standard/template-header
126
+         * Relative path to the HTML header template of the catalog filter search client.
127
+         *
128
+         * The template file contains the HTML code and processing instructions
129
+         * to generate the HTML code that is inserted into the HTML page header
130
+         * of the rendered page in the frontend. The configuration string is the
131
+         * path to the template file relative to the templates directory (usually
132
+         * in client/html/templates).
133
+         *
134
+         * You can overwrite the template file configuration in extensions and
135
+         * provide alternative templates. These alternative templates should be
136
+         * named like the default one but with the string "standard" replaced by
137
+         * an unique name. You may use the name of your project for this. If
138
+         * you've implemented an alternative client class as well, "standard"
139
+         * should be replaced by the name of the new class.
140
+         *
141
+         * @param string Relative path to the template creating code for the HTML page head
142
+         * @since 2014.03
143
+         * @category Developer
144
+         * @see client/html/catalog/filter/search/standard/template-body
145
+         */
146
+        $tplconf = 'client/html/catalog/filter/search/standard/template-header';
147
+        $default = 'catalog/filter/search-header-default.php';
148
+
149
+        return $view->render( $view->config( $tplconf, $default ) );
150
+    }
151
+
152
+
153
+    /**
154
+     * Returns the sub-client given by its name.
155
+     *
156
+     * @param string $type Name of the client type
157
+     * @param string|null $name Name of the sub-client (Default if null)
158
+     * @return \Aimeos\Client\Html\Iface Sub-client object
159
+     */
160
+    public function getSubClient( $type, $name = null )
161
+    {
162
+        /** client/html/catalog/filter/search/decorators/excludes
163
+         * Excludes decorators added by the "common" option from the catalog filter search html client
164
+         *
165
+         * Decorators extend the functionality of a class by adding new aspects
166
+         * (e.g. log what is currently done), executing the methods of the underlying
167
+         * class only in certain conditions (e.g. only for logged in users) or
168
+         * modify what is returned to the caller.
169
+         *
170
+         * This option allows you to remove a decorator added via
171
+         * "client/html/common/decorators/default" before they are wrapped
172
+         * around the html client.
173
+         *
174
+         *  client/html/catalog/filter/search/decorators/excludes = array( 'decorator1' )
175
+         *
176
+         * This would remove the decorator named "decorator1" from the list of
177
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
178
+         * "client/html/common/decorators/default" to the html client.
179
+         *
180
+         * @param array List of decorator names
181
+         * @since 2015.08
182
+         * @category Developer
183
+         * @see client/html/common/decorators/default
184
+         * @see client/html/catalog/filter/search/decorators/global
185
+         * @see client/html/catalog/filter/search/decorators/local
186
+         */
187
+
188
+        /** client/html/catalog/filter/search/decorators/global
189
+         * Adds a list of globally available decorators only to the catalog filter search html client
190
+         *
191
+         * Decorators extend the functionality of a class by adding new aspects
192
+         * (e.g. log what is currently done), executing the methods of the underlying
193
+         * class only in certain conditions (e.g. only for logged in users) or
194
+         * modify what is returned to the caller.
195
+         *
196
+         * This option allows you to wrap global decorators
197
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
198
+         *
199
+         *  client/html/catalog/filter/search/decorators/global = array( 'decorator1' )
200
+         *
201
+         * This would add the decorator named "decorator1" defined by
202
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
203
+         *
204
+         * @param array List of decorator names
205
+         * @since 2015.08
206
+         * @category Developer
207
+         * @see client/html/common/decorators/default
208
+         * @see client/html/catalog/filter/search/decorators/excludes
209
+         * @see client/html/catalog/filter/search/decorators/local
210
+         */
211
+
212
+        /** client/html/catalog/filter/search/decorators/local
213
+         * Adds a list of local decorators only to the catalog filter search html client
214
+         *
215
+         * Decorators extend the functionality of a class by adding new aspects
216
+         * (e.g. log what is currently done), executing the methods of the underlying
217
+         * class only in certain conditions (e.g. only for logged in users) or
218
+         * modify what is returned to the caller.
219
+         *
220
+         * This option allows you to wrap local decorators
221
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
222
+         *
223
+         *  client/html/catalog/filter/search/decorators/local = array( 'decorator2' )
224
+         *
225
+         * This would add the decorator named "decorator2" defined by
226
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
227
+         *
228
+         * @param array List of decorator names
229
+         * @since 2015.08
230
+         * @category Developer
231
+         * @see client/html/common/decorators/default
232
+         * @see client/html/catalog/filter/search/decorators/excludes
233
+         * @see client/html/catalog/filter/search/decorators/global
234
+         */
235
+
236
+        return $this->createSubClient( 'catalog/filter/search/' . $type, $name );
237
+    }
238
+
239
+
240
+    /**
241
+     * Returns the list of sub-client names configured for the client.
242
+     *
243
+     * @return array List of HTML client names
244
+     */
245
+    protected function getSubClientNames()
246
+    {
247
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
248
+    }
249 249
 }
250 250
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68 68
 	 * @return string HTML code
69 69
 	 */
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
71 71
 	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
72
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
73 73
 
74 74
 		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
75
+		foreach ($this->getSubClients() as $subclient) {
76
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
77 77
 		}
78 78
 		$view->searchBody = $html;
79 79
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$tplconf = 'client/html/catalog/filter/search/standard/template-body';
101 101
 		$default = 'catalog/filter/search-body-default.php';
102 102
 
103
-		return $view->render( $view->config( $tplconf, $default ) );
103
+		return $view->render($view->config($tplconf, $default));
104 104
 	}
105 105
 
106 106
 
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113 113
 	 * @return string|null String including HTML tags for the header on error
114 114
 	 */
115
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
115
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
116 116
 	{
117
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
117
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
118 118
 
119 119
 		$html = '';
120
-		foreach( $this->getSubClients() as $subclient ) {
121
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
120
+		foreach ($this->getSubClients() as $subclient) {
121
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
122 122
 		}
123 123
 		$view->searchHeader = $html;
124 124
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$tplconf = 'client/html/catalog/filter/search/standard/template-header';
147 147
 		$default = 'catalog/filter/search-header-default.php';
148 148
 
149
-		return $view->render( $view->config( $tplconf, $default ) );
149
+		return $view->render($view->config($tplconf, $default));
150 150
 	}
151 151
 
152 152
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param string|null $name Name of the sub-client (Default if null)
158 158
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
159 159
 	 */
160
-	public function getSubClient( $type, $name = null )
160
+	public function getSubClient($type, $name = null)
161 161
 	{
162 162
 		/** client/html/catalog/filter/search/decorators/excludes
163 163
 		 * Excludes decorators added by the "common" option from the catalog filter search html client
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		 * @see client/html/catalog/filter/search/decorators/global
234 234
 		 */
235 235
 
236
-		return $this->createSubClient( 'catalog/filter/search/' . $type, $name );
236
+		return $this->createSubClient('catalog/filter/search/'.$type, $name);
237 237
 	}
238 238
 
239 239
 
@@ -244,6 +244,6 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	protected function getSubClientNames()
246 246
 	{
247
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
247
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
248 248
 	}
249 249
 }
250 250
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Filter/Standard.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@
 block discarded – undo
199 199
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
200 200
 	 * @param array &$tags Result array for the list of tags that are associated to the output
201 201
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
202
-	 * @return string|null String including HTML tags for the header on error
202
+	 * @return string String including HTML tags for the header on error
203 203
 	 */
204 204
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
205 205
 	{
Please login to merge, or discard this patch.
Indentation   +514 added lines, -514 removed lines patch added patch discarded remove patch
@@ -19,519 +19,519 @@
 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
-	private static $headerSingleton;
26
-
27
-	/** client/html/catalog/filter/standard/subparts
28
-	 * List of HTML sub-clients rendered within the catalog filter section
29
-	 *
30
-	 * The output of the frontend is composed of the code generated by the HTML
31
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
32
-	 * that are responsible for rendering certain sub-parts of the output. The
33
-	 * sub-clients can contain HTML clients themselves and therefore a
34
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
35
-	 * the output that is placed inside the container of its parent.
36
-	 *
37
-	 * At first, always the HTML code generated by the parent is printed, then
38
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
39
-	 * determines the order of the output of these sub-clients inside the parent
40
-	 * container. If the configured list of clients is
41
-	 *
42
-	 *  array( "subclient1", "subclient2" )
43
-	 *
44
-	 * you can easily change the order of the output by reordering the subparts:
45
-	 *
46
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
47
-	 *
48
-	 * You can also remove one or more parts if they shouldn't be rendered:
49
-	 *
50
-	 *  client/html/<clients>/subparts = array( "subclient1" )
51
-	 *
52
-	 * As the clients only generates structural HTML, the layout defined via CSS
53
-	 * should support adding, removing or reordering content by a fluid like
54
-	 * design.
55
-	 *
56
-	 * @param array List of sub-client names
57
-	 * @since 2014.03
58
-	 * @category Developer
59
-	 */
60
-	private $subPartPath = 'client/html/catalog/filter/standard/subparts';
61
-
62
-	/** client/html/catalog/filter/search/name
63
-	 * Name of the search part used by the catalog filter client implementation
64
-	 *
65
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Search\Myname".
66
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
67
-	 *
68
-	 * @param string Last part of the client class name
69
-	 * @since 2014.03
70
-	 * @category Developer
71
-	 */
72
-
73
-	/** client/html/catalog/filter/tree/name
74
-	 * Name of the tree part used by the catalog filter client implementation
75
-	 *
76
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Tree\Myname".
77
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
78
-	 *
79
-	 * @param string Last part of the client class name
80
-	 * @since 2014.03
81
-	 * @category Developer
82
-	 */
83
-
84
-	/** client/html/catalog/filter/attribute/name
85
-	 * Name of the attribute part used by the catalog filter client implementation
86
-	 *
87
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Attribute\Myname".
88
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
89
-	 *
90
-	 * @param string Last part of the client class name
91
-	 * @since 2014.03
92
-	 * @category Developer
93
-	 */
94
-	private $subPartNames = array( 'search', 'tree', 'attribute' );
95
-	private $cache;
96
-
97
-
98
-	/**
99
-	 * Returns the HTML code for insertion into the body.
100
-	 *
101
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
102
-	 * @param array &$tags Result array for the list of tags that are associated to the output
103
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
104
-	 * @return string HTML code
105
-	 */
106
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
107
-	{
108
-		$prefixes = array( 'f' );
109
-		$context = $this->getContext();
110
-
111
-		/** client/html/catalog/filter
112
-		 * All parameters defined for the catalog filter component and its subparts
113
-		 *
114
-		 * This returns all settings related to the filter component.
115
-		 * Please refer to the single settings for details.
116
-		 *
117
-		 * @param array Associative list of name/value settings
118
-		 * @category Developer
119
-		 * @see client/html/catalog#filter
120
-		 */
121
-		$confkey = 'client/html/catalog/filter';
122
-
123
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null )
124
-		{
125
-			$view = $this->getView();
126
-
127
-			try
128
-			{
129
-				$view = $this->setViewParams( $view, $tags, $expire );
130
-
131
-				$html = '';
132
-				foreach( $this->getSubClients() as $subclient ) {
133
-					$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
134
-				}
135
-				$view->filterBody = $html;
136
-			}
137
-			catch( \Aimeos\Client\Html\Exception $e )
138
-			{
139
-				$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
140
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
141
-			}
142
-			catch( \Aimeos\Controller\Frontend\Exception $e )
143
-			{
144
-				$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
145
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
146
-			}
147
-			catch( \Aimeos\MShop\Exception $e )
148
-			{
149
-				$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
150
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
151
-			}
152
-			catch( \Exception $e )
153
-			{
154
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
155
-
156
-				$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
157
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
158
-			}
159
-
160
-			/** client/html/catalog/filter/standard/template-body
161
-			 * Relative path to the HTML body template of the catalog filter client.
162
-			 *
163
-			 * The template file contains the HTML code and processing instructions
164
-			 * to generate the result shown in the body of the frontend. The
165
-			 * configuration string is the path to the template file relative
166
-			 * to the templates directory (usually in client/html/templates).
167
-			 *
168
-			 * You can overwrite the template file configuration in extensions and
169
-			 * provide alternative templates. These alternative templates should be
170
-			 * named like the default one but with the string "standard" replaced by
171
-			 * an unique name. You may use the name of your project for this. If
172
-			 * you've implemented an alternative client class as well, "standard"
173
-			 * should be replaced by the name of the new class.
174
-			 *
175
-			 * @param string Relative path to the template creating code for the HTML page body
176
-			 * @since 2014.03
177
-			 * @category Developer
178
-			 * @see client/html/catalog/filter/standard/template-header
179
-			 */
180
-			$tplconf = 'client/html/catalog/filter/standard/template-body';
181
-			$default = 'catalog/filter/body-default.php';
182
-
183
-			$html = $view->render( $view->config( $tplconf, $default ) );
184
-
185
-			$this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
186
-		}
187
-		else
188
-		{
189
-			$html = $this->modifyBody( $html, $uid );
190
-		}
191
-
192
-		return $html;
193
-	}
194
-
195
-
196
-	/**
197
-	 * Returns the HTML string for insertion into the header.
198
-	 *
199
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
200
-	 * @param array &$tags Result array for the list of tags that are associated to the output
201
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
202
-	 * @return string|null String including HTML tags for the header on error
203
-	 */
204
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
205
-	{
206
-		if( self::$headerSingleton !== null ) {
207
-			return '';
208
-		}
209
-
210
-		self::$headerSingleton = true;
211
-
212
-		$prefixes = array( 'f' );
213
-		$context = $this->getContext();
214
-		$confkey = 'client/html/catalog/filter';
215
-
216
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null )
217
-		{
218
-			$view = $this->getView();
219
-
220
-			try
221
-			{
222
-				$view = $this->setViewParams( $view, $tags, $expire );
223
-
224
-				$html = '';
225
-				foreach( $this->getSubClients() as $subclient ) {
226
-					$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
227
-				}
228
-				$view->filterHeader = $html;
229
-			}
230
-			catch( \Exception $e )
231
-			{
232
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
233
-			}
234
-
235
-			/** client/html/catalog/filter/standard/template-header
236
-			 * Relative path to the HTML header template of the catalog filter client.
237
-			 *
238
-			 * The template file contains the HTML code and processing instructions
239
-			 * to generate the HTML code that is inserted into the HTML page header
240
-			 * of the rendered page in the frontend. The configuration string is the
241
-			 * path to the template file relative to the templates directory (usually
242
-			 * in client/html/templates).
243
-			 *
244
-			 * You can overwrite the template file configuration in extensions and
245
-			 * provide alternative templates. These alternative templates should be
246
-			 * named like the default one but with the string "standard" replaced by
247
-			 * an unique name. You may use the name of your project for this. If
248
-			 * you've implemented an alternative client class as well, "standard"
249
-			 * should be replaced by the name of the new class.
250
-			 *
251
-			 * @param string Relative path to the template creating code for the HTML page head
252
-			 * @since 2014.03
253
-			 * @category Developer
254
-			 * @see client/html/catalog/filter/standard/template-body
255
-			 */
256
-			$tplconf = 'client/html/catalog/filter/standard/template-header';
257
-			$default = 'catalog/filter/header-default.php';
258
-
259
-			$html = $view->render( $view->config( $tplconf, $default ) );
260
-
261
-			$this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
262
-		}
263
-		else
264
-		{
265
-			$html = $this->modifyHeader( $html, $uid );
266
-		}
267
-
268
-		return $html;
269
-	}
270
-
271
-
272
-	/**
273
-	 * Returns the sub-client given by its name.
274
-	 *
275
-	 * @param string $type Name of the client type
276
-	 * @param string|null $name Name of the sub-client (Default if null)
277
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
278
-	 */
279
-	public function getSubClient( $type, $name = null )
280
-	{
281
-		/** client/html/catalog/filter/decorators/excludes
282
-		 * Excludes decorators added by the "common" option from the catalog filter html client
283
-		 *
284
-		 * Decorators extend the functionality of a class by adding new aspects
285
-		 * (e.g. log what is currently done), executing the methods of the underlying
286
-		 * class only in certain conditions (e.g. only for logged in users) or
287
-		 * modify what is returned to the caller.
288
-		 *
289
-		 * This option allows you to remove a decorator added via
290
-		 * "client/html/common/decorators/default" before they are wrapped
291
-		 * around the html client.
292
-		 *
293
-		 *  client/html/catalog/filter/decorators/excludes = array( 'decorator1' )
294
-		 *
295
-		 * This would remove the decorator named "decorator1" from the list of
296
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
297
-		 * "client/html/common/decorators/default" to the html client.
298
-		 *
299
-		 * @param array List of decorator names
300
-		 * @since 2014.05
301
-		 * @category Developer
302
-		 * @see client/html/common/decorators/default
303
-		 * @see client/html/catalog/filter/decorators/global
304
-		 * @see client/html/catalog/filter/decorators/local
305
-		 */
306
-
307
-		/** client/html/catalog/filter/decorators/global
308
-		 * Adds a list of globally available decorators only to the catalog filter html client
309
-		 *
310
-		 * Decorators extend the functionality of a class by adding new aspects
311
-		 * (e.g. log what is currently done), executing the methods of the underlying
312
-		 * class only in certain conditions (e.g. only for logged in users) or
313
-		 * modify what is returned to the caller.
314
-		 *
315
-		 * This option allows you to wrap global decorators
316
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
317
-		 *
318
-		 *  client/html/catalog/filter/decorators/global = array( 'decorator1' )
319
-		 *
320
-		 * This would add the decorator named "decorator1" defined by
321
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
322
-		 *
323
-		 * @param array List of decorator names
324
-		 * @since 2014.05
325
-		 * @category Developer
326
-		 * @see client/html/common/decorators/default
327
-		 * @see client/html/catalog/filter/decorators/excludes
328
-		 * @see client/html/catalog/filter/decorators/local
329
-		 */
330
-
331
-		/** client/html/catalog/filter/decorators/local
332
-		 * Adds a list of local decorators only to the catalog filter html client
333
-		 *
334
-		 * Decorators extend the functionality of a class by adding new aspects
335
-		 * (e.g. log what is currently done), executing the methods of the underlying
336
-		 * class only in certain conditions (e.g. only for logged in users) or
337
-		 * modify what is returned to the caller.
338
-		 *
339
-		 * This option allows you to wrap local decorators
340
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
341
-		 *
342
-		 *  client/html/catalog/filter/decorators/local = array( 'decorator2' )
343
-		 *
344
-		 * This would add the decorator named "decorator2" defined by
345
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
346
-		 *
347
-		 * @param array List of decorator names
348
-		 * @since 2014.05
349
-		 * @category Developer
350
-		 * @see client/html/common/decorators/default
351
-		 * @see client/html/catalog/filter/decorators/excludes
352
-		 * @see client/html/catalog/filter/decorators/global
353
-		 */
354
-
355
-		return $this->createSubClient( 'catalog/filter/' . $type, $name );
356
-	}
357
-
358
-
359
-	/**
360
-	 * Modifies the cached body content to replace content based on sessions or cookies.
361
-	 *
362
-	 * @param string $content Cached content
363
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
364
-	 * @return string Modified body content
365
-	 */
366
-	public function modifyBody( $content, $uid )
367
-	{
368
-		$content = parent::modifyBody( $content, $uid );
369
-
370
-		return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.filter.csrf' );
371
-	}
372
-
373
-
374
-	/**
375
-	 * Processes the input, e.g. store given values.
376
-	 * A view must be available and this method doesn't generate any output
377
-	 * besides setting view variables.
378
-	 */
379
-	public function process()
380
-	{
381
-		$context = $this->getContext();
382
-		$view = $this->getView();
383
-
384
-		try
385
-		{
386
-			parent::process();
387
-		}
388
-		catch( \Aimeos\MShop\Exception $e )
389
-		{
390
-			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
391
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
392
-		}
393
-		catch( \Aimeos\Controller\Frontend\Exception $e )
394
-		{
395
-			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
396
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
397
-		}
398
-		catch( \Aimeos\Client\Html\Exception $e )
399
-		{
400
-			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
401
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
402
-		}
403
-		catch( \Exception $e )
404
-		{
405
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
406
-
407
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
408
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
409
-		}
410
-	}
411
-
412
-
413
-	protected function getSubClientNames()
414
-	{
415
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
416
-	}
417
-
418
-
419
-	/**
420
-	 * Sets the necessary parameter values in the view.
421
-	 *
422
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
423
-	 * @param array &$tags Result array for the list of tags that are associated to the output
424
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
425
-	 * @return \Aimeos\MW\View\Iface Modified view object
426
-	 */
427
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
428
-	{
429
-		if( !isset( $this->cache ) )
430
-		{
431
-			$config = $this->getContext()->getConfig();
432
-
433
-			/** client/html/catalog/count/enable
434
-			 * Enables or disables displaying product counts in the catalog filter
435
-			 *
436
-			 * This configuration option allows shop owners to display product
437
-			 * counts in the catalog filter or to disable fetching product count
438
-			 * information.
439
-			 *
440
-			 * The product count information is fetched via AJAX and inserted via
441
-			 * Javascript. This allows to cache parts of the catalog filter by
442
-			 * leaving out such highly dynamic content like product count which
443
-			 * changes with used filter parameter.
444
-			 *
445
-			 * @param boolean Value of "1" to display product counts, "0" to disable them
446
-			 * @since 2014.03
447
-			 * @category User
448
-			 * @category Developer
449
-			 * @see client/html/catalog/count/url/target
450
-			 * @see client/html/catalog/count/url/controller
451
-			 * @see client/html/catalog/count/url/action
452
-			 * @see client/html/catalog/count/url/config
453
-			 */
454
-			if( $config->get( 'client/html/catalog/count/enable', true ) == true )
455
-			{
456
-				/** client/html/catalog/count/url/target
457
-				 * Destination of the URL where the controller specified in the URL is known
458
-				 *
459
-				 * The destination can be a page ID like in a content management system or the
460
-				 * module of a software development framework. This "target" must contain or know
461
-				 * the controller that should be called by the generated URL.
462
-				 *
463
-				 * @param string Destination of the URL
464
-				 * @since 2014.03
465
-				 * @category Developer
466
-				 * @see client/html/catalog/count/url/controller
467
-				 * @see client/html/catalog/count/url/action
468
-				 * @see client/html/catalog/count/url/config
469
-				 */
470
-				$target = $config->get( 'client/html/catalog/count/url/target' );
471
-
472
-				/** client/html/catalog/count/url/controller
473
-				 * Name of the controller whose action should be called
474
-				 *
475
-				 * In Model-View-Controller (MVC) applications, the controller contains the methods
476
-				 * that create parts of the output displayed in the generated HTML page. Controller
477
-				 * names are usually alpha-numeric.
478
-				 *
479
-				 * @param string Name of the controller
480
-				 * @since 2014.03
481
-				 * @category Developer
482
-				 * @see client/html/catalog/count/url/target
483
-				 * @see client/html/catalog/count/url/action
484
-				 * @see client/html/catalog/count/url/config
485
-				 */
486
-				$controller = $config->get( 'client/html/catalog/count/url/controller', 'catalog' );
487
-
488
-				/** client/html/catalog/count/url/action
489
-				 * Name of the action that should create the output
490
-				 *
491
-				 * In Model-View-Controller (MVC) applications, actions are the methods of a
492
-				 * controller that create parts of the output displayed in the generated HTML page.
493
-				 * Action names are usually alpha-numeric.
494
-				 *
495
-				 * @param string Name of the action
496
-				 * @since 2014.03
497
-				 * @category Developer
498
-				 * @see client/html/catalog/count/url/target
499
-				 * @see client/html/catalog/count/url/controller
500
-				 * @see client/html/catalog/count/url/config
501
-				 */
502
-				$action = $config->get( 'client/html/catalog/count/url/action', 'count' );
503
-
504
-				/** client/html/catalog/count/url/config
505
-				 * Associative list of configuration options used for generating the URL
506
-				 *
507
-				 * You can specify additional options as key/value pairs used when generating
508
-				 * the URLs, like
509
-				 *
510
-				 *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
511
-				 *
512
-				 * The available key/value pairs depend on the application that embeds the e-commerce
513
-				 * framework. This is because the infrastructure of the application is used for
514
-				 * generating the URLs. The full list of available config options is referenced
515
-				 * in the "see also" section of this page.
516
-				 *
517
-				 * @param string Associative list of configuration options
518
-				 * @since 2014.03
519
-				 * @category Developer
520
-				 * @see client/html/catalog/count/url/target
521
-				 * @see client/html/catalog/count/url/controller
522
-				 * @see client/html/catalog/count/url/action
523
-				 * @see client/html/url/config
524
-				 */
525
-				$config = $config->get( 'client/html/catalog/count/url/config', array() );
526
-
527
-				$params = $this->getClientParams( $view->param(), array( 'f' ) );
528
-
529
-				$view->filterCountUrl = $view->url( $target, $controller, $action, $params, array(), $config );
530
-			}
531
-
532
-			$this->cache = $view;
533
-		}
534
-
535
-		return $this->cache;
536
-	}
25
+    private static $headerSingleton;
26
+
27
+    /** client/html/catalog/filter/standard/subparts
28
+     * List of HTML sub-clients rendered within the catalog filter section
29
+     *
30
+     * The output of the frontend is composed of the code generated by the HTML
31
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
32
+     * that are responsible for rendering certain sub-parts of the output. The
33
+     * sub-clients can contain HTML clients themselves and therefore a
34
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
35
+     * the output that is placed inside the container of its parent.
36
+     *
37
+     * At first, always the HTML code generated by the parent is printed, then
38
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
39
+     * determines the order of the output of these sub-clients inside the parent
40
+     * container. If the configured list of clients is
41
+     *
42
+     *  array( "subclient1", "subclient2" )
43
+     *
44
+     * you can easily change the order of the output by reordering the subparts:
45
+     *
46
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
47
+     *
48
+     * You can also remove one or more parts if they shouldn't be rendered:
49
+     *
50
+     *  client/html/<clients>/subparts = array( "subclient1" )
51
+     *
52
+     * As the clients only generates structural HTML, the layout defined via CSS
53
+     * should support adding, removing or reordering content by a fluid like
54
+     * design.
55
+     *
56
+     * @param array List of sub-client names
57
+     * @since 2014.03
58
+     * @category Developer
59
+     */
60
+    private $subPartPath = 'client/html/catalog/filter/standard/subparts';
61
+
62
+    /** client/html/catalog/filter/search/name
63
+     * Name of the search part used by the catalog filter client implementation
64
+     *
65
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Search\Myname".
66
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
67
+     *
68
+     * @param string Last part of the client class name
69
+     * @since 2014.03
70
+     * @category Developer
71
+     */
72
+
73
+    /** client/html/catalog/filter/tree/name
74
+     * Name of the tree part used by the catalog filter client implementation
75
+     *
76
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Tree\Myname".
77
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
78
+     *
79
+     * @param string Last part of the client class name
80
+     * @since 2014.03
81
+     * @category Developer
82
+     */
83
+
84
+    /** client/html/catalog/filter/attribute/name
85
+     * Name of the attribute part used by the catalog filter client implementation
86
+     *
87
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Filter\Attribute\Myname".
88
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
89
+     *
90
+     * @param string Last part of the client class name
91
+     * @since 2014.03
92
+     * @category Developer
93
+     */
94
+    private $subPartNames = array( 'search', 'tree', 'attribute' );
95
+    private $cache;
96
+
97
+
98
+    /**
99
+     * Returns the HTML code for insertion into the body.
100
+     *
101
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
102
+     * @param array &$tags Result array for the list of tags that are associated to the output
103
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
104
+     * @return string HTML code
105
+     */
106
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
107
+    {
108
+        $prefixes = array( 'f' );
109
+        $context = $this->getContext();
110
+
111
+        /** client/html/catalog/filter
112
+         * All parameters defined for the catalog filter component and its subparts
113
+         *
114
+         * This returns all settings related to the filter component.
115
+         * Please refer to the single settings for details.
116
+         *
117
+         * @param array Associative list of name/value settings
118
+         * @category Developer
119
+         * @see client/html/catalog#filter
120
+         */
121
+        $confkey = 'client/html/catalog/filter';
122
+
123
+        if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null )
124
+        {
125
+            $view = $this->getView();
126
+
127
+            try
128
+            {
129
+                $view = $this->setViewParams( $view, $tags, $expire );
130
+
131
+                $html = '';
132
+                foreach( $this->getSubClients() as $subclient ) {
133
+                    $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
134
+                }
135
+                $view->filterBody = $html;
136
+            }
137
+            catch( \Aimeos\Client\Html\Exception $e )
138
+            {
139
+                $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
140
+                $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
141
+            }
142
+            catch( \Aimeos\Controller\Frontend\Exception $e )
143
+            {
144
+                $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
145
+                $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
146
+            }
147
+            catch( \Aimeos\MShop\Exception $e )
148
+            {
149
+                $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
150
+                $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
151
+            }
152
+            catch( \Exception $e )
153
+            {
154
+                $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
155
+
156
+                $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
157
+                $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
158
+            }
159
+
160
+            /** client/html/catalog/filter/standard/template-body
161
+             * Relative path to the HTML body template of the catalog filter client.
162
+             *
163
+             * The template file contains the HTML code and processing instructions
164
+             * to generate the result shown in the body of the frontend. The
165
+             * configuration string is the path to the template file relative
166
+             * to the templates directory (usually in client/html/templates).
167
+             *
168
+             * You can overwrite the template file configuration in extensions and
169
+             * provide alternative templates. These alternative templates should be
170
+             * named like the default one but with the string "standard" replaced by
171
+             * an unique name. You may use the name of your project for this. If
172
+             * you've implemented an alternative client class as well, "standard"
173
+             * should be replaced by the name of the new class.
174
+             *
175
+             * @param string Relative path to the template creating code for the HTML page body
176
+             * @since 2014.03
177
+             * @category Developer
178
+             * @see client/html/catalog/filter/standard/template-header
179
+             */
180
+            $tplconf = 'client/html/catalog/filter/standard/template-body';
181
+            $default = 'catalog/filter/body-default.php';
182
+
183
+            $html = $view->render( $view->config( $tplconf, $default ) );
184
+
185
+            $this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
186
+        }
187
+        else
188
+        {
189
+            $html = $this->modifyBody( $html, $uid );
190
+        }
191
+
192
+        return $html;
193
+    }
194
+
195
+
196
+    /**
197
+     * Returns the HTML string for insertion into the header.
198
+     *
199
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
200
+     * @param array &$tags Result array for the list of tags that are associated to the output
201
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
202
+     * @return string|null String including HTML tags for the header on error
203
+     */
204
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
205
+    {
206
+        if( self::$headerSingleton !== null ) {
207
+            return '';
208
+        }
209
+
210
+        self::$headerSingleton = true;
211
+
212
+        $prefixes = array( 'f' );
213
+        $context = $this->getContext();
214
+        $confkey = 'client/html/catalog/filter';
215
+
216
+        if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null )
217
+        {
218
+            $view = $this->getView();
219
+
220
+            try
221
+            {
222
+                $view = $this->setViewParams( $view, $tags, $expire );
223
+
224
+                $html = '';
225
+                foreach( $this->getSubClients() as $subclient ) {
226
+                    $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
227
+                }
228
+                $view->filterHeader = $html;
229
+            }
230
+            catch( \Exception $e )
231
+            {
232
+                $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
233
+            }
234
+
235
+            /** client/html/catalog/filter/standard/template-header
236
+             * Relative path to the HTML header template of the catalog filter client.
237
+             *
238
+             * The template file contains the HTML code and processing instructions
239
+             * to generate the HTML code that is inserted into the HTML page header
240
+             * of the rendered page in the frontend. The configuration string is the
241
+             * path to the template file relative to the templates directory (usually
242
+             * in client/html/templates).
243
+             *
244
+             * You can overwrite the template file configuration in extensions and
245
+             * provide alternative templates. These alternative templates should be
246
+             * named like the default one but with the string "standard" replaced by
247
+             * an unique name. You may use the name of your project for this. If
248
+             * you've implemented an alternative client class as well, "standard"
249
+             * should be replaced by the name of the new class.
250
+             *
251
+             * @param string Relative path to the template creating code for the HTML page head
252
+             * @since 2014.03
253
+             * @category Developer
254
+             * @see client/html/catalog/filter/standard/template-body
255
+             */
256
+            $tplconf = 'client/html/catalog/filter/standard/template-header';
257
+            $default = 'catalog/filter/header-default.php';
258
+
259
+            $html = $view->render( $view->config( $tplconf, $default ) );
260
+
261
+            $this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
262
+        }
263
+        else
264
+        {
265
+            $html = $this->modifyHeader( $html, $uid );
266
+        }
267
+
268
+        return $html;
269
+    }
270
+
271
+
272
+    /**
273
+     * Returns the sub-client given by its name.
274
+     *
275
+     * @param string $type Name of the client type
276
+     * @param string|null $name Name of the sub-client (Default if null)
277
+     * @return \Aimeos\Client\Html\Iface Sub-client object
278
+     */
279
+    public function getSubClient( $type, $name = null )
280
+    {
281
+        /** client/html/catalog/filter/decorators/excludes
282
+         * Excludes decorators added by the "common" option from the catalog filter html client
283
+         *
284
+         * Decorators extend the functionality of a class by adding new aspects
285
+         * (e.g. log what is currently done), executing the methods of the underlying
286
+         * class only in certain conditions (e.g. only for logged in users) or
287
+         * modify what is returned to the caller.
288
+         *
289
+         * This option allows you to remove a decorator added via
290
+         * "client/html/common/decorators/default" before they are wrapped
291
+         * around the html client.
292
+         *
293
+         *  client/html/catalog/filter/decorators/excludes = array( 'decorator1' )
294
+         *
295
+         * This would remove the decorator named "decorator1" from the list of
296
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
297
+         * "client/html/common/decorators/default" to the html client.
298
+         *
299
+         * @param array List of decorator names
300
+         * @since 2014.05
301
+         * @category Developer
302
+         * @see client/html/common/decorators/default
303
+         * @see client/html/catalog/filter/decorators/global
304
+         * @see client/html/catalog/filter/decorators/local
305
+         */
306
+
307
+        /** client/html/catalog/filter/decorators/global
308
+         * Adds a list of globally available decorators only to the catalog filter html client
309
+         *
310
+         * Decorators extend the functionality of a class by adding new aspects
311
+         * (e.g. log what is currently done), executing the methods of the underlying
312
+         * class only in certain conditions (e.g. only for logged in users) or
313
+         * modify what is returned to the caller.
314
+         *
315
+         * This option allows you to wrap global decorators
316
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
317
+         *
318
+         *  client/html/catalog/filter/decorators/global = array( 'decorator1' )
319
+         *
320
+         * This would add the decorator named "decorator1" defined by
321
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
322
+         *
323
+         * @param array List of decorator names
324
+         * @since 2014.05
325
+         * @category Developer
326
+         * @see client/html/common/decorators/default
327
+         * @see client/html/catalog/filter/decorators/excludes
328
+         * @see client/html/catalog/filter/decorators/local
329
+         */
330
+
331
+        /** client/html/catalog/filter/decorators/local
332
+         * Adds a list of local decorators only to the catalog filter html client
333
+         *
334
+         * Decorators extend the functionality of a class by adding new aspects
335
+         * (e.g. log what is currently done), executing the methods of the underlying
336
+         * class only in certain conditions (e.g. only for logged in users) or
337
+         * modify what is returned to the caller.
338
+         *
339
+         * This option allows you to wrap local decorators
340
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
341
+         *
342
+         *  client/html/catalog/filter/decorators/local = array( 'decorator2' )
343
+         *
344
+         * This would add the decorator named "decorator2" defined by
345
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
346
+         *
347
+         * @param array List of decorator names
348
+         * @since 2014.05
349
+         * @category Developer
350
+         * @see client/html/common/decorators/default
351
+         * @see client/html/catalog/filter/decorators/excludes
352
+         * @see client/html/catalog/filter/decorators/global
353
+         */
354
+
355
+        return $this->createSubClient( 'catalog/filter/' . $type, $name );
356
+    }
357
+
358
+
359
+    /**
360
+     * Modifies the cached body content to replace content based on sessions or cookies.
361
+     *
362
+     * @param string $content Cached content
363
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
364
+     * @return string Modified body content
365
+     */
366
+    public function modifyBody( $content, $uid )
367
+    {
368
+        $content = parent::modifyBody( $content, $uid );
369
+
370
+        return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.filter.csrf' );
371
+    }
372
+
373
+
374
+    /**
375
+     * Processes the input, e.g. store given values.
376
+     * A view must be available and this method doesn't generate any output
377
+     * besides setting view variables.
378
+     */
379
+    public function process()
380
+    {
381
+        $context = $this->getContext();
382
+        $view = $this->getView();
383
+
384
+        try
385
+        {
386
+            parent::process();
387
+        }
388
+        catch( \Aimeos\MShop\Exception $e )
389
+        {
390
+            $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
391
+            $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
392
+        }
393
+        catch( \Aimeos\Controller\Frontend\Exception $e )
394
+        {
395
+            $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
396
+            $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
397
+        }
398
+        catch( \Aimeos\Client\Html\Exception $e )
399
+        {
400
+            $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
401
+            $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
402
+        }
403
+        catch( \Exception $e )
404
+        {
405
+            $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
406
+
407
+            $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
408
+            $view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
409
+        }
410
+    }
411
+
412
+
413
+    protected function getSubClientNames()
414
+    {
415
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
416
+    }
417
+
418
+
419
+    /**
420
+     * Sets the necessary parameter values in the view.
421
+     *
422
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
423
+     * @param array &$tags Result array for the list of tags that are associated to the output
424
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
425
+     * @return \Aimeos\MW\View\Iface Modified view object
426
+     */
427
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
428
+    {
429
+        if( !isset( $this->cache ) )
430
+        {
431
+            $config = $this->getContext()->getConfig();
432
+
433
+            /** client/html/catalog/count/enable
434
+             * Enables or disables displaying product counts in the catalog filter
435
+             *
436
+             * This configuration option allows shop owners to display product
437
+             * counts in the catalog filter or to disable fetching product count
438
+             * information.
439
+             *
440
+             * The product count information is fetched via AJAX and inserted via
441
+             * Javascript. This allows to cache parts of the catalog filter by
442
+             * leaving out such highly dynamic content like product count which
443
+             * changes with used filter parameter.
444
+             *
445
+             * @param boolean Value of "1" to display product counts, "0" to disable them
446
+             * @since 2014.03
447
+             * @category User
448
+             * @category Developer
449
+             * @see client/html/catalog/count/url/target
450
+             * @see client/html/catalog/count/url/controller
451
+             * @see client/html/catalog/count/url/action
452
+             * @see client/html/catalog/count/url/config
453
+             */
454
+            if( $config->get( 'client/html/catalog/count/enable', true ) == true )
455
+            {
456
+                /** client/html/catalog/count/url/target
457
+                 * Destination of the URL where the controller specified in the URL is known
458
+                 *
459
+                 * The destination can be a page ID like in a content management system or the
460
+                 * module of a software development framework. This "target" must contain or know
461
+                 * the controller that should be called by the generated URL.
462
+                 *
463
+                 * @param string Destination of the URL
464
+                 * @since 2014.03
465
+                 * @category Developer
466
+                 * @see client/html/catalog/count/url/controller
467
+                 * @see client/html/catalog/count/url/action
468
+                 * @see client/html/catalog/count/url/config
469
+                 */
470
+                $target = $config->get( 'client/html/catalog/count/url/target' );
471
+
472
+                /** client/html/catalog/count/url/controller
473
+                 * Name of the controller whose action should be called
474
+                 *
475
+                 * In Model-View-Controller (MVC) applications, the controller contains the methods
476
+                 * that create parts of the output displayed in the generated HTML page. Controller
477
+                 * names are usually alpha-numeric.
478
+                 *
479
+                 * @param string Name of the controller
480
+                 * @since 2014.03
481
+                 * @category Developer
482
+                 * @see client/html/catalog/count/url/target
483
+                 * @see client/html/catalog/count/url/action
484
+                 * @see client/html/catalog/count/url/config
485
+                 */
486
+                $controller = $config->get( 'client/html/catalog/count/url/controller', 'catalog' );
487
+
488
+                /** client/html/catalog/count/url/action
489
+                 * Name of the action that should create the output
490
+                 *
491
+                 * In Model-View-Controller (MVC) applications, actions are the methods of a
492
+                 * controller that create parts of the output displayed in the generated HTML page.
493
+                 * Action names are usually alpha-numeric.
494
+                 *
495
+                 * @param string Name of the action
496
+                 * @since 2014.03
497
+                 * @category Developer
498
+                 * @see client/html/catalog/count/url/target
499
+                 * @see client/html/catalog/count/url/controller
500
+                 * @see client/html/catalog/count/url/config
501
+                 */
502
+                $action = $config->get( 'client/html/catalog/count/url/action', 'count' );
503
+
504
+                /** client/html/catalog/count/url/config
505
+                 * Associative list of configuration options used for generating the URL
506
+                 *
507
+                 * You can specify additional options as key/value pairs used when generating
508
+                 * the URLs, like
509
+                 *
510
+                 *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
511
+                 *
512
+                 * The available key/value pairs depend on the application that embeds the e-commerce
513
+                 * framework. This is because the infrastructure of the application is used for
514
+                 * generating the URLs. The full list of available config options is referenced
515
+                 * in the "see also" section of this page.
516
+                 *
517
+                 * @param string Associative list of configuration options
518
+                 * @since 2014.03
519
+                 * @category Developer
520
+                 * @see client/html/catalog/count/url/target
521
+                 * @see client/html/catalog/count/url/controller
522
+                 * @see client/html/catalog/count/url/action
523
+                 * @see client/html/url/config
524
+                 */
525
+                $config = $config->get( 'client/html/catalog/count/url/config', array() );
526
+
527
+                $params = $this->getClientParams( $view->param(), array( 'f' ) );
528
+
529
+                $view->filterCountUrl = $view->url( $target, $controller, $action, $params, array(), $config );
530
+            }
531
+
532
+            $this->cache = $view;
533
+        }
534
+
535
+        return $this->cache;
536
+    }
537 537
 }
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @since 2014.03
92 92
 	 * @category Developer
93 93
 	 */
94
-	private $subPartNames = array( 'search', 'tree', 'attribute' );
94
+	private $subPartNames = array('search', 'tree', 'attribute');
95 95
 	private $cache;
96 96
 
97 97
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
104 104
 	 * @return string HTML code
105 105
 	 */
106
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
106
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
107 107
 	{
108
-		$prefixes = array( 'f' );
108
+		$prefixes = array('f');
109 109
 		$context = $this->getContext();
110 110
 
111 111
 		/** client/html/catalog/filter
@@ -120,41 +120,41 @@  discard block
 block discarded – undo
120 120
 		 */
121 121
 		$confkey = 'client/html/catalog/filter';
122 122
 
123
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'body', $uid, $prefixes, $confkey ) ) === null )
123
+		if ($context->getUserId() != null || ($html = $this->getCached('body', $uid, $prefixes, $confkey)) === null)
124 124
 		{
125 125
 			$view = $this->getView();
126 126
 
127 127
 			try
128 128
 			{
129
-				$view = $this->setViewParams( $view, $tags, $expire );
129
+				$view = $this->setViewParams($view, $tags, $expire);
130 130
 
131 131
 				$html = '';
132
-				foreach( $this->getSubClients() as $subclient ) {
133
-					$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
132
+				foreach ($this->getSubClients() as $subclient) {
133
+					$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
134 134
 				}
135 135
 				$view->filterBody = $html;
136 136
 			}
137
-			catch( \Aimeos\Client\Html\Exception $e )
137
+			catch (\Aimeos\Client\Html\Exception $e)
138 138
 			{
139
-				$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
140
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
139
+				$error = array($context->getI18n()->dt('client', $e->getMessage()));
140
+				$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
141 141
 			}
142
-			catch( \Aimeos\Controller\Frontend\Exception $e )
142
+			catch (\Aimeos\Controller\Frontend\Exception $e)
143 143
 			{
144
-				$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
145
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
144
+				$error = array($context->getI18n()->dt('controller/frontend', $e->getMessage()));
145
+				$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
146 146
 			}
147
-			catch( \Aimeos\MShop\Exception $e )
147
+			catch (\Aimeos\MShop\Exception $e)
148 148
 			{
149
-				$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
150
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
149
+				$error = array($context->getI18n()->dt('mshop', $e->getMessage()));
150
+				$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
151 151
 			}
152
-			catch( \Exception $e )
152
+			catch (\Exception $e)
153 153
 			{
154
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
154
+				$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
155 155
 
156
-				$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
157
-				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
156
+				$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
157
+				$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
158 158
 			}
159 159
 
160 160
 			/** client/html/catalog/filter/standard/template-body
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
 			$tplconf = 'client/html/catalog/filter/standard/template-body';
181 181
 			$default = 'catalog/filter/body-default.php';
182 182
 
183
-			$html = $view->render( $view->config( $tplconf, $default ) );
183
+			$html = $view->render($view->config($tplconf, $default));
184 184
 
185
-			$this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
185
+			$this->setCached('body', $uid, $prefixes, $confkey, $html, $tags, $expire);
186 186
 		}
187 187
 		else
188 188
 		{
189
-			$html = $this->modifyBody( $html, $uid );
189
+			$html = $this->modifyBody($html, $uid);
190 190
 		}
191 191
 
192 192
 		return $html;
@@ -201,35 +201,35 @@  discard block
 block discarded – undo
201 201
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
202 202
 	 * @return string|null String including HTML tags for the header on error
203 203
 	 */
204
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
204
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
205 205
 	{
206
-		if( self::$headerSingleton !== null ) {
206
+		if (self::$headerSingleton !== null) {
207 207
 			return '';
208 208
 		}
209 209
 
210 210
 		self::$headerSingleton = true;
211 211
 
212
-		$prefixes = array( 'f' );
212
+		$prefixes = array('f');
213 213
 		$context = $this->getContext();
214 214
 		$confkey = 'client/html/catalog/filter';
215 215
 
216
-		if( $context->getUserId() != null || ( $html = $this->getCached( 'header', $uid, $prefixes, $confkey ) ) === null )
216
+		if ($context->getUserId() != null || ($html = $this->getCached('header', $uid, $prefixes, $confkey)) === null)
217 217
 		{
218 218
 			$view = $this->getView();
219 219
 
220 220
 			try
221 221
 			{
222
-				$view = $this->setViewParams( $view, $tags, $expire );
222
+				$view = $this->setViewParams($view, $tags, $expire);
223 223
 
224 224
 				$html = '';
225
-				foreach( $this->getSubClients() as $subclient ) {
226
-					$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
225
+				foreach ($this->getSubClients() as $subclient) {
226
+					$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
227 227
 				}
228 228
 				$view->filterHeader = $html;
229 229
 			}
230
-			catch( \Exception $e )
230
+			catch (\Exception $e)
231 231
 			{
232
-				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
232
+				$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
233 233
 			}
234 234
 
235 235
 			/** client/html/catalog/filter/standard/template-header
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 			$tplconf = 'client/html/catalog/filter/standard/template-header';
257 257
 			$default = 'catalog/filter/header-default.php';
258 258
 
259
-			$html = $view->render( $view->config( $tplconf, $default ) );
259
+			$html = $view->render($view->config($tplconf, $default));
260 260
 
261
-			$this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
261
+			$this->setCached('header', $uid, $prefixes, $confkey, $html, $tags, $expire);
262 262
 		}
263 263
 		else
264 264
 		{
265
-			$html = $this->modifyHeader( $html, $uid );
265
+			$html = $this->modifyHeader($html, $uid);
266 266
 		}
267 267
 
268 268
 		return $html;
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 * @param string|null $name Name of the sub-client (Default if null)
277 277
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
278 278
 	 */
279
-	public function getSubClient( $type, $name = null )
279
+	public function getSubClient($type, $name = null)
280 280
 	{
281 281
 		/** client/html/catalog/filter/decorators/excludes
282 282
 		 * Excludes decorators added by the "common" option from the catalog filter html client
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		 * @see client/html/catalog/filter/decorators/global
353 353
 		 */
354 354
 
355
-		return $this->createSubClient( 'catalog/filter/' . $type, $name );
355
+		return $this->createSubClient('catalog/filter/'.$type, $name);
356 356
 	}
357 357
 
358 358
 
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
364 364
 	 * @return string Modified body content
365 365
 	 */
366
-	public function modifyBody( $content, $uid )
366
+	public function modifyBody($content, $uid)
367 367
 	{
368
-		$content = parent::modifyBody( $content, $uid );
368
+		$content = parent::modifyBody($content, $uid);
369 369
 
370
-		return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.filter.csrf' );
370
+		return $this->replaceSection($content, $this->getView()->csrf()->formfield(), 'catalog.filter.csrf');
371 371
 	}
372 372
 
373 373
 
@@ -385,34 +385,34 @@  discard block
 block discarded – undo
385 385
 		{
386 386
 			parent::process();
387 387
 		}
388
-		catch( \Aimeos\MShop\Exception $e )
388
+		catch (\Aimeos\MShop\Exception $e)
389 389
 		{
390
-			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
391
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
390
+			$error = array($context->getI18n()->dt('mshop', $e->getMessage()));
391
+			$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
392 392
 		}
393
-		catch( \Aimeos\Controller\Frontend\Exception $e )
393
+		catch (\Aimeos\Controller\Frontend\Exception $e)
394 394
 		{
395
-			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
396
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
395
+			$error = array($context->getI18n()->dt('controller/frontend', $e->getMessage()));
396
+			$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
397 397
 		}
398
-		catch( \Aimeos\Client\Html\Exception $e )
398
+		catch (\Aimeos\Client\Html\Exception $e)
399 399
 		{
400
-			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
401
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
400
+			$error = array($context->getI18n()->dt('client', $e->getMessage()));
401
+			$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
402 402
 		}
403
-		catch( \Exception $e )
403
+		catch (\Exception $e)
404 404
 		{
405
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
405
+			$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
406 406
 
407
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
408
-			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
407
+			$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
408
+			$view->filterErrorList = $view->get('filterErrorList', array()) + $error;
409 409
 		}
410 410
 	}
411 411
 
412 412
 
413 413
 	protected function getSubClientNames()
414 414
 	{
415
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
415
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
416 416
 	}
417 417
 
418 418
 
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
425 425
 	 * @return \Aimeos\MW\View\Iface Modified view object
426 426
 	 */
427
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
427
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
428 428
 	{
429
-		if( !isset( $this->cache ) )
429
+		if (!isset($this->cache))
430 430
 		{
431 431
 			$config = $this->getContext()->getConfig();
432 432
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 			 * @see client/html/catalog/count/url/action
452 452
 			 * @see client/html/catalog/count/url/config
453 453
 			 */
454
-			if( $config->get( 'client/html/catalog/count/enable', true ) == true )
454
+			if ($config->get('client/html/catalog/count/enable', true) == true)
455 455
 			{
456 456
 				/** client/html/catalog/count/url/target
457 457
 				 * Destination of the URL where the controller specified in the URL is known
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 				 * @see client/html/catalog/count/url/action
468 468
 				 * @see client/html/catalog/count/url/config
469 469
 				 */
470
-				$target = $config->get( 'client/html/catalog/count/url/target' );
470
+				$target = $config->get('client/html/catalog/count/url/target');
471 471
 
472 472
 				/** client/html/catalog/count/url/controller
473 473
 				 * Name of the controller whose action should be called
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 				 * @see client/html/catalog/count/url/action
484 484
 				 * @see client/html/catalog/count/url/config
485 485
 				 */
486
-				$controller = $config->get( 'client/html/catalog/count/url/controller', 'catalog' );
486
+				$controller = $config->get('client/html/catalog/count/url/controller', 'catalog');
487 487
 
488 488
 				/** client/html/catalog/count/url/action
489 489
 				 * Name of the action that should create the output
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 				 * @see client/html/catalog/count/url/controller
500 500
 				 * @see client/html/catalog/count/url/config
501 501
 				 */
502
-				$action = $config->get( 'client/html/catalog/count/url/action', 'count' );
502
+				$action = $config->get('client/html/catalog/count/url/action', 'count');
503 503
 
504 504
 				/** client/html/catalog/count/url/config
505 505
 				 * Associative list of configuration options used for generating the URL
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
 				 * @see client/html/catalog/count/url/action
523 523
 				 * @see client/html/url/config
524 524
 				 */
525
-				$config = $config->get( 'client/html/catalog/count/url/config', array() );
525
+				$config = $config->get('client/html/catalog/count/url/config', array());
526 526
 
527
-				$params = $this->getClientParams( $view->param(), array( 'f' ) );
527
+				$params = $this->getClientParams($view->param(), array('f'));
528 528
 
529
-				$view->filterCountUrl = $view->url( $target, $controller, $action, $params, array(), $config );
529
+				$view->filterCountUrl = $view->url($target, $controller, $action, $params, array(), $config);
530 530
 			}
531 531
 
532 532
 			$this->cache = $view;
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -133,23 +133,19 @@  discard block
 block discarded – undo
133 133
 					$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
134 134
 				}
135 135
 				$view->filterBody = $html;
136
-			}
137
-			catch( \Aimeos\Client\Html\Exception $e )
136
+			} catch( \Aimeos\Client\Html\Exception $e )
138 137
 			{
139 138
 				$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
140 139
 				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
141
-			}
142
-			catch( \Aimeos\Controller\Frontend\Exception $e )
140
+			} catch( \Aimeos\Controller\Frontend\Exception $e )
143 141
 			{
144 142
 				$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
145 143
 				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
146
-			}
147
-			catch( \Aimeos\MShop\Exception $e )
144
+			} catch( \Aimeos\MShop\Exception $e )
148 145
 			{
149 146
 				$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
150 147
 				$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
151
-			}
152
-			catch( \Exception $e )
148
+			} catch( \Exception $e )
153 149
 			{
154 150
 				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
155 151
 
@@ -183,8 +179,7 @@  discard block
 block discarded – undo
183 179
 			$html = $view->render( $view->config( $tplconf, $default ) );
184 180
 
185 181
 			$this->setCached( 'body', $uid, $prefixes, $confkey, $html, $tags, $expire );
186
-		}
187
-		else
182
+		} else
188 183
 		{
189 184
 			$html = $this->modifyBody( $html, $uid );
190 185
 		}
@@ -226,8 +221,7 @@  discard block
 block discarded – undo
226 221
 					$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
227 222
 				}
228 223
 				$view->filterHeader = $html;
229
-			}
230
-			catch( \Exception $e )
224
+			} catch( \Exception $e )
231 225
 			{
232 226
 				$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
233 227
 			}
@@ -259,8 +253,7 @@  discard block
 block discarded – undo
259 253
 			$html = $view->render( $view->config( $tplconf, $default ) );
260 254
 
261 255
 			$this->setCached( 'header', $uid, $prefixes, $confkey, $html, $tags, $expire );
262
-		}
263
-		else
256
+		} else
264 257
 		{
265 258
 			$html = $this->modifyHeader( $html, $uid );
266 259
 		}
@@ -384,23 +377,19 @@  discard block
 block discarded – undo
384 377
 		try
385 378
 		{
386 379
 			parent::process();
387
-		}
388
-		catch( \Aimeos\MShop\Exception $e )
380
+		} catch( \Aimeos\MShop\Exception $e )
389 381
 		{
390 382
 			$error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
391 383
 			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
392
-		}
393
-		catch( \Aimeos\Controller\Frontend\Exception $e )
384
+		} catch( \Aimeos\Controller\Frontend\Exception $e )
394 385
 		{
395 386
 			$error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
396 387
 			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
397
-		}
398
-		catch( \Aimeos\Client\Html\Exception $e )
388
+		} catch( \Aimeos\Client\Html\Exception $e )
399 389
 		{
400 390
 			$error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) );
401 391
 			$view->filterErrorList = $view->get( 'filterErrorList', array() ) + $error;
402
-		}
403
-		catch( \Exception $e )
392
+		} catch( \Exception $e )
404 393
 		{
405 394
 			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
406 395
 
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Filter/Tree/Standard.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114 114
 	 * @param array &$tags Result array for the list of tags that are associated to the output
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
116
+	 * @return string String including HTML tags for the header on error
117 117
 	 */
118 118
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119 119
 	{
Please login to merge, or discard this patch.
Indentation   +443 added lines, -443 removed lines patch added patch discarded remove patch
@@ -19,448 +19,448 @@
 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/filter/tree/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog filter tree section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/catalog/filter/tree/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->treeBody = $html;
82
-
83
-		/** client/html/catalog/filter/tree/standard/template-body
84
-		 * Relative path to the HTML body template of the catalog filter tree client.
85
-		 *
86
-		 * The template file contains the HTML code and processing instructions
87
-		 * to generate the result shown in the body of the frontend. The
88
-		 * configuration string is the path to the template file relative
89
-		 * to the templates directory (usually in client/html/templates).
90
-		 *
91
-		 * You can overwrite the template file configuration in extensions and
92
-		 * provide alternative templates. These alternative templates should be
93
-		 * named like the default one but with the string "standard" replaced by
94
-		 * an unique name. You may use the name of your project for this. If
95
-		 * you've implemented an alternative client class as well, "standard"
96
-		 * should be replaced by the name of the new class.
97
-		 *
98
-		 * @param string Relative path to the template creating code for the HTML page body
99
-		 * @since 2014.03
100
-		 * @category Developer
101
-		 * @see client/html/catalog/filter/tree/standard/template-header
102
-		 */
103
-		$tplconf = 'client/html/catalog/filter/tree/standard/template-body';
104
-		$default = 'catalog/filter/tree-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->treeHeader = $html;
127
-
128
-		/** client/html/catalog/filter/tree/standard/template-header
129
-		 * Relative path to the HTML header template of the catalog filter tree client.
130
-		 *
131
-		 * The template file contains the HTML code and processing instructions
132
-		 * to generate the HTML code that is inserted into the HTML page header
133
-		 * of the rendered page in the frontend. The configuration string is the
134
-		 * path to the template file relative to the templates directory (usually
135
-		 * in client/html/templates).
136
-		 *
137
-		 * You can overwrite the template file configuration in extensions and
138
-		 * provide alternative templates. These alternative templates should be
139
-		 * named like the default one but with the string "standard" replaced by
140
-		 * an unique name. You may use the name of your project for this. If
141
-		 * you've implemented an alternative client class as well, "standard"
142
-		 * should be replaced by the name of the new class.
143
-		 *
144
-		 * @param string Relative path to the template creating code for the HTML page head
145
-		 * @since 2014.03
146
-		 * @category Developer
147
-		 * @see client/html/catalog/filter/tree/standard/template-body
148
-		 */
149
-		$tplconf = 'client/html/catalog/filter/tree/standard/template-header';
150
-		$default = 'catalog/filter/tree-header-default.php';
151
-
152
-		return $view->render( $view->config( $tplconf, $default ) );
153
-	}
154
-
155
-
156
-	/**
157
-	 * Returns the sub-client given by its name.
158
-	 *
159
-	 * @param string $type Name of the client type
160
-	 * @param string|null $name Name of the sub-client (Default if null)
161
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
162
-	 */
163
-	public function getSubClient( $type, $name = null )
164
-	{
165
-		/** client/html/catalog/filter/tree/decorators/excludes
166
-		 * Excludes decorators added by the "common" option from the catalog filter tree html client
167
-		 *
168
-		 * Decorators extend the functionality of a class by adding new aspects
169
-		 * (e.g. log what is currently done), executing the methods of the underlying
170
-		 * class only in certain conditions (e.g. only for logged in users) or
171
-		 * modify what is returned to the caller.
172
-		 *
173
-		 * This option allows you to remove a decorator added via
174
-		 * "client/html/common/decorators/default" before they are wrapped
175
-		 * around the html client.
176
-		 *
177
-		 *  client/html/catalog/filter/tree/decorators/excludes = array( 'decorator1' )
178
-		 *
179
-		 * This would remove the decorator named "decorator1" from the list of
180
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
-		 * "client/html/common/decorators/default" to the html client.
182
-		 *
183
-		 * @param array List of decorator names
184
-		 * @since 2015.08
185
-		 * @category Developer
186
-		 * @see client/html/common/decorators/default
187
-		 * @see client/html/catalog/filter/tree/decorators/global
188
-		 * @see client/html/catalog/filter/tree/decorators/local
189
-		 */
190
-
191
-		/** client/html/catalog/filter/tree/decorators/global
192
-		 * Adds a list of globally available decorators only to the catalog filter tree html client
193
-		 *
194
-		 * Decorators extend the functionality of a class by adding new aspects
195
-		 * (e.g. log what is currently done), executing the methods of the underlying
196
-		 * class only in certain conditions (e.g. only for logged in users) or
197
-		 * modify what is returned to the caller.
198
-		 *
199
-		 * This option allows you to wrap global decorators
200
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
-		 *
202
-		 *  client/html/catalog/filter/tree/decorators/global = array( 'decorator1' )
203
-		 *
204
-		 * This would add the decorator named "decorator1" defined by
205
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
-		 *
207
-		 * @param array List of decorator names
208
-		 * @since 2015.08
209
-		 * @category Developer
210
-		 * @see client/html/common/decorators/default
211
-		 * @see client/html/catalog/filter/tree/decorators/excludes
212
-		 * @see client/html/catalog/filter/tree/decorators/local
213
-		 */
214
-
215
-		/** client/html/catalog/filter/tree/decorators/local
216
-		 * Adds a list of local decorators only to the catalog filter tree html client
217
-		 *
218
-		 * Decorators extend the functionality of a class by adding new aspects
219
-		 * (e.g. log what is currently done), executing the methods of the underlying
220
-		 * class only in certain conditions (e.g. only for logged in users) or
221
-		 * modify what is returned to the caller.
222
-		 *
223
-		 * This option allows you to wrap local decorators
224
-		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
-		 *
226
-		 *  client/html/catalog/filter/tree/decorators/local = array( 'decorator2' )
227
-		 *
228
-		 * This would add the decorator named "decorator2" defined by
229
-		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
-		 *
231
-		 * @param array List of decorator names
232
-		 * @since 2015.08
233
-		 * @category Developer
234
-		 * @see client/html/common/decorators/default
235
-		 * @see client/html/catalog/filter/tree/decorators/excludes
236
-		 * @see client/html/catalog/filter/tree/decorators/global
237
-		 */
238
-
239
-		return $this->createSubClient( 'catalog/filter/tree/' . $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
-			$catItems = array();
267
-			$context = $this->getContext();
268
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
269
-
270
-			$currentid = (string) $view->param( 'f_catid', '' );
271
-			$currentid = ( $currentid != '' ? $currentid : null );
272
-
273
-			/** client/html/catalog/filter/tree/startid
274
-			 * The ID of the category node that should be the root of the displayed category tree
275
-			 *
276
-			 * If you want to display only a part of your category tree, you can
277
-			 * configure the ID of the category node from which rendering the
278
-			 * remaining sub-tree should start.
279
-			 *
280
-			 * In most cases you can set this value via the administration interface
281
-			 * of the shop application. In that case you often can configure the
282
-			 * start ID individually for each catalog filter.
283
-			 *
284
-			 * @param string Category ID
285
-			 * @since 2014.03
286
-			 * @category User
287
-			 * @category Developer
288
-			 * @see client/html/catalog/filter/tree/levels-always
289
-			 * @see client/html/catalog/filter/tree/levels-only
290
-			 * @see client/html/catalog/filter/tree/domains
291
-			 */
292
-			$startid = $view->config( 'client/html/catalog/filter/tree/startid', '' );
293
-			$startid = ( $startid != '' ? $startid : null );
294
-
295
-			/** client/html/catalog/filter/tree/domains
296
-			 * List of domain names whose items should be fetched with the filter categories
297
-			 *
298
-			 * The templates rendering the categories in the catalog filter usually
299
-			 * add the images and texts associated to each item. If you want to
300
-			 * display additional content, you can configure your own list of
301
-			 * domains (attribute, media, price, product, text, etc. are domains)
302
-			 * whose items are fetched from the storage. Please keep in mind that
303
-			 * the more domains you add to the configuration, the more time is
304
-			 * required for fetching the content!
305
-			 *
306
-			 * @param array List of domain item names
307
-			 * @since 2014.03
308
-			 * @category Developer
309
-			 * @see client/html/catalog/filter/tree/startid
310
-			 * @see client/html/catalog/filter/tree/levels-always
311
-			 * @see client/html/catalog/filter/tree/levels-only
312
-			 */
313
-			$ref = $view->config( 'client/html/catalog/filter/tree/domains', array( 'text', 'media' ) );
314
-
315
-
316
-			if( $currentid )
317
-			{
318
-				$catItems = $controller->getCatalogPath( $currentid );
319
-
320
-				if( $startid )
321
-				{
322
-					foreach( $catItems as $key => $item )
323
-					{
324
-						if( $key == $startid ) {
325
-							break;
326
-						}
327
-						unset( $catItems[$key] );
328
-					}
329
-				}
330
-			}
331
-
332
-			if( ( $node = reset( $catItems ) ) === false )
333
-			{
334
-				$node = $controller->getCatalogTree( $startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );
335
-				$catItems = array( $node->getId() => $node );
336
-			}
337
-
338
-
339
-			$search = $controller->createCatalogFilter();
340
-			$expr = $search->compare( '==', 'catalog.parentid', array_keys( $catItems ) );
341
-			$expr = $search->combine( '||', array( $expr, $search->compare( '==', 'catalog.id', $node->getId() ) ) );
342
-
343
-			/** client/html/catalog/filter/tree/levels-always
344
-			 * The number of levels in the category tree that should be always displayed
345
-			 *
346
-			 * Usually, only the root node and the first level of the category
347
-			 * tree is shown in the frontend. Only if the user clicks on a
348
-			 * node in the first level, the page reloads and the sub-nodes of
349
-			 * the chosen category are rendered as well.
350
-			 *
351
-			 * Using this configuration option you can enforce the given number
352
-			 * of levels to be always displayed. The root node uses level 0, the
353
-			 * categories below level 1 and so on.
354
-			 *
355
-			 * In most cases you can set this value via the administration interface
356
-			 * of the shop application. In that case you often can configure the
357
-			 * levels individually for each catalog filter.
358
-			 *
359
-			 * @param integer Number of tree levels
360
-			 * @since 2014.03
361
-			 * @category User
362
-			 * @category Developer
363
-			 * @see client/html/catalog/filter/tree/startid
364
-			 * @see client/html/catalog/filter/tree/levels-only
365
-			 * @see client/html/catalog/filter/tree/domains
366
-			 */
367
-			if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-always' ) ) != null ) {
368
-				$expr = $search->combine( '||', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) );
369
-			}
370
-
371
-			/** client/html/catalog/filter/tree/levels-only
372
-			 * No more than this number of levels in the category tree should be displayed
373
-			 *
374
-			 * If the user clicks on a category node, the page reloads and the
375
-			 * sub-nodes of the chosen category are rendered as well.
376
-			 * Using this configuration option you can enforce that no more than
377
-			 * the given number of levels will be displayed at all. The root
378
-			 * node uses level 0, the categories below level 1 and so on.
379
-			 *
380
-			 * In most cases you can set this value via the administration interface
381
-			 * of the shop application. In that case you often can configure the
382
-			 * levels individually for each catalog filter.
383
-			 *
384
-			 * @param integer Number of tree levels
385
-			 * @since 2014.03
386
-			 * @category User
387
-			 * @category Developer
388
-			 * @see client/html/catalog/filter/tree/startid
389
-			 * @see client/html/catalog/filter/tree/levels-always
390
-			 * @see client/html/catalog/filter/tree/domains
391
-			 */
392
-			if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-only' ) ) != null ) {
393
-				$expr = $search->combine( '&&', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) );
394
-			}
395
-
396
-			$search->setConditions( $expr );
397
-
398
-			$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE;
399
-
400
-			$view->treeCatalogPath = $catItems;
401
-			$view->treeCatalogTree = $controller->getCatalogTree( $startid, $ref, $level, $search );
402
-			$view->treeCatalogIds = $this->getCatalogIds( $view->treeCatalogTree, $catItems, $currentid );
403
-			$view->treeFilterParams = $this->getClientParams( $view->param(), array( 'f' ) );
404
-
405
-			$this->addMetaItemCatalog( $view->treeCatalogTree, $this->expire, $this->tags );
406
-
407
-			$this->cache = $view;
408
-		}
409
-
410
-		$expire = $this->expires( $this->expire, $expire );
411
-		$tags = array_merge( $tags, $this->tags );
412
-
413
-		return $this->cache;
414
-	}
415
-
416
-
417
-	/**
418
-	 * Returns the category IDs of the given catalog tree.
419
-	 *
420
-	 * Only the IDs of the children of the current category are returned.
421
-	 *
422
-	 * @param \Aimeos\MShop\Catalog\Item\Iface $tree Catalog node as entry point of the tree
423
-	 * @param array $path Associative list of category IDs as keys and the catalog
424
-	 * 	nodes from the currently selected category up to the root node
425
-	 * @param string $currentId Currently selected category
426
-	 * @return array List of category IDs
427
-	 */
428
-	protected function getCatalogIds( \Aimeos\MShop\Catalog\Item\Iface $tree, array $path, $currentId )
429
-	{
430
-		if( $tree->getId() == $currentId )
431
-		{
432
-			$ids = array();
433
-			foreach( $tree->getChildren() as $item ) {
434
-				$ids[] = $item->getId();
435
-			}
436
-
437
-			return $ids;
438
-		}
439
-
440
-		foreach( $tree->getChildren() as $child )
441
-		{
442
-			if( isset( $path[$child->getId()] ) ) {
443
-				return $this->getCatalogIds( $child, $path, $currentId );
444
-			}
445
-		}
446
-
447
-		return array();
448
-	}
449
-
450
-
451
-	/**
452
-	 * Adds the cache tags to the given list and sets a new expiration date if necessary based on the given catalog tree.
453
-	 *
454
-	 * @param \Aimeos\MShop\Catalog\Item\Iface $tree Tree node, maybe with sub-nodes
455
-	 * @param string|null &$expire Expiration date that will be overwritten if an earlier date is found
456
-	 * @param array &$tags List of tags the new tags will be added to
457
-	 */
458
-	protected function addMetaItemCatalog( \Aimeos\MShop\Catalog\Item\Iface $tree, &$expire, array &$tags = array() )
459
-	{
460
-		$this->addMetaItem( $tree, 'catalog', $expire, $tags );
461
-
462
-		foreach( $tree->getChildren() as $child ) {
463
-			$this->addMetaItemCatalog( $child, $expire, $tags );
464
-		}
465
-	}
25
+    /** client/html/catalog/filter/tree/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog filter tree section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/catalog/filter/tree/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->treeBody = $html;
82
+
83
+        /** client/html/catalog/filter/tree/standard/template-body
84
+         * Relative path to the HTML body template of the catalog filter tree client.
85
+         *
86
+         * The template file contains the HTML code and processing instructions
87
+         * to generate the result shown in the body of the frontend. The
88
+         * configuration string is the path to the template file relative
89
+         * to the templates directory (usually in client/html/templates).
90
+         *
91
+         * You can overwrite the template file configuration in extensions and
92
+         * provide alternative templates. These alternative templates should be
93
+         * named like the default one but with the string "standard" replaced by
94
+         * an unique name. You may use the name of your project for this. If
95
+         * you've implemented an alternative client class as well, "standard"
96
+         * should be replaced by the name of the new class.
97
+         *
98
+         * @param string Relative path to the template creating code for the HTML page body
99
+         * @since 2014.03
100
+         * @category Developer
101
+         * @see client/html/catalog/filter/tree/standard/template-header
102
+         */
103
+        $tplconf = 'client/html/catalog/filter/tree/standard/template-body';
104
+        $default = 'catalog/filter/tree-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->treeHeader = $html;
127
+
128
+        /** client/html/catalog/filter/tree/standard/template-header
129
+         * Relative path to the HTML header template of the catalog filter tree client.
130
+         *
131
+         * The template file contains the HTML code and processing instructions
132
+         * to generate the HTML code that is inserted into the HTML page header
133
+         * of the rendered page in the frontend. The configuration string is the
134
+         * path to the template file relative to the templates directory (usually
135
+         * in client/html/templates).
136
+         *
137
+         * You can overwrite the template file configuration in extensions and
138
+         * provide alternative templates. These alternative templates should be
139
+         * named like the default one but with the string "standard" replaced by
140
+         * an unique name. You may use the name of your project for this. If
141
+         * you've implemented an alternative client class as well, "standard"
142
+         * should be replaced by the name of the new class.
143
+         *
144
+         * @param string Relative path to the template creating code for the HTML page head
145
+         * @since 2014.03
146
+         * @category Developer
147
+         * @see client/html/catalog/filter/tree/standard/template-body
148
+         */
149
+        $tplconf = 'client/html/catalog/filter/tree/standard/template-header';
150
+        $default = 'catalog/filter/tree-header-default.php';
151
+
152
+        return $view->render( $view->config( $tplconf, $default ) );
153
+    }
154
+
155
+
156
+    /**
157
+     * Returns the sub-client given by its name.
158
+     *
159
+     * @param string $type Name of the client type
160
+     * @param string|null $name Name of the sub-client (Default if null)
161
+     * @return \Aimeos\Client\Html\Iface Sub-client object
162
+     */
163
+    public function getSubClient( $type, $name = null )
164
+    {
165
+        /** client/html/catalog/filter/tree/decorators/excludes
166
+         * Excludes decorators added by the "common" option from the catalog filter tree html client
167
+         *
168
+         * Decorators extend the functionality of a class by adding new aspects
169
+         * (e.g. log what is currently done), executing the methods of the underlying
170
+         * class only in certain conditions (e.g. only for logged in users) or
171
+         * modify what is returned to the caller.
172
+         *
173
+         * This option allows you to remove a decorator added via
174
+         * "client/html/common/decorators/default" before they are wrapped
175
+         * around the html client.
176
+         *
177
+         *  client/html/catalog/filter/tree/decorators/excludes = array( 'decorator1' )
178
+         *
179
+         * This would remove the decorator named "decorator1" from the list of
180
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
181
+         * "client/html/common/decorators/default" to the html client.
182
+         *
183
+         * @param array List of decorator names
184
+         * @since 2015.08
185
+         * @category Developer
186
+         * @see client/html/common/decorators/default
187
+         * @see client/html/catalog/filter/tree/decorators/global
188
+         * @see client/html/catalog/filter/tree/decorators/local
189
+         */
190
+
191
+        /** client/html/catalog/filter/tree/decorators/global
192
+         * Adds a list of globally available decorators only to the catalog filter tree html client
193
+         *
194
+         * Decorators extend the functionality of a class by adding new aspects
195
+         * (e.g. log what is currently done), executing the methods of the underlying
196
+         * class only in certain conditions (e.g. only for logged in users) or
197
+         * modify what is returned to the caller.
198
+         *
199
+         * This option allows you to wrap global decorators
200
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
201
+         *
202
+         *  client/html/catalog/filter/tree/decorators/global = array( 'decorator1' )
203
+         *
204
+         * This would add the decorator named "decorator1" defined by
205
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
206
+         *
207
+         * @param array List of decorator names
208
+         * @since 2015.08
209
+         * @category Developer
210
+         * @see client/html/common/decorators/default
211
+         * @see client/html/catalog/filter/tree/decorators/excludes
212
+         * @see client/html/catalog/filter/tree/decorators/local
213
+         */
214
+
215
+        /** client/html/catalog/filter/tree/decorators/local
216
+         * Adds a list of local decorators only to the catalog filter tree html client
217
+         *
218
+         * Decorators extend the functionality of a class by adding new aspects
219
+         * (e.g. log what is currently done), executing the methods of the underlying
220
+         * class only in certain conditions (e.g. only for logged in users) or
221
+         * modify what is returned to the caller.
222
+         *
223
+         * This option allows you to wrap local decorators
224
+         * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
225
+         *
226
+         *  client/html/catalog/filter/tree/decorators/local = array( 'decorator2' )
227
+         *
228
+         * This would add the decorator named "decorator2" defined by
229
+         * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
230
+         *
231
+         * @param array List of decorator names
232
+         * @since 2015.08
233
+         * @category Developer
234
+         * @see client/html/common/decorators/default
235
+         * @see client/html/catalog/filter/tree/decorators/excludes
236
+         * @see client/html/catalog/filter/tree/decorators/global
237
+         */
238
+
239
+        return $this->createSubClient( 'catalog/filter/tree/' . $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
+            $catItems = array();
267
+            $context = $this->getContext();
268
+            $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
269
+
270
+            $currentid = (string) $view->param( 'f_catid', '' );
271
+            $currentid = ( $currentid != '' ? $currentid : null );
272
+
273
+            /** client/html/catalog/filter/tree/startid
274
+             * The ID of the category node that should be the root of the displayed category tree
275
+             *
276
+             * If you want to display only a part of your category tree, you can
277
+             * configure the ID of the category node from which rendering the
278
+             * remaining sub-tree should start.
279
+             *
280
+             * In most cases you can set this value via the administration interface
281
+             * of the shop application. In that case you often can configure the
282
+             * start ID individually for each catalog filter.
283
+             *
284
+             * @param string Category ID
285
+             * @since 2014.03
286
+             * @category User
287
+             * @category Developer
288
+             * @see client/html/catalog/filter/tree/levels-always
289
+             * @see client/html/catalog/filter/tree/levels-only
290
+             * @see client/html/catalog/filter/tree/domains
291
+             */
292
+            $startid = $view->config( 'client/html/catalog/filter/tree/startid', '' );
293
+            $startid = ( $startid != '' ? $startid : null );
294
+
295
+            /** client/html/catalog/filter/tree/domains
296
+             * List of domain names whose items should be fetched with the filter categories
297
+             *
298
+             * The templates rendering the categories in the catalog filter usually
299
+             * add the images and texts associated to each item. If you want to
300
+             * display additional content, you can configure your own list of
301
+             * domains (attribute, media, price, product, text, etc. are domains)
302
+             * whose items are fetched from the storage. Please keep in mind that
303
+             * the more domains you add to the configuration, the more time is
304
+             * required for fetching the content!
305
+             *
306
+             * @param array List of domain item names
307
+             * @since 2014.03
308
+             * @category Developer
309
+             * @see client/html/catalog/filter/tree/startid
310
+             * @see client/html/catalog/filter/tree/levels-always
311
+             * @see client/html/catalog/filter/tree/levels-only
312
+             */
313
+            $ref = $view->config( 'client/html/catalog/filter/tree/domains', array( 'text', 'media' ) );
314
+
315
+
316
+            if( $currentid )
317
+            {
318
+                $catItems = $controller->getCatalogPath( $currentid );
319
+
320
+                if( $startid )
321
+                {
322
+                    foreach( $catItems as $key => $item )
323
+                    {
324
+                        if( $key == $startid ) {
325
+                            break;
326
+                        }
327
+                        unset( $catItems[$key] );
328
+                    }
329
+                }
330
+            }
331
+
332
+            if( ( $node = reset( $catItems ) ) === false )
333
+            {
334
+                $node = $controller->getCatalogTree( $startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );
335
+                $catItems = array( $node->getId() => $node );
336
+            }
337
+
338
+
339
+            $search = $controller->createCatalogFilter();
340
+            $expr = $search->compare( '==', 'catalog.parentid', array_keys( $catItems ) );
341
+            $expr = $search->combine( '||', array( $expr, $search->compare( '==', 'catalog.id', $node->getId() ) ) );
342
+
343
+            /** client/html/catalog/filter/tree/levels-always
344
+             * The number of levels in the category tree that should be always displayed
345
+             *
346
+             * Usually, only the root node and the first level of the category
347
+             * tree is shown in the frontend. Only if the user clicks on a
348
+             * node in the first level, the page reloads and the sub-nodes of
349
+             * the chosen category are rendered as well.
350
+             *
351
+             * Using this configuration option you can enforce the given number
352
+             * of levels to be always displayed. The root node uses level 0, the
353
+             * categories below level 1 and so on.
354
+             *
355
+             * In most cases you can set this value via the administration interface
356
+             * of the shop application. In that case you often can configure the
357
+             * levels individually for each catalog filter.
358
+             *
359
+             * @param integer Number of tree levels
360
+             * @since 2014.03
361
+             * @category User
362
+             * @category Developer
363
+             * @see client/html/catalog/filter/tree/startid
364
+             * @see client/html/catalog/filter/tree/levels-only
365
+             * @see client/html/catalog/filter/tree/domains
366
+             */
367
+            if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-always' ) ) != null ) {
368
+                $expr = $search->combine( '||', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) );
369
+            }
370
+
371
+            /** client/html/catalog/filter/tree/levels-only
372
+             * No more than this number of levels in the category tree should be displayed
373
+             *
374
+             * If the user clicks on a category node, the page reloads and the
375
+             * sub-nodes of the chosen category are rendered as well.
376
+             * Using this configuration option you can enforce that no more than
377
+             * the given number of levels will be displayed at all. The root
378
+             * node uses level 0, the categories below level 1 and so on.
379
+             *
380
+             * In most cases you can set this value via the administration interface
381
+             * of the shop application. In that case you often can configure the
382
+             * levels individually for each catalog filter.
383
+             *
384
+             * @param integer Number of tree levels
385
+             * @since 2014.03
386
+             * @category User
387
+             * @category Developer
388
+             * @see client/html/catalog/filter/tree/startid
389
+             * @see client/html/catalog/filter/tree/levels-always
390
+             * @see client/html/catalog/filter/tree/domains
391
+             */
392
+            if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-only' ) ) != null ) {
393
+                $expr = $search->combine( '&&', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) );
394
+            }
395
+
396
+            $search->setConditions( $expr );
397
+
398
+            $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE;
399
+
400
+            $view->treeCatalogPath = $catItems;
401
+            $view->treeCatalogTree = $controller->getCatalogTree( $startid, $ref, $level, $search );
402
+            $view->treeCatalogIds = $this->getCatalogIds( $view->treeCatalogTree, $catItems, $currentid );
403
+            $view->treeFilterParams = $this->getClientParams( $view->param(), array( 'f' ) );
404
+
405
+            $this->addMetaItemCatalog( $view->treeCatalogTree, $this->expire, $this->tags );
406
+
407
+            $this->cache = $view;
408
+        }
409
+
410
+        $expire = $this->expires( $this->expire, $expire );
411
+        $tags = array_merge( $tags, $this->tags );
412
+
413
+        return $this->cache;
414
+    }
415
+
416
+
417
+    /**
418
+     * Returns the category IDs of the given catalog tree.
419
+     *
420
+     * Only the IDs of the children of the current category are returned.
421
+     *
422
+     * @param \Aimeos\MShop\Catalog\Item\Iface $tree Catalog node as entry point of the tree
423
+     * @param array $path Associative list of category IDs as keys and the catalog
424
+     * 	nodes from the currently selected category up to the root node
425
+     * @param string $currentId Currently selected category
426
+     * @return array List of category IDs
427
+     */
428
+    protected function getCatalogIds( \Aimeos\MShop\Catalog\Item\Iface $tree, array $path, $currentId )
429
+    {
430
+        if( $tree->getId() == $currentId )
431
+        {
432
+            $ids = array();
433
+            foreach( $tree->getChildren() as $item ) {
434
+                $ids[] = $item->getId();
435
+            }
436
+
437
+            return $ids;
438
+        }
439
+
440
+        foreach( $tree->getChildren() as $child )
441
+        {
442
+            if( isset( $path[$child->getId()] ) ) {
443
+                return $this->getCatalogIds( $child, $path, $currentId );
444
+            }
445
+        }
446
+
447
+        return array();
448
+    }
449
+
450
+
451
+    /**
452
+     * Adds the cache tags to the given list and sets a new expiration date if necessary based on the given catalog tree.
453
+     *
454
+     * @param \Aimeos\MShop\Catalog\Item\Iface $tree Tree node, maybe with sub-nodes
455
+     * @param string|null &$expire Expiration date that will be overwritten if an earlier date is found
456
+     * @param array &$tags List of tags the new tags will be added to
457
+     */
458
+    protected function addMetaItemCatalog( \Aimeos\MShop\Catalog\Item\Iface $tree, &$expire, array &$tags = array() )
459
+    {
460
+        $this->addMetaItem( $tree, 'catalog', $expire, $tags );
461
+
462
+        foreach( $tree->getChildren() as $child ) {
463
+            $this->addMetaItemCatalog( $child, $expire, $tags );
464
+        }
465
+    }
466 466
 }
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71 71
 	 * @return string HTML code
72 72
 	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
74 74
 	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
75
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
76 76
 
77 77
 		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
+		foreach ($this->getSubClients() as $subclient) {
79
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
80 80
 		}
81 81
 		$view->treeBody = $html;
82 82
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$tplconf = 'client/html/catalog/filter/tree/standard/template-body';
104 104
 		$default = 'catalog/filter/tree-body-default.php';
105 105
 
106
-		return $view->render( $view->config( $tplconf, $default ) );
106
+		return $view->render($view->config($tplconf, $default));
107 107
 	}
108 108
 
109 109
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116 116
 	 * @return string|null String including HTML tags for the header on error
117 117
 	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
119 119
 	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
120
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
121 121
 
122 122
 		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+		foreach ($this->getSubClients() as $subclient) {
124
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
125 125
 		}
126 126
 		$view->treeHeader = $html;
127 127
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$tplconf = 'client/html/catalog/filter/tree/standard/template-header';
150 150
 		$default = 'catalog/filter/tree-header-default.php';
151 151
 
152
-		return $view->render( $view->config( $tplconf, $default ) );
152
+		return $view->render($view->config($tplconf, $default));
153 153
 	}
154 154
 
155 155
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @param string|null $name Name of the sub-client (Default if null)
161 161
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
162 162
 	 */
163
-	public function getSubClient( $type, $name = null )
163
+	public function getSubClient($type, $name = null)
164 164
 	{
165 165
 		/** client/html/catalog/filter/tree/decorators/excludes
166 166
 		 * Excludes decorators added by the "common" option from the catalog filter tree html client
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		 * @see client/html/catalog/filter/tree/decorators/global
237 237
 		 */
238 238
 
239
-		return $this->createSubClient( 'catalog/filter/tree/' . $type, $name );
239
+		return $this->createSubClient('catalog/filter/tree/'.$type, $name);
240 240
 	}
241 241
 
242 242
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function getSubClientNames()
249 249
 	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
251 251
 	}
252 252
 
253 253
 
@@ -259,16 +259,16 @@  discard block
 block discarded – undo
259 259
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
260 260
 	 * @return \Aimeos\MW\View\Iface Modified view object
261 261
 	 */
262
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
263 263
 	{
264
-		if( !isset( $this->cache ) )
264
+		if (!isset($this->cache))
265 265
 		{
266 266
 			$catItems = array();
267 267
 			$context = $this->getContext();
268
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
268
+			$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
269 269
 
270
-			$currentid = (string) $view->param( 'f_catid', '' );
271
-			$currentid = ( $currentid != '' ? $currentid : null );
270
+			$currentid = (string) $view->param('f_catid', '');
271
+			$currentid = ($currentid != '' ? $currentid : null);
272 272
 
273 273
 			/** client/html/catalog/filter/tree/startid
274 274
 			 * The ID of the category node that should be the root of the displayed category tree
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 			 * @see client/html/catalog/filter/tree/levels-only
290 290
 			 * @see client/html/catalog/filter/tree/domains
291 291
 			 */
292
-			$startid = $view->config( 'client/html/catalog/filter/tree/startid', '' );
293
-			$startid = ( $startid != '' ? $startid : null );
292
+			$startid = $view->config('client/html/catalog/filter/tree/startid', '');
293
+			$startid = ($startid != '' ? $startid : null);
294 294
 
295 295
 			/** client/html/catalog/filter/tree/domains
296 296
 			 * List of domain names whose items should be fetched with the filter categories
@@ -310,35 +310,35 @@  discard block
 block discarded – undo
310 310
 			 * @see client/html/catalog/filter/tree/levels-always
311 311
 			 * @see client/html/catalog/filter/tree/levels-only
312 312
 			 */
313
-			$ref = $view->config( 'client/html/catalog/filter/tree/domains', array( 'text', 'media' ) );
313
+			$ref = $view->config('client/html/catalog/filter/tree/domains', array('text', 'media'));
314 314
 
315 315
 
316
-			if( $currentid )
316
+			if ($currentid)
317 317
 			{
318
-				$catItems = $controller->getCatalogPath( $currentid );
318
+				$catItems = $controller->getCatalogPath($currentid);
319 319
 
320
-				if( $startid )
320
+				if ($startid)
321 321
 				{
322
-					foreach( $catItems as $key => $item )
322
+					foreach ($catItems as $key => $item)
323 323
 					{
324
-						if( $key == $startid ) {
324
+						if ($key == $startid) {
325 325
 							break;
326 326
 						}
327
-						unset( $catItems[$key] );
327
+						unset($catItems[$key]);
328 328
 					}
329 329
 				}
330 330
 			}
331 331
 
332
-			if( ( $node = reset( $catItems ) ) === false )
332
+			if (($node = reset($catItems)) === false)
333 333
 			{
334
-				$node = $controller->getCatalogTree( $startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE );
335
-				$catItems = array( $node->getId() => $node );
334
+				$node = $controller->getCatalogTree($startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE);
335
+				$catItems = array($node->getId() => $node);
336 336
 			}
337 337
 
338 338
 
339 339
 			$search = $controller->createCatalogFilter();
340
-			$expr = $search->compare( '==', 'catalog.parentid', array_keys( $catItems ) );
341
-			$expr = $search->combine( '||', array( $expr, $search->compare( '==', 'catalog.id', $node->getId() ) ) );
340
+			$expr = $search->compare('==', 'catalog.parentid', array_keys($catItems));
341
+			$expr = $search->combine('||', array($expr, $search->compare('==', 'catalog.id', $node->getId())));
342 342
 
343 343
 			/** client/html/catalog/filter/tree/levels-always
344 344
 			 * The number of levels in the category tree that should be always displayed
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
 			 * @see client/html/catalog/filter/tree/levels-only
365 365
 			 * @see client/html/catalog/filter/tree/domains
366 366
 			 */
367
-			if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-always' ) ) != null ) {
368
-				$expr = $search->combine( '||', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) );
367
+			if (($levels = $view->config('client/html/catalog/filter/tree/levels-always')) != null) {
368
+				$expr = $search->combine('||', array($expr, $search->compare('<=', 'catalog.level', $levels)));
369 369
 			}
370 370
 
371 371
 			/** client/html/catalog/filter/tree/levels-only
@@ -389,26 +389,26 @@  discard block
 block discarded – undo
389 389
 			 * @see client/html/catalog/filter/tree/levels-always
390 390
 			 * @see client/html/catalog/filter/tree/domains
391 391
 			 */
392
-			if( ( $levels = $view->config( 'client/html/catalog/filter/tree/levels-only' ) ) != null ) {
393
-				$expr = $search->combine( '&&', array( $expr, $search->compare( '<=', 'catalog.level', $levels ) ) );
392
+			if (($levels = $view->config('client/html/catalog/filter/tree/levels-only')) != null) {
393
+				$expr = $search->combine('&&', array($expr, $search->compare('<=', 'catalog.level', $levels)));
394 394
 			}
395 395
 
396
-			$search->setConditions( $expr );
396
+			$search->setConditions($expr);
397 397
 
398 398
 			$level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE;
399 399
 
400 400
 			$view->treeCatalogPath = $catItems;
401
-			$view->treeCatalogTree = $controller->getCatalogTree( $startid, $ref, $level, $search );
402
-			$view->treeCatalogIds = $this->getCatalogIds( $view->treeCatalogTree, $catItems, $currentid );
403
-			$view->treeFilterParams = $this->getClientParams( $view->param(), array( 'f' ) );
401
+			$view->treeCatalogTree = $controller->getCatalogTree($startid, $ref, $level, $search);
402
+			$view->treeCatalogIds = $this->getCatalogIds($view->treeCatalogTree, $catItems, $currentid);
403
+			$view->treeFilterParams = $this->getClientParams($view->param(), array('f'));
404 404
 
405
-			$this->addMetaItemCatalog( $view->treeCatalogTree, $this->expire, $this->tags );
405
+			$this->addMetaItemCatalog($view->treeCatalogTree, $this->expire, $this->tags);
406 406
 
407 407
 			$this->cache = $view;
408 408
 		}
409 409
 
410
-		$expire = $this->expires( $this->expire, $expire );
411
-		$tags = array_merge( $tags, $this->tags );
410
+		$expire = $this->expires($this->expire, $expire);
411
+		$tags = array_merge($tags, $this->tags);
412 412
 
413 413
 		return $this->cache;
414 414
 	}
@@ -425,22 +425,22 @@  discard block
 block discarded – undo
425 425
 	 * @param string $currentId Currently selected category
426 426
 	 * @return array List of category IDs
427 427
 	 */
428
-	protected function getCatalogIds( \Aimeos\MShop\Catalog\Item\Iface $tree, array $path, $currentId )
428
+	protected function getCatalogIds(\Aimeos\MShop\Catalog\Item\Iface $tree, array $path, $currentId)
429 429
 	{
430
-		if( $tree->getId() == $currentId )
430
+		if ($tree->getId() == $currentId)
431 431
 		{
432 432
 			$ids = array();
433
-			foreach( $tree->getChildren() as $item ) {
433
+			foreach ($tree->getChildren() as $item) {
434 434
 				$ids[] = $item->getId();
435 435
 			}
436 436
 
437 437
 			return $ids;
438 438
 		}
439 439
 
440
-		foreach( $tree->getChildren() as $child )
440
+		foreach ($tree->getChildren() as $child)
441 441
 		{
442
-			if( isset( $path[$child->getId()] ) ) {
443
-				return $this->getCatalogIds( $child, $path, $currentId );
442
+			if (isset($path[$child->getId()])) {
443
+				return $this->getCatalogIds($child, $path, $currentId);
444 444
 			}
445 445
 		}
446 446
 
@@ -455,12 +455,12 @@  discard block
 block discarded – undo
455 455
 	 * @param string|null &$expire Expiration date that will be overwritten if an earlier date is found
456 456
 	 * @param array &$tags List of tags the new tags will be added to
457 457
 	 */
458
-	protected function addMetaItemCatalog( \Aimeos\MShop\Catalog\Item\Iface $tree, &$expire, array &$tags = array() )
458
+	protected function addMetaItemCatalog(\Aimeos\MShop\Catalog\Item\Iface $tree, &$expire, array &$tags = array())
459 459
 	{
460
-		$this->addMetaItem( $tree, 'catalog', $expire, $tags );
460
+		$this->addMetaItem($tree, 'catalog', $expire, $tags);
461 461
 
462
-		foreach( $tree->getChildren() as $child ) {
463
-			$this->addMetaItemCatalog( $child, $expire, $tags );
462
+		foreach ($tree->getChildren() as $child) {
463
+			$this->addMetaItemCatalog($child, $expire, $tags);
464 464
 		}
465 465
 	}
466 466
 }
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Lists/Head/Standard.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
111 111
 	 * @param array &$tags Result array for the list of tags that are associated to the output
112 112
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113
-	 * @return string|null String including HTML tags for the header on error
113
+	 * @return string String including HTML tags for the header on error
114 114
 	 */
115 115
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116 116
 	{
Please login to merge, or discard this 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/lists/head/standard/subparts
26
-	 * List of HTML sub-clients rendered within the catalog list head 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/head/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->headBody = $html;
79
-
80
-		/** client/html/catalog/lists/head/standard/template-body
81
-		 * Relative path to the HTML body template of the catalog list head 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/lists/head/standard/template-header
99
-		 */
100
-		$tplconf = 'client/html/catalog/lists/head/standard/template-body';
101
-		$default = 'catalog/lists/head-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->headHeader = $html;
124
-
125
-		/** client/html/catalog/lists/head/standard/template-header
126
-		 * Relative path to the HTML header template of the catalog list head 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/lists/head/standard/template-body
145
-		 */
146
-		$tplconf = 'client/html/catalog/lists/head/standard/template-header';
147
-		$default = 'catalog/lists/head-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/lists/head/decorators/excludes
163
-		 * Excludes decorators added by the "common" option from the catalog list head 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/lists/head/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/lists/head/decorators/global
185
-		 * @see client/html/catalog/lists/head/decorators/local
186
-		 */
187
-
188
-		/** client/html/catalog/lists/head/decorators/global
189
-		 * Adds a list of globally available decorators only to the catalog list head 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/lists/head/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/lists/head/decorators/excludes
209
-		 * @see client/html/catalog/lists/head/decorators/local
210
-		 */
211
-
212
-		/** client/html/catalog/lists/head/decorators/local
213
-		 * Adds a list of local decorators only to the catalog list head 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/lists/head/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/lists/head/decorators/excludes
233
-		 * @see client/html/catalog/lists/head/decorators/global
234
-		 */
235
-
236
-		return $this->createSubClient( 'catalog/lists/head/' . $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/lists/head/standard/subparts
26
+     * List of HTML sub-clients rendered within the catalog list head 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/head/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->headBody = $html;
79
+
80
+        /** client/html/catalog/lists/head/standard/template-body
81
+         * Relative path to the HTML body template of the catalog list head 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/lists/head/standard/template-header
99
+         */
100
+        $tplconf = 'client/html/catalog/lists/head/standard/template-body';
101
+        $default = 'catalog/lists/head-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->headHeader = $html;
124
+
125
+        /** client/html/catalog/lists/head/standard/template-header
126
+         * Relative path to the HTML header template of the catalog list head 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/lists/head/standard/template-body
145
+         */
146
+        $tplconf = 'client/html/catalog/lists/head/standard/template-header';
147
+        $default = 'catalog/lists/head-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/lists/head/decorators/excludes
163
+         * Excludes decorators added by the "common" option from the catalog list head 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/lists/head/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/lists/head/decorators/global
185
+         * @see client/html/catalog/lists/head/decorators/local
186
+         */
187
+
188
+        /** client/html/catalog/lists/head/decorators/global
189
+         * Adds a list of globally available decorators only to the catalog list head 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/lists/head/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/lists/head/decorators/excludes
209
+         * @see client/html/catalog/lists/head/decorators/local
210
+         */
211
+
212
+        /** client/html/catalog/lists/head/decorators/local
213
+         * Adds a list of local decorators only to the catalog list head 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/lists/head/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/lists/head/decorators/excludes
233
+         * @see client/html/catalog/lists/head/decorators/global
234
+         */
235
+
236
+        return $this->createSubClient( 'catalog/lists/head/' . $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.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68 68
 	 * @return string HTML code
69 69
 	 */
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
71 71
 	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
72
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
73 73
 
74 74
 		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
75
+		foreach ($this->getSubClients() as $subclient) {
76
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
77 77
 		}
78 78
 		$view->headBody = $html;
79 79
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$tplconf = 'client/html/catalog/lists/head/standard/template-body';
101 101
 		$default = 'catalog/lists/head-body-default.php';
102 102
 
103
-		return $view->render( $view->config( $tplconf, $default ) );
103
+		return $view->render($view->config($tplconf, $default));
104 104
 	}
105 105
 
106 106
 
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
113 113
 	 * @return string|null String including HTML tags for the header on error
114 114
 	 */
115
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
115
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
116 116
 	{
117
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
117
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
118 118
 
119 119
 		$html = '';
120
-		foreach( $this->getSubClients() as $subclient ) {
121
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
120
+		foreach ($this->getSubClients() as $subclient) {
121
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
122 122
 		}
123 123
 		$view->headHeader = $html;
124 124
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$tplconf = 'client/html/catalog/lists/head/standard/template-header';
147 147
 		$default = 'catalog/lists/head-header-default.php';
148 148
 
149
-		return $view->render( $view->config( $tplconf, $default ) );
149
+		return $view->render($view->config($tplconf, $default));
150 150
 	}
151 151
 
152 152
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @param string|null $name Name of the sub-client (Default if null)
158 158
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
159 159
 	 */
160
-	public function getSubClient( $type, $name = null )
160
+	public function getSubClient($type, $name = null)
161 161
 	{
162 162
 		/** client/html/catalog/lists/head/decorators/excludes
163 163
 		 * Excludes decorators added by the "common" option from the catalog list head html client
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		 * @see client/html/catalog/lists/head/decorators/global
234 234
 		 */
235 235
 
236
-		return $this->createSubClient( 'catalog/lists/head/' . $type, $name );
236
+		return $this->createSubClient('catalog/lists/head/'.$type, $name);
237 237
 	}
238 238
 
239 239
 
@@ -244,6 +244,6 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	protected function getSubClientNames()
246 246
 	{
247
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
247
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
248 248
 	}
249 249
 }
250 250
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Catalog/Lists/Items/Standard.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
114 114
 	 * @param array &$tags Result array for the list of tags that are associated to the output
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116
-	 * @return string|null String including HTML tags for the header on error
116
+	 * @return string String including HTML tags for the header on error
117 117
 	 */
118 118
 	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
119 119
 	{
Please login to merge, or discard this 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.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
71 71
 	 * @return string HTML code
72 72
 	 */
73
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
73
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
74 74
 	{
75
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
75
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
76 76
 
77 77
 		$html = '';
78
-		foreach( $this->getSubClients() as $subclient ) {
79
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
78
+		foreach ($this->getSubClients() as $subclient) {
79
+			$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
80 80
 		}
81 81
 		$view->itemsBody = $html;
82 82
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$tplconf = 'client/html/catalog/lists/items/standard/template-body';
104 104
 		$default = 'catalog/lists/items-body-default.php';
105 105
 
106
-		return $view->render( $view->config( $tplconf, $default ) );
106
+		return $view->render($view->config($tplconf, $default));
107 107
 	}
108 108
 
109 109
 
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
116 116
 	 * @return string|null String including HTML tags for the header on error
117 117
 	 */
118
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
118
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
119 119
 	{
120
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
120
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
121 121
 
122 122
 		$html = '';
123
-		foreach( $this->getSubClients() as $subclient ) {
124
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+		foreach ($this->getSubClients() as $subclient) {
124
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
125 125
 		}
126 126
 		$view->itemsHeader = $html;
127 127
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		$tplconf = 'client/html/catalog/lists/items/standard/template-header';
150 150
 		$default = 'catalog/lists/items-header-default.php';
151 151
 
152
-		return $view->render( $view->config( $tplconf, $default ) );
152
+		return $view->render($view->config($tplconf, $default));
153 153
 	}
154 154
 
155 155
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @param string|null $name Name of the sub-client (Default if null)
161 161
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
162 162
 	 */
163
-	public function getSubClient( $type, $name = null )
163
+	public function getSubClient($type, $name = null)
164 164
 	{
165 165
 		/** client/html/catalog/lists/items/decorators/excludes
166 166
 		 * Excludes decorators added by the "common" option from the catalog list items html client
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		 * @see client/html/catalog/lists/items/decorators/global
237 237
 		 */
238 238
 
239
-		return $this->createSubClient( 'catalog/lists/items/' . $type, $name );
239
+		return $this->createSubClient('catalog/lists/items/'.$type, $name);
240 240
 	}
241 241
 
242 242
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function getSubClientNames()
249 249
 	{
250
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
251 251
 	}
252 252
 
253 253
 
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
259 259
 	 * @return string Modified body content
260 260
 	 */
261
-	public function modifyBody( $content, $uid )
261
+	public function modifyBody($content, $uid)
262 262
 	{
263
-		$content = parent::modifyBody( $content, $uid );
263
+		$content = parent::modifyBody($content, $uid);
264 264
 
265
-		return $this->replaceSection( $content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf' );
265
+		return $this->replaceSection($content, $this->getView()->csrf()->formfield(), 'catalog.lists.items.csrf');
266 266
 	}
267 267
 
268 268
 
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
275 275
 	 * @return \Aimeos\MW\View\Iface Modified view object
276 276
 	 */
277
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
277
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
278 278
 	{
279
-		if( !isset( $this->view ) )
279
+		if (!isset($this->view))
280 280
 		{
281
-			$view->itemPosition = ( $this->getProductListPage( $view ) - 1 ) * $this->getProductListSize( $view );
281
+			$view->itemPosition = ($this->getProductListPage($view) - 1) * $this->getProductListSize($view);
282 282
 
283
-			if( $this->getContext()->getConfig()->get( 'client/html/catalog/lists/basket-add', false ) )
283
+			if ($this->getContext()->getConfig()->get('client/html/catalog/lists/basket-add', false))
284 284
 			{
285
-				$view = $this->addSelectionProducts( $view, $tags, $expire );
286
-				$view = $this->addConfigAttributes( $view, $tags, $expire );
285
+				$view = $this->addSelectionProducts($view, $tags, $expire);
286
+				$view = $this->addConfigAttributes($view, $tags, $expire);
287 287
 			}
288 288
 
289 289
 			$this->view = $view;
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
302 302
 	 * @return \Aimeos\MW\View\Iface Modified view object
303 303
 	 */
304
-	protected function addSelectionProducts( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
304
+	protected function addSelectionProducts(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
305 305
 	{
306 306
 		$context = $this->getContext();
307 307
 		$config = $context->getConfig();
308 308
 		$subProdMap = $prodMap = $prodIds = array();
309 309
 
310
-		foreach( (array) $view->get( 'listProductItems', array() ) as $product )
310
+		foreach ((array) $view->get('listProductItems', array()) as $product)
311 311
 		{
312
-			if( $product->getType() === 'select' )
312
+			if ($product->getType() === 'select')
313 313
 			{
314
-				foreach( $product->getListItems( 'product', 'default' ) as $listItem )
314
+				foreach ($product->getListItems('product', 'default') as $listItem)
315 315
 				{
316 316
 					$prodMap[$listItem->getParentId()][] = $listItem->getRefId();
317 317
 					$prodIds[$listItem->getRefId()] = null;
@@ -319,26 +319,26 @@  discard block
 block discarded – undo
319 319
 			}
320 320
 		}
321 321
 
322
-		$prodIds = array_keys( $prodIds );
322
+		$prodIds = array_keys($prodIds);
323 323
 
324 324
 
325
-		$domains = array( 'text', 'price', 'media', 'attribute' );
326
-		$domains = $config->get( 'client/html/catalog/detail/basket/selection/domains', $domains );
325
+		$domains = array('text', 'price', 'media', 'attribute');
326
+		$domains = $config->get('client/html/catalog/detail/basket/selection/domains', $domains);
327 327
 
328
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
329
-		$subproducts = $controller->getProductItems( $prodIds, $domains );
328
+		$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
329
+		$subproducts = $controller->getProductItems($prodIds, $domains);
330 330
 		$attrIds = $prodDeps = $attrDeps = $attrTypeDeps = array();
331 331
 
332
-		foreach( $prodMap as $prodId => $list )
332
+		foreach ($prodMap as $prodId => $list)
333 333
 		{
334
-			foreach( $list as $subProdId )
334
+			foreach ($list as $subProdId)
335 335
 			{
336
-				if( isset( $subproducts[$subProdId] ) )
336
+				if (isset($subproducts[$subProdId]))
337 337
 				{
338 338
 					$subProduct = $subproducts[$subProdId];
339 339
 					$subProdMap[$prodId][$subProdId] = $subProduct;
340 340
 
341
-					foreach( $subProduct->getRefItems( 'attribute', null, 'variant' ) as $attrId => $attrItem )
341
+					foreach ($subProduct->getRefItems('attribute', null, 'variant') as $attrId => $attrItem)
342 342
 					{
343 343
 						$attrTypeDeps[$prodId][$attrItem->getType()][$attrId] = $attrItem->getPosition();
344 344
 						$attrDeps[$prodId][$attrId][] = $subProdId;
@@ -348,31 +348,31 @@  discard block
 block discarded – undo
348 348
 				}
349 349
 			}
350 350
 
351
-			ksort( $attrTypeDeps[$prodId] );
351
+			ksort($attrTypeDeps[$prodId]);
352 352
 		}
353 353
 
354
-		$this->addMetaItem( $subproducts, 'product', $this->expire, $this->tags );
355
-		$this->addMetaList( array_keys( $subproducts ), 'product', $this->expire );
354
+		$this->addMetaItem($subproducts, 'product', $this->expire, $this->tags);
355
+		$this->addMetaList(array_keys($subproducts), 'product', $this->expire);
356 356
 
357 357
 
358
-		$attrManager = $controller->createManager( 'attribute' );
358
+		$attrManager = $controller->createManager('attribute');
359 359
 
360
-		$search = $attrManager->createSearch( true );
360
+		$search = $attrManager->createSearch(true);
361 361
 		$expr = array(
362
-			$search->compare( '==', 'attribute.id', array_keys( $attrIds ) ),
362
+			$search->compare('==', 'attribute.id', array_keys($attrIds)),
363 363
 			$search->getConditions(),
364 364
 		);
365
-		$search->setConditions( $search->combine( '&&', $expr ) );
365
+		$search->setConditions($search->combine('&&', $expr));
366 366
 
367
-		$domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) );
368
-		$attributes = $attrManager->searchItems( $search, $domains );
367
+		$domains = $config->get('client/html/catalog/lists/items/domains-attributes', array('text', 'price', 'media'));
368
+		$attributes = $attrManager->searchItems($search, $domains);
369 369
 
370
-		$this->addMetaItem( $attributes, 'attribute', $this->expire, $this->tags );
371
-		$this->addMetaList( array_keys( $attributes ), 'attribute', $this->expire );
370
+		$this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags);
371
+		$this->addMetaList(array_keys($attributes), 'attribute', $this->expire);
372 372
 
373 373
 
374
-		if( !empty( $prodIds ) && $config->get( 'client/html/catalog/lists/stock/enable', true ) === true ) {
375
-			$view->itemsStockUrl = $this->getStockUrl( $view, $prodIds );
374
+		if (!empty($prodIds) && $config->get('client/html/catalog/lists/stock/enable', true) === true) {
375
+			$view->itemsStockUrl = $this->getStockUrl($view, $prodIds);
376 376
 		}
377 377
 
378 378
 		$view->itemsSelectionProducts = $subProdMap;
@@ -393,15 +393,15 @@  discard block
 block discarded – undo
393 393
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
394 394
 	 * @return \Aimeos\MW\View\Iface Modified view object
395 395
 	 */
396
-	protected function addConfigAttributes( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
396
+	protected function addConfigAttributes(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
397 397
 	{
398 398
 		$context = $this->getContext();
399 399
 		$config = $context->getConfig();
400 400
 		$attrIds = $attributeTypes = array();
401 401
 
402
-		foreach( (array) $view->get( 'listProductItems', array() ) as $product )
402
+		foreach ((array) $view->get('listProductItems', array()) as $product)
403 403
 		{
404
-			foreach( $product->getListItems( 'attribute' ) as $listItem ) {
404
+			foreach ($product->getListItems('attribute') as $listItem) {
405 405
 				$attrIds[$listItem->getRefId()] = null;
406 406
 			}
407 407
 		}
@@ -424,29 +424,29 @@  discard block
 block discarded – undo
424 424
 		 * @since 2016.01
425 425
 		 * @category Developer
426 426
 		 */
427
-		$domains = $config->get( 'client/html/catalog/lists/items/domains-attributes', array( 'text', 'price', 'media' ) );
427
+		$domains = $config->get('client/html/catalog/lists/items/domains-attributes', array('text', 'price', 'media'));
428 428
 
429
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
430
-		$attrManager = $controller->createManager( 'attribute' );
429
+		$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
430
+		$attrManager = $controller->createManager('attribute');
431 431
 
432
-		$search = $attrManager->createSearch( true );
432
+		$search = $attrManager->createSearch(true);
433 433
 		$expr = array(
434
-			$search->compare( '==', 'attribute.id', array_keys( $attrIds ) ),
434
+			$search->compare('==', 'attribute.id', array_keys($attrIds)),
435 435
 			$search->getConditions(),
436 436
 		);
437
-		$search->setConditions( $search->combine( '&&', $expr ) );
437
+		$search->setConditions($search->combine('&&', $expr));
438 438
 
439
-		$attrItems = $attrManager->searchItems( $search, $domains );
439
+		$attrItems = $attrManager->searchItems($search, $domains);
440 440
 
441
-		$this->addMetaItem( $attrItems, 'attribute', $this->expire, $this->tags );
442
-		$this->addMetaList( array_keys( $attrItems ), 'attribute', $this->expire );
441
+		$this->addMetaItem($attrItems, 'attribute', $this->expire, $this->tags);
442
+		$this->addMetaList(array_keys($attrItems), 'attribute', $this->expire);
443 443
 
444 444
 
445
-		foreach( (array) $view->get( 'listProductItems', array() ) as $prodId => $product )
445
+		foreach ((array) $view->get('listProductItems', array()) as $prodId => $product)
446 446
 		{
447
-			foreach( $product->getRefItems( 'attribute', null, 'config' ) as $id => $attribute )
447
+			foreach ($product->getRefItems('attribute', null, 'config') as $id => $attribute)
448 448
 			{
449
-				if( isset( $attrItems[$id] ) ) {
449
+				if (isset($attrItems[$id])) {
450 450
 					$attributeTypes[$prodId][$attrItems[$id]->getType()][$id] = $attrItems[$id];
451 451
 				}
452 452
 			}
@@ -465,16 +465,16 @@  discard block
 block discarded – undo
465 465
 	 * @param array $productIds List of product IDs
466 466
 	 * @return string Generated stock level URL
467 467
 	 */
468
-	protected function getStockUrl( \Aimeos\MW\View\Iface $view, array $productIds )
468
+	protected function getStockUrl(\Aimeos\MW\View\Iface $view, array $productIds)
469 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() );
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 474
 
475
-		sort( $productIds );
475
+		sort($productIds);
476 476
 
477
-		$params = array( 's_prodid' => implode( ' ', $productIds ) );
478
-		return $view->url( $stockTarget, $stockController, $stockAction, $params, array(), $stockConfig );
477
+		$params = array('s_prodid' => implode(' ', $productIds));
478
+		return $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig);
479 479
 	}
480 480
 }
481 481
\ No newline at end of file
Please login to merge, or discard this patch.