Completed
Push — master ( 2005c2...d9c87d )
by Aimeos
06:04
created
client/html/src/Client/Html/Account/History/Factory.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -19,69 +19,69 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Factory
22
-	extends \Aimeos\Client\Html\Common\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Factory\Iface
24 24
 {
25
-	/**
26
-	 * Creates a account history client object.
27
-	 *
28
-	 * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
29
-	 * @param array $templatePaths List of file system paths where the templates are stored
30
-	 * @param string|null $name Client name (default: "Standard")
31
-	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32
-	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33
-	 */
34
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
35
-	{
36
-		/** client/html/account/history/name
37
-		 * Class name of the used account history client implementation
38
-		 *
39
-		 * Each default HTML client can be replace by an alternative imlementation.
40
-		 * To use this implementation, you have to set the last part of the class
41
-		 * name as configuration value so the client factory knows which class it
42
-		 * has to instantiate.
43
-		 *
44
-		 * For example, if the name of the default class is
45
-		 *
46
-		 *  \Aimeos\Client\Html\Account\History\Standard
47
-		 *
48
-		 * and you want to replace it with your own version named
49
-		 *
50
-		 *  \Aimeos\Client\Html\Account\History\Myhistory
51
-		 *
52
-		 * then you have to set the this configuration option:
53
-		 *
54
-		 *  client/html/account/history/name = Myhistory
55
-		 *
56
-		 * The value is the last part of your own class name and it's case sensitive,
57
-		 * so take care that the configuration value is exactly named like the last
58
-		 * part of the class name.
59
-		 *
60
-		 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
61
-		 * characters are possible! You should always start the last part of the class
62
-		 * name with an upper case character and continue only with lower case characters
63
-		 * or numbers. Avoid chamel case names like "MyHistory"!
64
-		 *
65
-		 * @param string Last part of the class name
66
-		 * @since 2014.03
67
-		 * @category Developer
68
-		 */
69
-		if( $name === null ) {
70
-			$name = $context->getConfig()->get( 'client/html/account/history/name', 'Standard' );
71
-		}
25
+    /**
26
+     * Creates a account history client object.
27
+     *
28
+     * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
29
+     * @param array $templatePaths List of file system paths where the templates are stored
30
+     * @param string|null $name Client name (default: "Standard")
31
+     * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32
+     * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33
+     */
34
+    public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
35
+    {
36
+        /** client/html/account/history/name
37
+         * Class name of the used account history client implementation
38
+         *
39
+         * Each default HTML client can be replace by an alternative imlementation.
40
+         * To use this implementation, you have to set the last part of the class
41
+         * name as configuration value so the client factory knows which class it
42
+         * has to instantiate.
43
+         *
44
+         * For example, if the name of the default class is
45
+         *
46
+         *  \Aimeos\Client\Html\Account\History\Standard
47
+         *
48
+         * and you want to replace it with your own version named
49
+         *
50
+         *  \Aimeos\Client\Html\Account\History\Myhistory
51
+         *
52
+         * then you have to set the this configuration option:
53
+         *
54
+         *  client/html/account/history/name = Myhistory
55
+         *
56
+         * The value is the last part of your own class name and it's case sensitive,
57
+         * so take care that the configuration value is exactly named like the last
58
+         * part of the class name.
59
+         *
60
+         * The allowed characters of the class name are A-Z, a-z and 0-9. No other
61
+         * characters are possible! You should always start the last part of the class
62
+         * name with an upper case character and continue only with lower case characters
63
+         * or numbers. Avoid chamel case names like "MyHistory"!
64
+         *
65
+         * @param string Last part of the class name
66
+         * @since 2014.03
67
+         * @category Developer
68
+         */
69
+        if( $name === null ) {
70
+            $name = $context->getConfig()->get( 'client/html/account/history/name', 'Standard' );
71
+        }
72 72
 
73
-		if( ctype_alnum( $name ) === false )
74
-		{
75
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\History\\' . $name : '<not a string>';
76
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
77
-		}
73
+        if( ctype_alnum( $name ) === false )
74
+        {
75
+            $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\History\\' . $name : '<not a string>';
76
+            throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
77
+        }
78 78
 
79
-		$iface = '\\Aimeos\\Client\\Html\\Iface';
80
-		$classname = '\\Aimeos\\Client\\Html\\Account\\History\\' . $name;
79
+        $iface = '\\Aimeos\\Client\\Html\\Iface';
80
+        $classname = '\\Aimeos\\Client\\Html\\Account\\History\\' . $name;
81 81
 
82
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82
+        $client = self::createClientBase( $context, $classname, $iface, $templatePaths );
83 83
 
84
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/history' );
85
-	}
84
+        return self::addClientDecorators( $context, $client, $templatePaths, 'account/history' );
85
+    }
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32 32
 	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33 33
 	 */
34
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
34
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null)
35 35
 	{
36 36
 		/** client/html/account/history/name
37 37
 		 * Class name of the used account history client implementation
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 		 * @since 2014.03
67 67
 		 * @category Developer
68 68
 		 */
69
-		if( $name === null ) {
70
-			$name = $context->getConfig()->get( 'client/html/account/history/name', 'Standard' );
69
+		if ($name === null) {
70
+			$name = $context->getConfig()->get('client/html/account/history/name', 'Standard');
71 71
 		}
72 72
 
73
-		if( ctype_alnum( $name ) === false )
73
+		if (ctype_alnum($name) === false)
74 74
 		{
75
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\History\\' . $name : '<not a string>';
76
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
75
+			$classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Account\\History\\'.$name : '<not a string>';
76
+			throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
77 77
 		}
78 78
 
79 79
 		$iface = '\\Aimeos\\Client\\Html\\Iface';
80
-		$classname = '\\Aimeos\\Client\\Html\\Account\\History\\' . $name;
80
+		$classname = '\\Aimeos\\Client\\Html\\Account\\History\\'.$name;
81 81
 
82
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82
+		$client = self::createClientBase($context, $classname, $iface, $templatePaths);
83 83
 
84
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/history' );
84
+		return self::addClientDecorators($context, $client, $templatePaths, 'account/history');
85 85
 	}
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/History/Standard.php 3 patches
Indentation   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -19,288 +19,288 @@
 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\Iface
22
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
23
+    implements \Aimeos\Client\Html\Iface
24 24
 {
25
-	/** client/html/account/history/standard/subparts
26
-	 * List of HTML sub-clients rendered within the account history section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/account/history/standard/subparts';
25
+    /** client/html/account/history/standard/subparts
26
+     * List of HTML sub-clients rendered within the account history section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/account/history/standard/subparts';
59 59
 
60
-	/** client/html/account/history/lists/name
61
-	 * Name of the list part used by the account history client implementation
62
-	 *
63
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Lists\Myname".
64
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
65
-	 *
66
-	 * @param string Last part of the client class name
67
-	 * @since 2014.03
68
-	 * @category Developer
69
-	 */
60
+    /** client/html/account/history/lists/name
61
+     * Name of the list part used by the account history client implementation
62
+     *
63
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Lists\Myname".
64
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
65
+     *
66
+     * @param string Last part of the client class name
67
+     * @since 2014.03
68
+     * @category Developer
69
+     */
70 70
 
71
-	/** client/html/account/history/order/name
72
-	 * Name of the order part used by the account history client implementation
73
-	 *
74
-	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Myname".
75
-	 * The name is case-sensitive and you should avoid camel case names like "MyName".
76
-	 *
77
-	 * @param string Last part of the client class name
78
-	 * @since 2015.02
79
-	 * @category Developer
80
-	 */
81
-	private $subPartNames = array( 'lists', 'order' );
71
+    /** client/html/account/history/order/name
72
+     * Name of the order part used by the account history client implementation
73
+     *
74
+     * Use "Myname" if your class is named "\Aimeos\Client\Html\Account\History\Order\Myname".
75
+     * The name is case-sensitive and you should avoid camel case names like "MyName".
76
+     *
77
+     * @param string Last part of the client class name
78
+     * @since 2015.02
79
+     * @category Developer
80
+     */
81
+    private $subPartNames = array( 'lists', 'order' );
82 82
 
83 83
 
84
-	/**
85
-	 * Returns the HTML code for insertion into the body.
86
-	 *
87
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
88
-	 * @param array &$tags Result array for the list of tags that are associated to the output
89
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
90
-	 * @return string HTML code
91
-	 */
92
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
93
-	{
94
-		$context = $this->getContext();
95
-		$view = $this->getView();
84
+    /**
85
+     * Returns the HTML code for insertion into the body.
86
+     *
87
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
88
+     * @param array &$tags Result array for the list of tags that are associated to the output
89
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
90
+     * @return string HTML code
91
+     */
92
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
93
+    {
94
+        $context = $this->getContext();
95
+        $view = $this->getView();
96 96
 
97
-		try
98
-		{
99
-			$view = $this->setViewParams( $view, $tags, $expire );
97
+        try
98
+        {
99
+            $view = $this->setViewParams( $view, $tags, $expire );
100 100
 
101
-			$html = '';
102
-			foreach( $this->getSubClients() as $subclient ) {
103
-				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
104
-			}
105
-			$view->historyBody = $html;
106
-		}
107
-		catch( \Aimeos\Client\Html\Exception $e )
108
-		{
109
-			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
110
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
111
-		}
112
-		catch( \Aimeos\Controller\Frontend\Exception $e )
113
-		{
114
-			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
115
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
116
-		}
117
-		catch( \Aimeos\MShop\Exception $e )
118
-		{
119
-			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
120
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
121
-		}
122
-		catch( \Exception $e )
123
-		{
124
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
101
+            $html = '';
102
+            foreach( $this->getSubClients() as $subclient ) {
103
+                $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
104
+            }
105
+            $view->historyBody = $html;
106
+        }
107
+        catch( \Aimeos\Client\Html\Exception $e )
108
+        {
109
+            $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
110
+            $view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
111
+        }
112
+        catch( \Aimeos\Controller\Frontend\Exception $e )
113
+        {
114
+            $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
115
+            $view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
116
+        }
117
+        catch( \Aimeos\MShop\Exception $e )
118
+        {
119
+            $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
120
+            $view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
121
+        }
122
+        catch( \Exception $e )
123
+        {
124
+            $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
125 125
 
126
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
127
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
128
-		}
126
+            $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
127
+            $view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
128
+        }
129 129
 
130
-		/** client/html/account/history/standard/template-body
131
-		 * Relative path to the HTML body template of the account history client.
132
-		 *
133
-		 * The template file contains the HTML code and processing instructions
134
-		 * to generate the result shown in the body of the frontend. The
135
-		 * configuration string is the path to the template file relative
136
-		 * to the templates directory (usually in client/html/templates).
137
-		 *
138
-		 * You can overwrite the template file configuration in extensions and
139
-		 * provide alternative templates. These alternative templates should be
140
-		 * named like the default one but with the string "standard" replaced by
141
-		 * an unique name. You may use the name of your project for this. If
142
-		 * you've implemented an alternative client class as well, "standard"
143
-		 * should be replaced by the name of the new class.
144
-		 *
145
-		 * @param string Relative path to the template creating code for the HTML page body
146
-		 * @since 2014.03
147
-		 * @category Developer
148
-		 * @see client/html/account/history/standard/template-header
149
-		 */
150
-		$tplconf = 'client/html/account/history/standard/template-body';
151
-		$default = 'account/history/body-default.php';
130
+        /** client/html/account/history/standard/template-body
131
+         * Relative path to the HTML body template of the account history client.
132
+         *
133
+         * The template file contains the HTML code and processing instructions
134
+         * to generate the result shown in the body of the frontend. The
135
+         * configuration string is the path to the template file relative
136
+         * to the templates directory (usually in client/html/templates).
137
+         *
138
+         * You can overwrite the template file configuration in extensions and
139
+         * provide alternative templates. These alternative templates should be
140
+         * named like the default one but with the string "standard" replaced by
141
+         * an unique name. You may use the name of your project for this. If
142
+         * you've implemented an alternative client class as well, "standard"
143
+         * should be replaced by the name of the new class.
144
+         *
145
+         * @param string Relative path to the template creating code for the HTML page body
146
+         * @since 2014.03
147
+         * @category Developer
148
+         * @see client/html/account/history/standard/template-header
149
+         */
150
+        $tplconf = 'client/html/account/history/standard/template-body';
151
+        $default = 'account/history/body-default.php';
152 152
 
153
-		return $view->render( $view->config( $tplconf, $default ) );
154
-	}
153
+        return $view->render( $view->config( $tplconf, $default ) );
154
+    }
155 155
 
156 156
 
157
-	/**
158
-	 * Returns the HTML string for insertion into the header.
159
-	 *
160
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
161
-	 * @param array &$tags Result array for the list of tags that are associated to the output
162
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
163
-	 * @return string|null String including HTML tags for the header on error
164
-	 */
165
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
166
-	{
167
-		try
168
-		{
169
-			$view = $this->setViewParams( $this->getView(), $tags, $expire );
157
+    /**
158
+     * Returns the HTML string for insertion into the header.
159
+     *
160
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
161
+     * @param array &$tags Result array for the list of tags that are associated to the output
162
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
163
+     * @return string|null String including HTML tags for the header on error
164
+     */
165
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
166
+    {
167
+        try
168
+        {
169
+            $view = $this->setViewParams( $this->getView(), $tags, $expire );
170 170
 
171
-			$html = '';
172
-			foreach( $this->getSubClients() as $subclient ) {
173
-				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
174
-			}
175
-			$view->historyHeader = $html;
171
+            $html = '';
172
+            foreach( $this->getSubClients() as $subclient ) {
173
+                $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
174
+            }
175
+            $view->historyHeader = $html;
176 176
 
177
-			/** client/html/account/history/standard/template-header
178
-			 * Relative path to the HTML header template of the account history client.
179
-			 *
180
-			 * The template file contains the HTML code and processing instructions
181
-			 * to generate the HTML code that is inserted into the HTML page header
182
-			 * of the rendered page in the frontend. The configuration string is the
183
-			 * path to the template file relative to the templates directory (usually
184
-			 * in client/html/templates).
185
-			 *
186
-			 * You can overwrite the template file configuration in extensions and
187
-			 * provide alternative templates. These alternative templates should be
188
-			 * named like the default one but with the string "standard" replaced by
189
-			 * an unique name. You may use the name of your project for this. If
190
-			 * you've implemented an alternative client class as well, "standard"
191
-			 * should be replaced by the name of the new class.
192
-			 *
193
-			 * @param string Relative path to the template creating code for the HTML page head
194
-			 * @since 2014.03
195
-			 * @category Developer
196
-			 * @see client/html/account/history/standard/template-body
197
-			 */
198
-			$tplconf = 'client/html/account/history/standard/template-header';
199
-			$default = 'account/history/header-default.php';
177
+            /** client/html/account/history/standard/template-header
178
+             * Relative path to the HTML header template of the account history client.
179
+             *
180
+             * The template file contains the HTML code and processing instructions
181
+             * to generate the HTML code that is inserted into the HTML page header
182
+             * of the rendered page in the frontend. The configuration string is the
183
+             * path to the template file relative to the templates directory (usually
184
+             * in client/html/templates).
185
+             *
186
+             * You can overwrite the template file configuration in extensions and
187
+             * provide alternative templates. These alternative templates should be
188
+             * named like the default one but with the string "standard" replaced by
189
+             * an unique name. You may use the name of your project for this. If
190
+             * you've implemented an alternative client class as well, "standard"
191
+             * should be replaced by the name of the new class.
192
+             *
193
+             * @param string Relative path to the template creating code for the HTML page head
194
+             * @since 2014.03
195
+             * @category Developer
196
+             * @see client/html/account/history/standard/template-body
197
+             */
198
+            $tplconf = 'client/html/account/history/standard/template-header';
199
+            $default = 'account/history/header-default.php';
200 200
 
201
-			return $view->render( $view->config( $tplconf, $default ) );
202
-		}
203
-		catch( \Exception $e )
204
-		{
205
-			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
206
-		}
207
-	}
201
+            return $view->render( $view->config( $tplconf, $default ) );
202
+        }
203
+        catch( \Exception $e )
204
+        {
205
+            $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
206
+        }
207
+    }
208 208
 
209 209
 
210
-	/**
211
-	 * Returns the sub-client given by its name.
212
-	 *
213
-	 * @param string $type Name of the client type
214
-	 * @param string|null $name Name of the sub-client (Default if null)
215
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
216
-	 */
217
-	public function getSubClient( $type, $name = null )
218
-	{
219
-		/** client/html/account/history/decorators/excludes
220
-		 * Excludes decorators added by the "common" option from the account history html client
221
-		 *
222
-		 * Decorators extend the functionality of a class by adding new aspects
223
-		 * (e.g. log what is currently done), executing the methods of the underlying
224
-		 * class only in certain conditions (e.g. only for logged in users) or
225
-		 * modify what is returned to the caller.
226
-		 *
227
-		 * This option allows you to remove a decorator added via
228
-		 * "client/html/common/decorators/default" before they are wrapped
229
-		 * around the html client.
230
-		 *
231
-		 *  client/html/account/history/decorators/excludes = array( 'decorator1' )
232
-		 *
233
-		 * This would remove the decorator named "decorator1" from the list of
234
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
235
-		 * "client/html/common/decorators/default" to the html client.
236
-		 *
237
-		 * @param array List of decorator names
238
-		 * @since 2014.05
239
-		 * @category Developer
240
-		 * @see client/html/common/decorators/default
241
-		 * @see client/html/account/history/decorators/global
242
-		 * @see client/html/account/history/decorators/local
243
-		 */
210
+    /**
211
+     * Returns the sub-client given by its name.
212
+     *
213
+     * @param string $type Name of the client type
214
+     * @param string|null $name Name of the sub-client (Default if null)
215
+     * @return \Aimeos\Client\Html\Iface Sub-client object
216
+     */
217
+    public function getSubClient( $type, $name = null )
218
+    {
219
+        /** client/html/account/history/decorators/excludes
220
+         * Excludes decorators added by the "common" option from the account history html client
221
+         *
222
+         * Decorators extend the functionality of a class by adding new aspects
223
+         * (e.g. log what is currently done), executing the methods of the underlying
224
+         * class only in certain conditions (e.g. only for logged in users) or
225
+         * modify what is returned to the caller.
226
+         *
227
+         * This option allows you to remove a decorator added via
228
+         * "client/html/common/decorators/default" before they are wrapped
229
+         * around the html client.
230
+         *
231
+         *  client/html/account/history/decorators/excludes = array( 'decorator1' )
232
+         *
233
+         * This would remove the decorator named "decorator1" from the list of
234
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
235
+         * "client/html/common/decorators/default" to the html client.
236
+         *
237
+         * @param array List of decorator names
238
+         * @since 2014.05
239
+         * @category Developer
240
+         * @see client/html/common/decorators/default
241
+         * @see client/html/account/history/decorators/global
242
+         * @see client/html/account/history/decorators/local
243
+         */
244 244
 
245
-		/** client/html/account/history/decorators/global
246
-		 * Adds a list of globally available decorators only to the account history html client
247
-		 *
248
-		 * Decorators extend the functionality of a class by adding new aspects
249
-		 * (e.g. log what is currently done), executing the methods of the underlying
250
-		 * class only in certain conditions (e.g. only for logged in users) or
251
-		 * modify what is returned to the caller.
252
-		 *
253
-		 * This option allows you to wrap global decorators
254
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
255
-		 *
256
-		 *  client/html/account/history/decorators/global = array( 'decorator1' )
257
-		 *
258
-		 * This would add the decorator named "decorator1" defined by
259
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
260
-		 *
261
-		 * @param array List of decorator names
262
-		 * @since 2014.05
263
-		 * @category Developer
264
-		 * @see client/html/common/decorators/default
265
-		 * @see client/html/account/history/decorators/excludes
266
-		 * @see client/html/account/history/decorators/local
267
-		 */
245
+        /** client/html/account/history/decorators/global
246
+         * Adds a list of globally available decorators only to the account history html client
247
+         *
248
+         * Decorators extend the functionality of a class by adding new aspects
249
+         * (e.g. log what is currently done), executing the methods of the underlying
250
+         * class only in certain conditions (e.g. only for logged in users) or
251
+         * modify what is returned to the caller.
252
+         *
253
+         * This option allows you to wrap global decorators
254
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
255
+         *
256
+         *  client/html/account/history/decorators/global = array( 'decorator1' )
257
+         *
258
+         * This would add the decorator named "decorator1" defined by
259
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
260
+         *
261
+         * @param array List of decorator names
262
+         * @since 2014.05
263
+         * @category Developer
264
+         * @see client/html/common/decorators/default
265
+         * @see client/html/account/history/decorators/excludes
266
+         * @see client/html/account/history/decorators/local
267
+         */
268 268
 
269
-		/** client/html/account/history/decorators/local
270
-		 * Adds a list of local decorators only to the account history html client
271
-		 *
272
-		 * Decorators extend the functionality of a class by adding new aspects
273
-		 * (e.g. log what is currently done), executing the methods of the underlying
274
-		 * class only in certain conditions (e.g. only for logged in users) or
275
-		 * modify what is returned to the caller.
276
-		 *
277
-		 * This option allows you to wrap local decorators
278
-		 * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client.
279
-		 *
280
-		 *  client/html/account/history/decorators/local = array( 'decorator2' )
281
-		 *
282
-		 * This would add the decorator named "decorator2" defined by
283
-		 * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client.
284
-		 *
285
-		 * @param array List of decorator names
286
-		 * @since 2014.05
287
-		 * @category Developer
288
-		 * @see client/html/common/decorators/default
289
-		 * @see client/html/account/history/decorators/excludes
290
-		 * @see client/html/account/history/decorators/global
291
-		 */
269
+        /** client/html/account/history/decorators/local
270
+         * Adds a list of local decorators only to the account history html client
271
+         *
272
+         * Decorators extend the functionality of a class by adding new aspects
273
+         * (e.g. log what is currently done), executing the methods of the underlying
274
+         * class only in certain conditions (e.g. only for logged in users) or
275
+         * modify what is returned to the caller.
276
+         *
277
+         * This option allows you to wrap local decorators
278
+         * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client.
279
+         *
280
+         *  client/html/account/history/decorators/local = array( 'decorator2' )
281
+         *
282
+         * This would add the decorator named "decorator2" defined by
283
+         * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client.
284
+         *
285
+         * @param array List of decorator names
286
+         * @since 2014.05
287
+         * @category Developer
288
+         * @see client/html/common/decorators/default
289
+         * @see client/html/account/history/decorators/excludes
290
+         * @see client/html/account/history/decorators/global
291
+         */
292 292
 
293
-		return $this->createSubClient( 'account/history/' . $type, $name );
294
-	}
293
+        return $this->createSubClient( 'account/history/' . $type, $name );
294
+    }
295 295
 
296 296
 
297
-	/**
298
-	 * Returns the list of sub-client names configured for the client.
299
-	 *
300
-	 * @return array List of HTML client names
301
-	 */
302
-	protected function getSubClientNames()
303
-	{
304
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
305
-	}
297
+    /**
298
+     * Returns the list of sub-client names configured for the client.
299
+     *
300
+     * @return array List of HTML client names
301
+     */
302
+    protected function getSubClientNames()
303
+    {
304
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
305
+    }
306 306
 }
307 307
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 2015.02
79 79
 	 * @category Developer
80 80
 	 */
81
-	private $subPartNames = array( 'lists', 'order' );
81
+	private $subPartNames = array('lists', 'order');
82 82
 
83 83
 
84 84
 	/**
@@ -89,42 +89,42 @@  discard block
 block discarded – undo
89 89
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
90 90
 	 * @return string HTML code
91 91
 	 */
92
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
92
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
93 93
 	{
94 94
 		$context = $this->getContext();
95 95
 		$view = $this->getView();
96 96
 
97 97
 		try
98 98
 		{
99
-			$view = $this->setViewParams( $view, $tags, $expire );
99
+			$view = $this->setViewParams($view, $tags, $expire);
100 100
 
101 101
 			$html = '';
102
-			foreach( $this->getSubClients() as $subclient ) {
103
-				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
102
+			foreach ($this->getSubClients() as $subclient) {
103
+				$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
104 104
 			}
105 105
 			$view->historyBody = $html;
106 106
 		}
107
-		catch( \Aimeos\Client\Html\Exception $e )
107
+		catch (\Aimeos\Client\Html\Exception $e)
108 108
 		{
109
-			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
110
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
109
+			$error = array($this->getContext()->getI18n()->dt('client', $e->getMessage()));
110
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
111 111
 		}
112
-		catch( \Aimeos\Controller\Frontend\Exception $e )
112
+		catch (\Aimeos\Controller\Frontend\Exception $e)
113 113
 		{
114
-			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
115
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
114
+			$error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage()));
115
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
116 116
 		}
117
-		catch( \Aimeos\MShop\Exception $e )
117
+		catch (\Aimeos\MShop\Exception $e)
118 118
 		{
119
-			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
120
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
119
+			$error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage()));
120
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
121 121
 		}
122
-		catch( \Exception $e )
122
+		catch (\Exception $e)
123 123
 		{
124
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
124
+			$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
125 125
 
126
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
127
-			$view->historyErrorList = $view->get( 'historyErrorList', array() ) + $error;
126
+			$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
127
+			$view->historyErrorList = $view->get('historyErrorList', array()) + $error;
128 128
 		}
129 129
 
130 130
 		/** client/html/account/history/standard/template-body
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		$tplconf = 'client/html/account/history/standard/template-body';
151 151
 		$default = 'account/history/body-default.php';
152 152
 
153
-		return $view->render( $view->config( $tplconf, $default ) );
153
+		return $view->render($view->config($tplconf, $default));
154 154
 	}
155 155
 
156 156
 
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
163 163
 	 * @return string|null String including HTML tags for the header on error
164 164
 	 */
165
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
165
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
166 166
 	{
167 167
 		try
168 168
 		{
169
-			$view = $this->setViewParams( $this->getView(), $tags, $expire );
169
+			$view = $this->setViewParams($this->getView(), $tags, $expire);
170 170
 
171 171
 			$html = '';
172
-			foreach( $this->getSubClients() as $subclient ) {
173
-				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
172
+			foreach ($this->getSubClients() as $subclient) {
173
+				$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
174 174
 			}
175 175
 			$view->historyHeader = $html;
176 176
 
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 			$tplconf = 'client/html/account/history/standard/template-header';
199 199
 			$default = 'account/history/header-default.php';
200 200
 
201
-			return $view->render( $view->config( $tplconf, $default ) );
201
+			return $view->render($view->config($tplconf, $default));
202 202
 		}
203
-		catch( \Exception $e )
203
+		catch (\Exception $e)
204 204
 		{
205
-			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
205
+			$this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
206 206
 		}
207 207
 	}
208 208
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @param string|null $name Name of the sub-client (Default if null)
215 215
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
216 216
 	 */
217
-	public function getSubClient( $type, $name = null )
217
+	public function getSubClient($type, $name = null)
218 218
 	{
219 219
 		/** client/html/account/history/decorators/excludes
220 220
 		 * Excludes decorators added by the "common" option from the account history html client
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		 * @see client/html/account/history/decorators/global
291 291
 		 */
292 292
 
293
-		return $this->createSubClient( 'account/history/' . $type, $name );
293
+		return $this->createSubClient('account/history/'.$type, $name);
294 294
 	}
295 295
 
296 296
 
@@ -301,6 +301,6 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	protected function getSubClientNames()
303 303
 	{
304
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
304
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
305 305
 	}
306 306
 }
307 307
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,23 +82,19 @@  discard block
 block discarded – undo
82 82
 				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
83 83
 			}
84 84
 			$view->watchBody = $html;
85
-		}
86
-		catch( \Aimeos\Client\Html\Exception $e )
85
+		} catch( \Aimeos\Client\Html\Exception $e )
87 86
 		{
88 87
 			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
89 88
 			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
90
-		}
91
-		catch( \Aimeos\Controller\Frontend\Exception $e )
89
+		} catch( \Aimeos\Controller\Frontend\Exception $e )
92 90
 		{
93 91
 			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
94 92
 			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
95
-		}
96
-		catch( \Aimeos\MShop\Exception $e )
93
+		} catch( \Aimeos\MShop\Exception $e )
97 94
 		{
98 95
 			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
99 96
 			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
100
-		}
101
-		catch( \Exception $e )
97
+		} catch( \Exception $e )
102 98
 		{
103 99
 			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
104 100
 
@@ -178,8 +174,7 @@  discard block
 block discarded – undo
178 174
 			$default = 'account/watch/header-default.php';
179 175
 
180 176
 			return $view->render( $view->config( $tplconf, $default ) );
181
-		}
182
-		catch( \Exception $e )
177
+		} catch( \Exception $e )
183 178
 		{
184 179
 			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
185 180
 		}
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Download/Factory.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -18,69 +18,69 @@
 block discarded – undo
18 18
  * @subpackage Html
19 19
  */
20 20
 class Factory
21
-	extends \Aimeos\Client\Html\Common\Factory\Base
22
-	implements \Aimeos\Client\Html\Common\Factory\Iface
21
+    extends \Aimeos\Client\Html\Common\Factory\Base
22
+    implements \Aimeos\Client\Html\Common\Factory\Iface
23 23
 {
24
-	/**
25
-	 * Creates a account download client object.
26
-	 *
27
-	 * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
28
-	 * @param array $templatePaths List of file system paths where the templates are stored
29
-	 * @param string|null $name Client name (default: "Standard")
30
-	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
31
-	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
32
-	 */
33
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
34
-	{
35
-		/** client/html/account/download/name
36
-		 * Class name of the used account download client implementation
37
-		 *
38
-		 * Each default HTML client can be replace by an alternative imlementation.
39
-		 * To use this implementation, you have to set the last part of the class
40
-		 * name as configuration value so the client factory knows which class it
41
-		 * has to instantiate.
42
-		 *
43
-		 * For example, if the name of the default class is
44
-		 *
45
-		 *  \Aimeos\Client\Html\Account\Download\Standard
46
-		 *
47
-		 * and you want to replace it with your own version named
48
-		 *
49
-		 *  \Aimeos\Client\Html\Account\Download\Mydownload
50
-		 *
51
-		 * then you have to set the this configuration option:
52
-		 *
53
-		 *  client/html/account/download/name = Mydownload
54
-		 *
55
-		 * The value is the last part of your own class name and it's case sensitive,
56
-		 * so take care that the configuration value is exactly named like the last
57
-		 * part of the class name.
58
-		 *
59
-		 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
60
-		 * characters are possible! You should always start the last part of the class
61
-		 * name with an upper case character and continue only with lower case characters
62
-		 * or numbers. Avoid chamel case names like "MyDownload"!
63
-		 *
64
-		 * @param string Last part of the class name
65
-		 * @since 2014.03
66
-		 * @category Developer
67
-		 */
68
-		if( $name === null ) {
69
-			$name = $context->getConfig()->get( 'client/html/account/download/name', 'Standard' );
70
-		}
24
+    /**
25
+     * Creates a account download client object.
26
+     *
27
+     * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
28
+     * @param array $templatePaths List of file system paths where the templates are stored
29
+     * @param string|null $name Client name (default: "Standard")
30
+     * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
31
+     * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
32
+     */
33
+    public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
34
+    {
35
+        /** client/html/account/download/name
36
+         * Class name of the used account download client implementation
37
+         *
38
+         * Each default HTML client can be replace by an alternative imlementation.
39
+         * To use this implementation, you have to set the last part of the class
40
+         * name as configuration value so the client factory knows which class it
41
+         * has to instantiate.
42
+         *
43
+         * For example, if the name of the default class is
44
+         *
45
+         *  \Aimeos\Client\Html\Account\Download\Standard
46
+         *
47
+         * and you want to replace it with your own version named
48
+         *
49
+         *  \Aimeos\Client\Html\Account\Download\Mydownload
50
+         *
51
+         * then you have to set the this configuration option:
52
+         *
53
+         *  client/html/account/download/name = Mydownload
54
+         *
55
+         * The value is the last part of your own class name and it's case sensitive,
56
+         * so take care that the configuration value is exactly named like the last
57
+         * part of the class name.
58
+         *
59
+         * The allowed characters of the class name are A-Z, a-z and 0-9. No other
60
+         * characters are possible! You should always start the last part of the class
61
+         * name with an upper case character and continue only with lower case characters
62
+         * or numbers. Avoid chamel case names like "MyDownload"!
63
+         *
64
+         * @param string Last part of the class name
65
+         * @since 2014.03
66
+         * @category Developer
67
+         */
68
+        if( $name === null ) {
69
+            $name = $context->getConfig()->get( 'client/html/account/download/name', 'Standard' );
70
+        }
71 71
 
72
-		if( ctype_alnum( $name ) === false )
73
-		{
74
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name : '<not a string>';
75
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
76
-		}
72
+        if( ctype_alnum( $name ) === false )
73
+        {
74
+            $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name : '<not a string>';
75
+            throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
76
+        }
77 77
 
78
-		$iface = '\\Aimeos\\Client\\Html\\Iface';
79
-		$classname = '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name;
78
+        $iface = '\\Aimeos\\Client\\Html\\Iface';
79
+        $classname = '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name;
80 80
 
81
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
81
+        $client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82 82
 
83
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/download' );
84
-	}
83
+        return self::addClientDecorators( $context, $client, $templatePaths, 'account/download' );
84
+    }
85 85
 
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
31 31
 	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
32 32
 	 */
33
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
33
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null)
34 34
 	{
35 35
 		/** client/html/account/download/name
36 36
 		 * Class name of the used account download client implementation
@@ -65,22 +65,22 @@  discard block
 block discarded – undo
65 65
 		 * @since 2014.03
66 66
 		 * @category Developer
67 67
 		 */
68
-		if( $name === null ) {
69
-			$name = $context->getConfig()->get( 'client/html/account/download/name', 'Standard' );
68
+		if ($name === null) {
69
+			$name = $context->getConfig()->get('client/html/account/download/name', 'Standard');
70 70
 		}
71 71
 
72
-		if( ctype_alnum( $name ) === false )
72
+		if (ctype_alnum($name) === false)
73 73
 		{
74
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name : '<not a string>';
75
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
74
+			$classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Account\\Download\\'.$name : '<not a string>';
75
+			throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
76 76
 		}
77 77
 
78 78
 		$iface = '\\Aimeos\\Client\\Html\\Iface';
79
-		$classname = '\\Aimeos\\Client\\Html\\Account\\Download\\' . $name;
79
+		$classname = '\\Aimeos\\Client\\Html\\Account\\Download\\'.$name;
80 80
 
81
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
81
+		$client = self::createClientBase($context, $classname, $iface, $templatePaths);
82 82
 
83
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/download' );
83
+		return self::addClientDecorators($context, $client, $templatePaths, 'account/download');
84 84
 	}
85 85
 
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Download/Standard.php 3 patches
Indentation   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -18,365 +18,365 @@
 block discarded – undo
18 18
  * @subpackage Html
19 19
  */
20 20
 class Standard
21
-	extends \Aimeos\Client\Html\Common\Client\Factory\Base
22
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
21
+    extends \Aimeos\Client\Html\Common\Client\Factory\Base
22
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
23 23
 {
24
-	/** client/html/account/download/standard/subparts
25
-	 * List of HTML sub-clients rendered within the account download section
26
-	 *
27
-	 * The output of the frontend is composed of the code generated by the HTML
28
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
29
-	 * that are responsible for rendering certain sub-parts of the output. The
30
-	 * sub-clients can contain HTML clients themselves and therefore a
31
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
32
-	 * the output that is placed inside the container of its parent.
33
-	 *
34
-	 * At first, always the HTML code generated by the parent is printed, then
35
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
36
-	 * determines the order of the output of these sub-clients inside the parent
37
-	 * container. If the configured list of clients is
38
-	 *
39
-	 *  array( "subclient1", "subclient2" )
40
-	 *
41
-	 * you can easily change the order of the output by reordering the subparts:
42
-	 *
43
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
44
-	 *
45
-	 * You can also remove one or more parts if they shouldn't be rendered:
46
-	 *
47
-	 *  client/html/<clients>/subparts = array( "subclient1" )
48
-	 *
49
-	 * As the clients only generates structural HTML, the layout defined via CSS
50
-	 * should support adding, removing or reordering content by a fluid like
51
-	 * design.
52
-	 *
53
-	 * @param array List of sub-client names
54
-	 * @since 2016.02
55
-	 * @category Developer
56
-	 */
57
-	private $subPartPath = 'client/html/account/download/standard/subparts';
58
-	private $subPartNames = array();
59
-
60
-
61
-	/**
62
-	 * Returns the HTML code for insertion into the body.
63
-	 *
64
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
65
-	 * @param array &$tags Result array for the list of tags that are associated to the output
66
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
67
-	 * @return string HTML code
68
-	 */
69
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
-	{
71
-		return '';
72
-	}
73
-
74
-
75
-	/**
76
-	 * Returns the HTML string for insertion into the header.
77
-	 *
78
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
79
-	 * @param array &$tags Result array for the list of tags that are associated to the output
80
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
81
-	 * @return string|null String including HTML tags for the header on error
82
-	 */
83
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
84
-	{
85
-		return '';
86
-	}
87
-
88
-
89
-	/**
90
-	 * Returns the sub-client given by its name.
91
-	 *
92
-	 * @param string $type Name of the client type
93
-	 * @param string|null $name Name of the sub-client (Default if null)
94
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
95
-	 */
96
-	public function getSubClient( $type, $name = null )
97
-	{
98
-		/** client/html/account/download/decorators/excludes
99
-		 * Excludes decorators added by the "common" option from the account download html client
100
-		 *
101
-		 * Decorators extend the functionality of a class by adding new aspects
102
-		 * (e.g. log what is currently done), executing the methods of the underlying
103
-		 * class only in certain conditions (e.g. only for logged in users) or
104
-		 * modify what is returned to the caller.
105
-		 *
106
-		 * This option allows you to remove a decorator added via
107
-		 * "client/html/common/decorators/default" before they are wrapped
108
-		 * around the html client.
109
-		 *
110
-		 *  client/html/account/download/decorators/excludes = array( 'decorator1' )
111
-		 *
112
-		 * This would remove the decorator named "decorator1" from the list of
113
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
114
-		 * "client/html/common/decorators/default" to the html client.
115
-		 *
116
-		 * @param array List of decorator names
117
-		 * @since 2016.02
118
-		 * @category Developer
119
-		 * @see client/html/common/decorators/default
120
-		 * @see client/html/account/download/decorators/global
121
-		 * @see client/html/account/download/decorators/local
122
-		 */
123
-
124
-		/** client/html/account/download/decorators/global
125
-		 * Adds a list of globally available decorators only to the account download html client
126
-		 *
127
-		 * Decorators extend the functionality of a class by adding new aspects
128
-		 * (e.g. log what is currently done), executing the methods of the underlying
129
-		 * class only in certain conditions (e.g. only for logged in users) or
130
-		 * modify what is returned to the caller.
131
-		 *
132
-		 * This option allows you to wrap global decorators
133
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
134
-		 *
135
-		 *  client/html/account/download/decorators/global = array( 'decorator1' )
136
-		 *
137
-		 * This would add the decorator named "decorator1" defined by
138
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
139
-		 *
140
-		 * @param array List of decorator names
141
-		 * @since 2016.02
142
-		 * @category Developer
143
-		 * @see client/html/common/decorators/default
144
-		 * @see client/html/account/download/decorators/excludes
145
-		 * @see client/html/account/download/decorators/local
146
-		 */
147
-
148
-		/** client/html/account/download/decorators/local
149
-		 * Adds a list of local decorators only to the account download html client
150
-		 *
151
-		 * Decorators extend the functionality of a class by adding new aspects
152
-		 * (e.g. log what is currently done), executing the methods of the underlying
153
-		 * class only in certain conditions (e.g. only for logged in users) or
154
-		 * modify what is returned to the caller.
155
-		 *
156
-		 * This option allows you to wrap local decorators
157
-		 * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client.
158
-		 *
159
-		 *  client/html/account/download/decorators/local = array( 'decorator2' )
160
-		 *
161
-		 * This would add the decorator named "decorator2" defined by
162
-		 * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client.
163
-		 *
164
-		 * @param array List of decorator names
165
-		 * @since 2016.02
166
-		 * @category Developer
167
-		 * @see client/html/common/decorators/default
168
-		 * @see client/html/account/download/decorators/excludes
169
-		 * @see client/html/account/download/decorators/global
170
-		 */
171
-		return $this->createSubClient( 'account/download/' . $type, $name );
172
-	}
173
-
174
-
175
-	/**
176
-	 * Processes the input, e.g. store given values.
177
-	 * A view must be available and this method doesn't generate any output
178
-	 * besides setting view variables.
179
-	 */
180
-	public function process()
181
-	{
182
-		$context = $this->getContext();
183
-
184
-		try
185
-		{
186
-			$view = $this->getView();
187
-			$id = $view->param( 'dl_id' );
188
-			$customerId = $context->getUserId();
189
-
190
-			if( $this->checkAccess( $customerId, $id ) === false )
191
-			{
192
-				$view->response()->withStatus( 401 );
193
-				return;
194
-			}
195
-
196
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
197
-			$item = $manager->getItem( $id );
198
-
199
-			if( $this->checkDownload( $context->getUserId(), $id ) === true ) {
200
-				$this->addDownload( $item );
201
-			} else {
202
-				$view->response()->withStatus( 403 );
203
-			}
204
-
205
-			parent::process();
206
-		}
207
-		catch( \Exception $e )
208
-		{
209
-			$context->getLogger()->log( $e->getMessage() );
210
-		}
211
-	}
212
-
213
-
214
-	/**
215
-	 * Returns the list of sub-client names configured for the client.
216
-	 *
217
-	 * @return array List of HTML client names
218
-	 */
219
-	protected function getSubClientNames()
220
-	{
221
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
222
-	}
223
-
224
-
225
-	/**
226
-	 * Adds the necessary headers and the download content to the reponse object
227
-	 *
228
-	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item Order product attribute item with file reference
229
-	 */
230
-	protected function addDownload( \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item )
231
-	{
232
-		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
233
-		$response = $this->getView()->response();
234
-		$value = (string) $item->getValue();
235
-
236
-		if( $fs->has( $value ) )
237
-		{
238
-			$name = $item->getName();
239
-
240
-			if( pathinfo( $name, PATHINFO_EXTENSION ) == null
241
-					&& ( $ext = pathinfo( $value, PATHINFO_EXTENSION ) ) != null
242
-			) {
243
-				$name .= '.' . $ext;
244
-			}
245
-
246
-			$response->withHeader( 'Content-Description', 'File Transfer' );
247
-			$response->withHeader( 'Content-Type', 'application/octet-stream' );
248
-			$response->withHeader( 'Content-Disposition', 'attachment; filename="' . $name . '"' );
249
-			$response->withHeader( 'Content-Length', (string) $fs->size( $value ) );
250
-			$response->withHeader( 'Cache-Control', 'must-revalidate' );
251
-			$response->withHeader( 'Pragma', 'private' );
252
-			$response->withHeader( 'Expires', '0' );
253
-
254
-			$response->withBody( $response->createStream( $fs->reads( $value ) ) );
255
-		}
256
-		elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
257
-		{
258
-			$response->withHeader( 'Location', $value );
259
-			$response->withStatus( 303 );
260
-		}
261
-		else
262
-		{
263
-			$response->withStatus( 404 );
264
-		}
265
-	}
266
-
267
-
268
-	/**
269
-	 * Checks if the customer is allowed to download the file
270
-	 *
271
-	 * @param string $customerId Unique customer ID
272
-	 * @param string $id Unique order base product attribute ID referencing the download file
273
-	 * @return boolean True if download is allowed, false if not
274
-	 */
275
-	protected function checkAccess( $customerId, $id )
276
-	{
277
-		if( $customerId !== null && $id !== null )
278
-		{
279
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' );
280
-
281
-			$search = $manager->createSearch();
282
-			$expr = array(
283
-				$search->compare( '==', 'order.base.customerid', $customerId ),
284
-				$search->compare( '==', 'order.base.product.attribute.id', $id ),
285
-			);
286
-			$search->setConditions( $search->combine( '&&', $expr ) );
287
-			$search->setSlice( 0, 1 );
288
-
289
-			if( count( $manager->searchItems( $search ) ) > 0 ) {
290
-				return true;
291
-			}
292
-		}
293
-
294
-		return false;
295
-	}
296
-
297
-
298
-	/**
299
-	 * Updates the download counter for the downloaded file
300
-	 *
301
-	 * @param string $customerId Unique customer ID
302
-	 * @param string $id Unique order base product attribute ID referencing the download file
303
-	 * @return boolean True if download is allowed, false if not
304
-	 */
305
-	protected function checkDownload( $customerId, $id )
306
-	{
307
-		$context = $this->getContext();
308
-
309
-		/** client/html/account/download/maxcount
310
-		 * Maximum number of file downloads allowed for an ordered product
311
-		 *
312
-		 * This configuration setting enables you to limit the number of downloads
313
-		 * of a product download file. The count is the maximum number for each
314
-		 * bought product and customer, i.e. setting the count to "3" allows
315
-		 * a customer to download the bought product file up to three times.
316
-		 *
317
-		 * The default value of null enforces no limit.
318
-		 *
319
-		 * @param integer Maximum number of downloads
320
-		 * @since 2016.02
321
-		 * @category Developer
322
-		 * @category User
323
-		 */
324
-		$maxcnt = $context->getConfig()->get( 'client/html/account/download/maxcount' );
325
-
326
-		$listItem = $this->getListItem( $customerId, $id );
327
-		$config = $listItem->getConfig();
328
-
329
-		if( !isset( $config['count'] ) ) {
330
-			$config['count'] = 0;
331
-		}
332
-
333
-		if( $maxcnt === null || ((int) $config['count']) < $maxcnt )
334
-		{
335
-			$config['count']++;
336
-			$listItem->setConfig( $config );
337
-
338
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
339
-			$manager->saveItem( $listItem, false );
340
-
341
-			return true;
342
-		}
343
-
344
-		return false;
345
-	}
346
-
347
-
348
-	/**
349
-	 * Returns the list item storing the download counter
350
-	 *
351
-	 * @param string $customerId Unique customer ID
352
-	 * @param string $refId Unique order base product attribute ID referencing the download file
353
-	 * @return \Aimeos\MSho\Common\Item\Lists\Iface List item object
354
-	 */
355
-	protected function getListItem( $customerId, $refId )
356
-	{
357
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
358
-
359
-		$search = $manager->createSearch();
360
-		$expr = array(
361
-			$search->compare( '==', 'customer.lists.parentid', $customerId ),
362
-			$search->compare( '==', 'customer.lists.refid', $refId ),
363
-			$search->compare( '==', 'customer.lists.domain', 'order' ),
364
-			$search->compare( '==', 'customer.lists.type.domain', 'order' ),
365
-			$search->compare( '==', 'customer.lists.type.code', 'download' ),
366
-		);
367
-		$search->setConditions( $search->combine( '&&', $expr ) );
368
-
369
-		$listItems = $manager->searchItems( $search );
370
-
371
-		if( ( $listItem = reset( $listItems ) ) === false )
372
-		{
373
-			$listItem = $manager->createItem();
374
-			$listItem->setTypeId( $this->getTypeItem( 'customer/lists/type', 'order', 'download' )->getId() );
375
-			$listItem->setParentId( $customerId );
376
-			$listItem->setDomain( 'order' );
377
-			$listItem->setRefId( $refId );
378
-		}
379
-
380
-		return $listItem;
381
-	}
24
+    /** client/html/account/download/standard/subparts
25
+     * List of HTML sub-clients rendered within the account download section
26
+     *
27
+     * The output of the frontend is composed of the code generated by the HTML
28
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
29
+     * that are responsible for rendering certain sub-parts of the output. The
30
+     * sub-clients can contain HTML clients themselves and therefore a
31
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
32
+     * the output that is placed inside the container of its parent.
33
+     *
34
+     * At first, always the HTML code generated by the parent is printed, then
35
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
36
+     * determines the order of the output of these sub-clients inside the parent
37
+     * container. If the configured list of clients is
38
+     *
39
+     *  array( "subclient1", "subclient2" )
40
+     *
41
+     * you can easily change the order of the output by reordering the subparts:
42
+     *
43
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
44
+     *
45
+     * You can also remove one or more parts if they shouldn't be rendered:
46
+     *
47
+     *  client/html/<clients>/subparts = array( "subclient1" )
48
+     *
49
+     * As the clients only generates structural HTML, the layout defined via CSS
50
+     * should support adding, removing or reordering content by a fluid like
51
+     * design.
52
+     *
53
+     * @param array List of sub-client names
54
+     * @since 2016.02
55
+     * @category Developer
56
+     */
57
+    private $subPartPath = 'client/html/account/download/standard/subparts';
58
+    private $subPartNames = array();
59
+
60
+
61
+    /**
62
+     * Returns the HTML code for insertion into the body.
63
+     *
64
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
65
+     * @param array &$tags Result array for the list of tags that are associated to the output
66
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
67
+     * @return string HTML code
68
+     */
69
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
70
+    {
71
+        return '';
72
+    }
73
+
74
+
75
+    /**
76
+     * Returns the HTML string for insertion into the header.
77
+     *
78
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
79
+     * @param array &$tags Result array for the list of tags that are associated to the output
80
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
81
+     * @return string|null String including HTML tags for the header on error
82
+     */
83
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
84
+    {
85
+        return '';
86
+    }
87
+
88
+
89
+    /**
90
+     * Returns the sub-client given by its name.
91
+     *
92
+     * @param string $type Name of the client type
93
+     * @param string|null $name Name of the sub-client (Default if null)
94
+     * @return \Aimeos\Client\Html\Iface Sub-client object
95
+     */
96
+    public function getSubClient( $type, $name = null )
97
+    {
98
+        /** client/html/account/download/decorators/excludes
99
+         * Excludes decorators added by the "common" option from the account download html client
100
+         *
101
+         * Decorators extend the functionality of a class by adding new aspects
102
+         * (e.g. log what is currently done), executing the methods of the underlying
103
+         * class only in certain conditions (e.g. only for logged in users) or
104
+         * modify what is returned to the caller.
105
+         *
106
+         * This option allows you to remove a decorator added via
107
+         * "client/html/common/decorators/default" before they are wrapped
108
+         * around the html client.
109
+         *
110
+         *  client/html/account/download/decorators/excludes = array( 'decorator1' )
111
+         *
112
+         * This would remove the decorator named "decorator1" from the list of
113
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
114
+         * "client/html/common/decorators/default" to the html client.
115
+         *
116
+         * @param array List of decorator names
117
+         * @since 2016.02
118
+         * @category Developer
119
+         * @see client/html/common/decorators/default
120
+         * @see client/html/account/download/decorators/global
121
+         * @see client/html/account/download/decorators/local
122
+         */
123
+
124
+        /** client/html/account/download/decorators/global
125
+         * Adds a list of globally available decorators only to the account download html client
126
+         *
127
+         * Decorators extend the functionality of a class by adding new aspects
128
+         * (e.g. log what is currently done), executing the methods of the underlying
129
+         * class only in certain conditions (e.g. only for logged in users) or
130
+         * modify what is returned to the caller.
131
+         *
132
+         * This option allows you to wrap global decorators
133
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
134
+         *
135
+         *  client/html/account/download/decorators/global = array( 'decorator1' )
136
+         *
137
+         * This would add the decorator named "decorator1" defined by
138
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
139
+         *
140
+         * @param array List of decorator names
141
+         * @since 2016.02
142
+         * @category Developer
143
+         * @see client/html/common/decorators/default
144
+         * @see client/html/account/download/decorators/excludes
145
+         * @see client/html/account/download/decorators/local
146
+         */
147
+
148
+        /** client/html/account/download/decorators/local
149
+         * Adds a list of local decorators only to the account download html client
150
+         *
151
+         * Decorators extend the functionality of a class by adding new aspects
152
+         * (e.g. log what is currently done), executing the methods of the underlying
153
+         * class only in certain conditions (e.g. only for logged in users) or
154
+         * modify what is returned to the caller.
155
+         *
156
+         * This option allows you to wrap local decorators
157
+         * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client.
158
+         *
159
+         *  client/html/account/download/decorators/local = array( 'decorator2' )
160
+         *
161
+         * This would add the decorator named "decorator2" defined by
162
+         * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client.
163
+         *
164
+         * @param array List of decorator names
165
+         * @since 2016.02
166
+         * @category Developer
167
+         * @see client/html/common/decorators/default
168
+         * @see client/html/account/download/decorators/excludes
169
+         * @see client/html/account/download/decorators/global
170
+         */
171
+        return $this->createSubClient( 'account/download/' . $type, $name );
172
+    }
173
+
174
+
175
+    /**
176
+     * Processes the input, e.g. store given values.
177
+     * A view must be available and this method doesn't generate any output
178
+     * besides setting view variables.
179
+     */
180
+    public function process()
181
+    {
182
+        $context = $this->getContext();
183
+
184
+        try
185
+        {
186
+            $view = $this->getView();
187
+            $id = $view->param( 'dl_id' );
188
+            $customerId = $context->getUserId();
189
+
190
+            if( $this->checkAccess( $customerId, $id ) === false )
191
+            {
192
+                $view->response()->withStatus( 401 );
193
+                return;
194
+            }
195
+
196
+            $manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
197
+            $item = $manager->getItem( $id );
198
+
199
+            if( $this->checkDownload( $context->getUserId(), $id ) === true ) {
200
+                $this->addDownload( $item );
201
+            } else {
202
+                $view->response()->withStatus( 403 );
203
+            }
204
+
205
+            parent::process();
206
+        }
207
+        catch( \Exception $e )
208
+        {
209
+            $context->getLogger()->log( $e->getMessage() );
210
+        }
211
+    }
212
+
213
+
214
+    /**
215
+     * Returns the list of sub-client names configured for the client.
216
+     *
217
+     * @return array List of HTML client names
218
+     */
219
+    protected function getSubClientNames()
220
+    {
221
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
222
+    }
223
+
224
+
225
+    /**
226
+     * Adds the necessary headers and the download content to the reponse object
227
+     *
228
+     * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item Order product attribute item with file reference
229
+     */
230
+    protected function addDownload( \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item )
231
+    {
232
+        $fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
233
+        $response = $this->getView()->response();
234
+        $value = (string) $item->getValue();
235
+
236
+        if( $fs->has( $value ) )
237
+        {
238
+            $name = $item->getName();
239
+
240
+            if( pathinfo( $name, PATHINFO_EXTENSION ) == null
241
+                    && ( $ext = pathinfo( $value, PATHINFO_EXTENSION ) ) != null
242
+            ) {
243
+                $name .= '.' . $ext;
244
+            }
245
+
246
+            $response->withHeader( 'Content-Description', 'File Transfer' );
247
+            $response->withHeader( 'Content-Type', 'application/octet-stream' );
248
+            $response->withHeader( 'Content-Disposition', 'attachment; filename="' . $name . '"' );
249
+            $response->withHeader( 'Content-Length', (string) $fs->size( $value ) );
250
+            $response->withHeader( 'Cache-Control', 'must-revalidate' );
251
+            $response->withHeader( 'Pragma', 'private' );
252
+            $response->withHeader( 'Expires', '0' );
253
+
254
+            $response->withBody( $response->createStream( $fs->reads( $value ) ) );
255
+        }
256
+        elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
257
+        {
258
+            $response->withHeader( 'Location', $value );
259
+            $response->withStatus( 303 );
260
+        }
261
+        else
262
+        {
263
+            $response->withStatus( 404 );
264
+        }
265
+    }
266
+
267
+
268
+    /**
269
+     * Checks if the customer is allowed to download the file
270
+     *
271
+     * @param string $customerId Unique customer ID
272
+     * @param string $id Unique order base product attribute ID referencing the download file
273
+     * @return boolean True if download is allowed, false if not
274
+     */
275
+    protected function checkAccess( $customerId, $id )
276
+    {
277
+        if( $customerId !== null && $id !== null )
278
+        {
279
+            $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' );
280
+
281
+            $search = $manager->createSearch();
282
+            $expr = array(
283
+                $search->compare( '==', 'order.base.customerid', $customerId ),
284
+                $search->compare( '==', 'order.base.product.attribute.id', $id ),
285
+            );
286
+            $search->setConditions( $search->combine( '&&', $expr ) );
287
+            $search->setSlice( 0, 1 );
288
+
289
+            if( count( $manager->searchItems( $search ) ) > 0 ) {
290
+                return true;
291
+            }
292
+        }
293
+
294
+        return false;
295
+    }
296
+
297
+
298
+    /**
299
+     * Updates the download counter for the downloaded file
300
+     *
301
+     * @param string $customerId Unique customer ID
302
+     * @param string $id Unique order base product attribute ID referencing the download file
303
+     * @return boolean True if download is allowed, false if not
304
+     */
305
+    protected function checkDownload( $customerId, $id )
306
+    {
307
+        $context = $this->getContext();
308
+
309
+        /** client/html/account/download/maxcount
310
+         * Maximum number of file downloads allowed for an ordered product
311
+         *
312
+         * This configuration setting enables you to limit the number of downloads
313
+         * of a product download file. The count is the maximum number for each
314
+         * bought product and customer, i.e. setting the count to "3" allows
315
+         * a customer to download the bought product file up to three times.
316
+         *
317
+         * The default value of null enforces no limit.
318
+         *
319
+         * @param integer Maximum number of downloads
320
+         * @since 2016.02
321
+         * @category Developer
322
+         * @category User
323
+         */
324
+        $maxcnt = $context->getConfig()->get( 'client/html/account/download/maxcount' );
325
+
326
+        $listItem = $this->getListItem( $customerId, $id );
327
+        $config = $listItem->getConfig();
328
+
329
+        if( !isset( $config['count'] ) ) {
330
+            $config['count'] = 0;
331
+        }
332
+
333
+        if( $maxcnt === null || ((int) $config['count']) < $maxcnt )
334
+        {
335
+            $config['count']++;
336
+            $listItem->setConfig( $config );
337
+
338
+            $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
339
+            $manager->saveItem( $listItem, false );
340
+
341
+            return true;
342
+        }
343
+
344
+        return false;
345
+    }
346
+
347
+
348
+    /**
349
+     * Returns the list item storing the download counter
350
+     *
351
+     * @param string $customerId Unique customer ID
352
+     * @param string $refId Unique order base product attribute ID referencing the download file
353
+     * @return \Aimeos\MSho\Common\Item\Lists\Iface List item object
354
+     */
355
+    protected function getListItem( $customerId, $refId )
356
+    {
357
+        $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
358
+
359
+        $search = $manager->createSearch();
360
+        $expr = array(
361
+            $search->compare( '==', 'customer.lists.parentid', $customerId ),
362
+            $search->compare( '==', 'customer.lists.refid', $refId ),
363
+            $search->compare( '==', 'customer.lists.domain', 'order' ),
364
+            $search->compare( '==', 'customer.lists.type.domain', 'order' ),
365
+            $search->compare( '==', 'customer.lists.type.code', 'download' ),
366
+        );
367
+        $search->setConditions( $search->combine( '&&', $expr ) );
368
+
369
+        $listItems = $manager->searchItems( $search );
370
+
371
+        if( ( $listItem = reset( $listItems ) ) === false )
372
+        {
373
+            $listItem = $manager->createItem();
374
+            $listItem->setTypeId( $this->getTypeItem( 'customer/lists/type', 'order', 'download' )->getId() );
375
+            $listItem->setParentId( $customerId );
376
+            $listItem->setDomain( 'order' );
377
+            $listItem->setRefId( $refId );
378
+        }
379
+
380
+        return $listItem;
381
+    }
382 382
 }
383 383
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
67 67
 	 * @return string HTML code
68 68
 	 */
69
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
69
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
70 70
 	{
71 71
 		return '';
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
81 81
 	 * @return string|null String including HTML tags for the header on error
82 82
 	 */
83
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
83
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
84 84
 	{
85 85
 		return '';
86 86
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param string|null $name Name of the sub-client (Default if null)
94 94
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
95 95
 	 */
96
-	public function getSubClient( $type, $name = null )
96
+	public function getSubClient($type, $name = null)
97 97
 	{
98 98
 		/** client/html/account/download/decorators/excludes
99 99
 		 * Excludes decorators added by the "common" option from the account download html client
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		 * @see client/html/account/download/decorators/excludes
169 169
 		 * @see client/html/account/download/decorators/global
170 170
 		 */
171
-		return $this->createSubClient( 'account/download/' . $type, $name );
171
+		return $this->createSubClient('account/download/'.$type, $name);
172 172
 	}
173 173
 
174 174
 
@@ -184,29 +184,29 @@  discard block
 block discarded – undo
184 184
 		try
185 185
 		{
186 186
 			$view = $this->getView();
187
-			$id = $view->param( 'dl_id' );
187
+			$id = $view->param('dl_id');
188 188
 			$customerId = $context->getUserId();
189 189
 
190
-			if( $this->checkAccess( $customerId, $id ) === false )
190
+			if ($this->checkAccess($customerId, $id) === false)
191 191
 			{
192
-				$view->response()->withStatus( 401 );
192
+				$view->response()->withStatus(401);
193 193
 				return;
194 194
 			}
195 195
 
196
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
197
-			$item = $manager->getItem( $id );
196
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product/attribute');
197
+			$item = $manager->getItem($id);
198 198
 
199
-			if( $this->checkDownload( $context->getUserId(), $id ) === true ) {
200
-				$this->addDownload( $item );
199
+			if ($this->checkDownload($context->getUserId(), $id) === true) {
200
+				$this->addDownload($item);
201 201
 			} else {
202
-				$view->response()->withStatus( 403 );
202
+				$view->response()->withStatus(403);
203 203
 			}
204 204
 
205 205
 			parent::process();
206 206
 		}
207
-		catch( \Exception $e )
207
+		catch (\Exception $e)
208 208
 		{
209
-			$context->getLogger()->log( $e->getMessage() );
209
+			$context->getLogger()->log($e->getMessage());
210 210
 		}
211 211
 	}
212 212
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	protected function getSubClientNames()
220 220
 	{
221
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
221
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
222 222
 	}
223 223
 
224 224
 
@@ -227,40 +227,40 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item Order product attribute item with file reference
229 229
 	 */
230
-	protected function addDownload( \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item )
230
+	protected function addDownload(\Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface $item)
231 231
 	{
232
-		$fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' );
232
+		$fs = $this->getContext()->getFilesystemManager()->get('fs-secure');
233 233
 		$response = $this->getView()->response();
234 234
 		$value = (string) $item->getValue();
235 235
 
236
-		if( $fs->has( $value ) )
236
+		if ($fs->has($value))
237 237
 		{
238 238
 			$name = $item->getName();
239 239
 
240
-			if( pathinfo( $name, PATHINFO_EXTENSION ) == null
241
-					&& ( $ext = pathinfo( $value, PATHINFO_EXTENSION ) ) != null
240
+			if (pathinfo($name, PATHINFO_EXTENSION) == null
241
+					&& ($ext = pathinfo($value, PATHINFO_EXTENSION)) != null
242 242
 			) {
243
-				$name .= '.' . $ext;
243
+				$name .= '.'.$ext;
244 244
 			}
245 245
 
246
-			$response->withHeader( 'Content-Description', 'File Transfer' );
247
-			$response->withHeader( 'Content-Type', 'application/octet-stream' );
248
-			$response->withHeader( 'Content-Disposition', 'attachment; filename="' . $name . '"' );
249
-			$response->withHeader( 'Content-Length', (string) $fs->size( $value ) );
250
-			$response->withHeader( 'Cache-Control', 'must-revalidate' );
251
-			$response->withHeader( 'Pragma', 'private' );
252
-			$response->withHeader( 'Expires', '0' );
246
+			$response->withHeader('Content-Description', 'File Transfer');
247
+			$response->withHeader('Content-Type', 'application/octet-stream');
248
+			$response->withHeader('Content-Disposition', 'attachment; filename="'.$name.'"');
249
+			$response->withHeader('Content-Length', (string) $fs->size($value));
250
+			$response->withHeader('Cache-Control', 'must-revalidate');
251
+			$response->withHeader('Pragma', 'private');
252
+			$response->withHeader('Expires', '0');
253 253
 
254
-			$response->withBody( $response->createStream( $fs->reads( $value ) ) );
254
+			$response->withBody($response->createStream($fs->reads($value)));
255 255
 		}
256
-		elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
256
+		elseif (filter_var($value, FILTER_VALIDATE_URL) !== false)
257 257
 		{
258
-			$response->withHeader( 'Location', $value );
259
-			$response->withStatus( 303 );
258
+			$response->withHeader('Location', $value);
259
+			$response->withStatus(303);
260 260
 		}
261 261
 		else
262 262
 		{
263
-			$response->withStatus( 404 );
263
+			$response->withStatus(404);
264 264
 		}
265 265
 	}
266 266
 
@@ -272,21 +272,21 @@  discard block
 block discarded – undo
272 272
 	 * @param string $id Unique order base product attribute ID referencing the download file
273 273
 	 * @return boolean True if download is allowed, false if not
274 274
 	 */
275
-	protected function checkAccess( $customerId, $id )
275
+	protected function checkAccess($customerId, $id)
276 276
 	{
277
-		if( $customerId !== null && $id !== null )
277
+		if ($customerId !== null && $id !== null)
278 278
 		{
279
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' );
279
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base');
280 280
 
281 281
 			$search = $manager->createSearch();
282 282
 			$expr = array(
283
-				$search->compare( '==', 'order.base.customerid', $customerId ),
284
-				$search->compare( '==', 'order.base.product.attribute.id', $id ),
283
+				$search->compare('==', 'order.base.customerid', $customerId),
284
+				$search->compare('==', 'order.base.product.attribute.id', $id),
285 285
 			);
286
-			$search->setConditions( $search->combine( '&&', $expr ) );
287
-			$search->setSlice( 0, 1 );
286
+			$search->setConditions($search->combine('&&', $expr));
287
+			$search->setSlice(0, 1);
288 288
 
289
-			if( count( $manager->searchItems( $search ) ) > 0 ) {
289
+			if (count($manager->searchItems($search)) > 0) {
290 290
 				return true;
291 291
 			}
292 292
 		}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @param string $id Unique order base product attribute ID referencing the download file
303 303
 	 * @return boolean True if download is allowed, false if not
304 304
 	 */
305
-	protected function checkDownload( $customerId, $id )
305
+	protected function checkDownload($customerId, $id)
306 306
 	{
307 307
 		$context = $this->getContext();
308 308
 
@@ -321,22 +321,22 @@  discard block
 block discarded – undo
321 321
 		 * @category Developer
322 322
 		 * @category User
323 323
 		 */
324
-		$maxcnt = $context->getConfig()->get( 'client/html/account/download/maxcount' );
324
+		$maxcnt = $context->getConfig()->get('client/html/account/download/maxcount');
325 325
 
326
-		$listItem = $this->getListItem( $customerId, $id );
326
+		$listItem = $this->getListItem($customerId, $id);
327 327
 		$config = $listItem->getConfig();
328 328
 
329
-		if( !isset( $config['count'] ) ) {
329
+		if (!isset($config['count'])) {
330 330
 			$config['count'] = 0;
331 331
 		}
332 332
 
333
-		if( $maxcnt === null || ((int) $config['count']) < $maxcnt )
333
+		if ($maxcnt === null || ((int) $config['count']) < $maxcnt)
334 334
 		{
335 335
 			$config['count']++;
336
-			$listItem->setConfig( $config );
336
+			$listItem->setConfig($config);
337 337
 
338
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
339
-			$manager->saveItem( $listItem, false );
338
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
339
+			$manager->saveItem($listItem, false);
340 340
 
341 341
 			return true;
342 342
 		}
@@ -352,29 +352,29 @@  discard block
 block discarded – undo
352 352
 	 * @param string $refId Unique order base product attribute ID referencing the download file
353 353
 	 * @return \Aimeos\MSho\Common\Item\Lists\Iface List item object
354 354
 	 */
355
-	protected function getListItem( $customerId, $refId )
355
+	protected function getListItem($customerId, $refId)
356 356
 	{
357
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
357
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists');
358 358
 
359 359
 		$search = $manager->createSearch();
360 360
 		$expr = array(
361
-			$search->compare( '==', 'customer.lists.parentid', $customerId ),
362
-			$search->compare( '==', 'customer.lists.refid', $refId ),
363
-			$search->compare( '==', 'customer.lists.domain', 'order' ),
364
-			$search->compare( '==', 'customer.lists.type.domain', 'order' ),
365
-			$search->compare( '==', 'customer.lists.type.code', 'download' ),
361
+			$search->compare('==', 'customer.lists.parentid', $customerId),
362
+			$search->compare('==', 'customer.lists.refid', $refId),
363
+			$search->compare('==', 'customer.lists.domain', 'order'),
364
+			$search->compare('==', 'customer.lists.type.domain', 'order'),
365
+			$search->compare('==', 'customer.lists.type.code', 'download'),
366 366
 		);
367
-		$search->setConditions( $search->combine( '&&', $expr ) );
367
+		$search->setConditions($search->combine('&&', $expr));
368 368
 
369
-		$listItems = $manager->searchItems( $search );
369
+		$listItems = $manager->searchItems($search);
370 370
 
371
-		if( ( $listItem = reset( $listItems ) ) === false )
371
+		if (($listItem = reset($listItems)) === false)
372 372
 		{
373 373
 			$listItem = $manager->createItem();
374
-			$listItem->setTypeId( $this->getTypeItem( 'customer/lists/type', 'order', 'download' )->getId() );
375
-			$listItem->setParentId( $customerId );
376
-			$listItem->setDomain( 'order' );
377
-			$listItem->setRefId( $refId );
374
+			$listItem->setTypeId($this->getTypeItem('customer/lists/type', 'order', 'download')->getId());
375
+			$listItem->setParentId($customerId);
376
+			$listItem->setDomain('order');
377
+			$listItem->setRefId($refId);
378 378
 		}
379 379
 
380 380
 		return $listItem;
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -203,8 +203,7 @@  discard block
 block discarded – undo
203 203
 			}
204 204
 
205 205
 			parent::process();
206
-		}
207
-		catch( \Exception $e )
206
+		} catch( \Exception $e )
208 207
 		{
209 208
 			$context->getLogger()->log( $e->getMessage() );
210 209
 		}
@@ -252,13 +251,11 @@  discard block
 block discarded – undo
252 251
 			$response->withHeader( 'Expires', '0' );
253 252
 
254 253
 			$response->withBody( $response->createStream( $fs->reads( $value ) ) );
255
-		}
256
-		elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
254
+		} elseif( filter_var( $value, FILTER_VALIDATE_URL ) !== false )
257 255
 		{
258 256
 			$response->withHeader( 'Location', $value );
259 257
 			$response->withStatus( 303 );
260
-		}
261
-		else
258
+		} else
262 259
 		{
263 260
 			$response->withStatus( 404 );
264 261
 		}
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Watch/Factory.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -19,69 +19,69 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Factory
22
-	extends \Aimeos\Client\Html\Common\Factory\Base
23
-	implements \Aimeos\Client\Html\Common\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Factory\Base
23
+    implements \Aimeos\Client\Html\Common\Factory\Iface
24 24
 {
25
-	/**
26
-	 * Creates a account watch client object.
27
-	 *
28
-	 * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
29
-	 * @param array $templatePaths List of file system paths where the templates are stored
30
-	 * @param string|null $name Client name (default: "Standard")
31
-	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32
-	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33
-	 */
34
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
35
-	{
36
-		/** client/html/account/watch/name
37
-		 * Class name of the used account watch client implementation
38
-		 *
39
-		 * Each default HTML client can be replace by an alternative imlementation.
40
-		 * To use this implementation, you have to set the last part of the class
41
-		 * name as configuration value so the client factory knows which class it
42
-		 * has to instantiate.
43
-		 *
44
-		 * For example, if the name of the default class is
45
-		 *
46
-		 *  \Aimeos\Client\Html\Account\Watch\Standard
47
-		 *
48
-		 * and you want to replace it with your own version named
49
-		 *
50
-		 *  \Aimeos\Client\Html\Account\Watch\Mywatch
51
-		 *
52
-		 * then you have to set the this configuration option:
53
-		 *
54
-		 *  client/html/account/watch/name = Mywatch
55
-		 *
56
-		 * The value is the last part of your own class name and it's case sensitive,
57
-		 * so take care that the configuration value is exactly named like the last
58
-		 * part of the class name.
59
-		 *
60
-		 * The allowed characters of the class name are A-Z, a-z and 0-9. No other
61
-		 * characters are possible! You should always start the last part of the class
62
-		 * name with an upper case character and continue only with lower case characters
63
-		 * or numbers. Avoid chamel case names like "MyWatch"!
64
-		 *
65
-		 * @param string Last part of the class name
66
-		 * @since 2014.03
67
-		 * @category Developer
68
-		 */
69
-		if( $name === null ) {
70
-			$name = $context->getConfig()->get( 'client/html/account/watch/name', 'Standard' );
71
-		}
25
+    /**
26
+     * Creates a account watch client object.
27
+     *
28
+     * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects
29
+     * @param array $templatePaths List of file system paths where the templates are stored
30
+     * @param string|null $name Client name (default: "Standard")
31
+     * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32
+     * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33
+     */
34
+    public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
35
+    {
36
+        /** client/html/account/watch/name
37
+         * Class name of the used account watch client implementation
38
+         *
39
+         * Each default HTML client can be replace by an alternative imlementation.
40
+         * To use this implementation, you have to set the last part of the class
41
+         * name as configuration value so the client factory knows which class it
42
+         * has to instantiate.
43
+         *
44
+         * For example, if the name of the default class is
45
+         *
46
+         *  \Aimeos\Client\Html\Account\Watch\Standard
47
+         *
48
+         * and you want to replace it with your own version named
49
+         *
50
+         *  \Aimeos\Client\Html\Account\Watch\Mywatch
51
+         *
52
+         * then you have to set the this configuration option:
53
+         *
54
+         *  client/html/account/watch/name = Mywatch
55
+         *
56
+         * The value is the last part of your own class name and it's case sensitive,
57
+         * so take care that the configuration value is exactly named like the last
58
+         * part of the class name.
59
+         *
60
+         * The allowed characters of the class name are A-Z, a-z and 0-9. No other
61
+         * characters are possible! You should always start the last part of the class
62
+         * name with an upper case character and continue only with lower case characters
63
+         * or numbers. Avoid chamel case names like "MyWatch"!
64
+         *
65
+         * @param string Last part of the class name
66
+         * @since 2014.03
67
+         * @category Developer
68
+         */
69
+        if( $name === null ) {
70
+            $name = $context->getConfig()->get( 'client/html/account/watch/name', 'Standard' );
71
+        }
72 72
 
73
-		if( ctype_alnum( $name ) === false )
74
-		{
75
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name : '<not a string>';
76
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
77
-		}
73
+        if( ctype_alnum( $name ) === false )
74
+        {
75
+            $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name : '<not a string>';
76
+            throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
77
+        }
78 78
 
79
-		$iface = '\\Aimeos\\Client\\Html\\Iface';
80
-		$classname = '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name;
79
+        $iface = '\\Aimeos\\Client\\Html\\Iface';
80
+        $classname = '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name;
81 81
 
82
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82
+        $client = self::createClientBase( $context, $classname, $iface, $templatePaths );
83 83
 
84
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/watch' );
85
-	}
84
+        return self::addClientDecorators( $context, $client, $templatePaths, 'account/watch' );
85
+    }
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface
32 32
 	 * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails
33 33
 	 */
34
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
34
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null)
35 35
 	{
36 36
 		/** client/html/account/watch/name
37 37
 		 * Class name of the used account watch client implementation
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 		 * @since 2014.03
67 67
 		 * @category Developer
68 68
 		 */
69
-		if( $name === null ) {
70
-			$name = $context->getConfig()->get( 'client/html/account/watch/name', 'Standard' );
69
+		if ($name === null) {
70
+			$name = $context->getConfig()->get('client/html/account/watch/name', 'Standard');
71 71
 		}
72 72
 
73
-		if( ctype_alnum( $name ) === false )
73
+		if (ctype_alnum($name) === false)
74 74
 		{
75
-			$classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name : '<not a string>';
76
-			throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
75
+			$classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Account\\Watch\\'.$name : '<not a string>';
76
+			throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
77 77
 		}
78 78
 
79 79
 		$iface = '\\Aimeos\\Client\\Html\\Iface';
80
-		$classname = '\\Aimeos\\Client\\Html\\Account\\Watch\\' . $name;
80
+		$classname = '\\Aimeos\\Client\\Html\\Account\\Watch\\'.$name;
81 81
 
82
-		$client = self::createClientBase( $context, $classname, $iface, $templatePaths );
82
+		$client = self::createClientBase($context, $classname, $iface, $templatePaths);
83 83
 
84
-		return self::addClientDecorators( $context, $client, $templatePaths, 'account/watch' );
84
+		return self::addClientDecorators($context, $client, $templatePaths, 'account/watch');
85 85
 	}
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
client/html/src/Client/Html/Account/Watch/Standard.php 3 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -82,23 +82,19 @@  discard block
 block discarded – undo
82 82
 				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
83 83
 			}
84 84
 			$view->watchBody = $html;
85
-		}
86
-		catch( \Aimeos\Client\Html\Exception $e )
85
+		} catch( \Aimeos\Client\Html\Exception $e )
87 86
 		{
88 87
 			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
89 88
 			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
90
-		}
91
-		catch( \Aimeos\Controller\Frontend\Exception $e )
89
+		} catch( \Aimeos\Controller\Frontend\Exception $e )
92 90
 		{
93 91
 			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
94 92
 			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
95
-		}
96
-		catch( \Aimeos\MShop\Exception $e )
93
+		} catch( \Aimeos\MShop\Exception $e )
97 94
 		{
98 95
 			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
99 96
 			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
100
-		}
101
-		catch( \Exception $e )
97
+		} catch( \Exception $e )
102 98
 		{
103 99
 			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
104 100
 
@@ -178,8 +174,7 @@  discard block
 block discarded – undo
178 174
 			$default = 'account/watch/header-default.php';
179 175
 
180 176
 			return $view->render( $view->config( $tplconf, $default ) );
181
-		}
182
-		catch( \Exception $e )
177
+		} catch( \Exception $e )
183 178
 		{
184 179
 			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
185 180
 		}
Please login to merge, or discard this patch.
Indentation   +601 added lines, -601 removed lines patch added patch discarded remove patch
@@ -19,606 +19,606 @@
 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/account/watch/standard/subparts
26
-	 * List of HTML sub-clients rendered within the account watch section
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2014.03
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/account/watch/standard/subparts';
59
-	private $subPartNames = array();
60
-	private $cache;
61
-
62
-
63
-	/**
64
-	 * Returns the HTML code for insertion into the body.
65
-	 *
66
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
67
-	 * @param array &$tags Result array for the list of tags that are associated to the output
68
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
69
-	 * @return string HTML code
70
-	 */
71
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
72
-	{
73
-		$context = $this->getContext();
74
-		$view = $this->getView();
75
-
76
-		try
77
-		{
78
-			$view = $this->setViewParams( $view, $tags, $expire );
79
-
80
-			$html = '';
81
-			foreach( $this->getSubClients() as $subclient ) {
82
-				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
83
-			}
84
-			$view->watchBody = $html;
85
-		}
86
-		catch( \Aimeos\Client\Html\Exception $e )
87
-		{
88
-			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
89
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
90
-		}
91
-		catch( \Aimeos\Controller\Frontend\Exception $e )
92
-		{
93
-			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
94
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
95
-		}
96
-		catch( \Aimeos\MShop\Exception $e )
97
-		{
98
-			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
99
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
100
-		}
101
-		catch( \Exception $e )
102
-		{
103
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
104
-
105
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
106
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
107
-		}
108
-
109
-		/** client/html/account/watch/standard/template-body
110
-		 * Relative path to the HTML body template of the account watch client.
111
-		 *
112
-		 * The template file contains the HTML code and processing instructions
113
-		 * to generate the result shown in the body of the frontend. The
114
-		 * configuration string is the path to the template file relative
115
-		 * to the templates directory (usually in client/html/templates).
116
-		 *
117
-		 * You can overwrite the template file configuration in extensions and
118
-		 * provide alternative templates. These alternative templates should be
119
-		 * named like the default one but with the string "standard" replaced by
120
-		 * an unique name. You may use the name of your project for this. If
121
-		 * you've implemented an alternative client class as well, "standard"
122
-		 * should be replaced by the name of the new class.
123
-		 *
124
-		 * @param string Relative path to the template creating code for the HTML page body
125
-		 * @since 2014.03
126
-		 * @category Developer
127
-		 * @see client/html/account/watch/standard/template-header
128
-		 */
129
-		$tplconf = 'client/html/account/watch/standard/template-body';
130
-		$default = 'account/watch/body-default.php';
131
-
132
-		return $view->render( $view->config( $tplconf, $default ) );
133
-	}
134
-
135
-
136
-	/**
137
-	 * Returns the HTML string for insertion into the header.
138
-	 *
139
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
140
-	 * @param array &$tags Result array for the list of tags that are associated to the output
141
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
142
-	 * @return string|null String including HTML tags for the header on error
143
-	 */
144
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
145
-	{
146
-		try
147
-		{
148
-			$view = $this->setViewParams( $this->getView(), $tags, $expire );
149
-
150
-			$html = '';
151
-			foreach( $this->getSubClients() as $subclient ) {
152
-				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
153
-			}
154
-			$view->watchHeader = $html;
155
-
156
-			/** client/html/account/watch/standard/template-header
157
-			 * Relative path to the HTML header template of the account watch client.
158
-			 *
159
-			 * The template file contains the HTML code and processing instructions
160
-			 * to generate the HTML code that is inserted into the HTML page header
161
-			 * of the rendered page in the frontend. The configuration string is the
162
-			 * path to the template file relative to the templates directory (usually
163
-			 * in client/html/templates).
164
-			 *
165
-			 * You can overwrite the template file configuration in extensions and
166
-			 * provide alternative templates. These alternative templates should be
167
-			 * named like the default one but with the string "standard" replaced by
168
-			 * an unique name. You may use the name of your project for this. If
169
-			 * you've implemented an alternative client class as well, "standard"
170
-			 * should be replaced by the name of the new class.
171
-			 *
172
-			 * @param string Relative path to the template creating code for the HTML page head
173
-			 * @since 2014.03
174
-			 * @category Developer
175
-			 * @see client/html/account/watch/standard/template-body
176
-			 */
177
-			$tplconf = 'client/html/account/watch/standard/template-header';
178
-			$default = 'account/watch/header-default.php';
179
-
180
-			return $view->render( $view->config( $tplconf, $default ) );
181
-		}
182
-		catch( \Exception $e )
183
-		{
184
-			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
185
-		}
186
-	}
187
-
188
-
189
-	/**
190
-	 * Returns the sub-client given by its name.
191
-	 *
192
-	 * @param string $type Name of the client type
193
-	 * @param string|null $name Name of the sub-client (Default if null)
194
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
195
-	 */
196
-	public function getSubClient( $type, $name = null )
197
-	{
198
-		/** client/html/account/watch/decorators/excludes
199
-		 * Excludes decorators added by the "common" option from the account watch html client
200
-		 *
201
-		 * Decorators extend the functionality of a class by adding new aspects
202
-		 * (e.g. log what is currently done), executing the methods of the underlying
203
-		 * class only in certain conditions (e.g. only for logged in users) or
204
-		 * modify what is returned to the caller.
205
-		 *
206
-		 * This option allows you to remove a decorator added via
207
-		 * "client/html/common/decorators/default" before they are wrapped
208
-		 * around the html client.
209
-		 *
210
-		 *  client/html/account/watch/decorators/excludes = array( 'decorator1' )
211
-		 *
212
-		 * This would remove the decorator named "decorator1" from the list of
213
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
214
-		 * "client/html/common/decorators/default" to the html client.
215
-		 *
216
-		 * @param array List of decorator names
217
-		 * @since 2014.05
218
-		 * @category Developer
219
-		 * @see client/html/common/decorators/default
220
-		 * @see client/html/account/watch/decorators/global
221
-		 * @see client/html/account/watch/decorators/local
222
-		 */
223
-
224
-		/** client/html/account/watch/decorators/global
225
-		 * Adds a list of globally available decorators only to the account watch html client
226
-		 *
227
-		 * Decorators extend the functionality of a class by adding new aspects
228
-		 * (e.g. log what is currently done), executing the methods of the underlying
229
-		 * class only in certain conditions (e.g. only for logged in users) or
230
-		 * modify what is returned to the caller.
231
-		 *
232
-		 * This option allows you to wrap global decorators
233
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
234
-		 *
235
-		 *  client/html/account/watch/decorators/global = array( 'decorator1' )
236
-		 *
237
-		 * This would add the decorator named "decorator1" defined by
238
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
239
-		 *
240
-		 * @param array List of decorator names
241
-		 * @since 2014.05
242
-		 * @category Developer
243
-		 * @see client/html/common/decorators/default
244
-		 * @see client/html/account/watch/decorators/excludes
245
-		 * @see client/html/account/watch/decorators/local
246
-		 */
247
-
248
-		/** client/html/account/watch/decorators/local
249
-		 * Adds a list of local decorators only to the account watch html client
250
-		 *
251
-		 * Decorators extend the functionality of a class by adding new aspects
252
-		 * (e.g. log what is currently done), executing the methods of the underlying
253
-		 * class only in certain conditions (e.g. only for logged in users) or
254
-		 * modify what is returned to the caller.
255
-		 *
256
-		 * This option allows you to wrap local decorators
257
-		 * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client.
258
-		 *
259
-		 *  client/html/account/watch/decorators/local = array( 'decorator2' )
260
-		 *
261
-		 * This would add the decorator named "decorator2" defined by
262
-		 * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client.
263
-		 *
264
-		 * @param array List of decorator names
265
-		 * @since 2014.05
266
-		 * @category Developer
267
-		 * @see client/html/common/decorators/default
268
-		 * @see client/html/account/watch/decorators/excludes
269
-		 * @see client/html/account/watch/decorators/global
270
-		 */
271
-
272
-		return $this->createSubClient( 'account/watch/' . $type, $name );
273
-	}
274
-
275
-
276
-	/**
277
-	 * Processes the input, e.g. store given values.
278
-	 * A view must be available and this method doesn't generate any output
279
-	 * besides setting view variables.
280
-	 */
281
-	public function process()
282
-	{
283
-		$view = $this->getView();
284
-		$context = $this->getContext();
285
-		$userId = $context->getUserId();
286
-		$ids = (array) $view->param( 'wat_id', array() );
287
-
288
-		if( $userId != null && !empty( $ids ) )
289
-		{
290
-			$typeId = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' )->getId();
291
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
292
-			$items = $this->getListItems( $manager, $ids, $typeId, $userId );
293
-
294
-			switch( $view->param( 'wat_action' ) )
295
-			{
296
-				case 'add':
297
-
298
-					/** client/html/account/watch/standard/maxitems
299
-					 * Maximum number of products that can be watched in parallel
300
-					 *
301
-					 * This option limits the number of products that can be watched
302
-					 * after the users added the products to their watch list.
303
-					 * It must be a positive integer value greater than 0.
304
-					 *
305
-					 * Note: It's recommended to set this value not too high as this
306
-					 * leads to a high memory consumption when the e-mails are generated
307
-					 * to notify the customers. The memory used will up to 100*maxitems
308
-					 * of the footprint of one product item including the associated
309
-					 * texts, prices and media.
310
-					 *
311
-					 * @param integer Number of products
312
-					 * @since 2014.09
313
-					 * @category User
314
-					 * @category Developer
315
-					 */
316
-					$max = $context->getConfig()->get( 'client/html/account/watch/standard/maxitems', 100 );
317
-					$cnt = count( $ids );
318
-
319
-					if( $this->checkLimit( $manager, $typeId, $userId, $max, $cnt ) === false )
320
-					{
321
-						$error = sprintf( $context->getI18n()->dt( 'client', 'You can only watch up to %1$s products' ), $max );
322
-						$view->watchErrorList = $view->get( 'watchErrorList', array() ) + array( $error );
323
-						break;
324
-					}
325
-
326
-					$this->addItems( $manager, $items, $ids, $typeId, $userId );
327
-					break;
328
-
329
-				case 'edit':
330
-
331
-					$config = array(
332
-						'timeframe' => $view->param( 'wat_timeframe', 7 ),
333
-						'pricevalue' => $view->param( 'wat_pricevalue', '0.00' ),
334
-						'price' => $view->param( 'wat_price', 0 ),
335
-						'stock' => $view->param( 'wat_stock', 0 ),
336
-						'currency' => $context->getLocale()->getCurrencyId(),
337
-					);
338
-					$this->editItems( $manager, $items, $ids, $config );
339
-					break;
340
-
341
-				case 'delete':
342
-
343
-					$this->deleteItems( $manager, $items, $ids );
344
-					break;
345
-			}
346
-		}
347
-
348
-		parent::process();
349
-	}
350
-
351
-
352
-	/**
353
-	 * Tests if the maximum number of entries per user is already reached
354
-	 *
355
-	 * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
356
-	 * @param string $typeId List type ID of the referenced items
357
-	 * @param string $userId Unique user ID
358
-	 * @param integer $max Maximum number of items that are allowed
359
-	 * @param integer $cnt Number of items that should be added
360
-	 * @return boolean True if items can be added, false if not
361
-	 */
362
-	protected function checkLimit( \Aimeos\MShop\Common\Manager\Iface $manager, $typeId, $userId, $max, $cnt )
363
-	{
364
-		$search = $manager->createSearch();
365
-		$expr = array(
366
-			$search->compare( '==', 'customer.lists.parentid', $userId ),
367
-			$search->compare( '==', 'customer.lists.typeid', $typeId ),
368
-			$search->compare( '==', 'customer.lists.domain', 'product' ),
369
-		);
370
-		$search->setConditions( $search->combine( '&&', $expr ) );
371
-		$search->setSlice( 0, 0 );
372
-
373
-		$total = 0;
374
-		$manager->searchItems( $search, array(), $total );
375
-
376
-		if( $total + $cnt > $max ) {
377
-			return false;
378
-		}
379
-
380
-		return true;
381
-	}
382
-
383
-
384
-	/**
385
-	 * Adds one or more list items to the given user
386
-	 *
387
-	 * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
388
-	 * @param array $listItems Associative list of the reference IDs as keys and the list items as values
389
-	 * @param array $ids List of referenced IDs
390
-	 * @param string $typeId List type ID of the referenced items
391
-	 * @param string $userId Unique user ID
392
-	 */
393
-	protected function addItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, $typeId, $userId )
394
-	{
395
-		$item = $manager->createItem();
396
-		$item->setParentId( $userId );
397
-		$item->setTypeId( $typeId );
398
-		$item->setDomain( 'product' );
399
-		$item->setStatus( 1 );
400
-
401
-		foreach( $ids as $id )
402
-		{
403
-			if( !isset( $listItems[$id] ) )
404
-			{
405
-				$item->setId( null );
406
-				$item->setRefId( $id );
407
-
408
-				$manager->saveItem( $item );
409
-				$manager->moveItem( $item->getId() );
410
-			}
411
-		}
412
-	}
413
-
414
-
415
-	/**
416
-	 * Removes the list items for the given reference IDs
417
-	 *
418
-	 * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
419
-	 * @param array $listItems Associative list of the reference IDs as keys and the list items as values
420
-	 * @param array $ids List of referenced IDs
421
-	 */
422
-	protected function deleteItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids )
423
-	{
424
-		$listIds = array();
425
-
426
-		foreach( $ids as $id )
427
-		{
428
-			if( isset( $listItems[$id] ) ) {
429
-				$listIds[] = $listItems[$id]->getId();
430
-			}
431
-		}
432
-
433
-		$manager->deleteItems( $listIds );
434
-	}
435
-
436
-
437
-	/**
438
-	 * Updates the list items for the given reference IDs
439
-	 *
440
-	 * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
441
-	 * @param array $listItems Associative list of the reference IDs as keys and the list items as values
442
-	 * @param array $ids List of referenced IDs
443
-	 * @param array $config Configuration settins with "timeframe", "pricevalue", "price", "stock" and "currency"
444
-	 */
445
-	protected function editItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, array $config )
446
-	{
447
-		foreach( $ids as $id )
448
-		{
449
-			if( isset( $listItems[$id] ) )
450
-			{
451
-				$item = $listItems[$id];
452
-				$time = time() + ( $config['timeframe'] + 1 ) * 86400;
453
-
454
-				$item->setDateEnd( date( 'Y-m-d 00:00:00', $time ) );
455
-				$item->setConfig( $config );
456
-
457
-				$manager->saveItem( $item );
458
-			}
459
-		}
460
-	}
461
-
462
-
463
-	/**
464
-	 * Returns the list items associated to the given user ID
465
-	 *
466
-	 * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
467
-	 * @param array $refIds IDs of the referenced items
468
-	 * @param string $typeId List type ID of the referenced items
469
-	 * @param string $userId Unique user ID
470
-	 * @return array Associative list of the reference IDs as keys and the list items as values
471
-	 */
472
-	protected function getListItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $refIds, $typeId, $userId )
473
-	{
474
-		$search = $manager->createSearch();
475
-		$expr = array(
476
-			$search->compare( '==', 'customer.lists.parentid', $userId ),
477
-			$search->compare( '==', 'customer.lists.refid', $refIds ),
478
-			$search->compare( '==', 'customer.lists.domain', 'product' ),
479
-			$search->compare( '==', 'customer.lists.typeid', $typeId ),
480
-		);
481
-		$search->setConditions( $search->combine( '&&', $expr ) );
482
-
483
-		$items = array();
484
-		foreach( $manager->searchItems( $search ) as $item ) {
485
-			$items[$item->getRefId()] = $item;
486
-		}
487
-
488
-		return $items;
489
-	}
490
-
491
-
492
-	/**
493
-	 * Returns the list of sub-client names configured for the client.
494
-	 *
495
-	 * @return array List of HTML client names
496
-	 */
497
-	protected function getSubClientNames()
498
-	{
499
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
500
-	}
501
-
502
-
503
-	/**
504
-	 * Returns the sanitized page from the parameters for the product list.
505
-	 *
506
-	 * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
507
-	 * @return integer Page number starting from 1
508
-	 */
509
-	protected function getProductListPage( \Aimeos\MW\View\Iface $view )
510
-	{
511
-		$page = (int) $view->param( 'wat_page', 1 );
512
-		return ( $page < 1 ? 1 : $page );
513
-	}
514
-
515
-
516
-	/**
517
-	 * Returns the sanitized page size from the parameters for the product list.
518
-	 *
519
-	 * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
520
-	 * @return integer Page size
521
-	 */
522
-	protected function getProductListSize( \Aimeos\MW\View\Iface $view )
523
-	{
524
-		/** client/html/account/watch/size
525
-		 * The number of products shown in a list page for watch products
526
-		 *
527
-		 * Limits the number of products that is shown in the list pages to the
528
-		 * given value. If more products are available, the products are split
529
-		 * into bunches which will be shown on their own list page. The user is
530
-		 * able to move to the next page (or previous one if it's not the first)
531
-		 * to display the next (or previous) products.
532
-		 *
533
-		 * The value must be an integer number from 1 to 100. Negative values as
534
-		 * well as values above 100 are not allowed. The value can be overwritten
535
-		 * per request if the "l_size" parameter is part of the URL.
536
-		 *
537
-		 * @param integer Number of products
538
-		 * @since 2014.09
539
-		 * @category User
540
-		 * @category Developer
541
-		 * @see client/html/catalog/lists/size
542
-		 */
543
-		$defaultSize = $this->getContext()->getConfig()->get( 'client/html/account/watch/size', 48 );
544
-
545
-		$size = (int) $view->param( 'watch-size', $defaultSize );
546
-		return ( $size < 1 || $size > 100 ? $defaultSize : $size );
547
-	}
548
-
549
-
550
-	/**
551
-	 * Sets the necessary parameter values in the view.
552
-	 *
553
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
554
-	 * @param array &$tags Result array for the list of tags that are associated to the output
555
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
556
-	 * @return \Aimeos\MW\View\Iface Modified view object
557
-	 */
558
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
559
-	{
560
-		if( !isset( $this->cache ) )
561
-		{
562
-			$total = 0;
563
-			$productIds = array();
564
-			$context = $this->getContext();
565
-			$typeItem = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' );
566
-
567
-			$size = $this->getProductListSize( $view );
568
-			$current = $this->getProductListPage( $view );
569
-			$last = ( $total != 0 ? ceil( $total / $size ) : 1 );
570
-
571
-
572
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
573
-
574
-			$search = $manager->createSearch();
575
-			$expr = array(
576
-				$search->compare( '==', 'customer.lists.parentid', $context->getUserId() ),
577
-				$search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ),
578
-				$search->compare( '==', 'customer.lists.domain', 'product' ),
579
-			);
580
-			$search->setConditions( $search->combine( '&&', $expr ) );
581
-			$search->setSortations( array( $search->sort( '-', 'customer.lists.position' ) ) );
582
-			$search->setSlice( ( $current - 1 ) * $size, $size );
583
-
584
-			$view->watchListItems = $manager->searchItems( $search, array(), $total );
585
-
586
-
587
-			/** client/html/account/watch/domains
588
-			 * A list of domain names whose items should be available in the account watch view template
589
-			 *
590
-			 * The templates rendering product details usually add the images,
591
-			 * prices and texts associated to the product item. If you want to
592
-			 * display additional or less content, you can configure your own
593
-			 * list of domains (attribute, media, price, product, text, etc. are
594
-			 * domains) whose items are fetched from the storage. Please keep
595
-			 * in mind that the more domains you add to the configuration, the
596
-			 * more time is required for fetching the content!
597
-			 *
598
-			 * @param array List of domain names
599
-			 * @since 2014.09
600
-			 * @category Developer
601
-			 * @see client/html/catalog/domains
602
-			 */
603
-			$default = array( 'text', 'price', 'media' );
604
-			$domains = $context->getConfig()->get( 'client/html/account/watch/domains', $default );
605
-
606
-			foreach( $view->watchListItems as $listItem ) {
607
-				$productIds[] = $listItem->getRefId();
608
-			}
609
-
610
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
611
-
612
-			$view->watchProductItems = $controller->getProductItems( $productIds, $domains );
613
-			$view->watchPageFirst = 1;
614
-			$view->watchPagePrev = ( $current > 1 ? $current - 1 : 1 );
615
-			$view->watchPageNext = ( $current < $last ? $current + 1 : $last );
616
-			$view->watchPageLast = $last;
617
-			$view->watchPageCurr = $current;
618
-
619
-			$this->cache = $view;
620
-		}
621
-
622
-		return $this->cache;
623
-	}
25
+    /** client/html/account/watch/standard/subparts
26
+     * List of HTML sub-clients rendered within the account watch section
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2014.03
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/account/watch/standard/subparts';
59
+    private $subPartNames = array();
60
+    private $cache;
61
+
62
+
63
+    /**
64
+     * Returns the HTML code for insertion into the body.
65
+     *
66
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
67
+     * @param array &$tags Result array for the list of tags that are associated to the output
68
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
69
+     * @return string HTML code
70
+     */
71
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
72
+    {
73
+        $context = $this->getContext();
74
+        $view = $this->getView();
75
+
76
+        try
77
+        {
78
+            $view = $this->setViewParams( $view, $tags, $expire );
79
+
80
+            $html = '';
81
+            foreach( $this->getSubClients() as $subclient ) {
82
+                $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
83
+            }
84
+            $view->watchBody = $html;
85
+        }
86
+        catch( \Aimeos\Client\Html\Exception $e )
87
+        {
88
+            $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
89
+            $view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
90
+        }
91
+        catch( \Aimeos\Controller\Frontend\Exception $e )
92
+        {
93
+            $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
94
+            $view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
95
+        }
96
+        catch( \Aimeos\MShop\Exception $e )
97
+        {
98
+            $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
99
+            $view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
100
+        }
101
+        catch( \Exception $e )
102
+        {
103
+            $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
104
+
105
+            $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
106
+            $view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
107
+        }
108
+
109
+        /** client/html/account/watch/standard/template-body
110
+         * Relative path to the HTML body template of the account watch client.
111
+         *
112
+         * The template file contains the HTML code and processing instructions
113
+         * to generate the result shown in the body of the frontend. The
114
+         * configuration string is the path to the template file relative
115
+         * to the templates directory (usually in client/html/templates).
116
+         *
117
+         * You can overwrite the template file configuration in extensions and
118
+         * provide alternative templates. These alternative templates should be
119
+         * named like the default one but with the string "standard" replaced by
120
+         * an unique name. You may use the name of your project for this. If
121
+         * you've implemented an alternative client class as well, "standard"
122
+         * should be replaced by the name of the new class.
123
+         *
124
+         * @param string Relative path to the template creating code for the HTML page body
125
+         * @since 2014.03
126
+         * @category Developer
127
+         * @see client/html/account/watch/standard/template-header
128
+         */
129
+        $tplconf = 'client/html/account/watch/standard/template-body';
130
+        $default = 'account/watch/body-default.php';
131
+
132
+        return $view->render( $view->config( $tplconf, $default ) );
133
+    }
134
+
135
+
136
+    /**
137
+     * Returns the HTML string for insertion into the header.
138
+     *
139
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
140
+     * @param array &$tags Result array for the list of tags that are associated to the output
141
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
142
+     * @return string|null String including HTML tags for the header on error
143
+     */
144
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
145
+    {
146
+        try
147
+        {
148
+            $view = $this->setViewParams( $this->getView(), $tags, $expire );
149
+
150
+            $html = '';
151
+            foreach( $this->getSubClients() as $subclient ) {
152
+                $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
153
+            }
154
+            $view->watchHeader = $html;
155
+
156
+            /** client/html/account/watch/standard/template-header
157
+             * Relative path to the HTML header template of the account watch client.
158
+             *
159
+             * The template file contains the HTML code and processing instructions
160
+             * to generate the HTML code that is inserted into the HTML page header
161
+             * of the rendered page in the frontend. The configuration string is the
162
+             * path to the template file relative to the templates directory (usually
163
+             * in client/html/templates).
164
+             *
165
+             * You can overwrite the template file configuration in extensions and
166
+             * provide alternative templates. These alternative templates should be
167
+             * named like the default one but with the string "standard" replaced by
168
+             * an unique name. You may use the name of your project for this. If
169
+             * you've implemented an alternative client class as well, "standard"
170
+             * should be replaced by the name of the new class.
171
+             *
172
+             * @param string Relative path to the template creating code for the HTML page head
173
+             * @since 2014.03
174
+             * @category Developer
175
+             * @see client/html/account/watch/standard/template-body
176
+             */
177
+            $tplconf = 'client/html/account/watch/standard/template-header';
178
+            $default = 'account/watch/header-default.php';
179
+
180
+            return $view->render( $view->config( $tplconf, $default ) );
181
+        }
182
+        catch( \Exception $e )
183
+        {
184
+            $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
185
+        }
186
+    }
187
+
188
+
189
+    /**
190
+     * Returns the sub-client given by its name.
191
+     *
192
+     * @param string $type Name of the client type
193
+     * @param string|null $name Name of the sub-client (Default if null)
194
+     * @return \Aimeos\Client\Html\Iface Sub-client object
195
+     */
196
+    public function getSubClient( $type, $name = null )
197
+    {
198
+        /** client/html/account/watch/decorators/excludes
199
+         * Excludes decorators added by the "common" option from the account watch html client
200
+         *
201
+         * Decorators extend the functionality of a class by adding new aspects
202
+         * (e.g. log what is currently done), executing the methods of the underlying
203
+         * class only in certain conditions (e.g. only for logged in users) or
204
+         * modify what is returned to the caller.
205
+         *
206
+         * This option allows you to remove a decorator added via
207
+         * "client/html/common/decorators/default" before they are wrapped
208
+         * around the html client.
209
+         *
210
+         *  client/html/account/watch/decorators/excludes = array( 'decorator1' )
211
+         *
212
+         * This would remove the decorator named "decorator1" from the list of
213
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
214
+         * "client/html/common/decorators/default" to the html client.
215
+         *
216
+         * @param array List of decorator names
217
+         * @since 2014.05
218
+         * @category Developer
219
+         * @see client/html/common/decorators/default
220
+         * @see client/html/account/watch/decorators/global
221
+         * @see client/html/account/watch/decorators/local
222
+         */
223
+
224
+        /** client/html/account/watch/decorators/global
225
+         * Adds a list of globally available decorators only to the account watch html client
226
+         *
227
+         * Decorators extend the functionality of a class by adding new aspects
228
+         * (e.g. log what is currently done), executing the methods of the underlying
229
+         * class only in certain conditions (e.g. only for logged in users) or
230
+         * modify what is returned to the caller.
231
+         *
232
+         * This option allows you to wrap global decorators
233
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
234
+         *
235
+         *  client/html/account/watch/decorators/global = array( 'decorator1' )
236
+         *
237
+         * This would add the decorator named "decorator1" defined by
238
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
239
+         *
240
+         * @param array List of decorator names
241
+         * @since 2014.05
242
+         * @category Developer
243
+         * @see client/html/common/decorators/default
244
+         * @see client/html/account/watch/decorators/excludes
245
+         * @see client/html/account/watch/decorators/local
246
+         */
247
+
248
+        /** client/html/account/watch/decorators/local
249
+         * Adds a list of local decorators only to the account watch html client
250
+         *
251
+         * Decorators extend the functionality of a class by adding new aspects
252
+         * (e.g. log what is currently done), executing the methods of the underlying
253
+         * class only in certain conditions (e.g. only for logged in users) or
254
+         * modify what is returned to the caller.
255
+         *
256
+         * This option allows you to wrap local decorators
257
+         * ("\Aimeos\Client\Html\Account\Decorator\*") around the html client.
258
+         *
259
+         *  client/html/account/watch/decorators/local = array( 'decorator2' )
260
+         *
261
+         * This would add the decorator named "decorator2" defined by
262
+         * "\Aimeos\Client\Html\Account\Decorator\Decorator2" only to the html client.
263
+         *
264
+         * @param array List of decorator names
265
+         * @since 2014.05
266
+         * @category Developer
267
+         * @see client/html/common/decorators/default
268
+         * @see client/html/account/watch/decorators/excludes
269
+         * @see client/html/account/watch/decorators/global
270
+         */
271
+
272
+        return $this->createSubClient( 'account/watch/' . $type, $name );
273
+    }
274
+
275
+
276
+    /**
277
+     * Processes the input, e.g. store given values.
278
+     * A view must be available and this method doesn't generate any output
279
+     * besides setting view variables.
280
+     */
281
+    public function process()
282
+    {
283
+        $view = $this->getView();
284
+        $context = $this->getContext();
285
+        $userId = $context->getUserId();
286
+        $ids = (array) $view->param( 'wat_id', array() );
287
+
288
+        if( $userId != null && !empty( $ids ) )
289
+        {
290
+            $typeId = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' )->getId();
291
+            $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
292
+            $items = $this->getListItems( $manager, $ids, $typeId, $userId );
293
+
294
+            switch( $view->param( 'wat_action' ) )
295
+            {
296
+                case 'add':
297
+
298
+                    /** client/html/account/watch/standard/maxitems
299
+                     * Maximum number of products that can be watched in parallel
300
+                     *
301
+                     * This option limits the number of products that can be watched
302
+                     * after the users added the products to their watch list.
303
+                     * It must be a positive integer value greater than 0.
304
+                     *
305
+                     * Note: It's recommended to set this value not too high as this
306
+                     * leads to a high memory consumption when the e-mails are generated
307
+                     * to notify the customers. The memory used will up to 100*maxitems
308
+                     * of the footprint of one product item including the associated
309
+                     * texts, prices and media.
310
+                     *
311
+                     * @param integer Number of products
312
+                     * @since 2014.09
313
+                     * @category User
314
+                     * @category Developer
315
+                     */
316
+                    $max = $context->getConfig()->get( 'client/html/account/watch/standard/maxitems', 100 );
317
+                    $cnt = count( $ids );
318
+
319
+                    if( $this->checkLimit( $manager, $typeId, $userId, $max, $cnt ) === false )
320
+                    {
321
+                        $error = sprintf( $context->getI18n()->dt( 'client', 'You can only watch up to %1$s products' ), $max );
322
+                        $view->watchErrorList = $view->get( 'watchErrorList', array() ) + array( $error );
323
+                        break;
324
+                    }
325
+
326
+                    $this->addItems( $manager, $items, $ids, $typeId, $userId );
327
+                    break;
328
+
329
+                case 'edit':
330
+
331
+                    $config = array(
332
+                        'timeframe' => $view->param( 'wat_timeframe', 7 ),
333
+                        'pricevalue' => $view->param( 'wat_pricevalue', '0.00' ),
334
+                        'price' => $view->param( 'wat_price', 0 ),
335
+                        'stock' => $view->param( 'wat_stock', 0 ),
336
+                        'currency' => $context->getLocale()->getCurrencyId(),
337
+                    );
338
+                    $this->editItems( $manager, $items, $ids, $config );
339
+                    break;
340
+
341
+                case 'delete':
342
+
343
+                    $this->deleteItems( $manager, $items, $ids );
344
+                    break;
345
+            }
346
+        }
347
+
348
+        parent::process();
349
+    }
350
+
351
+
352
+    /**
353
+     * Tests if the maximum number of entries per user is already reached
354
+     *
355
+     * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
356
+     * @param string $typeId List type ID of the referenced items
357
+     * @param string $userId Unique user ID
358
+     * @param integer $max Maximum number of items that are allowed
359
+     * @param integer $cnt Number of items that should be added
360
+     * @return boolean True if items can be added, false if not
361
+     */
362
+    protected function checkLimit( \Aimeos\MShop\Common\Manager\Iface $manager, $typeId, $userId, $max, $cnt )
363
+    {
364
+        $search = $manager->createSearch();
365
+        $expr = array(
366
+            $search->compare( '==', 'customer.lists.parentid', $userId ),
367
+            $search->compare( '==', 'customer.lists.typeid', $typeId ),
368
+            $search->compare( '==', 'customer.lists.domain', 'product' ),
369
+        );
370
+        $search->setConditions( $search->combine( '&&', $expr ) );
371
+        $search->setSlice( 0, 0 );
372
+
373
+        $total = 0;
374
+        $manager->searchItems( $search, array(), $total );
375
+
376
+        if( $total + $cnt > $max ) {
377
+            return false;
378
+        }
379
+
380
+        return true;
381
+    }
382
+
383
+
384
+    /**
385
+     * Adds one or more list items to the given user
386
+     *
387
+     * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
388
+     * @param array $listItems Associative list of the reference IDs as keys and the list items as values
389
+     * @param array $ids List of referenced IDs
390
+     * @param string $typeId List type ID of the referenced items
391
+     * @param string $userId Unique user ID
392
+     */
393
+    protected function addItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, $typeId, $userId )
394
+    {
395
+        $item = $manager->createItem();
396
+        $item->setParentId( $userId );
397
+        $item->setTypeId( $typeId );
398
+        $item->setDomain( 'product' );
399
+        $item->setStatus( 1 );
400
+
401
+        foreach( $ids as $id )
402
+        {
403
+            if( !isset( $listItems[$id] ) )
404
+            {
405
+                $item->setId( null );
406
+                $item->setRefId( $id );
407
+
408
+                $manager->saveItem( $item );
409
+                $manager->moveItem( $item->getId() );
410
+            }
411
+        }
412
+    }
413
+
414
+
415
+    /**
416
+     * Removes the list items for the given reference IDs
417
+     *
418
+     * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
419
+     * @param array $listItems Associative list of the reference IDs as keys and the list items as values
420
+     * @param array $ids List of referenced IDs
421
+     */
422
+    protected function deleteItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids )
423
+    {
424
+        $listIds = array();
425
+
426
+        foreach( $ids as $id )
427
+        {
428
+            if( isset( $listItems[$id] ) ) {
429
+                $listIds[] = $listItems[$id]->getId();
430
+            }
431
+        }
432
+
433
+        $manager->deleteItems( $listIds );
434
+    }
435
+
436
+
437
+    /**
438
+     * Updates the list items for the given reference IDs
439
+     *
440
+     * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
441
+     * @param array $listItems Associative list of the reference IDs as keys and the list items as values
442
+     * @param array $ids List of referenced IDs
443
+     * @param array $config Configuration settins with "timeframe", "pricevalue", "price", "stock" and "currency"
444
+     */
445
+    protected function editItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, array $config )
446
+    {
447
+        foreach( $ids as $id )
448
+        {
449
+            if( isset( $listItems[$id] ) )
450
+            {
451
+                $item = $listItems[$id];
452
+                $time = time() + ( $config['timeframe'] + 1 ) * 86400;
453
+
454
+                $item->setDateEnd( date( 'Y-m-d 00:00:00', $time ) );
455
+                $item->setConfig( $config );
456
+
457
+                $manager->saveItem( $item );
458
+            }
459
+        }
460
+    }
461
+
462
+
463
+    /**
464
+     * Returns the list items associated to the given user ID
465
+     *
466
+     * @param \Aimeos\MShop\Common\Manager\Iface $manager Customer list manager
467
+     * @param array $refIds IDs of the referenced items
468
+     * @param string $typeId List type ID of the referenced items
469
+     * @param string $userId Unique user ID
470
+     * @return array Associative list of the reference IDs as keys and the list items as values
471
+     */
472
+    protected function getListItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $refIds, $typeId, $userId )
473
+    {
474
+        $search = $manager->createSearch();
475
+        $expr = array(
476
+            $search->compare( '==', 'customer.lists.parentid', $userId ),
477
+            $search->compare( '==', 'customer.lists.refid', $refIds ),
478
+            $search->compare( '==', 'customer.lists.domain', 'product' ),
479
+            $search->compare( '==', 'customer.lists.typeid', $typeId ),
480
+        );
481
+        $search->setConditions( $search->combine( '&&', $expr ) );
482
+
483
+        $items = array();
484
+        foreach( $manager->searchItems( $search ) as $item ) {
485
+            $items[$item->getRefId()] = $item;
486
+        }
487
+
488
+        return $items;
489
+    }
490
+
491
+
492
+    /**
493
+     * Returns the list of sub-client names configured for the client.
494
+     *
495
+     * @return array List of HTML client names
496
+     */
497
+    protected function getSubClientNames()
498
+    {
499
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
500
+    }
501
+
502
+
503
+    /**
504
+     * Returns the sanitized page from the parameters for the product list.
505
+     *
506
+     * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
507
+     * @return integer Page number starting from 1
508
+     */
509
+    protected function getProductListPage( \Aimeos\MW\View\Iface $view )
510
+    {
511
+        $page = (int) $view->param( 'wat_page', 1 );
512
+        return ( $page < 1 ? 1 : $page );
513
+    }
514
+
515
+
516
+    /**
517
+     * Returns the sanitized page size from the parameters for the product list.
518
+     *
519
+     * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
520
+     * @return integer Page size
521
+     */
522
+    protected function getProductListSize( \Aimeos\MW\View\Iface $view )
523
+    {
524
+        /** client/html/account/watch/size
525
+         * The number of products shown in a list page for watch products
526
+         *
527
+         * Limits the number of products that is shown in the list pages to the
528
+         * given value. If more products are available, the products are split
529
+         * into bunches which will be shown on their own list page. The user is
530
+         * able to move to the next page (or previous one if it's not the first)
531
+         * to display the next (or previous) products.
532
+         *
533
+         * The value must be an integer number from 1 to 100. Negative values as
534
+         * well as values above 100 are not allowed. The value can be overwritten
535
+         * per request if the "l_size" parameter is part of the URL.
536
+         *
537
+         * @param integer Number of products
538
+         * @since 2014.09
539
+         * @category User
540
+         * @category Developer
541
+         * @see client/html/catalog/lists/size
542
+         */
543
+        $defaultSize = $this->getContext()->getConfig()->get( 'client/html/account/watch/size', 48 );
544
+
545
+        $size = (int) $view->param( 'watch-size', $defaultSize );
546
+        return ( $size < 1 || $size > 100 ? $defaultSize : $size );
547
+    }
548
+
549
+
550
+    /**
551
+     * Sets the necessary parameter values in the view.
552
+     *
553
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
554
+     * @param array &$tags Result array for the list of tags that are associated to the output
555
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
556
+     * @return \Aimeos\MW\View\Iface Modified view object
557
+     */
558
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
559
+    {
560
+        if( !isset( $this->cache ) )
561
+        {
562
+            $total = 0;
563
+            $productIds = array();
564
+            $context = $this->getContext();
565
+            $typeItem = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' );
566
+
567
+            $size = $this->getProductListSize( $view );
568
+            $current = $this->getProductListPage( $view );
569
+            $last = ( $total != 0 ? ceil( $total / $size ) : 1 );
570
+
571
+
572
+            $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
573
+
574
+            $search = $manager->createSearch();
575
+            $expr = array(
576
+                $search->compare( '==', 'customer.lists.parentid', $context->getUserId() ),
577
+                $search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ),
578
+                $search->compare( '==', 'customer.lists.domain', 'product' ),
579
+            );
580
+            $search->setConditions( $search->combine( '&&', $expr ) );
581
+            $search->setSortations( array( $search->sort( '-', 'customer.lists.position' ) ) );
582
+            $search->setSlice( ( $current - 1 ) * $size, $size );
583
+
584
+            $view->watchListItems = $manager->searchItems( $search, array(), $total );
585
+
586
+
587
+            /** client/html/account/watch/domains
588
+             * A list of domain names whose items should be available in the account watch view template
589
+             *
590
+             * The templates rendering product details usually add the images,
591
+             * prices and texts associated to the product item. If you want to
592
+             * display additional or less content, you can configure your own
593
+             * list of domains (attribute, media, price, product, text, etc. are
594
+             * domains) whose items are fetched from the storage. Please keep
595
+             * in mind that the more domains you add to the configuration, the
596
+             * more time is required for fetching the content!
597
+             *
598
+             * @param array List of domain names
599
+             * @since 2014.09
600
+             * @category Developer
601
+             * @see client/html/catalog/domains
602
+             */
603
+            $default = array( 'text', 'price', 'media' );
604
+            $domains = $context->getConfig()->get( 'client/html/account/watch/domains', $default );
605
+
606
+            foreach( $view->watchListItems as $listItem ) {
607
+                $productIds[] = $listItem->getRefId();
608
+            }
609
+
610
+            $controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
611
+
612
+            $view->watchProductItems = $controller->getProductItems( $productIds, $domains );
613
+            $view->watchPageFirst = 1;
614
+            $view->watchPagePrev = ( $current > 1 ? $current - 1 : 1 );
615
+            $view->watchPageNext = ( $current < $last ? $current + 1 : $last );
616
+            $view->watchPageLast = $last;
617
+            $view->watchPageCurr = $current;
618
+
619
+            $this->cache = $view;
620
+        }
621
+
622
+        return $this->cache;
623
+    }
624 624
 }
625 625
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -68,42 +68,42 @@  discard block
 block discarded – undo
68 68
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
69 69
 	 * @return string HTML code
70 70
 	 */
71
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
+	public function getBody($uid = '', array &$tags = array(), &$expire = null)
72 72
 	{
73 73
 		$context = $this->getContext();
74 74
 		$view = $this->getView();
75 75
 
76 76
 		try
77 77
 		{
78
-			$view = $this->setViewParams( $view, $tags, $expire );
78
+			$view = $this->setViewParams($view, $tags, $expire);
79 79
 
80 80
 			$html = '';
81
-			foreach( $this->getSubClients() as $subclient ) {
82
-				$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
81
+			foreach ($this->getSubClients() as $subclient) {
82
+				$html .= $subclient->setView($view)->getBody($uid, $tags, $expire);
83 83
 			}
84 84
 			$view->watchBody = $html;
85 85
 		}
86
-		catch( \Aimeos\Client\Html\Exception $e )
86
+		catch (\Aimeos\Client\Html\Exception $e)
87 87
 		{
88
-			$error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) );
89
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
88
+			$error = array($this->getContext()->getI18n()->dt('client', $e->getMessage()));
89
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
90 90
 		}
91
-		catch( \Aimeos\Controller\Frontend\Exception $e )
91
+		catch (\Aimeos\Controller\Frontend\Exception $e)
92 92
 		{
93
-			$error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
94
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
93
+			$error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage()));
94
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
95 95
 		}
96
-		catch( \Aimeos\MShop\Exception $e )
96
+		catch (\Aimeos\MShop\Exception $e)
97 97
 		{
98
-			$error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
99
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
98
+			$error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage()));
99
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
100 100
 		}
101
-		catch( \Exception $e )
101
+		catch (\Exception $e)
102 102
 		{
103
-			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
103
+			$context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
104 104
 
105
-			$error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) );
106
-			$view->watchErrorList = $view->get( 'watchErrorList', array() ) + $error;
105
+			$error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
106
+			$view->watchErrorList = $view->get('watchErrorList', array()) + $error;
107 107
 		}
108 108
 
109 109
 		/** client/html/account/watch/standard/template-body
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		$tplconf = 'client/html/account/watch/standard/template-body';
130 130
 		$default = 'account/watch/body-default.php';
131 131
 
132
-		return $view->render( $view->config( $tplconf, $default ) );
132
+		return $view->render($view->config($tplconf, $default));
133 133
 	}
134 134
 
135 135
 
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
142 142
 	 * @return string|null String including HTML tags for the header on error
143 143
 	 */
144
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
144
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
145 145
 	{
146 146
 		try
147 147
 		{
148
-			$view = $this->setViewParams( $this->getView(), $tags, $expire );
148
+			$view = $this->setViewParams($this->getView(), $tags, $expire);
149 149
 
150 150
 			$html = '';
151
-			foreach( $this->getSubClients() as $subclient ) {
152
-				$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
151
+			foreach ($this->getSubClients() as $subclient) {
152
+				$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
153 153
 			}
154 154
 			$view->watchHeader = $html;
155 155
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 			$tplconf = 'client/html/account/watch/standard/template-header';
178 178
 			$default = 'account/watch/header-default.php';
179 179
 
180
-			return $view->render( $view->config( $tplconf, $default ) );
180
+			return $view->render($view->config($tplconf, $default));
181 181
 		}
182
-		catch( \Exception $e )
182
+		catch (\Exception $e)
183 183
 		{
184
-			$this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );
184
+			$this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString());
185 185
 		}
186 186
 	}
187 187
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @param string|null $name Name of the sub-client (Default if null)
194 194
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
195 195
 	 */
196
-	public function getSubClient( $type, $name = null )
196
+	public function getSubClient($type, $name = null)
197 197
 	{
198 198
 		/** client/html/account/watch/decorators/excludes
199 199
 		 * Excludes decorators added by the "common" option from the account watch html client
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		 * @see client/html/account/watch/decorators/global
270 270
 		 */
271 271
 
272
-		return $this->createSubClient( 'account/watch/' . $type, $name );
272
+		return $this->createSubClient('account/watch/'.$type, $name);
273 273
 	}
274 274
 
275 275
 
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 		$view = $this->getView();
284 284
 		$context = $this->getContext();
285 285
 		$userId = $context->getUserId();
286
-		$ids = (array) $view->param( 'wat_id', array() );
286
+		$ids = (array) $view->param('wat_id', array());
287 287
 
288
-		if( $userId != null && !empty( $ids ) )
288
+		if ($userId != null && !empty($ids))
289 289
 		{
290
-			$typeId = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' )->getId();
291
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
292
-			$items = $this->getListItems( $manager, $ids, $typeId, $userId );
290
+			$typeId = $this->getTypeItem('customer/lists/type', 'product', 'watch')->getId();
291
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
292
+			$items = $this->getListItems($manager, $ids, $typeId, $userId);
293 293
 
294
-			switch( $view->param( 'wat_action' ) )
294
+			switch ($view->param('wat_action'))
295 295
 			{
296 296
 				case 'add':
297 297
 
@@ -313,34 +313,34 @@  discard block
 block discarded – undo
313 313
 					 * @category User
314 314
 					 * @category Developer
315 315
 					 */
316
-					$max = $context->getConfig()->get( 'client/html/account/watch/standard/maxitems', 100 );
317
-					$cnt = count( $ids );
316
+					$max = $context->getConfig()->get('client/html/account/watch/standard/maxitems', 100);
317
+					$cnt = count($ids);
318 318
 
319
-					if( $this->checkLimit( $manager, $typeId, $userId, $max, $cnt ) === false )
319
+					if ($this->checkLimit($manager, $typeId, $userId, $max, $cnt) === false)
320 320
 					{
321
-						$error = sprintf( $context->getI18n()->dt( 'client', 'You can only watch up to %1$s products' ), $max );
322
-						$view->watchErrorList = $view->get( 'watchErrorList', array() ) + array( $error );
321
+						$error = sprintf($context->getI18n()->dt('client', 'You can only watch up to %1$s products'), $max);
322
+						$view->watchErrorList = $view->get('watchErrorList', array()) + array($error);
323 323
 						break;
324 324
 					}
325 325
 
326
-					$this->addItems( $manager, $items, $ids, $typeId, $userId );
326
+					$this->addItems($manager, $items, $ids, $typeId, $userId);
327 327
 					break;
328 328
 
329 329
 				case 'edit':
330 330
 
331 331
 					$config = array(
332
-						'timeframe' => $view->param( 'wat_timeframe', 7 ),
333
-						'pricevalue' => $view->param( 'wat_pricevalue', '0.00' ),
334
-						'price' => $view->param( 'wat_price', 0 ),
335
-						'stock' => $view->param( 'wat_stock', 0 ),
332
+						'timeframe' => $view->param('wat_timeframe', 7),
333
+						'pricevalue' => $view->param('wat_pricevalue', '0.00'),
334
+						'price' => $view->param('wat_price', 0),
335
+						'stock' => $view->param('wat_stock', 0),
336 336
 						'currency' => $context->getLocale()->getCurrencyId(),
337 337
 					);
338
-					$this->editItems( $manager, $items, $ids, $config );
338
+					$this->editItems($manager, $items, $ids, $config);
339 339
 					break;
340 340
 
341 341
 				case 'delete':
342 342
 
343
-					$this->deleteItems( $manager, $items, $ids );
343
+					$this->deleteItems($manager, $items, $ids);
344 344
 					break;
345 345
 			}
346 346
 		}
@@ -359,21 +359,21 @@  discard block
 block discarded – undo
359 359
 	 * @param integer $cnt Number of items that should be added
360 360
 	 * @return boolean True if items can be added, false if not
361 361
 	 */
362
-	protected function checkLimit( \Aimeos\MShop\Common\Manager\Iface $manager, $typeId, $userId, $max, $cnt )
362
+	protected function checkLimit(\Aimeos\MShop\Common\Manager\Iface $manager, $typeId, $userId, $max, $cnt)
363 363
 	{
364 364
 		$search = $manager->createSearch();
365 365
 		$expr = array(
366
-			$search->compare( '==', 'customer.lists.parentid', $userId ),
367
-			$search->compare( '==', 'customer.lists.typeid', $typeId ),
368
-			$search->compare( '==', 'customer.lists.domain', 'product' ),
366
+			$search->compare('==', 'customer.lists.parentid', $userId),
367
+			$search->compare('==', 'customer.lists.typeid', $typeId),
368
+			$search->compare('==', 'customer.lists.domain', 'product'),
369 369
 		);
370
-		$search->setConditions( $search->combine( '&&', $expr ) );
371
-		$search->setSlice( 0, 0 );
370
+		$search->setConditions($search->combine('&&', $expr));
371
+		$search->setSlice(0, 0);
372 372
 
373 373
 		$total = 0;
374
-		$manager->searchItems( $search, array(), $total );
374
+		$manager->searchItems($search, array(), $total);
375 375
 
376
-		if( $total + $cnt > $max ) {
376
+		if ($total + $cnt > $max) {
377 377
 			return false;
378 378
 		}
379 379
 
@@ -390,23 +390,23 @@  discard block
 block discarded – undo
390 390
 	 * @param string $typeId List type ID of the referenced items
391 391
 	 * @param string $userId Unique user ID
392 392
 	 */
393
-	protected function addItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, $typeId, $userId )
393
+	protected function addItems(\Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, $typeId, $userId)
394 394
 	{
395 395
 		$item = $manager->createItem();
396
-		$item->setParentId( $userId );
397
-		$item->setTypeId( $typeId );
398
-		$item->setDomain( 'product' );
399
-		$item->setStatus( 1 );
396
+		$item->setParentId($userId);
397
+		$item->setTypeId($typeId);
398
+		$item->setDomain('product');
399
+		$item->setStatus(1);
400 400
 
401
-		foreach( $ids as $id )
401
+		foreach ($ids as $id)
402 402
 		{
403
-			if( !isset( $listItems[$id] ) )
403
+			if (!isset($listItems[$id]))
404 404
 			{
405
-				$item->setId( null );
406
-				$item->setRefId( $id );
405
+				$item->setId(null);
406
+				$item->setRefId($id);
407 407
 
408
-				$manager->saveItem( $item );
409
-				$manager->moveItem( $item->getId() );
408
+				$manager->saveItem($item);
409
+				$manager->moveItem($item->getId());
410 410
 			}
411 411
 		}
412 412
 	}
@@ -419,18 +419,18 @@  discard block
 block discarded – undo
419 419
 	 * @param array $listItems Associative list of the reference IDs as keys and the list items as values
420 420
 	 * @param array $ids List of referenced IDs
421 421
 	 */
422
-	protected function deleteItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids )
422
+	protected function deleteItems(\Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids)
423 423
 	{
424 424
 		$listIds = array();
425 425
 
426
-		foreach( $ids as $id )
426
+		foreach ($ids as $id)
427 427
 		{
428
-			if( isset( $listItems[$id] ) ) {
428
+			if (isset($listItems[$id])) {
429 429
 				$listIds[] = $listItems[$id]->getId();
430 430
 			}
431 431
 		}
432 432
 
433
-		$manager->deleteItems( $listIds );
433
+		$manager->deleteItems($listIds);
434 434
 	}
435 435
 
436 436
 
@@ -442,19 +442,19 @@  discard block
 block discarded – undo
442 442
 	 * @param array $ids List of referenced IDs
443 443
 	 * @param array $config Configuration settins with "timeframe", "pricevalue", "price", "stock" and "currency"
444 444
 	 */
445
-	protected function editItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, array $config )
445
+	protected function editItems(\Aimeos\MShop\Common\Manager\Iface $manager, array $listItems, array $ids, array $config)
446 446
 	{
447
-		foreach( $ids as $id )
447
+		foreach ($ids as $id)
448 448
 		{
449
-			if( isset( $listItems[$id] ) )
449
+			if (isset($listItems[$id]))
450 450
 			{
451 451
 				$item = $listItems[$id];
452
-				$time = time() + ( $config['timeframe'] + 1 ) * 86400;
452
+				$time = time() + ($config['timeframe'] + 1) * 86400;
453 453
 
454
-				$item->setDateEnd( date( 'Y-m-d 00:00:00', $time ) );
455
-				$item->setConfig( $config );
454
+				$item->setDateEnd(date('Y-m-d 00:00:00', $time));
455
+				$item->setConfig($config);
456 456
 
457
-				$manager->saveItem( $item );
457
+				$manager->saveItem($item);
458 458
 			}
459 459
 		}
460 460
 	}
@@ -469,19 +469,19 @@  discard block
 block discarded – undo
469 469
 	 * @param string $userId Unique user ID
470 470
 	 * @return array Associative list of the reference IDs as keys and the list items as values
471 471
 	 */
472
-	protected function getListItems( \Aimeos\MShop\Common\Manager\Iface $manager, array $refIds, $typeId, $userId )
472
+	protected function getListItems(\Aimeos\MShop\Common\Manager\Iface $manager, array $refIds, $typeId, $userId)
473 473
 	{
474 474
 		$search = $manager->createSearch();
475 475
 		$expr = array(
476
-			$search->compare( '==', 'customer.lists.parentid', $userId ),
477
-			$search->compare( '==', 'customer.lists.refid', $refIds ),
478
-			$search->compare( '==', 'customer.lists.domain', 'product' ),
479
-			$search->compare( '==', 'customer.lists.typeid', $typeId ),
476
+			$search->compare('==', 'customer.lists.parentid', $userId),
477
+			$search->compare('==', 'customer.lists.refid', $refIds),
478
+			$search->compare('==', 'customer.lists.domain', 'product'),
479
+			$search->compare('==', 'customer.lists.typeid', $typeId),
480 480
 		);
481
-		$search->setConditions( $search->combine( '&&', $expr ) );
481
+		$search->setConditions($search->combine('&&', $expr));
482 482
 
483 483
 		$items = array();
484
-		foreach( $manager->searchItems( $search ) as $item ) {
484
+		foreach ($manager->searchItems($search) as $item) {
485 485
 			$items[$item->getRefId()] = $item;
486 486
 		}
487 487
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 */
497 497
 	protected function getSubClientNames()
498 498
 	{
499
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
499
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
500 500
 	}
501 501
 
502 502
 
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 	 * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
507 507
 	 * @return integer Page number starting from 1
508 508
 	 */
509
-	protected function getProductListPage( \Aimeos\MW\View\Iface $view )
509
+	protected function getProductListPage(\Aimeos\MW\View\Iface $view)
510 510
 	{
511
-		$page = (int) $view->param( 'wat_page', 1 );
512
-		return ( $page < 1 ? 1 : $page );
511
+		$page = (int) $view->param('wat_page', 1);
512
+		return ($page < 1 ? 1 : $page);
513 513
 	}
514 514
 
515 515
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 * @param \Aimeos\MW\View\Iface $view View instance with helper for retrieving the required parameters
520 520
 	 * @return integer Page size
521 521
 	 */
522
-	protected function getProductListSize( \Aimeos\MW\View\Iface $view )
522
+	protected function getProductListSize(\Aimeos\MW\View\Iface $view)
523 523
 	{
524 524
 		/** client/html/account/watch/size
525 525
 		 * The number of products shown in a list page for watch products
@@ -540,10 +540,10 @@  discard block
 block discarded – undo
540 540
 		 * @category Developer
541 541
 		 * @see client/html/catalog/lists/size
542 542
 		 */
543
-		$defaultSize = $this->getContext()->getConfig()->get( 'client/html/account/watch/size', 48 );
543
+		$defaultSize = $this->getContext()->getConfig()->get('client/html/account/watch/size', 48);
544 544
 
545
-		$size = (int) $view->param( 'watch-size', $defaultSize );
546
-		return ( $size < 1 || $size > 100 ? $defaultSize : $size );
545
+		$size = (int) $view->param('watch-size', $defaultSize);
546
+		return ($size < 1 || $size > 100 ? $defaultSize : $size);
547 547
 	}
548 548
 
549 549
 
@@ -555,33 +555,33 @@  discard block
 block discarded – undo
555 555
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
556 556
 	 * @return \Aimeos\MW\View\Iface Modified view object
557 557
 	 */
558
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
558
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
559 559
 	{
560
-		if( !isset( $this->cache ) )
560
+		if (!isset($this->cache))
561 561
 		{
562 562
 			$total = 0;
563 563
 			$productIds = array();
564 564
 			$context = $this->getContext();
565
-			$typeItem = $this->getTypeItem( 'customer/lists/type', 'product', 'watch' );
565
+			$typeItem = $this->getTypeItem('customer/lists/type', 'product', 'watch');
566 566
 
567
-			$size = $this->getProductListSize( $view );
568
-			$current = $this->getProductListPage( $view );
569
-			$last = ( $total != 0 ? ceil( $total / $size ) : 1 );
567
+			$size = $this->getProductListSize($view);
568
+			$current = $this->getProductListPage($view);
569
+			$last = ($total != 0 ? ceil($total / $size) : 1);
570 570
 
571 571
 
572
-			$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
572
+			$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
573 573
 
574 574
 			$search = $manager->createSearch();
575 575
 			$expr = array(
576
-				$search->compare( '==', 'customer.lists.parentid', $context->getUserId() ),
577
-				$search->compare( '==', 'customer.lists.typeid', $typeItem->getId() ),
578
-				$search->compare( '==', 'customer.lists.domain', 'product' ),
576
+				$search->compare('==', 'customer.lists.parentid', $context->getUserId()),
577
+				$search->compare('==', 'customer.lists.typeid', $typeItem->getId()),
578
+				$search->compare('==', 'customer.lists.domain', 'product'),
579 579
 			);
580
-			$search->setConditions( $search->combine( '&&', $expr ) );
581
-			$search->setSortations( array( $search->sort( '-', 'customer.lists.position' ) ) );
582
-			$search->setSlice( ( $current - 1 ) * $size, $size );
580
+			$search->setConditions($search->combine('&&', $expr));
581
+			$search->setSortations(array($search->sort('-', 'customer.lists.position')));
582
+			$search->setSlice(($current - 1) * $size, $size);
583 583
 
584
-			$view->watchListItems = $manager->searchItems( $search, array(), $total );
584
+			$view->watchListItems = $manager->searchItems($search, array(), $total);
585 585
 
586 586
 
587 587
 			/** client/html/account/watch/domains
@@ -600,19 +600,19 @@  discard block
 block discarded – undo
600 600
 			 * @category Developer
601 601
 			 * @see client/html/catalog/domains
602 602
 			 */
603
-			$default = array( 'text', 'price', 'media' );
604
-			$domains = $context->getConfig()->get( 'client/html/account/watch/domains', $default );
603
+			$default = array('text', 'price', 'media');
604
+			$domains = $context->getConfig()->get('client/html/account/watch/domains', $default);
605 605
 
606
-			foreach( $view->watchListItems as $listItem ) {
606
+			foreach ($view->watchListItems as $listItem) {
607 607
 				$productIds[] = $listItem->getRefId();
608 608
 			}
609 609
 
610
-			$controller = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
610
+			$controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
611 611
 
612
-			$view->watchProductItems = $controller->getProductItems( $productIds, $domains );
612
+			$view->watchProductItems = $controller->getProductItems($productIds, $domains);
613 613
 			$view->watchPageFirst = 1;
614
-			$view->watchPagePrev = ( $current > 1 ? $current - 1 : 1 );
615
-			$view->watchPageNext = ( $current < $last ? $current + 1 : $last );
614
+			$view->watchPagePrev = ($current > 1 ? $current - 1 : 1);
615
+			$view->watchPageNext = ($current < $last ? $current + 1 : $last);
616 616
 			$view->watchPageLast = $last;
617 617
 			$view->watchPageCurr = $current;
618 618
 
Please login to merge, or discard this patch.
html/src/Client/Html/Email/Delivery/Html/Summary/Service/Standard.php 3 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,233 +19,233 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Summary\Service\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Summary\Service\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/email/delivery/html/summary/service/standard/subparts
26
-	 * List of HTML sub-clients rendered within the summary service section of the delivery HTML e-mail
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2015.11
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/email/delivery/html/summary/service/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->serviceBody = $html;
79
-
80
-		/** client/html/email/delivery/html/summary/service/standard/template-body
81
-		 * Relative path to the HTML body template of the summary service section of the delivery HTML e-mail client.
82
-		 *
83
-		 * The template file contains the HTML code and processing instructions
84
-		 * to generate the result shown in the body of the frontend. The
85
-		 * configuration string is the path to the template file relative
86
-		 * to the templates directory (usually in client/html/templates).
87
-		 *
88
-		 * You can overwrite the template file configuration in extensions and
89
-		 * provide alternative templates. These alternative templates should be
90
-		 * named like the default one but with the string "standard" replaced by
91
-		 * an unique name. You may use the name of your project for this. If
92
-		 * you've implemented an alternative client class as well, "standard"
93
-		 * (second one) should be replaced by the name of the new class in lower
94
-		 * case.
95
-		 *
96
-		 * @param string Relative path to the template creating code for the HTML page body
97
-		 * @since 2015.11
98
-		 * @category Developer
99
-		 * @see client/html/email/delivery/html/summary/service/standard/template-header
100
-		 */
101
-		$tplconf = 'client/html/email/delivery/html/summary/service/standard/template-body';
102
-		$default = 'common/summary/service-body-default.php';
103
-
104
-		return $view->render( $view->config( $tplconf, $default ) );
105
-	}
106
-
107
-
108
-	/**
109
-	 * Returns the HTML string for insertion into the header.
110
-	 *
111
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
-	 * @param array &$tags Result array for the list of tags that are associated to the output
113
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
-	 * @return string|null String including HTML tags for the header on error
115
-	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
-	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
119
-
120
-		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
-		}
124
-		$view->serviceHeader = $html;
125
-
126
-		/** client/html/email/delivery/html/summary/service/standard/template-header
127
-		 * Relative path to the HTML header template of the summary service section of the delivery HTML e-mail client.
128
-		 *
129
-		 * The template file contains the HTML code and processing instructions
130
-		 * to generate the HTML code that is inserted into the HTML page header
131
-		 * of the rendered page in the frontend. The configuration string is the
132
-		 * path to the template file relative to the templates directory (usually
133
-		 * in client/html/templates).
134
-		 *
135
-		 * You can overwrite the template file configuration in extensions and
136
-		 * provide alternative templates. These alternative templates should be
137
-		 * named like the default one but with the string "standard" replaced by
138
-		 * an unique name. You may use the name of your project for this. If
139
-		 * you've implemented an alternative client class as well, "standard"
140
-		 * (second one) should be replaced by the name of the new class in lower
141
-		 * case.
142
-		 *
143
-		 * @param string Relative path to the template creating code for the HTML page head
144
-		 * @since 2015.11
145
-		 * @category Developer
146
-		 * @see client/html/email/delivery/html/summary/service/standard/template-body
147
-		 */
148
-		$tplconf = 'client/html/email/delivery/html/summary/service/standard/template-header';
149
-		$default = 'common/summary/service-header-default.php';
150
-
151
-		return $view->render( $view->config( $tplconf, $default ) );
152
-	}
153
-
154
-
155
-	/**
156
-	 * Returns the sub-client given by its name.
157
-	 *
158
-	 * @param string $type Name of the client type
159
-	 * @param string|null $name Name of the sub-client (Default if null)
160
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
161
-	 */
162
-	public function getSubClient( $type, $name = null )
163
-	{
164
-		/** client/html/email/delivery/html/summary/service/decorators/excludes
165
-		 * Excludes decorators added by the "common" option from the email delivery html summary service html client
166
-		 *
167
-		 * Decorators extend the functionality of a class by adding new aspects
168
-		 * (e.g. log what is currently done), executing the methods of the underlying
169
-		 * class only in certain conditions (e.g. only for logged in users) or
170
-		 * modify what is returned to the caller.
171
-		 *
172
-		 * This option allows you to remove a decorator added via
173
-		 * "client/html/common/decorators/default" before they are wrapped
174
-		 * around the html client.
175
-		 *
176
-		 *  client/html/email/delivery/html/summary/service/decorators/excludes = array( 'decorator1' )
177
-		 *
178
-		 * This would remove the decorator named "decorator1" from the list of
179
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
-		 * "client/html/common/decorators/default" to the html client.
181
-		 *
182
-		 * @param array List of decorator names
183
-		 * @since 2015.08
184
-		 * @category Developer
185
-		 * @see client/html/common/decorators/default
186
-		 * @see client/html/email/delivery/html/summary/service/decorators/global
187
-		 * @see client/html/email/delivery/html/summary/service/decorators/local
188
-		 */
189
-
190
-		/** client/html/email/delivery/html/summary/service/decorators/global
191
-		 * Adds a list of globally available decorators only to the email delivery html summary service html client
192
-		 *
193
-		 * Decorators extend the functionality of a class by adding new aspects
194
-		 * (e.g. log what is currently done), executing the methods of the underlying
195
-		 * class only in certain conditions (e.g. only for logged in users) or
196
-		 * modify what is returned to the caller.
197
-		 *
198
-		 * This option allows you to wrap global decorators
199
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
-		 *
201
-		 *  client/html/email/delivery/html/summary/service/decorators/global = array( 'decorator1' )
202
-		 *
203
-		 * This would add the decorator named "decorator1" defined by
204
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
-		 *
206
-		 * @param array List of decorator names
207
-		 * @since 2015.08
208
-		 * @category Developer
209
-		 * @see client/html/common/decorators/default
210
-		 * @see client/html/email/delivery/html/summary/service/decorators/excludes
211
-		 * @see client/html/email/delivery/html/summary/service/decorators/local
212
-		 */
213
-
214
-		/** client/html/email/delivery/html/summary/service/decorators/local
215
-		 * Adds a list of local decorators only to the email delivery html summary service html client
216
-		 *
217
-		 * Decorators extend the functionality of a class by adding new aspects
218
-		 * (e.g. log what is currently done), executing the methods of the underlying
219
-		 * class only in certain conditions (e.g. only for logged in users) or
220
-		 * modify what is returned to the caller.
221
-		 *
222
-		 * This option allows you to wrap local decorators
223
-		 * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
224
-		 *
225
-		 *  client/html/email/delivery/html/summary/service/decorators/local = array( 'decorator2' )
226
-		 *
227
-		 * This would add the decorator named "decorator2" defined by
228
-		 * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
229
-		 *
230
-		 * @param array List of decorator names
231
-		 * @since 2015.08
232
-		 * @category Developer
233
-		 * @see client/html/common/decorators/default
234
-		 * @see client/html/email/delivery/html/summary/service/decorators/excludes
235
-		 * @see client/html/email/delivery/html/summary/service/decorators/global
236
-		 */
237
-
238
-		return $this->createSubClient( 'email/delivery/html/summary/service/' . $type, $name );
239
-	}
240
-
241
-
242
-	/**
243
-	 * Returns the list of sub-client names configured for the client.
244
-	 *
245
-	 * @return array List of HTML client names
246
-	 */
247
-	protected function getSubClientNames()
248
-	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
-	}
25
+    /** client/html/email/delivery/html/summary/service/standard/subparts
26
+     * List of HTML sub-clients rendered within the summary service section of the delivery HTML e-mail
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2015.11
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/email/delivery/html/summary/service/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->serviceBody = $html;
79
+
80
+        /** client/html/email/delivery/html/summary/service/standard/template-body
81
+         * Relative path to the HTML body template of the summary service section of the delivery HTML e-mail client.
82
+         *
83
+         * The template file contains the HTML code and processing instructions
84
+         * to generate the result shown in the body of the frontend. The
85
+         * configuration string is the path to the template file relative
86
+         * to the templates directory (usually in client/html/templates).
87
+         *
88
+         * You can overwrite the template file configuration in extensions and
89
+         * provide alternative templates. These alternative templates should be
90
+         * named like the default one but with the string "standard" replaced by
91
+         * an unique name. You may use the name of your project for this. If
92
+         * you've implemented an alternative client class as well, "standard"
93
+         * (second one) should be replaced by the name of the new class in lower
94
+         * case.
95
+         *
96
+         * @param string Relative path to the template creating code for the HTML page body
97
+         * @since 2015.11
98
+         * @category Developer
99
+         * @see client/html/email/delivery/html/summary/service/standard/template-header
100
+         */
101
+        $tplconf = 'client/html/email/delivery/html/summary/service/standard/template-body';
102
+        $default = 'common/summary/service-body-default.php';
103
+
104
+        return $view->render( $view->config( $tplconf, $default ) );
105
+    }
106
+
107
+
108
+    /**
109
+     * Returns the HTML string for insertion into the header.
110
+     *
111
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
+     * @param array &$tags Result array for the list of tags that are associated to the output
113
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
+     * @return string|null String including HTML tags for the header on error
115
+     */
116
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
+    {
118
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
119
+
120
+        $html = '';
121
+        foreach( $this->getSubClients() as $subclient ) {
122
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+        }
124
+        $view->serviceHeader = $html;
125
+
126
+        /** client/html/email/delivery/html/summary/service/standard/template-header
127
+         * Relative path to the HTML header template of the summary service section of the delivery HTML e-mail client.
128
+         *
129
+         * The template file contains the HTML code and processing instructions
130
+         * to generate the HTML code that is inserted into the HTML page header
131
+         * of the rendered page in the frontend. The configuration string is the
132
+         * path to the template file relative to the templates directory (usually
133
+         * in client/html/templates).
134
+         *
135
+         * You can overwrite the template file configuration in extensions and
136
+         * provide alternative templates. These alternative templates should be
137
+         * named like the default one but with the string "standard" replaced by
138
+         * an unique name. You may use the name of your project for this. If
139
+         * you've implemented an alternative client class as well, "standard"
140
+         * (second one) should be replaced by the name of the new class in lower
141
+         * case.
142
+         *
143
+         * @param string Relative path to the template creating code for the HTML page head
144
+         * @since 2015.11
145
+         * @category Developer
146
+         * @see client/html/email/delivery/html/summary/service/standard/template-body
147
+         */
148
+        $tplconf = 'client/html/email/delivery/html/summary/service/standard/template-header';
149
+        $default = 'common/summary/service-header-default.php';
150
+
151
+        return $view->render( $view->config( $tplconf, $default ) );
152
+    }
153
+
154
+
155
+    /**
156
+     * Returns the sub-client given by its name.
157
+     *
158
+     * @param string $type Name of the client type
159
+     * @param string|null $name Name of the sub-client (Default if null)
160
+     * @return \Aimeos\Client\Html\Iface Sub-client object
161
+     */
162
+    public function getSubClient( $type, $name = null )
163
+    {
164
+        /** client/html/email/delivery/html/summary/service/decorators/excludes
165
+         * Excludes decorators added by the "common" option from the email delivery html summary service html client
166
+         *
167
+         * Decorators extend the functionality of a class by adding new aspects
168
+         * (e.g. log what is currently done), executing the methods of the underlying
169
+         * class only in certain conditions (e.g. only for logged in users) or
170
+         * modify what is returned to the caller.
171
+         *
172
+         * This option allows you to remove a decorator added via
173
+         * "client/html/common/decorators/default" before they are wrapped
174
+         * around the html client.
175
+         *
176
+         *  client/html/email/delivery/html/summary/service/decorators/excludes = array( 'decorator1' )
177
+         *
178
+         * This would remove the decorator named "decorator1" from the list of
179
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
+         * "client/html/common/decorators/default" to the html client.
181
+         *
182
+         * @param array List of decorator names
183
+         * @since 2015.08
184
+         * @category Developer
185
+         * @see client/html/common/decorators/default
186
+         * @see client/html/email/delivery/html/summary/service/decorators/global
187
+         * @see client/html/email/delivery/html/summary/service/decorators/local
188
+         */
189
+
190
+        /** client/html/email/delivery/html/summary/service/decorators/global
191
+         * Adds a list of globally available decorators only to the email delivery html summary service html client
192
+         *
193
+         * Decorators extend the functionality of a class by adding new aspects
194
+         * (e.g. log what is currently done), executing the methods of the underlying
195
+         * class only in certain conditions (e.g. only for logged in users) or
196
+         * modify what is returned to the caller.
197
+         *
198
+         * This option allows you to wrap global decorators
199
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
+         *
201
+         *  client/html/email/delivery/html/summary/service/decorators/global = array( 'decorator1' )
202
+         *
203
+         * This would add the decorator named "decorator1" defined by
204
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
+         *
206
+         * @param array List of decorator names
207
+         * @since 2015.08
208
+         * @category Developer
209
+         * @see client/html/common/decorators/default
210
+         * @see client/html/email/delivery/html/summary/service/decorators/excludes
211
+         * @see client/html/email/delivery/html/summary/service/decorators/local
212
+         */
213
+
214
+        /** client/html/email/delivery/html/summary/service/decorators/local
215
+         * Adds a list of local decorators only to the email delivery html summary service html client
216
+         *
217
+         * Decorators extend the functionality of a class by adding new aspects
218
+         * (e.g. log what is currently done), executing the methods of the underlying
219
+         * class only in certain conditions (e.g. only for logged in users) or
220
+         * modify what is returned to the caller.
221
+         *
222
+         * This option allows you to wrap local decorators
223
+         * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
224
+         *
225
+         *  client/html/email/delivery/html/summary/service/decorators/local = array( 'decorator2' )
226
+         *
227
+         * This would add the decorator named "decorator2" defined by
228
+         * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
229
+         *
230
+         * @param array List of decorator names
231
+         * @since 2015.08
232
+         * @category Developer
233
+         * @see client/html/common/decorators/default
234
+         * @see client/html/email/delivery/html/summary/service/decorators/excludes
235
+         * @see client/html/email/delivery/html/summary/service/decorators/global
236
+         */
237
+
238
+        return $this->createSubClient( 'email/delivery/html/summary/service/' . $type, $name );
239
+    }
240
+
241
+
242
+    /**
243
+     * Returns the list of sub-client names configured for the client.
244
+     *
245
+     * @return array List of HTML client names
246
+     */
247
+    protected function getSubClientNames()
248
+    {
249
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+    }
251 251
 }
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->serviceBody = $html;
79 79
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$tplconf = 'client/html/email/delivery/html/summary/service/standard/template-body';
102 102
 		$default = 'common/summary/service-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
104
+		return $view->render($view->config($tplconf, $default));
105 105
 	}
106 106
 
107 107
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114 114
 	 * @return string|null String including HTML tags for the header on error
115 115
 	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
117 117
 	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
119 119
 
120 120
 		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
121
+		foreach ($this->getSubClients() as $subclient) {
122
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
123 123
 		}
124 124
 		$view->serviceHeader = $html;
125 125
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$tplconf = 'client/html/email/delivery/html/summary/service/standard/template-header';
149 149
 		$default = 'common/summary/service-header-default.php';
150 150
 
151
-		return $view->render( $view->config( $tplconf, $default ) );
151
+		return $view->render($view->config($tplconf, $default));
152 152
 	}
153 153
 
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string|null $name Name of the sub-client (Default if null)
160 160
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
161 161
 	 */
162
-	public function getSubClient( $type, $name = null )
162
+	public function getSubClient($type, $name = null)
163 163
 	{
164 164
 		/** client/html/email/delivery/html/summary/service/decorators/excludes
165 165
 		 * Excludes decorators added by the "common" option from the email delivery html summary service html client
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		 * @see client/html/email/delivery/html/summary/service/decorators/global
236 236
 		 */
237 237
 
238
-		return $this->createSubClient( 'email/delivery/html/summary/service/' . $type, $name );
238
+		return $this->createSubClient('email/delivery/html/summary/service/'.$type, $name);
239 239
 	}
240 240
 
241 241
 
@@ -246,6 +246,6 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	protected function getSubClientNames()
248 248
 	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
249
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
250 250
 	}
251 251
 }
Please login to merge, or discard this patch.
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.
client/html/src/Client/Html/Email/Delivery/Html/Summary/Coupon/Standard.php 3 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,233 +19,233 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Summary\Coupon\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Summary\Coupon\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/email/delivery/html/summary/coupon/standard/subparts
26
-	 * List of HTML sub-clients rendered within the summary coupon section of the delivery HTML e-mail
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2015.11
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/email/delivery/html/summary/coupon/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->couponBody = $html;
79
-
80
-		/** client/html/email/delivery/html/summary/coupon/standard/template-body
81
-		 * Relative path to the HTML body template of the summary coupon section of the delivery HTML e-mail client.
82
-		 *
83
-		 * The template file contains the HTML code and processing instructions
84
-		 * to generate the result shown in the body of the frontend. The
85
-		 * configuration string is the path to the template file relative
86
-		 * to the templates directory (usually in client/html/templates).
87
-		 *
88
-		 * You can overwrite the template file configuration in extensions and
89
-		 * provide alternative templates. These alternative templates should be
90
-		 * named like the default one but with the string "standard" replaced by
91
-		 * an unique name. You may use the name of your project for this. If
92
-		 * you've implemented an alternative client class as well, "standard"
93
-		 * (second one) should be replaced by the name of the new class in lower
94
-		 * case.
95
-		 *
96
-		 * @param string Relative path to the template creating code for the HTML page body
97
-		 * @since 2015.11
98
-		 * @category Developer
99
-		 * @see client/html/email/delivery/html/summary/coupon/standard/template-header
100
-		 */
101
-		$tplconf = 'client/html/email/delivery/html/summary/coupon/standard/template-body';
102
-		$default = 'common/summary/coupon-body-default.php';
103
-
104
-		return $view->render( $view->config( $tplconf, $default ) );
105
-	}
106
-
107
-
108
-	/**
109
-	 * Returns the HTML string for insertion into the header.
110
-	 *
111
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
-	 * @param array &$tags Result array for the list of tags that are associated to the output
113
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
-	 * @return string|null String including HTML tags for the header on error
115
-	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
-	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
119
-
120
-		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
-		}
124
-		$view->couponHeader = $html;
125
-
126
-		/** client/html/email/delivery/html/summary/coupon/standard/template-header
127
-		 * Relative path to the HTML header template of the summary coupon section of the delivery HTML e-mail client.
128
-		 *
129
-		 * The template file contains the HTML code and processing instructions
130
-		 * to generate the HTML code that is inserted into the HTML page header
131
-		 * of the rendered page in the frontend. The configuration string is the
132
-		 * path to the template file relative to the templates directory (usually
133
-		 * in client/html/templates).
134
-		 *
135
-		 * You can overwrite the template file configuration in extensions and
136
-		 * provide alternative templates. These alternative templates should be
137
-		 * named like the default one but with the string "standard" replaced by
138
-		 * an unique name. You may use the name of your project for this. If
139
-		 * you've implemented an alternative client class as well, "standard"
140
-		 * (second one) should be replaced by the name of the new class in lower
141
-		 * case.
142
-		 *
143
-		 * @param string Relative path to the template creating code for the HTML page head
144
-		 * @since 2015.11
145
-		 * @category Developer
146
-		 * @see client/html/email/delivery/html/summary/coupon/standard/template-body
147
-		 */
148
-		$tplconf = 'client/html/email/delivery/html/summary/coupon/standard/template-header';
149
-		$default = 'common/summary/coupon-header-default.php';
150
-
151
-		return $view->render( $view->config( $tplconf, $default ) );
152
-	}
153
-
154
-
155
-	/**
156
-	 * Returns the sub-client given by its name.
157
-	 *
158
-	 * @param string $type Name of the client type
159
-	 * @param string|null $name Name of the sub-client (Default if null)
160
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
161
-	 */
162
-	public function getSubClient( $type, $name = null )
163
-	{
164
-		/** client/html/email/delivery/html/summary/coupon/decorators/excludes
165
-		 * Excludes decorators added by the "common" option from the email delivery html summary coupon html client
166
-		 *
167
-		 * Decorators extend the functionality of a class by adding new aspects
168
-		 * (e.g. log what is currently done), executing the methods of the underlying
169
-		 * class only in certain conditions (e.g. only for logged in users) or
170
-		 * modify what is returned to the caller.
171
-		 *
172
-		 * This option allows you to remove a decorator added via
173
-		 * "client/html/common/decorators/default" before they are wrapped
174
-		 * around the html client.
175
-		 *
176
-		 *  client/html/email/delivery/html/summary/coupon/decorators/excludes = array( 'decorator1' )
177
-		 *
178
-		 * This would remove the decorator named "decorator1" from the list of
179
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
-		 * "client/html/common/decorators/default" to the html client.
181
-		 *
182
-		 * @param array List of decorator names
183
-		 * @since 2015.08
184
-		 * @category Developer
185
-		 * @see client/html/common/decorators/default
186
-		 * @see client/html/email/delivery/html/summary/coupon/decorators/global
187
-		 * @see client/html/email/delivery/html/summary/coupon/decorators/local
188
-		 */
189
-
190
-		/** client/html/email/delivery/html/summary/coupon/decorators/global
191
-		 * Adds a list of globally available decorators only to the email delivery html summary coupon html client
192
-		 *
193
-		 * Decorators extend the functionality of a class by adding new aspects
194
-		 * (e.g. log what is currently done), executing the methods of the underlying
195
-		 * class only in certain conditions (e.g. only for logged in users) or
196
-		 * modify what is returned to the caller.
197
-		 *
198
-		 * This option allows you to wrap global decorators
199
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
-		 *
201
-		 *  client/html/email/delivery/html/summary/coupon/decorators/global = array( 'decorator1' )
202
-		 *
203
-		 * This would add the decorator named "decorator1" defined by
204
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
-		 *
206
-		 * @param array List of decorator names
207
-		 * @since 2015.08
208
-		 * @category Developer
209
-		 * @see client/html/common/decorators/default
210
-		 * @see client/html/email/delivery/html/summary/coupon/decorators/excludes
211
-		 * @see client/html/email/delivery/html/summary/coupon/decorators/local
212
-		 */
213
-
214
-		/** client/html/email/delivery/html/summary/coupon/decorators/local
215
-		 * Adds a list of local decorators only to the email delivery html summary coupon html client
216
-		 *
217
-		 * Decorators extend the functionality of a class by adding new aspects
218
-		 * (e.g. log what is currently done), executing the methods of the underlying
219
-		 * class only in certain conditions (e.g. only for logged in users) or
220
-		 * modify what is returned to the caller.
221
-		 *
222
-		 * This option allows you to wrap local decorators
223
-		 * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
224
-		 *
225
-		 *  client/html/email/delivery/html/summary/coupon/decorators/local = array( 'decorator2' )
226
-		 *
227
-		 * This would add the decorator named "decorator2" defined by
228
-		 * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
229
-		 *
230
-		 * @param array List of decorator names
231
-		 * @since 2015.08
232
-		 * @category Developer
233
-		 * @see client/html/common/decorators/default
234
-		 * @see client/html/email/delivery/html/summary/coupon/decorators/excludes
235
-		 * @see client/html/email/delivery/html/summary/coupon/decorators/global
236
-		 */
237
-
238
-		return $this->createSubClient( 'email/delivery/html/summary/coupon/' . $type, $name );
239
-	}
240
-
241
-
242
-	/**
243
-	 * Returns the list of sub-client names configured for the client.
244
-	 *
245
-	 * @return array List of HTML client names
246
-	 */
247
-	protected function getSubClientNames()
248
-	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
-	}
25
+    /** client/html/email/delivery/html/summary/coupon/standard/subparts
26
+     * List of HTML sub-clients rendered within the summary coupon section of the delivery HTML e-mail
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2015.11
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/email/delivery/html/summary/coupon/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->couponBody = $html;
79
+
80
+        /** client/html/email/delivery/html/summary/coupon/standard/template-body
81
+         * Relative path to the HTML body template of the summary coupon section of the delivery HTML e-mail client.
82
+         *
83
+         * The template file contains the HTML code and processing instructions
84
+         * to generate the result shown in the body of the frontend. The
85
+         * configuration string is the path to the template file relative
86
+         * to the templates directory (usually in client/html/templates).
87
+         *
88
+         * You can overwrite the template file configuration in extensions and
89
+         * provide alternative templates. These alternative templates should be
90
+         * named like the default one but with the string "standard" replaced by
91
+         * an unique name. You may use the name of your project for this. If
92
+         * you've implemented an alternative client class as well, "standard"
93
+         * (second one) should be replaced by the name of the new class in lower
94
+         * case.
95
+         *
96
+         * @param string Relative path to the template creating code for the HTML page body
97
+         * @since 2015.11
98
+         * @category Developer
99
+         * @see client/html/email/delivery/html/summary/coupon/standard/template-header
100
+         */
101
+        $tplconf = 'client/html/email/delivery/html/summary/coupon/standard/template-body';
102
+        $default = 'common/summary/coupon-body-default.php';
103
+
104
+        return $view->render( $view->config( $tplconf, $default ) );
105
+    }
106
+
107
+
108
+    /**
109
+     * Returns the HTML string for insertion into the header.
110
+     *
111
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
+     * @param array &$tags Result array for the list of tags that are associated to the output
113
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
+     * @return string|null String including HTML tags for the header on error
115
+     */
116
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
+    {
118
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
119
+
120
+        $html = '';
121
+        foreach( $this->getSubClients() as $subclient ) {
122
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+        }
124
+        $view->couponHeader = $html;
125
+
126
+        /** client/html/email/delivery/html/summary/coupon/standard/template-header
127
+         * Relative path to the HTML header template of the summary coupon section of the delivery HTML e-mail client.
128
+         *
129
+         * The template file contains the HTML code and processing instructions
130
+         * to generate the HTML code that is inserted into the HTML page header
131
+         * of the rendered page in the frontend. The configuration string is the
132
+         * path to the template file relative to the templates directory (usually
133
+         * in client/html/templates).
134
+         *
135
+         * You can overwrite the template file configuration in extensions and
136
+         * provide alternative templates. These alternative templates should be
137
+         * named like the default one but with the string "standard" replaced by
138
+         * an unique name. You may use the name of your project for this. If
139
+         * you've implemented an alternative client class as well, "standard"
140
+         * (second one) should be replaced by the name of the new class in lower
141
+         * case.
142
+         *
143
+         * @param string Relative path to the template creating code for the HTML page head
144
+         * @since 2015.11
145
+         * @category Developer
146
+         * @see client/html/email/delivery/html/summary/coupon/standard/template-body
147
+         */
148
+        $tplconf = 'client/html/email/delivery/html/summary/coupon/standard/template-header';
149
+        $default = 'common/summary/coupon-header-default.php';
150
+
151
+        return $view->render( $view->config( $tplconf, $default ) );
152
+    }
153
+
154
+
155
+    /**
156
+     * Returns the sub-client given by its name.
157
+     *
158
+     * @param string $type Name of the client type
159
+     * @param string|null $name Name of the sub-client (Default if null)
160
+     * @return \Aimeos\Client\Html\Iface Sub-client object
161
+     */
162
+    public function getSubClient( $type, $name = null )
163
+    {
164
+        /** client/html/email/delivery/html/summary/coupon/decorators/excludes
165
+         * Excludes decorators added by the "common" option from the email delivery html summary coupon html client
166
+         *
167
+         * Decorators extend the functionality of a class by adding new aspects
168
+         * (e.g. log what is currently done), executing the methods of the underlying
169
+         * class only in certain conditions (e.g. only for logged in users) or
170
+         * modify what is returned to the caller.
171
+         *
172
+         * This option allows you to remove a decorator added via
173
+         * "client/html/common/decorators/default" before they are wrapped
174
+         * around the html client.
175
+         *
176
+         *  client/html/email/delivery/html/summary/coupon/decorators/excludes = array( 'decorator1' )
177
+         *
178
+         * This would remove the decorator named "decorator1" from the list of
179
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
+         * "client/html/common/decorators/default" to the html client.
181
+         *
182
+         * @param array List of decorator names
183
+         * @since 2015.08
184
+         * @category Developer
185
+         * @see client/html/common/decorators/default
186
+         * @see client/html/email/delivery/html/summary/coupon/decorators/global
187
+         * @see client/html/email/delivery/html/summary/coupon/decorators/local
188
+         */
189
+
190
+        /** client/html/email/delivery/html/summary/coupon/decorators/global
191
+         * Adds a list of globally available decorators only to the email delivery html summary coupon html client
192
+         *
193
+         * Decorators extend the functionality of a class by adding new aspects
194
+         * (e.g. log what is currently done), executing the methods of the underlying
195
+         * class only in certain conditions (e.g. only for logged in users) or
196
+         * modify what is returned to the caller.
197
+         *
198
+         * This option allows you to wrap global decorators
199
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
+         *
201
+         *  client/html/email/delivery/html/summary/coupon/decorators/global = array( 'decorator1' )
202
+         *
203
+         * This would add the decorator named "decorator1" defined by
204
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
+         *
206
+         * @param array List of decorator names
207
+         * @since 2015.08
208
+         * @category Developer
209
+         * @see client/html/common/decorators/default
210
+         * @see client/html/email/delivery/html/summary/coupon/decorators/excludes
211
+         * @see client/html/email/delivery/html/summary/coupon/decorators/local
212
+         */
213
+
214
+        /** client/html/email/delivery/html/summary/coupon/decorators/local
215
+         * Adds a list of local decorators only to the email delivery html summary coupon html client
216
+         *
217
+         * Decorators extend the functionality of a class by adding new aspects
218
+         * (e.g. log what is currently done), executing the methods of the underlying
219
+         * class only in certain conditions (e.g. only for logged in users) or
220
+         * modify what is returned to the caller.
221
+         *
222
+         * This option allows you to wrap local decorators
223
+         * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
224
+         *
225
+         *  client/html/email/delivery/html/summary/coupon/decorators/local = array( 'decorator2' )
226
+         *
227
+         * This would add the decorator named "decorator2" defined by
228
+         * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
229
+         *
230
+         * @param array List of decorator names
231
+         * @since 2015.08
232
+         * @category Developer
233
+         * @see client/html/common/decorators/default
234
+         * @see client/html/email/delivery/html/summary/coupon/decorators/excludes
235
+         * @see client/html/email/delivery/html/summary/coupon/decorators/global
236
+         */
237
+
238
+        return $this->createSubClient( 'email/delivery/html/summary/coupon/' . $type, $name );
239
+    }
240
+
241
+
242
+    /**
243
+     * Returns the list of sub-client names configured for the client.
244
+     *
245
+     * @return array List of HTML client names
246
+     */
247
+    protected function getSubClientNames()
248
+    {
249
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+    }
251 251
 }
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->couponBody = $html;
79 79
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$tplconf = 'client/html/email/delivery/html/summary/coupon/standard/template-body';
102 102
 		$default = 'common/summary/coupon-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
104
+		return $view->render($view->config($tplconf, $default));
105 105
 	}
106 106
 
107 107
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114 114
 	 * @return string|null String including HTML tags for the header on error
115 115
 	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
117 117
 	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
119 119
 
120 120
 		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
121
+		foreach ($this->getSubClients() as $subclient) {
122
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
123 123
 		}
124 124
 		$view->couponHeader = $html;
125 125
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$tplconf = 'client/html/email/delivery/html/summary/coupon/standard/template-header';
149 149
 		$default = 'common/summary/coupon-header-default.php';
150 150
 
151
-		return $view->render( $view->config( $tplconf, $default ) );
151
+		return $view->render($view->config($tplconf, $default));
152 152
 	}
153 153
 
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string|null $name Name of the sub-client (Default if null)
160 160
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
161 161
 	 */
162
-	public function getSubClient( $type, $name = null )
162
+	public function getSubClient($type, $name = null)
163 163
 	{
164 164
 		/** client/html/email/delivery/html/summary/coupon/decorators/excludes
165 165
 		 * Excludes decorators added by the "common" option from the email delivery html summary coupon html client
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		 * @see client/html/email/delivery/html/summary/coupon/decorators/global
236 236
 		 */
237 237
 
238
-		return $this->createSubClient( 'email/delivery/html/summary/coupon/' . $type, $name );
238
+		return $this->createSubClient('email/delivery/html/summary/coupon/'.$type, $name);
239 239
 	}
240 240
 
241 241
 
@@ -246,6 +246,6 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	protected function getSubClientNames()
248 248
 	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
249
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
250 250
 	}
251 251
 }
Please login to merge, or discard this patch.
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.
client/html/src/Client/Html/Email/Delivery/Html/Summary/Detail/Standard.php 3 patches
Indentation   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,254 +19,254 @@
 block discarded – undo
19 19
  * @subpackage Html
20 20
  */
21 21
 class Standard
22
-	extends \Aimeos\Client\Html\Common\Summary\Detail\Base
23
-	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
22
+    extends \Aimeos\Client\Html\Common\Summary\Detail\Base
23
+    implements \Aimeos\Client\Html\Common\Client\Factory\Iface
24 24
 {
25
-	/** client/html/email/delivery/html/summary/detail/standard/subparts
26
-	 * List of HTML sub-clients rendered within the summary detail section of the delivery HTML e-mail
27
-	 *
28
-	 * The output of the frontend is composed of the code generated by the HTML
29
-	 * clients. Each HTML client can consist of serveral (or none) sub-clients
30
-	 * that are responsible for rendering certain sub-parts of the output. The
31
-	 * sub-clients can contain HTML clients themselves and therefore a
32
-	 * hierarchical tree of HTML clients is composed. Each HTML client creates
33
-	 * the output that is placed inside the container of its parent.
34
-	 *
35
-	 * At first, always the HTML code generated by the parent is printed, then
36
-	 * the HTML code of its sub-clients. The order of the HTML sub-clients
37
-	 * determines the order of the output of these sub-clients inside the parent
38
-	 * container. If the configured list of clients is
39
-	 *
40
-	 *  array( "subclient1", "subclient2" )
41
-	 *
42
-	 * you can easily change the order of the output by reordering the subparts:
43
-	 *
44
-	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
-	 *
46
-	 * You can also remove one or more parts if they shouldn't be rendered:
47
-	 *
48
-	 *  client/html/<clients>/subparts = array( "subclient1" )
49
-	 *
50
-	 * As the clients only generates structural HTML, the layout defined via CSS
51
-	 * should support adding, removing or reordering content by a fluid like
52
-	 * design.
53
-	 *
54
-	 * @param array List of sub-client names
55
-	 * @since 2015.11
56
-	 * @category Developer
57
-	 */
58
-	private $subPartPath = 'client/html/email/delivery/html/summary/detail/standard/subparts';
59
-	private $subPartNames = array();
25
+    /** client/html/email/delivery/html/summary/detail/standard/subparts
26
+     * List of HTML sub-clients rendered within the summary detail section of the delivery HTML e-mail
27
+     *
28
+     * The output of the frontend is composed of the code generated by the HTML
29
+     * clients. Each HTML client can consist of serveral (or none) sub-clients
30
+     * that are responsible for rendering certain sub-parts of the output. The
31
+     * sub-clients can contain HTML clients themselves and therefore a
32
+     * hierarchical tree of HTML clients is composed. Each HTML client creates
33
+     * the output that is placed inside the container of its parent.
34
+     *
35
+     * At first, always the HTML code generated by the parent is printed, then
36
+     * the HTML code of its sub-clients. The order of the HTML sub-clients
37
+     * determines the order of the output of these sub-clients inside the parent
38
+     * container. If the configured list of clients is
39
+     *
40
+     *  array( "subclient1", "subclient2" )
41
+     *
42
+     * you can easily change the order of the output by reordering the subparts:
43
+     *
44
+     *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
45
+     *
46
+     * You can also remove one or more parts if they shouldn't be rendered:
47
+     *
48
+     *  client/html/<clients>/subparts = array( "subclient1" )
49
+     *
50
+     * As the clients only generates structural HTML, the layout defined via CSS
51
+     * should support adding, removing or reordering content by a fluid like
52
+     * design.
53
+     *
54
+     * @param array List of sub-client names
55
+     * @since 2015.11
56
+     * @category Developer
57
+     */
58
+    private $subPartPath = 'client/html/email/delivery/html/summary/detail/standard/subparts';
59
+    private $subPartNames = array();
60 60
 
61 61
 
62
-	/**
63
-	 * Returns the HTML code for insertion into the body.
64
-	 *
65
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
66
-	 * @param array &$tags Result array for the list of tags that are associated to the output
67
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68
-	 * @return string HTML code
69
-	*/
70
-	public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
-	{
72
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
62
+    /**
63
+     * Returns the HTML code for insertion into the body.
64
+     *
65
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
66
+     * @param array &$tags Result array for the list of tags that are associated to the output
67
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
68
+     * @return string HTML code
69
+     */
70
+    public function getBody( $uid = '', array &$tags = array(), &$expire = null )
71
+    {
72
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
73 73
 
74
-		$html = '';
75
-		foreach( $this->getSubClients() as $subclient ) {
76
-			$html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
77
-		}
78
-		$view->detailBody = $html;
74
+        $html = '';
75
+        foreach( $this->getSubClients() as $subclient ) {
76
+            $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire );
77
+        }
78
+        $view->detailBody = $html;
79 79
 
80
-		/** client/html/email/delivery/html/summary/detail/standard/template-body
81
-		 * Relative path to the HTML body template of the summary detail section of the delivery HTML e-mail client.
82
-		 *
83
-		 * The template file contains the HTML code and processing instructions
84
-		 * to generate the result shown in the body of the frontend. The
85
-		 * configuration string is the path to the template file relative
86
-		 * to the templates directory (usually in client/html/templates).
87
-		 *
88
-		 * You can overwrite the template file configuration in extensions and
89
-		 * provide alternative templates. These alternative templates should be
90
-		 * named like the default one but with the string "standard" replaced by
91
-		 * an unique name. You may use the name of your project for this. If
92
-		 * you've implemented an alternative client class as well, "standard"
93
-		 * (second one) should be replaced by the name of the new class in lower
94
-		 * case.
95
-		 *
96
-		 * @param string Relative path to the template creating code for the HTML page body
97
-		 * @since 2015.11
98
-		 * @category Developer
99
-		 * @see client/html/email/delivery/html/summary/detail/standard/template-header
100
-		 */
101
-		$tplconf = 'client/html/email/delivery/html/summary/detail/standard/template-body';
102
-		$default = 'common/summary/detail-body-default.php';
80
+        /** client/html/email/delivery/html/summary/detail/standard/template-body
81
+         * Relative path to the HTML body template of the summary detail section of the delivery HTML e-mail client.
82
+         *
83
+         * The template file contains the HTML code and processing instructions
84
+         * to generate the result shown in the body of the frontend. The
85
+         * configuration string is the path to the template file relative
86
+         * to the templates directory (usually in client/html/templates).
87
+         *
88
+         * You can overwrite the template file configuration in extensions and
89
+         * provide alternative templates. These alternative templates should be
90
+         * named like the default one but with the string "standard" replaced by
91
+         * an unique name. You may use the name of your project for this. If
92
+         * you've implemented an alternative client class as well, "standard"
93
+         * (second one) should be replaced by the name of the new class in lower
94
+         * case.
95
+         *
96
+         * @param string Relative path to the template creating code for the HTML page body
97
+         * @since 2015.11
98
+         * @category Developer
99
+         * @see client/html/email/delivery/html/summary/detail/standard/template-header
100
+         */
101
+        $tplconf = 'client/html/email/delivery/html/summary/detail/standard/template-body';
102
+        $default = 'common/summary/detail-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
105
-	}
104
+        return $view->render( $view->config( $tplconf, $default ) );
105
+    }
106 106
 
107 107
 
108
-	/**
109
-	 * Returns the HTML string for insertion into the header.
110
-	 *
111
-	 * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
-	 * @param array &$tags Result array for the list of tags that are associated to the output
113
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
-	 * @return string|null String including HTML tags for the header on error
115
-	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
-	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
108
+    /**
109
+     * Returns the HTML string for insertion into the header.
110
+     *
111
+     * @param string $uid Unique identifier for the output if the content is placed more than once on the same page
112
+     * @param array &$tags Result array for the list of tags that are associated to the output
113
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114
+     * @return string|null String including HTML tags for the header on error
115
+     */
116
+    public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
117
+    {
118
+        $view = $this->setViewParams( $this->getView(), $tags, $expire );
119 119
 
120
-		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
-		}
124
-		$view->detailHeader = $html;
120
+        $html = '';
121
+        foreach( $this->getSubClients() as $subclient ) {
122
+            $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
123
+        }
124
+        $view->detailHeader = $html;
125 125
 
126
-		/** client/html/email/delivery/html/summary/detail/standard/template-header
127
-		 * Relative path to the HTML header template of the summary detail section of the delivery HTML e-mail client.
128
-		 *
129
-		 * The template file contains the HTML code and processing instructions
130
-		 * to generate the HTML code that is inserted into the HTML page header
131
-		 * of the rendered page in the frontend. The configuration string is the
132
-		 * path to the template file relative to the templates directory (usually
133
-		 * in client/html/templates).
134
-		 *
135
-		 * You can overwrite the template file configuration in extensions and
136
-		 * provide alternative templates. These alternative templates should be
137
-		 * named like the default one but with the string "standard" replaced by
138
-		 * an unique name. You may use the name of your project for this. If
139
-		 * you've implemented an alternative client class as well, "standard"
140
-		 * (second one) should be replaced by the name of the new class in lower
141
-		 * case.
142
-		 *
143
-		 * @param string Relative path to the template creating code for the HTML page head
144
-		 * @since 2015.11
145
-		 * @category Developer
146
-		 * @see client/html/email/delivery/html/summary/detail/standard/template-body
147
-		 */
148
-		$tplconf = 'client/html/email/delivery/html/summary/detail/standard/template-header';
149
-		$default = 'common/summary/detail-header-default.php';
126
+        /** client/html/email/delivery/html/summary/detail/standard/template-header
127
+         * Relative path to the HTML header template of the summary detail section of the delivery HTML e-mail client.
128
+         *
129
+         * The template file contains the HTML code and processing instructions
130
+         * to generate the HTML code that is inserted into the HTML page header
131
+         * of the rendered page in the frontend. The configuration string is the
132
+         * path to the template file relative to the templates directory (usually
133
+         * in client/html/templates).
134
+         *
135
+         * You can overwrite the template file configuration in extensions and
136
+         * provide alternative templates. These alternative templates should be
137
+         * named like the default one but with the string "standard" replaced by
138
+         * an unique name. You may use the name of your project for this. If
139
+         * you've implemented an alternative client class as well, "standard"
140
+         * (second one) should be replaced by the name of the new class in lower
141
+         * case.
142
+         *
143
+         * @param string Relative path to the template creating code for the HTML page head
144
+         * @since 2015.11
145
+         * @category Developer
146
+         * @see client/html/email/delivery/html/summary/detail/standard/template-body
147
+         */
148
+        $tplconf = 'client/html/email/delivery/html/summary/detail/standard/template-header';
149
+        $default = 'common/summary/detail-header-default.php';
150 150
 
151
-		return $view->render( $view->config( $tplconf, $default ) );
152
-	}
151
+        return $view->render( $view->config( $tplconf, $default ) );
152
+    }
153 153
 
154 154
 
155
-	/**
156
-	 * Returns the sub-client given by its name.
157
-	 *
158
-	 * @param string $type Name of the client type
159
-	 * @param string|null $name Name of the sub-client (Default if null)
160
-	 * @return \Aimeos\Client\Html\Iface Sub-client object
161
-	 */
162
-	public function getSubClient( $type, $name = null )
163
-	{
164
-		/** client/html/email/delivery/html/summary/detail/decorators/excludes
165
-		 * Excludes decorators added by the "common" option from the email delivery html summary detail html client
166
-		 *
167
-		 * Decorators extend the functionality of a class by adding new aspects
168
-		 * (e.g. log what is currently done), executing the methods of the underlying
169
-		 * class only in certain conditions (e.g. only for logged in users) or
170
-		 * modify what is returned to the caller.
171
-		 *
172
-		 * This option allows you to remove a decorator added via
173
-		 * "client/html/common/decorators/default" before they are wrapped
174
-		 * around the html client.
175
-		 *
176
-		 *  client/html/email/delivery/html/summary/detail/decorators/excludes = array( 'decorator1' )
177
-		 *
178
-		 * This would remove the decorator named "decorator1" from the list of
179
-		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
-		 * "client/html/common/decorators/default" to the html client.
181
-		 *
182
-		 * @param array List of decorator names
183
-		 * @since 2015.08
184
-		 * @category Developer
185
-		 * @see client/html/common/decorators/default
186
-		 * @see client/html/email/delivery/html/summary/detail/decorators/global
187
-		 * @see client/html/email/delivery/html/summary/detail/decorators/local
188
-		 */
155
+    /**
156
+     * Returns the sub-client given by its name.
157
+     *
158
+     * @param string $type Name of the client type
159
+     * @param string|null $name Name of the sub-client (Default if null)
160
+     * @return \Aimeos\Client\Html\Iface Sub-client object
161
+     */
162
+    public function getSubClient( $type, $name = null )
163
+    {
164
+        /** client/html/email/delivery/html/summary/detail/decorators/excludes
165
+         * Excludes decorators added by the "common" option from the email delivery html summary detail html client
166
+         *
167
+         * Decorators extend the functionality of a class by adding new aspects
168
+         * (e.g. log what is currently done), executing the methods of the underlying
169
+         * class only in certain conditions (e.g. only for logged in users) or
170
+         * modify what is returned to the caller.
171
+         *
172
+         * This option allows you to remove a decorator added via
173
+         * "client/html/common/decorators/default" before they are wrapped
174
+         * around the html client.
175
+         *
176
+         *  client/html/email/delivery/html/summary/detail/decorators/excludes = array( 'decorator1' )
177
+         *
178
+         * This would remove the decorator named "decorator1" from the list of
179
+         * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
180
+         * "client/html/common/decorators/default" to the html client.
181
+         *
182
+         * @param array List of decorator names
183
+         * @since 2015.08
184
+         * @category Developer
185
+         * @see client/html/common/decorators/default
186
+         * @see client/html/email/delivery/html/summary/detail/decorators/global
187
+         * @see client/html/email/delivery/html/summary/detail/decorators/local
188
+         */
189 189
 
190
-		/** client/html/email/delivery/html/summary/detail/decorators/global
191
-		 * Adds a list of globally available decorators only to the email delivery html summary detail html client
192
-		 *
193
-		 * Decorators extend the functionality of a class by adding new aspects
194
-		 * (e.g. log what is currently done), executing the methods of the underlying
195
-		 * class only in certain conditions (e.g. only for logged in users) or
196
-		 * modify what is returned to the caller.
197
-		 *
198
-		 * This option allows you to wrap global decorators
199
-		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
-		 *
201
-		 *  client/html/email/delivery/html/summary/detail/decorators/global = array( 'decorator1' )
202
-		 *
203
-		 * This would add the decorator named "decorator1" defined by
204
-		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
-		 *
206
-		 * @param array List of decorator names
207
-		 * @since 2015.08
208
-		 * @category Developer
209
-		 * @see client/html/common/decorators/default
210
-		 * @see client/html/email/delivery/html/summary/detail/decorators/excludes
211
-		 * @see client/html/email/delivery/html/summary/detail/decorators/local
212
-		 */
190
+        /** client/html/email/delivery/html/summary/detail/decorators/global
191
+         * Adds a list of globally available decorators only to the email delivery html summary detail html client
192
+         *
193
+         * Decorators extend the functionality of a class by adding new aspects
194
+         * (e.g. log what is currently done), executing the methods of the underlying
195
+         * class only in certain conditions (e.g. only for logged in users) or
196
+         * modify what is returned to the caller.
197
+         *
198
+         * This option allows you to wrap global decorators
199
+         * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
200
+         *
201
+         *  client/html/email/delivery/html/summary/detail/decorators/global = array( 'decorator1' )
202
+         *
203
+         * This would add the decorator named "decorator1" defined by
204
+         * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
205
+         *
206
+         * @param array List of decorator names
207
+         * @since 2015.08
208
+         * @category Developer
209
+         * @see client/html/common/decorators/default
210
+         * @see client/html/email/delivery/html/summary/detail/decorators/excludes
211
+         * @see client/html/email/delivery/html/summary/detail/decorators/local
212
+         */
213 213
 
214
-		/** client/html/email/delivery/html/summary/detail/decorators/local
215
-		 * Adds a list of local decorators only to the email delivery html summary detail html client
216
-		 *
217
-		 * Decorators extend the functionality of a class by adding new aspects
218
-		 * (e.g. log what is currently done), executing the methods of the underlying
219
-		 * class only in certain conditions (e.g. only for logged in users) or
220
-		 * modify what is returned to the caller.
221
-		 *
222
-		 * This option allows you to wrap local decorators
223
-		 * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
224
-		 *
225
-		 *  client/html/email/delivery/html/summary/detail/decorators/local = array( 'decorator2' )
226
-		 *
227
-		 * This would add the decorator named "decorator2" defined by
228
-		 * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
229
-		 *
230
-		 * @param array List of decorator names
231
-		 * @since 2015.08
232
-		 * @category Developer
233
-		 * @see client/html/common/decorators/default
234
-		 * @see client/html/email/delivery/html/summary/detail/decorators/excludes
235
-		 * @see client/html/email/delivery/html/summary/detail/decorators/global
236
-		 */
214
+        /** client/html/email/delivery/html/summary/detail/decorators/local
215
+         * Adds a list of local decorators only to the email delivery html summary detail html client
216
+         *
217
+         * Decorators extend the functionality of a class by adding new aspects
218
+         * (e.g. log what is currently done), executing the methods of the underlying
219
+         * class only in certain conditions (e.g. only for logged in users) or
220
+         * modify what is returned to the caller.
221
+         *
222
+         * This option allows you to wrap local decorators
223
+         * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client.
224
+         *
225
+         *  client/html/email/delivery/html/summary/detail/decorators/local = array( 'decorator2' )
226
+         *
227
+         * This would add the decorator named "decorator2" defined by
228
+         * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client.
229
+         *
230
+         * @param array List of decorator names
231
+         * @since 2015.08
232
+         * @category Developer
233
+         * @see client/html/common/decorators/default
234
+         * @see client/html/email/delivery/html/summary/detail/decorators/excludes
235
+         * @see client/html/email/delivery/html/summary/detail/decorators/global
236
+         */
237 237
 
238
-		return $this->createSubClient( 'email/delivery/html/summary/detail/' . $type, $name );
239
-	}
238
+        return $this->createSubClient( 'email/delivery/html/summary/detail/' . $type, $name );
239
+    }
240 240
 
241 241
 
242
-	/**
243
-	 * Returns the list of sub-client names configured for the client.
244
-	 *
245
-	 * @return array List of HTML client names
246
-	 */
247
-	protected function getSubClientNames()
248
-	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
-	}
242
+    /**
243
+     * Returns the list of sub-client names configured for the client.
244
+     *
245
+     * @return array List of HTML client names
246
+     */
247
+    protected function getSubClientNames()
248
+    {
249
+        return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
250
+    }
251 251
 
252 252
 
253
-	/**
254
-	 * Sets the necessary parameter values in the view.
255
-	 *
256
-	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
257
-	 * @param array &$tags Result array for the list of tags that are associated to the output
258
-	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
259
-	 * @return \Aimeos\MW\View\Iface Modified view object
260
-	 */
261
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
-	{
263
-		// we can't cache the calculation because the same client object is used for all e-mails
264
-		$view->summaryTaxRates = $this->getTaxRates( $view->extOrderBaseItem );
253
+    /**
254
+     * Sets the necessary parameter values in the view.
255
+     *
256
+     * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
257
+     * @param array &$tags Result array for the list of tags that are associated to the output
258
+     * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
259
+     * @return \Aimeos\MW\View\Iface Modified view object
260
+     */
261
+    protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
262
+    {
263
+        // we can't cache the calculation because the same client object is used for all e-mails
264
+        $view->summaryTaxRates = $this->getTaxRates( $view->extOrderBaseItem );
265 265
 
266
-		if( $view->extOrderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) {
267
-			$view->summaryShowDownloadAttributes = true;
268
-		}
266
+        if( $view->extOrderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) {
267
+            $view->summaryShowDownloadAttributes = true;
268
+        }
269 269
 
270
-		return $view;
271
-	}
270
+        return $view;
271
+    }
272 272
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 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->detailBody = $html;
79 79
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$tplconf = 'client/html/email/delivery/html/summary/detail/standard/template-body';
102 102
 		$default = 'common/summary/detail-body-default.php';
103 103
 
104
-		return $view->render( $view->config( $tplconf, $default ) );
104
+		return $view->render($view->config($tplconf, $default));
105 105
 	}
106 106
 
107 107
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
114 114
 	 * @return string|null String including HTML tags for the header on error
115 115
 	 */
116
-	public function getHeader( $uid = '', array &$tags = array(), &$expire = null )
116
+	public function getHeader($uid = '', array &$tags = array(), &$expire = null)
117 117
 	{
118
-		$view = $this->setViewParams( $this->getView(), $tags, $expire );
118
+		$view = $this->setViewParams($this->getView(), $tags, $expire);
119 119
 
120 120
 		$html = '';
121
-		foreach( $this->getSubClients() as $subclient ) {
122
-			$html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire );
121
+		foreach ($this->getSubClients() as $subclient) {
122
+			$html .= $subclient->setView($view)->getHeader($uid, $tags, $expire);
123 123
 		}
124 124
 		$view->detailHeader = $html;
125 125
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$tplconf = 'client/html/email/delivery/html/summary/detail/standard/template-header';
149 149
 		$default = 'common/summary/detail-header-default.php';
150 150
 
151
-		return $view->render( $view->config( $tplconf, $default ) );
151
+		return $view->render($view->config($tplconf, $default));
152 152
 	}
153 153
 
154 154
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @param string|null $name Name of the sub-client (Default if null)
160 160
 	 * @return \Aimeos\Client\Html\Iface Sub-client object
161 161
 	 */
162
-	public function getSubClient( $type, $name = null )
162
+	public function getSubClient($type, $name = null)
163 163
 	{
164 164
 		/** client/html/email/delivery/html/summary/detail/decorators/excludes
165 165
 		 * Excludes decorators added by the "common" option from the email delivery html summary detail html client
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		 * @see client/html/email/delivery/html/summary/detail/decorators/global
236 236
 		 */
237 237
 
238
-		return $this->createSubClient( 'email/delivery/html/summary/detail/' . $type, $name );
238
+		return $this->createSubClient('email/delivery/html/summary/detail/'.$type, $name);
239 239
 	}
240 240
 
241 241
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	protected function getSubClientNames()
248 248
 	{
249
-		return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames );
249
+		return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames);
250 250
 	}
251 251
 
252 252
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
259 259
 	 * @return \Aimeos\MW\View\Iface Modified view object
260 260
 	 */
261
-	protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null )
261
+	protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
262 262
 	{
263 263
 		// we can't cache the calculation because the same client object is used for all e-mails
264
-		$view->summaryTaxRates = $this->getTaxRates( $view->extOrderBaseItem );
264
+		$view->summaryTaxRates = $this->getTaxRates($view->extOrderBaseItem);
265 265
 
266
-		if( $view->extOrderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus() ) {
266
+		if ($view->extOrderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus()) {
267 267
 			$view->summaryShowDownloadAttributes = true;
268 268
 		}
269 269
 
Please login to merge, or discard this patch.
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.