@@ -20,74 +20,74 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | interface Iface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * Returns the sub-client given by its name. |
|
| 25 | - * |
|
| 26 | - * @param string $type Name of the client type |
|
| 27 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 28 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 29 | - */ |
|
| 30 | - public function getSubClient( $type, $name = null ); |
|
| 23 | + /** |
|
| 24 | + * Returns the sub-client given by its name. |
|
| 25 | + * |
|
| 26 | + * @param string $type Name of the client type |
|
| 27 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 28 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 29 | + */ |
|
| 30 | + public function getSubClient( $type, $name = null ); |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Returns the HTML string for insertion into the header. |
|
| 34 | - * |
|
| 35 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 36 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 37 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 38 | - * @return string|null String including HTML tags for the header on error |
|
| 39 | - */ |
|
| 40 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 32 | + /** |
|
| 33 | + * Returns the HTML string for insertion into the header. |
|
| 34 | + * |
|
| 35 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 36 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 37 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 38 | + * @return string|null String including HTML tags for the header on error |
|
| 39 | + */ |
|
| 40 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Returns the HTML code for insertion into the body. |
|
| 44 | - * |
|
| 45 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 46 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 47 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 48 | - * @return string HTML code |
|
| 49 | - */ |
|
| 50 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 42 | + /** |
|
| 43 | + * Returns the HTML code for insertion into the body. |
|
| 44 | + * |
|
| 45 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 46 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 47 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 48 | + * @return string HTML code |
|
| 49 | + */ |
|
| 50 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Returns the view object that will generate the HTML output. |
|
| 54 | - * |
|
| 55 | - * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 56 | - */ |
|
| 57 | - public function getView(); |
|
| 52 | + /** |
|
| 53 | + * Returns the view object that will generate the HTML output. |
|
| 54 | + * |
|
| 55 | + * @return \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 56 | + */ |
|
| 57 | + public function getView(); |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Sets the view object that will generate the HTML output. |
|
| 61 | - * |
|
| 62 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 63 | - * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 64 | - */ |
|
| 65 | - public function setView( \Aimeos\MW\View\Iface $view ); |
|
| 59 | + /** |
|
| 60 | + * Sets the view object that will generate the HTML output. |
|
| 61 | + * |
|
| 62 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 63 | + * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
|
| 64 | + */ |
|
| 65 | + public function setView( \Aimeos\MW\View\Iface $view ); |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 69 | - * |
|
| 70 | - * @param string $content Cached content |
|
| 71 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 72 | - * @return string Modified body content |
|
| 73 | - */ |
|
| 74 | - public function modifyBody( $content, $uid ); |
|
| 67 | + /** |
|
| 68 | + * Modifies the cached body content to replace content based on sessions or cookies. |
|
| 69 | + * |
|
| 70 | + * @param string $content Cached content |
|
| 71 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 72 | + * @return string Modified body content |
|
| 73 | + */ |
|
| 74 | + public function modifyBody( $content, $uid ); |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 78 | - * |
|
| 79 | - * @param string $content Cached content |
|
| 80 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 81 | - * @return string Modified header content |
|
| 82 | - */ |
|
| 83 | - public function modifyHeader( $content, $uid ); |
|
| 76 | + /** |
|
| 77 | + * Modifies the cached header content to replace content based on sessions or cookies. |
|
| 78 | + * |
|
| 79 | + * @param string $content Cached content |
|
| 80 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 81 | + * @return string Modified header content |
|
| 82 | + */ |
|
| 83 | + public function modifyHeader( $content, $uid ); |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Processes the input, e.g. store given values. |
|
| 87 | - * A view must be available and this method doesn't generate any output |
|
| 88 | - * besides setting view variables. |
|
| 89 | - * |
|
| 90 | - * @return boolean False if processing is stopped, otherwise all processing was completed successfully |
|
| 91 | - */ |
|
| 92 | - public function process(); |
|
| 85 | + /** |
|
| 86 | + * Processes the input, e.g. store given values. |
|
| 87 | + * A view must be available and this method doesn't generate any output |
|
| 88 | + * besides setting view variables. |
|
| 89 | + * |
|
| 90 | + * @return boolean False if processing is stopped, otherwise all processing was completed successfully |
|
| 91 | + */ |
|
| 92 | + public function process(); |
|
| 93 | 93 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param string|null $name Name of the sub-client (Default if null) |
| 28 | 28 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 29 | 29 | */ |
| 30 | - public function getSubClient( $type, $name = null ); |
|
| 30 | + public function getSubClient($type, $name = null); |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Returns the HTML string for insertion into the header. |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 38 | 38 | * @return string|null String including HTML tags for the header on error |
| 39 | 39 | */ |
| 40 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 40 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Returns the HTML code for insertion into the body. |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 48 | 48 | * @return string HTML code |
| 49 | 49 | */ |
| 50 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ); |
|
| 50 | + public function getBody($uid = '', array &$tags = array(), &$expire = null); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Returns the view object that will generate the HTML output. |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
| 63 | 63 | * @return \Aimeos\Client\Html\Iface Reference to this object for fluent calls |
| 64 | 64 | */ |
| 65 | - public function setView( \Aimeos\MW\View\Iface $view ); |
|
| 65 | + public function setView(\Aimeos\MW\View\Iface $view); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Modifies the cached body content to replace content based on sessions or cookies. |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 72 | 72 | * @return string Modified body content |
| 73 | 73 | */ |
| 74 | - public function modifyBody( $content, $uid ); |
|
| 74 | + public function modifyBody($content, $uid); |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Modifies the cached header content to replace content based on sessions or cookies. |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 81 | 81 | * @return string Modified header content |
| 82 | 82 | */ |
| 83 | - public function modifyHeader( $content, $uid ); |
|
| 83 | + public function modifyHeader($content, $uid); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Processes the input, e.g. store given values. |
@@ -19,253 +19,253 @@ |
||
| 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/locale/select/currency/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the locale select currency section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.09 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/locale/select/currency/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 25 | + /** client/html/locale/select/currency/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the locale select currency section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.09 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/locale/select/currency/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->currencyBody = $html; |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->currencyBody = $html; |
|
| 79 | 79 | |
| 80 | - /** client/html/locale/select/currency/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the locale select currency client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.09 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/locale/select/currency/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/locale/select/currency/standard/template-body'; |
|
| 101 | - $default = 'locale/select/currency-body-default.php'; |
|
| 80 | + /** client/html/locale/select/currency/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the locale select currency client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.09 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/locale/select/currency/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/locale/select/currency/standard/template-body'; |
|
| 101 | + $default = 'locale/select/currency-body-default.php'; |
|
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | 118 | |
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->currencyHeader = $html; |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->currencyHeader = $html; |
|
| 124 | 124 | |
| 125 | - /** client/html/locale/select/currency/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the locale select currency client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.09 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/locale/select/currency/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/locale/select/currency/standard/template-header'; |
|
| 147 | - $default = 'locale/select/currency-header-default.php'; |
|
| 125 | + /** client/html/locale/select/currency/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the locale select currency client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.09 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/locale/select/currency/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/locale/select/currency/standard/template-header'; |
|
| 147 | + $default = 'locale/select/currency-header-default.php'; |
|
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/locale/select/currency/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the locale select currency html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/locale/select/currency/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/locale/select/currency/decorators/global |
|
| 185 | - * @see client/html/locale/select/currency/decorators/local |
|
| 186 | - */ |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/locale/select/currency/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the locale select currency html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/locale/select/currency/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/locale/select/currency/decorators/global |
|
| 185 | + * @see client/html/locale/select/currency/decorators/local |
|
| 186 | + */ |
|
| 187 | 187 | |
| 188 | - /** client/html/locale/select/currency/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the locale select currency html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/locale/select/currency/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/locale/select/currency/decorators/excludes |
|
| 209 | - * @see client/html/locale/select/currency/decorators/local |
|
| 210 | - */ |
|
| 188 | + /** client/html/locale/select/currency/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the locale select currency html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/locale/select/currency/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/locale/select/currency/decorators/excludes |
|
| 209 | + * @see client/html/locale/select/currency/decorators/local |
|
| 210 | + */ |
|
| 211 | 211 | |
| 212 | - /** client/html/locale/select/currency/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the locale select currency html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/locale/select/currency/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/locale/select/currency/decorators/excludes |
|
| 233 | - * @see client/html/locale/select/currency/decorators/global |
|
| 234 | - */ |
|
| 212 | + /** client/html/locale/select/currency/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the locale select currency html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/locale/select/currency/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/locale/select/currency/decorators/excludes |
|
| 233 | + * @see client/html/locale/select/currency/decorators/global |
|
| 234 | + */ |
|
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'locale/select/currency/' . $type, $name ); |
|
| 237 | - } |
|
| 236 | + return $this->createSubClient( 'locale/select/currency/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Processes the input, e.g. store given values. |
|
| 242 | - * A view must be available and this method doesn't generate any output |
|
| 243 | - * besides setting view variables. |
|
| 244 | - */ |
|
| 245 | - public function process() |
|
| 246 | - { |
|
| 247 | - $view = $this->getView(); |
|
| 248 | - $context = $this->getContext(); |
|
| 249 | - $config = $context->getConfig(); |
|
| 250 | - $session = $context->getSession(); |
|
| 240 | + /** |
|
| 241 | + * Processes the input, e.g. store given values. |
|
| 242 | + * A view must be available and this method doesn't generate any output |
|
| 243 | + * besides setting view variables. |
|
| 244 | + */ |
|
| 245 | + public function process() |
|
| 246 | + { |
|
| 247 | + $view = $this->getView(); |
|
| 248 | + $context = $this->getContext(); |
|
| 249 | + $config = $context->getConfig(); |
|
| 250 | + $session = $context->getSession(); |
|
| 251 | 251 | |
| 252 | - $name = $config->get( 'client/html/locale/select/currency/param-name', 'loc_currencyid' ); |
|
| 252 | + $name = $config->get( 'client/html/locale/select/currency/param-name', 'loc_currencyid' ); |
|
| 253 | 253 | |
| 254 | - if( ( $currencyId = $view->param( $name ) ) !== null ) { |
|
| 255 | - $session->set( 'aimeos/locale/currencyId', $currencyId ); |
|
| 256 | - } |
|
| 254 | + if( ( $currencyId = $view->param( $name ) ) !== null ) { |
|
| 255 | + $session->set( 'aimeos/locale/currencyId', $currencyId ); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - parent::process(); |
|
| 259 | - } |
|
| 258 | + parent::process(); |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Returns the list of sub-client names configured for the client. |
|
| 264 | - * |
|
| 265 | - * @return array List of HTML client names |
|
| 266 | - */ |
|
| 267 | - protected function getSubClientNames() |
|
| 268 | - { |
|
| 269 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 270 | - } |
|
| 262 | + /** |
|
| 263 | + * Returns the list of sub-client names configured for the client. |
|
| 264 | + * |
|
| 265 | + * @return array List of HTML client names |
|
| 266 | + */ |
|
| 267 | + protected function getSubClientNames() |
|
| 268 | + { |
|
| 269 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 270 | + } |
|
| 271 | 271 | } |
| 272 | 272 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->currencyBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/locale/select/currency/standard/template-body'; |
| 101 | 101 | $default = 'locale/select/currency-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->currencyHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/locale/select/currency/standard/template-header'; |
| 147 | 147 | $default = 'locale/select/currency-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/locale/select/currency/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the locale select currency html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/locale/select/currency/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'locale/select/currency/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('locale/select/currency/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | $config = $context->getConfig(); |
| 250 | 250 | $session = $context->getSession(); |
| 251 | 251 | |
| 252 | - $name = $config->get( 'client/html/locale/select/currency/param-name', 'loc_currencyid' ); |
|
| 252 | + $name = $config->get('client/html/locale/select/currency/param-name', 'loc_currencyid'); |
|
| 253 | 253 | |
| 254 | - if( ( $currencyId = $view->param( $name ) ) !== null ) { |
|
| 255 | - $session->set( 'aimeos/locale/currencyId', $currencyId ); |
|
| 254 | + if (($currencyId = $view->param($name)) !== null) { |
|
| 255 | + $session->set('aimeos/locale/currencyId', $currencyId); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | parent::process(); |
@@ -266,6 +266,6 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | protected function getSubClientNames() |
| 268 | 268 | { |
| 269 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 269 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,68 +19,68 @@ |
||
| 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 locale select 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/locale/select/name |
|
| 37 | - * Class name of the used locale select 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\Locale\Select\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Locale\Select\Myselect |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/locale/select/name = Myselect |
|
| 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 "MySelect"! |
|
| 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/locale/select/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a locale select 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/locale/select/name |
|
| 37 | + * Class name of the used locale select 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\Locale\Select\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Locale\Select\Myselect |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/locale/select/name = Myselect |
|
| 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 "MySelect"! |
|
| 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/locale/select/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Locale\\Select\\' . $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\\Locale\\Select\\' . $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\\Locale\\Select\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Locale\\Select\\' . $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, 'locale/select' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'locale/select' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -31,7 +31,7 @@ discard block |
||
| 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/locale/select/name |
| 37 | 37 | * Class name of the used locale select client implementation |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/locale/select/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/locale/select/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\\Locale\\Select\\' . $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\\Locale\\Select\\'.$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\\Locale\\Select\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Locale\\Select\\'.$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, 'locale/select' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'locale/select'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -19,360 +19,360 @@ |
||
| 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/locale/select/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the locale select section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.09 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/locale/select/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/locale/select/language/name |
|
| 61 | - * Name of the language part used by the locale selector client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Locale\Select\Language\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.09 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/locale/select/currency/name |
|
| 72 | - * Name of the currency part used by the locale selector client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Locale\Select\Currency\Myname". |
|
| 75 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | - * |
|
| 77 | - * @param string Last part of the client class name |
|
| 78 | - * @since 2014.09 |
|
| 79 | - * @category Developer |
|
| 80 | - */ |
|
| 81 | - private $subPartNames = array( 'language', 'currency' ); |
|
| 82 | - private $cache; |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Returns the HTML code for insertion into the body. |
|
| 87 | - * |
|
| 88 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 89 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 90 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 91 | - * @return string HTML code |
|
| 92 | - */ |
|
| 93 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 94 | - { |
|
| 95 | - $context = $this->getContext(); |
|
| 96 | - $view = $this->getView(); |
|
| 97 | - |
|
| 98 | - try |
|
| 99 | - { |
|
| 100 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 101 | - |
|
| 102 | - $html = ''; |
|
| 103 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 104 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 105 | - } |
|
| 106 | - $view->selectBody = $html; |
|
| 107 | - } |
|
| 108 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 109 | - { |
|
| 110 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 111 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 112 | - } |
|
| 113 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 114 | - { |
|
| 115 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 116 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 117 | - } |
|
| 118 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 119 | - { |
|
| 120 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 121 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 122 | - } |
|
| 123 | - catch( \Exception $e ) |
|
| 124 | - { |
|
| 125 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 126 | - |
|
| 127 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 128 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** client/html/locale/select/standard/template-body |
|
| 132 | - * Relative path to the HTML body template of the locale select client. |
|
| 133 | - * |
|
| 134 | - * The template file contains the HTML code and processing instructions |
|
| 135 | - * to generate the result shown in the body of the frontend. The |
|
| 136 | - * configuration string is the path to the template file relative |
|
| 137 | - * to the templates directory (usually in client/html/templates). |
|
| 138 | - * |
|
| 139 | - * You can overwrite the template file configuration in extensions and |
|
| 140 | - * provide alternative templates. These alternative templates should be |
|
| 141 | - * named like the default one but with the string "standard" replaced by |
|
| 142 | - * an unique name. You may use the name of your project for this. If |
|
| 143 | - * you've implemented an alternative client class as well, "standard" |
|
| 144 | - * should be replaced by the name of the new class. |
|
| 145 | - * |
|
| 146 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 147 | - * @since 2014.09 |
|
| 148 | - * @category Developer |
|
| 149 | - * @see client/html/locale/select/standard/template-header |
|
| 150 | - */ |
|
| 151 | - $tplconf = 'client/html/locale/select/standard/template-body'; |
|
| 152 | - $default = 'locale/select/body-default.php'; |
|
| 153 | - |
|
| 154 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * Returns the HTML string for insertion into the header. |
|
| 160 | - * |
|
| 161 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 162 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 163 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 164 | - * @return string|null String including HTML tags for the header on error |
|
| 165 | - */ |
|
| 166 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 167 | - { |
|
| 168 | - try |
|
| 169 | - { |
|
| 170 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 171 | - |
|
| 172 | - $html = ''; |
|
| 173 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 174 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 175 | - } |
|
| 176 | - $view->selectHeader = $html; |
|
| 177 | - |
|
| 178 | - /** client/html/locale/select/standard/template-header |
|
| 179 | - * Relative path to the HTML header template of the locale select client. |
|
| 180 | - * |
|
| 181 | - * The template file contains the HTML code and processing instructions |
|
| 182 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 183 | - * of the rendered page in the frontend. The configuration string is the |
|
| 184 | - * path to the template file relative to the templates directory (usually |
|
| 185 | - * in client/html/templates). |
|
| 186 | - * |
|
| 187 | - * You can overwrite the template file configuration in extensions and |
|
| 188 | - * provide alternative templates. These alternative templates should be |
|
| 189 | - * named like the default one but with the string "standard" replaced by |
|
| 190 | - * an unique name. You may use the name of your project for this. If |
|
| 191 | - * you've implemented an alternative client class as well, "standard" |
|
| 192 | - * should be replaced by the name of the new class. |
|
| 193 | - * |
|
| 194 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 195 | - * @since 2014.09 |
|
| 196 | - * @category Developer |
|
| 197 | - * @see client/html/locale/select/standard/template-body |
|
| 198 | - */ |
|
| 199 | - $tplconf = 'client/html/locale/select/standard/template-header'; |
|
| 200 | - $default = 'locale/select/header-default.php'; |
|
| 201 | - |
|
| 202 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 203 | - } |
|
| 204 | - catch( \Exception $e ) |
|
| 205 | - { |
|
| 206 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 207 | - } |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - |
|
| 211 | - /** |
|
| 212 | - * Returns the sub-client given by its name. |
|
| 213 | - * |
|
| 214 | - * @param string $type Name of the client type |
|
| 215 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 216 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 217 | - */ |
|
| 218 | - public function getSubClient( $type, $name = null ) |
|
| 219 | - { |
|
| 220 | - /** client/html/locale/select/decorators/excludes |
|
| 221 | - * Excludes decorators added by the "common" option from the locale select html client |
|
| 222 | - * |
|
| 223 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 224 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 225 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 226 | - * modify what is returned to the caller. |
|
| 227 | - * |
|
| 228 | - * This option allows you to remove a decorator added via |
|
| 229 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 230 | - * around the html client. |
|
| 231 | - * |
|
| 232 | - * client/html/locale/select/decorators/excludes = array( 'decorator1' ) |
|
| 233 | - * |
|
| 234 | - * This would remove the decorator named "decorator1" from the list of |
|
| 235 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 236 | - * "client/html/common/decorators/default" to the html client. |
|
| 237 | - * |
|
| 238 | - * @param array List of decorator names |
|
| 239 | - * @since 2014.05 |
|
| 240 | - * @category Developer |
|
| 241 | - * @see client/html/common/decorators/default |
|
| 242 | - * @see client/html/locale/select/decorators/global |
|
| 243 | - * @see client/html/locale/select/decorators/local |
|
| 244 | - */ |
|
| 245 | - |
|
| 246 | - /** client/html/locale/select/decorators/global |
|
| 247 | - * Adds a list of globally available decorators only to the locale select html client |
|
| 248 | - * |
|
| 249 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 250 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 251 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 252 | - * modify what is returned to the caller. |
|
| 253 | - * |
|
| 254 | - * This option allows you to wrap global decorators |
|
| 255 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 256 | - * |
|
| 257 | - * client/html/locale/select/decorators/global = array( 'decorator1' ) |
|
| 258 | - * |
|
| 259 | - * This would add the decorator named "decorator1" defined by |
|
| 260 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 261 | - * |
|
| 262 | - * @param array List of decorator names |
|
| 263 | - * @since 2014.05 |
|
| 264 | - * @category Developer |
|
| 265 | - * @see client/html/common/decorators/default |
|
| 266 | - * @see client/html/locale/select/decorators/excludes |
|
| 267 | - * @see client/html/locale/select/decorators/local |
|
| 268 | - */ |
|
| 269 | - |
|
| 270 | - /** client/html/locale/select/decorators/local |
|
| 271 | - * Adds a list of local decorators only to the locale select html client |
|
| 272 | - * |
|
| 273 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 274 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 275 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 276 | - * modify what is returned to the caller. |
|
| 277 | - * |
|
| 278 | - * This option allows you to wrap local decorators |
|
| 279 | - * ("\Aimeos\Client\Html\Locale\Decorator\*") around the html client. |
|
| 280 | - * |
|
| 281 | - * client/html/locale/select/decorators/local = array( 'decorator2' ) |
|
| 282 | - * |
|
| 283 | - * This would add the decorator named "decorator2" defined by |
|
| 284 | - * "\Aimeos\Client\Html\Locale\Decorator\Decorator2" only to the html client. |
|
| 285 | - * |
|
| 286 | - * @param array List of decorator names |
|
| 287 | - * @since 2014.05 |
|
| 288 | - * @category Developer |
|
| 289 | - * @see client/html/common/decorators/default |
|
| 290 | - * @see client/html/locale/select/decorators/excludes |
|
| 291 | - * @see client/html/locale/select/decorators/global |
|
| 292 | - */ |
|
| 293 | - return $this->createSubClient( 'locale/select/' . $type, $name ); |
|
| 294 | - } |
|
| 295 | - |
|
| 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 | - } |
|
| 306 | - |
|
| 307 | - |
|
| 308 | - /** |
|
| 309 | - * Sets the necessary parameter values in the view. |
|
| 310 | - * |
|
| 311 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 312 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 313 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 314 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 315 | - */ |
|
| 316 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 317 | - { |
|
| 318 | - if( !isset( $this->cache ) ) |
|
| 319 | - { |
|
| 320 | - $map = array(); |
|
| 321 | - $context = $this->getContext(); |
|
| 322 | - $config = $context->getConfig(); |
|
| 323 | - $locale = $context->getLocale(); |
|
| 324 | - |
|
| 325 | - /** client/html/locale/select/language/param-name |
|
| 326 | - * Name of the parameter that contains the language ID value |
|
| 327 | - * |
|
| 328 | - * Frameworks and applications normally use its own predefined parameter |
|
| 329 | - * that contains the current language ID if they are multi-language |
|
| 330 | - * capable. To adapt the Aimeos parameter name to the already used name, |
|
| 331 | - * you are able to configure it by using this setting. |
|
| 332 | - * |
|
| 333 | - * @param string Parameter name for language ID |
|
| 334 | - * @since 2015.06 |
|
| 335 | - * @see client/html/locale/select/currency/param-name |
|
| 336 | - */ |
|
| 337 | - $langname = $config->get( 'client/html/locale/select/language/param-name', 'loc_languageid' ); |
|
| 338 | - |
|
| 339 | - /** client/html/locale/select/currency/param-name |
|
| 340 | - * Name of the parameter that contains the currency ID value |
|
| 341 | - * |
|
| 342 | - * Frameworks and applications normally use its own predefined parameter |
|
| 343 | - * that contains the current currency ID if they already support multiple |
|
| 344 | - * currencies. To adapt the Aimeos parameter name to the already used name, |
|
| 345 | - * you are able to configure it by using this setting. |
|
| 346 | - * |
|
| 347 | - * @param string Parameter name for currency ID |
|
| 348 | - * @since 2015.06 |
|
| 349 | - * @see client/html/locale/select/language/param-name |
|
| 350 | - */ |
|
| 351 | - $curname = $config->get( 'client/html/locale/select/currency/param-name', 'loc_currencyid' ); |
|
| 352 | - |
|
| 353 | - |
|
| 354 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 355 | - |
|
| 356 | - $search = $manager->createSearch( true ); |
|
| 357 | - $search->setSortations( array( $search->sort( '+', 'locale.position' ) ) ); |
|
| 358 | - |
|
| 359 | - foreach( $manager->searchItems( $search ) as $item ) |
|
| 360 | - { |
|
| 361 | - $curId = $item->getCurrencyId(); |
|
| 362 | - $langId = $item->getLanguageId(); |
|
| 363 | - $map[$langId][$curId] = array( $langname => $langId, $curname => $curId ); |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - $params = $view->param(); |
|
| 367 | - |
|
| 368 | - $view->selectMap = $map; |
|
| 369 | - $view->selectParams = $params; |
|
| 370 | - $view->selectLanguageId = $locale->getLanguageId(); |
|
| 371 | - $view->selectCurrencyId = $locale->getCurrencyId(); |
|
| 372 | - |
|
| 373 | - $this->cache = $view; |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - return $this->cache; |
|
| 377 | - } |
|
| 25 | + /** client/html/locale/select/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the locale select section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.09 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/locale/select/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/locale/select/language/name |
|
| 61 | + * Name of the language part used by the locale selector client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Locale\Select\Language\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.09 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/locale/select/currency/name |
|
| 72 | + * Name of the currency part used by the locale selector client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Locale\Select\Currency\Myname". |
|
| 75 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | + * |
|
| 77 | + * @param string Last part of the client class name |
|
| 78 | + * @since 2014.09 |
|
| 79 | + * @category Developer |
|
| 80 | + */ |
|
| 81 | + private $subPartNames = array( 'language', 'currency' ); |
|
| 82 | + private $cache; |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Returns the HTML code for insertion into the body. |
|
| 87 | + * |
|
| 88 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 89 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 90 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 91 | + * @return string HTML code |
|
| 92 | + */ |
|
| 93 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 94 | + { |
|
| 95 | + $context = $this->getContext(); |
|
| 96 | + $view = $this->getView(); |
|
| 97 | + |
|
| 98 | + try |
|
| 99 | + { |
|
| 100 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 101 | + |
|
| 102 | + $html = ''; |
|
| 103 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 104 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 105 | + } |
|
| 106 | + $view->selectBody = $html; |
|
| 107 | + } |
|
| 108 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 109 | + { |
|
| 110 | + $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 111 | + $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 112 | + } |
|
| 113 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 114 | + { |
|
| 115 | + $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 116 | + $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 117 | + } |
|
| 118 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 119 | + { |
|
| 120 | + $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 121 | + $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 122 | + } |
|
| 123 | + catch( \Exception $e ) |
|
| 124 | + { |
|
| 125 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 126 | + |
|
| 127 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 128 | + $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** client/html/locale/select/standard/template-body |
|
| 132 | + * Relative path to the HTML body template of the locale select client. |
|
| 133 | + * |
|
| 134 | + * The template file contains the HTML code and processing instructions |
|
| 135 | + * to generate the result shown in the body of the frontend. The |
|
| 136 | + * configuration string is the path to the template file relative |
|
| 137 | + * to the templates directory (usually in client/html/templates). |
|
| 138 | + * |
|
| 139 | + * You can overwrite the template file configuration in extensions and |
|
| 140 | + * provide alternative templates. These alternative templates should be |
|
| 141 | + * named like the default one but with the string "standard" replaced by |
|
| 142 | + * an unique name. You may use the name of your project for this. If |
|
| 143 | + * you've implemented an alternative client class as well, "standard" |
|
| 144 | + * should be replaced by the name of the new class. |
|
| 145 | + * |
|
| 146 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 147 | + * @since 2014.09 |
|
| 148 | + * @category Developer |
|
| 149 | + * @see client/html/locale/select/standard/template-header |
|
| 150 | + */ |
|
| 151 | + $tplconf = 'client/html/locale/select/standard/template-body'; |
|
| 152 | + $default = 'locale/select/body-default.php'; |
|
| 153 | + |
|
| 154 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * Returns the HTML string for insertion into the header. |
|
| 160 | + * |
|
| 161 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 162 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 163 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 164 | + * @return string|null String including HTML tags for the header on error |
|
| 165 | + */ |
|
| 166 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 167 | + { |
|
| 168 | + try |
|
| 169 | + { |
|
| 170 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 171 | + |
|
| 172 | + $html = ''; |
|
| 173 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 174 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 175 | + } |
|
| 176 | + $view->selectHeader = $html; |
|
| 177 | + |
|
| 178 | + /** client/html/locale/select/standard/template-header |
|
| 179 | + * Relative path to the HTML header template of the locale select client. |
|
| 180 | + * |
|
| 181 | + * The template file contains the HTML code and processing instructions |
|
| 182 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 183 | + * of the rendered page in the frontend. The configuration string is the |
|
| 184 | + * path to the template file relative to the templates directory (usually |
|
| 185 | + * in client/html/templates). |
|
| 186 | + * |
|
| 187 | + * You can overwrite the template file configuration in extensions and |
|
| 188 | + * provide alternative templates. These alternative templates should be |
|
| 189 | + * named like the default one but with the string "standard" replaced by |
|
| 190 | + * an unique name. You may use the name of your project for this. If |
|
| 191 | + * you've implemented an alternative client class as well, "standard" |
|
| 192 | + * should be replaced by the name of the new class. |
|
| 193 | + * |
|
| 194 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 195 | + * @since 2014.09 |
|
| 196 | + * @category Developer |
|
| 197 | + * @see client/html/locale/select/standard/template-body |
|
| 198 | + */ |
|
| 199 | + $tplconf = 'client/html/locale/select/standard/template-header'; |
|
| 200 | + $default = 'locale/select/header-default.php'; |
|
| 201 | + |
|
| 202 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 203 | + } |
|
| 204 | + catch( \Exception $e ) |
|
| 205 | + { |
|
| 206 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 207 | + } |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + |
|
| 211 | + /** |
|
| 212 | + * Returns the sub-client given by its name. |
|
| 213 | + * |
|
| 214 | + * @param string $type Name of the client type |
|
| 215 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 216 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 217 | + */ |
|
| 218 | + public function getSubClient( $type, $name = null ) |
|
| 219 | + { |
|
| 220 | + /** client/html/locale/select/decorators/excludes |
|
| 221 | + * Excludes decorators added by the "common" option from the locale select html client |
|
| 222 | + * |
|
| 223 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 224 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 225 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 226 | + * modify what is returned to the caller. |
|
| 227 | + * |
|
| 228 | + * This option allows you to remove a decorator added via |
|
| 229 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 230 | + * around the html client. |
|
| 231 | + * |
|
| 232 | + * client/html/locale/select/decorators/excludes = array( 'decorator1' ) |
|
| 233 | + * |
|
| 234 | + * This would remove the decorator named "decorator1" from the list of |
|
| 235 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 236 | + * "client/html/common/decorators/default" to the html client. |
|
| 237 | + * |
|
| 238 | + * @param array List of decorator names |
|
| 239 | + * @since 2014.05 |
|
| 240 | + * @category Developer |
|
| 241 | + * @see client/html/common/decorators/default |
|
| 242 | + * @see client/html/locale/select/decorators/global |
|
| 243 | + * @see client/html/locale/select/decorators/local |
|
| 244 | + */ |
|
| 245 | + |
|
| 246 | + /** client/html/locale/select/decorators/global |
|
| 247 | + * Adds a list of globally available decorators only to the locale select html client |
|
| 248 | + * |
|
| 249 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 250 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 251 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 252 | + * modify what is returned to the caller. |
|
| 253 | + * |
|
| 254 | + * This option allows you to wrap global decorators |
|
| 255 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 256 | + * |
|
| 257 | + * client/html/locale/select/decorators/global = array( 'decorator1' ) |
|
| 258 | + * |
|
| 259 | + * This would add the decorator named "decorator1" defined by |
|
| 260 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 261 | + * |
|
| 262 | + * @param array List of decorator names |
|
| 263 | + * @since 2014.05 |
|
| 264 | + * @category Developer |
|
| 265 | + * @see client/html/common/decorators/default |
|
| 266 | + * @see client/html/locale/select/decorators/excludes |
|
| 267 | + * @see client/html/locale/select/decorators/local |
|
| 268 | + */ |
|
| 269 | + |
|
| 270 | + /** client/html/locale/select/decorators/local |
|
| 271 | + * Adds a list of local decorators only to the locale select html client |
|
| 272 | + * |
|
| 273 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 274 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 275 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 276 | + * modify what is returned to the caller. |
|
| 277 | + * |
|
| 278 | + * This option allows you to wrap local decorators |
|
| 279 | + * ("\Aimeos\Client\Html\Locale\Decorator\*") around the html client. |
|
| 280 | + * |
|
| 281 | + * client/html/locale/select/decorators/local = array( 'decorator2' ) |
|
| 282 | + * |
|
| 283 | + * This would add the decorator named "decorator2" defined by |
|
| 284 | + * "\Aimeos\Client\Html\Locale\Decorator\Decorator2" only to the html client. |
|
| 285 | + * |
|
| 286 | + * @param array List of decorator names |
|
| 287 | + * @since 2014.05 |
|
| 288 | + * @category Developer |
|
| 289 | + * @see client/html/common/decorators/default |
|
| 290 | + * @see client/html/locale/select/decorators/excludes |
|
| 291 | + * @see client/html/locale/select/decorators/global |
|
| 292 | + */ |
|
| 293 | + return $this->createSubClient( 'locale/select/' . $type, $name ); |
|
| 294 | + } |
|
| 295 | + |
|
| 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 | + } |
|
| 306 | + |
|
| 307 | + |
|
| 308 | + /** |
|
| 309 | + * Sets the necessary parameter values in the view. |
|
| 310 | + * |
|
| 311 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 312 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 313 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 314 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 315 | + */ |
|
| 316 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 317 | + { |
|
| 318 | + if( !isset( $this->cache ) ) |
|
| 319 | + { |
|
| 320 | + $map = array(); |
|
| 321 | + $context = $this->getContext(); |
|
| 322 | + $config = $context->getConfig(); |
|
| 323 | + $locale = $context->getLocale(); |
|
| 324 | + |
|
| 325 | + /** client/html/locale/select/language/param-name |
|
| 326 | + * Name of the parameter that contains the language ID value |
|
| 327 | + * |
|
| 328 | + * Frameworks and applications normally use its own predefined parameter |
|
| 329 | + * that contains the current language ID if they are multi-language |
|
| 330 | + * capable. To adapt the Aimeos parameter name to the already used name, |
|
| 331 | + * you are able to configure it by using this setting. |
|
| 332 | + * |
|
| 333 | + * @param string Parameter name for language ID |
|
| 334 | + * @since 2015.06 |
|
| 335 | + * @see client/html/locale/select/currency/param-name |
|
| 336 | + */ |
|
| 337 | + $langname = $config->get( 'client/html/locale/select/language/param-name', 'loc_languageid' ); |
|
| 338 | + |
|
| 339 | + /** client/html/locale/select/currency/param-name |
|
| 340 | + * Name of the parameter that contains the currency ID value |
|
| 341 | + * |
|
| 342 | + * Frameworks and applications normally use its own predefined parameter |
|
| 343 | + * that contains the current currency ID if they already support multiple |
|
| 344 | + * currencies. To adapt the Aimeos parameter name to the already used name, |
|
| 345 | + * you are able to configure it by using this setting. |
|
| 346 | + * |
|
| 347 | + * @param string Parameter name for currency ID |
|
| 348 | + * @since 2015.06 |
|
| 349 | + * @see client/html/locale/select/language/param-name |
|
| 350 | + */ |
|
| 351 | + $curname = $config->get( 'client/html/locale/select/currency/param-name', 'loc_currencyid' ); |
|
| 352 | + |
|
| 353 | + |
|
| 354 | + $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 355 | + |
|
| 356 | + $search = $manager->createSearch( true ); |
|
| 357 | + $search->setSortations( array( $search->sort( '+', 'locale.position' ) ) ); |
|
| 358 | + |
|
| 359 | + foreach( $manager->searchItems( $search ) as $item ) |
|
| 360 | + { |
|
| 361 | + $curId = $item->getCurrencyId(); |
|
| 362 | + $langId = $item->getLanguageId(); |
|
| 363 | + $map[$langId][$curId] = array( $langname => $langId, $curname => $curId ); |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + $params = $view->param(); |
|
| 367 | + |
|
| 368 | + $view->selectMap = $map; |
|
| 369 | + $view->selectParams = $params; |
|
| 370 | + $view->selectLanguageId = $locale->getLanguageId(); |
|
| 371 | + $view->selectCurrencyId = $locale->getCurrencyId(); |
|
| 372 | + |
|
| 373 | + $this->cache = $view; |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + return $this->cache; |
|
| 377 | + } |
|
| 378 | 378 | } |
| 379 | 379 | \ No newline at end of file |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @since 2014.09 |
| 79 | 79 | * @category Developer |
| 80 | 80 | */ |
| 81 | - private $subPartNames = array( 'language', 'currency' ); |
|
| 81 | + private $subPartNames = array('language', 'currency'); |
|
| 82 | 82 | private $cache; |
| 83 | 83 | |
| 84 | 84 | |
@@ -90,42 +90,42 @@ discard block |
||
| 90 | 90 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 91 | 91 | * @return string HTML code |
| 92 | 92 | */ |
| 93 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 93 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 94 | 94 | { |
| 95 | 95 | $context = $this->getContext(); |
| 96 | 96 | $view = $this->getView(); |
| 97 | 97 | |
| 98 | 98 | try |
| 99 | 99 | { |
| 100 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 100 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 101 | 101 | |
| 102 | 102 | $html = ''; |
| 103 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 104 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 103 | + foreach ($this->getSubClients() as $subclient) { |
|
| 104 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 105 | 105 | } |
| 106 | 106 | $view->selectBody = $html; |
| 107 | 107 | } |
| 108 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 108 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 109 | 109 | { |
| 110 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 111 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 110 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 111 | + $view->selectErrorList = $view->get('selectErrorList', array()) + $error; |
|
| 112 | 112 | } |
| 113 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 113 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 114 | 114 | { |
| 115 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 116 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 115 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 116 | + $view->selectErrorList = $view->get('selectErrorList', array()) + $error; |
|
| 117 | 117 | } |
| 118 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 118 | + catch (\Aimeos\MShop\Exception $e) |
|
| 119 | 119 | { |
| 120 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 121 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 120 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 121 | + $view->selectErrorList = $view->get('selectErrorList', array()) + $error; |
|
| 122 | 122 | } |
| 123 | - catch( \Exception $e ) |
|
| 123 | + catch (\Exception $e) |
|
| 124 | 124 | { |
| 125 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 125 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 126 | 126 | |
| 127 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 128 | - $view->selectErrorList = $view->get( 'selectErrorList', array() ) + $error; |
|
| 127 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 128 | + $view->selectErrorList = $view->get('selectErrorList', array()) + $error; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** client/html/locale/select/standard/template-body |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $tplconf = 'client/html/locale/select/standard/template-body'; |
| 152 | 152 | $default = 'locale/select/body-default.php'; |
| 153 | 153 | |
| 154 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 154 | + return $view->render($view->config($tplconf, $default)); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
@@ -163,15 +163,15 @@ discard block |
||
| 163 | 163 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 164 | 164 | * @return string|null String including HTML tags for the header on error |
| 165 | 165 | */ |
| 166 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 166 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 167 | 167 | { |
| 168 | 168 | try |
| 169 | 169 | { |
| 170 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 170 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 171 | 171 | |
| 172 | 172 | $html = ''; |
| 173 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 174 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 173 | + foreach ($this->getSubClients() as $subclient) { |
|
| 174 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 175 | 175 | } |
| 176 | 176 | $view->selectHeader = $html; |
| 177 | 177 | |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | $tplconf = 'client/html/locale/select/standard/template-header'; |
| 200 | 200 | $default = 'locale/select/header-default.php'; |
| 201 | 201 | |
| 202 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 202 | + return $view->render($view->config($tplconf, $default)); |
|
| 203 | 203 | } |
| 204 | - catch( \Exception $e ) |
|
| 204 | + catch (\Exception $e) |
|
| 205 | 205 | { |
| 206 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 206 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @param string|null $name Name of the sub-client (Default if null) |
| 216 | 216 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 217 | 217 | */ |
| 218 | - public function getSubClient( $type, $name = null ) |
|
| 218 | + public function getSubClient($type, $name = null) |
|
| 219 | 219 | { |
| 220 | 220 | /** client/html/locale/select/decorators/excludes |
| 221 | 221 | * Excludes decorators added by the "common" option from the locale select html client |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @see client/html/locale/select/decorators/excludes |
| 291 | 291 | * @see client/html/locale/select/decorators/global |
| 292 | 292 | */ |
| 293 | - return $this->createSubClient( 'locale/select/' . $type, $name ); |
|
| 293 | + return $this->createSubClient('locale/select/'.$type, $name); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -301,7 +301,7 @@ discard block |
||
| 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 | |
@@ -313,9 +313,9 @@ discard block |
||
| 313 | 313 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 314 | 314 | * @return \Aimeos\MW\View\Iface Modified view object |
| 315 | 315 | */ |
| 316 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 316 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 317 | 317 | { |
| 318 | - if( !isset( $this->cache ) ) |
|
| 318 | + if (!isset($this->cache)) |
|
| 319 | 319 | { |
| 320 | 320 | $map = array(); |
| 321 | 321 | $context = $this->getContext(); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @since 2015.06 |
| 335 | 335 | * @see client/html/locale/select/currency/param-name |
| 336 | 336 | */ |
| 337 | - $langname = $config->get( 'client/html/locale/select/language/param-name', 'loc_languageid' ); |
|
| 337 | + $langname = $config->get('client/html/locale/select/language/param-name', 'loc_languageid'); |
|
| 338 | 338 | |
| 339 | 339 | /** client/html/locale/select/currency/param-name |
| 340 | 340 | * Name of the parameter that contains the currency ID value |
@@ -348,19 +348,19 @@ discard block |
||
| 348 | 348 | * @since 2015.06 |
| 349 | 349 | * @see client/html/locale/select/language/param-name |
| 350 | 350 | */ |
| 351 | - $curname = $config->get( 'client/html/locale/select/currency/param-name', 'loc_currencyid' ); |
|
| 351 | + $curname = $config->get('client/html/locale/select/currency/param-name', 'loc_currencyid'); |
|
| 352 | 352 | |
| 353 | 353 | |
| 354 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 354 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 355 | 355 | |
| 356 | - $search = $manager->createSearch( true ); |
|
| 357 | - $search->setSortations( array( $search->sort( '+', 'locale.position' ) ) ); |
|
| 356 | + $search = $manager->createSearch(true); |
|
| 357 | + $search->setSortations(array($search->sort('+', 'locale.position'))); |
|
| 358 | 358 | |
| 359 | - foreach( $manager->searchItems( $search ) as $item ) |
|
| 359 | + foreach ($manager->searchItems($search) as $item) |
|
| 360 | 360 | { |
| 361 | 361 | $curId = $item->getCurrencyId(); |
| 362 | 362 | $langId = $item->getLanguageId(); |
| 363 | - $map[$langId][$curId] = array( $langname => $langId, $curname => $curId ); |
|
| 363 | + $map[$langId][$curId] = array($langname => $langId, $curname => $curId); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | $params = $view->param(); |
@@ -82,23 +82,19 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -19,48 +19,48 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Factory |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Creates a new client object. |
|
| 24 | - * |
|
| 25 | - * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 26 | - * @param array List of file system paths where the templates are stored |
|
| 27 | - * @param string $type Type of the client, e.g 'account/favorite' for \Aimeos\Client\Html\Account\Favorite\Standard |
|
| 28 | - * @param string|null $name Client name (default: "Standard") |
|
| 29 | - * @return \Aimeos\Client\Html\Iface HTML client implementing \Aimeos\Client\Html\Iface |
|
| 30 | - * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 31 | - */ |
|
| 32 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null ) |
|
| 33 | - { |
|
| 34 | - if( empty( $type ) ) { |
|
| 35 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Client HTML type is empty' ) ); |
|
| 36 | - } |
|
| 22 | + /** |
|
| 23 | + * Creates a new client object. |
|
| 24 | + * |
|
| 25 | + * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 26 | + * @param array List of file system paths where the templates are stored |
|
| 27 | + * @param string $type Type of the client, e.g 'account/favorite' for \Aimeos\Client\Html\Account\Favorite\Standard |
|
| 28 | + * @param string|null $name Client name (default: "Standard") |
|
| 29 | + * @return \Aimeos\Client\Html\Iface HTML client implementing \Aimeos\Client\Html\Iface |
|
| 30 | + * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 31 | + */ |
|
| 32 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null ) |
|
| 33 | + { |
|
| 34 | + if( empty( $type ) ) { |
|
| 35 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Client HTML type is empty' ) ); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $parts = explode( '/', $type ); |
|
| 38 | + $parts = explode( '/', $type ); |
|
| 39 | 39 | |
| 40 | - if( count( $parts ) !== 2 ) { |
|
| 41 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Client type "%1$s" must consist of two parts separated by "/"', $type ) ); |
|
| 42 | - } |
|
| 40 | + if( count( $parts ) !== 2 ) { |
|
| 41 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Client type "%1$s" must consist of two parts separated by "/"', $type ) ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - foreach( $parts as $part ) |
|
| 45 | - { |
|
| 46 | - if( ctype_alnum( $part ) === false ) { |
|
| 47 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in client name "%1$s" in "%2$s"', $part, $type ) ); |
|
| 48 | - } |
|
| 49 | - } |
|
| 44 | + foreach( $parts as $part ) |
|
| 45 | + { |
|
| 46 | + if( ctype_alnum( $part ) === false ) { |
|
| 47 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in client name "%1$s" in "%2$s"', $part, $type ) ); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $factory = '\\Aimeos\\Client\\Html\\' . ucwords( $parts[0] ) . '\\' . ucwords( $parts[1] ) . '\\Factory'; |
|
| 51 | + $factory = '\\Aimeos\\Client\\Html\\' . ucwords( $parts[0] ) . '\\' . ucwords( $parts[1] ) . '\\Factory'; |
|
| 52 | 52 | |
| 53 | - if( class_exists( $factory ) === false ) { |
|
| 54 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not available', $factory ) ); |
|
| 55 | - } |
|
| 53 | + if( class_exists( $factory ) === false ) { |
|
| 54 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not available', $factory ) ); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - $client = @call_user_func_array( array( $factory, 'createClient' ), array( $context, $templatePaths, $name ) ); |
|
| 57 | + $client = @call_user_func_array( array( $factory, 'createClient' ), array( $context, $templatePaths, $name ) ); |
|
| 58 | 58 | |
| 59 | - if( $client === false ) { |
|
| 60 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
| 61 | - } |
|
| 59 | + if( $client === false ) { |
|
| 60 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $client; |
|
| 64 | - } |
|
| 63 | + return $client; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -29,35 +29,35 @@ |
||
| 29 | 29 | * @return \Aimeos\Client\Html\Iface HTML client implementing \Aimeos\Client\Html\Iface |
| 30 | 30 | * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
| 31 | 31 | */ |
| 32 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null ) |
|
| 32 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null) |
|
| 33 | 33 | { |
| 34 | - if( empty( $type ) ) { |
|
| 35 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Client HTML type is empty' ) ); |
|
| 34 | + if (empty($type)) { |
|
| 35 | + throw new \Aimeos\Client\Html\Exception(sprintf('Client HTML type is empty')); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $parts = explode( '/', $type ); |
|
| 38 | + $parts = explode('/', $type); |
|
| 39 | 39 | |
| 40 | - if( count( $parts ) !== 2 ) { |
|
| 41 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Client type "%1$s" must consist of two parts separated by "/"', $type ) ); |
|
| 40 | + if (count($parts) !== 2) { |
|
| 41 | + throw new \Aimeos\Client\Html\Exception(sprintf('Client type "%1$s" must consist of two parts separated by "/"', $type)); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - foreach( $parts as $part ) |
|
| 44 | + foreach ($parts as $part) |
|
| 45 | 45 | { |
| 46 | - if( ctype_alnum( $part ) === false ) { |
|
| 47 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in client name "%1$s" in "%2$s"', $part, $type ) ); |
|
| 46 | + if (ctype_alnum($part) === false) { |
|
| 47 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in client name "%1$s" in "%2$s"', $part, $type)); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $factory = '\\Aimeos\\Client\\Html\\' . ucwords( $parts[0] ) . '\\' . ucwords( $parts[1] ) . '\\Factory'; |
|
| 51 | + $factory = '\\Aimeos\\Client\\Html\\'.ucwords($parts[0]).'\\'.ucwords($parts[1]).'\\Factory'; |
|
| 52 | 52 | |
| 53 | - if( class_exists( $factory ) === false ) { |
|
| 54 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Class "%1$s" not available', $factory ) ); |
|
| 53 | + if (class_exists($factory) === false) { |
|
| 54 | + throw new \Aimeos\Client\Html\Exception(sprintf('Class "%1$s" not available', $factory)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $client = @call_user_func_array( array( $factory, 'createClient' ), array( $context, $templatePaths, $name ) ); |
|
| 57 | + $client = @call_user_func_array(array($factory, 'createClient'), array($context, $templatePaths, $name)); |
|
| 58 | 58 | |
| 59 | - if( $client === false ) { |
|
| 60 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
| 59 | + if ($client === false) { |
|
| 60 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid factory "%1$s"', $factory)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | return $client; |
@@ -19,66 +19,66 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | abstract class Base |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | 23 | { |
| 24 | - /** |
|
| 25 | - * Removes all cached basket parts from the cache. |
|
| 26 | - */ |
|
| 27 | - protected function clearCached() |
|
| 28 | - { |
|
| 29 | - $session = $this->getContext()->getSession(); |
|
| 24 | + /** |
|
| 25 | + * Removes all cached basket parts from the cache. |
|
| 26 | + */ |
|
| 27 | + protected function clearCached() |
|
| 28 | + { |
|
| 29 | + $session = $this->getContext()->getSession(); |
|
| 30 | 30 | |
| 31 | - foreach( $session->get( 'aimeos/basket/cache', array() ) as $key => $value ) { |
|
| 32 | - $session->set( $key, null ); |
|
| 33 | - } |
|
| 34 | - } |
|
| 31 | + foreach( $session->get( 'aimeos/basket/cache', array() ) as $key => $value ) { |
|
| 32 | + $session->set( $key, null ); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Returns the basket cache entry from the cache if available. |
|
| 39 | - * |
|
| 40 | - * @param string $key Path to the requested cache entry |
|
| 41 | - * @param mixed $default Value returned if requested key isn't found |
|
| 42 | - * @return mixed Value associated to the requested key. If no value for the |
|
| 43 | - * key is found in the cache, the given default value is returned |
|
| 44 | - */ |
|
| 45 | - protected function getBasketCached( $key, $default = null ) |
|
| 46 | - { |
|
| 47 | - return $this->getContext()->getSession()->get( $key, $default ); |
|
| 48 | - } |
|
| 37 | + /** |
|
| 38 | + * Returns the basket cache entry from the cache if available. |
|
| 39 | + * |
|
| 40 | + * @param string $key Path to the requested cache entry |
|
| 41 | + * @param mixed $default Value returned if requested key isn't found |
|
| 42 | + * @return mixed Value associated to the requested key. If no value for the |
|
| 43 | + * key is found in the cache, the given default value is returned |
|
| 44 | + */ |
|
| 45 | + protected function getBasketCached( $key, $default = null ) |
|
| 46 | + { |
|
| 47 | + return $this->getContext()->getSession()->get( $key, $default ); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Adds or overwrite a cache entry for the given key and value. |
|
| 53 | - * |
|
| 54 | - * @param string $key Path the cache entry should be stored in |
|
| 55 | - * @param mixed $value Value stored in the cache for the path |
|
| 56 | - */ |
|
| 57 | - protected function setBasketCached( $key, $value ) |
|
| 58 | - { |
|
| 59 | - $context = $this->getContext(); |
|
| 51 | + /** |
|
| 52 | + * Adds or overwrite a cache entry for the given key and value. |
|
| 53 | + * |
|
| 54 | + * @param string $key Path the cache entry should be stored in |
|
| 55 | + * @param mixed $value Value stored in the cache for the path |
|
| 56 | + */ |
|
| 57 | + protected function setBasketCached( $key, $value ) |
|
| 58 | + { |
|
| 59 | + $context = $this->getContext(); |
|
| 60 | 60 | |
| 61 | - /** client/html/basket/cache/enable |
|
| 62 | - * Enables or disables caching of the basket content |
|
| 63 | - * |
|
| 64 | - * For performance reasons, the content of the small baskets is cached |
|
| 65 | - * in the session of the customer. The cache is updated each time the |
|
| 66 | - * basket content changes either by adding, deleting or editing products. |
|
| 67 | - * |
|
| 68 | - * To ease development, the caching can be disabled but you shouldn't |
|
| 69 | - * disable it in your production environment! |
|
| 70 | - * |
|
| 71 | - * @param boolean True to enable, false to disable basket content caching |
|
| 72 | - * @category Developer |
|
| 73 | - * @since 2014.11 |
|
| 74 | - */ |
|
| 75 | - if( $context->getConfig()->get( 'client/html/basket/cache/enable', true ) != false ) |
|
| 76 | - { |
|
| 77 | - $session = $context->getSession(); |
|
| 61 | + /** client/html/basket/cache/enable |
|
| 62 | + * Enables or disables caching of the basket content |
|
| 63 | + * |
|
| 64 | + * For performance reasons, the content of the small baskets is cached |
|
| 65 | + * in the session of the customer. The cache is updated each time the |
|
| 66 | + * basket content changes either by adding, deleting or editing products. |
|
| 67 | + * |
|
| 68 | + * To ease development, the caching can be disabled but you shouldn't |
|
| 69 | + * disable it in your production environment! |
|
| 70 | + * |
|
| 71 | + * @param boolean True to enable, false to disable basket content caching |
|
| 72 | + * @category Developer |
|
| 73 | + * @since 2014.11 |
|
| 74 | + */ |
|
| 75 | + if( $context->getConfig()->get( 'client/html/basket/cache/enable', true ) != false ) |
|
| 76 | + { |
|
| 77 | + $session = $context->getSession(); |
|
| 78 | 78 | |
| 79 | - $cached = $session->get( 'aimeos/basket/cache', array() ) + array( $key => true ); |
|
| 80 | - $session->set( 'aimeos/basket/cache', $cached ); |
|
| 81 | - $session->set( $key, $value ); |
|
| 82 | - } |
|
| 83 | - } |
|
| 79 | + $cached = $session->get( 'aimeos/basket/cache', array() ) + array( $key => true ); |
|
| 80 | + $session->set( 'aimeos/basket/cache', $cached ); |
|
| 81 | + $session->set( $key, $value ); |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | 84 | } |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $session = $this->getContext()->getSession(); |
| 30 | 30 | |
| 31 | - foreach( $session->get( 'aimeos/basket/cache', array() ) as $key => $value ) { |
|
| 32 | - $session->set( $key, null ); |
|
| 31 | + foreach ($session->get('aimeos/basket/cache', array()) as $key => $value) { |
|
| 32 | + $session->set($key, null); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * @return mixed Value associated to the requested key. If no value for the |
| 43 | 43 | * key is found in the cache, the given default value is returned |
| 44 | 44 | */ |
| 45 | - protected function getBasketCached( $key, $default = null ) |
|
| 45 | + protected function getBasketCached($key, $default = null) |
|
| 46 | 46 | { |
| 47 | - return $this->getContext()->getSession()->get( $key, $default ); |
|
| 47 | + return $this->getContext()->getSession()->get($key, $default); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param string $key Path the cache entry should be stored in |
| 55 | 55 | * @param mixed $value Value stored in the cache for the path |
| 56 | 56 | */ |
| 57 | - protected function setBasketCached( $key, $value ) |
|
| 57 | + protected function setBasketCached($key, $value) |
|
| 58 | 58 | { |
| 59 | 59 | $context = $this->getContext(); |
| 60 | 60 | |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | * @category Developer |
| 73 | 73 | * @since 2014.11 |
| 74 | 74 | */ |
| 75 | - if( $context->getConfig()->get( 'client/html/basket/cache/enable', true ) != false ) |
|
| 75 | + if ($context->getConfig()->get('client/html/basket/cache/enable', true) != false) |
|
| 76 | 76 | { |
| 77 | 77 | $session = $context->getSession(); |
| 78 | 78 | |
| 79 | - $cached = $session->get( 'aimeos/basket/cache', array() ) + array( $key => true ); |
|
| 80 | - $session->set( 'aimeos/basket/cache', $cached ); |
|
| 81 | - $session->set( $key, $value ); |
|
| 79 | + $cached = $session->get('aimeos/basket/cache', array()) + array($key => true); |
|
| 80 | + $session->set('aimeos/basket/cache', $cached); |
|
| 81 | + $session->set($key, $value); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -19,292 +19,292 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Basket\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Basket\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/basket/standard/coupon/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the basket standard coupon section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/basket/standard/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/basket/standard/coupon/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the basket standard coupon client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/basket/standard/coupon/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/basket/standard/coupon/standard/template-body'; |
|
| 101 | - $default = 'basket/standard/coupon-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->couponHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/basket/standard/coupon/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the basket standard coupon client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/basket/standard/coupon/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/basket/standard/coupon/standard/template-header'; |
|
| 147 | - $default = 'basket/standard/coupon-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/basket/standard/coupon/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the basket standard coupon html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/basket/standard/coupon/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/basket/standard/coupon/decorators/global |
|
| 185 | - * @see client/html/basket/standard/coupon/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/basket/standard/coupon/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the basket standard coupon html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/basket/standard/coupon/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/basket/standard/coupon/decorators/excludes |
|
| 209 | - * @see client/html/basket/standard/coupon/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/basket/standard/coupon/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the basket standard coupon html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/basket/standard/coupon/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/basket/standard/coupon/decorators/excludes |
|
| 233 | - * @see client/html/basket/standard/coupon/decorators/global |
|
| 234 | - */ |
|
| 235 | - return $this->createSubClient( 'basket/standard/coupon/' . $type, $name ); |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * Processes the input, e.g. store given values. |
|
| 241 | - * A view must be available and this method doesn't generate any output |
|
| 242 | - * besides setting view variables. |
|
| 243 | - */ |
|
| 244 | - public function process() |
|
| 245 | - { |
|
| 246 | - $view = $this->getView(); |
|
| 247 | - $context = $this->getContext(); |
|
| 248 | - |
|
| 249 | - switch( $view->param( 'b_action' ) ) |
|
| 250 | - { |
|
| 251 | - case 'coupon-delete': |
|
| 252 | - |
|
| 253 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 254 | - { |
|
| 255 | - $this->clearCached(); |
|
| 256 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 257 | - $cntl->deleteCoupon( $coupon ); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - break; |
|
| 261 | - |
|
| 262 | - default: |
|
| 263 | - |
|
| 264 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 265 | - { |
|
| 266 | - $this->clearCached(); |
|
| 267 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 268 | - |
|
| 269 | - /** client/html/basket/standard/coupon/allowed |
|
| 270 | - * Number of coupon codes a customer is allowed to enter |
|
| 271 | - * |
|
| 272 | - * This configuration option enables shop owners to limit the number of coupon |
|
| 273 | - * codes that can be added by a customer to his current basket. By default, only |
|
| 274 | - * one coupon code is allowed per order. |
|
| 275 | - * |
|
| 276 | - * Coupon codes are valid until a payed order is placed by the customer. The |
|
| 277 | - * "count" of the codes is decreased afterwards. If codes are not personalized |
|
| 278 | - * the codes can be reused in the next order until their "count" reaches zero. |
|
| 279 | - * |
|
| 280 | - * @param integer Positive number of coupon codes including zero |
|
| 281 | - * @since 2014.05 |
|
| 282 | - * @category User |
|
| 283 | - * @category Developer |
|
| 284 | - */ |
|
| 285 | - $allowed = $context->getConfig()->get( 'client/html/basket/standard/coupon/allowed', 1 ); |
|
| 286 | - |
|
| 287 | - if( $allowed <= count( $cntl->get()->getCoupons() ) ) { |
|
| 288 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Number of coupon codes exceeds the limit' ) ); |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - $cntl->addCoupon( $coupon ); |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - break; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - parent::process(); |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - |
|
| 301 | - /** |
|
| 302 | - * Returns the list of sub-client names configured for the client. |
|
| 303 | - * |
|
| 304 | - * @return array List of HTML client names |
|
| 305 | - */ |
|
| 306 | - protected function getSubClientNames() |
|
| 307 | - { |
|
| 308 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 309 | - } |
|
| 25 | + /** client/html/basket/standard/coupon/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the basket standard coupon section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/basket/standard/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/basket/standard/coupon/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the basket standard coupon client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/basket/standard/coupon/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/basket/standard/coupon/standard/template-body'; |
|
| 101 | + $default = 'basket/standard/coupon-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->couponHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/basket/standard/coupon/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the basket standard coupon client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/basket/standard/coupon/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/basket/standard/coupon/standard/template-header'; |
|
| 147 | + $default = 'basket/standard/coupon-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/basket/standard/coupon/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the basket standard coupon html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/basket/standard/coupon/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/basket/standard/coupon/decorators/global |
|
| 185 | + * @see client/html/basket/standard/coupon/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/basket/standard/coupon/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the basket standard coupon html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/basket/standard/coupon/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/basket/standard/coupon/decorators/excludes |
|
| 209 | + * @see client/html/basket/standard/coupon/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/basket/standard/coupon/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the basket standard coupon html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/basket/standard/coupon/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/basket/standard/coupon/decorators/excludes |
|
| 233 | + * @see client/html/basket/standard/coupon/decorators/global |
|
| 234 | + */ |
|
| 235 | + return $this->createSubClient( 'basket/standard/coupon/' . $type, $name ); |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * Processes the input, e.g. store given values. |
|
| 241 | + * A view must be available and this method doesn't generate any output |
|
| 242 | + * besides setting view variables. |
|
| 243 | + */ |
|
| 244 | + public function process() |
|
| 245 | + { |
|
| 246 | + $view = $this->getView(); |
|
| 247 | + $context = $this->getContext(); |
|
| 248 | + |
|
| 249 | + switch( $view->param( 'b_action' ) ) |
|
| 250 | + { |
|
| 251 | + case 'coupon-delete': |
|
| 252 | + |
|
| 253 | + if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 254 | + { |
|
| 255 | + $this->clearCached(); |
|
| 256 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 257 | + $cntl->deleteCoupon( $coupon ); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + break; |
|
| 261 | + |
|
| 262 | + default: |
|
| 263 | + |
|
| 264 | + if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 265 | + { |
|
| 266 | + $this->clearCached(); |
|
| 267 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 268 | + |
|
| 269 | + /** client/html/basket/standard/coupon/allowed |
|
| 270 | + * Number of coupon codes a customer is allowed to enter |
|
| 271 | + * |
|
| 272 | + * This configuration option enables shop owners to limit the number of coupon |
|
| 273 | + * codes that can be added by a customer to his current basket. By default, only |
|
| 274 | + * one coupon code is allowed per order. |
|
| 275 | + * |
|
| 276 | + * Coupon codes are valid until a payed order is placed by the customer. The |
|
| 277 | + * "count" of the codes is decreased afterwards. If codes are not personalized |
|
| 278 | + * the codes can be reused in the next order until their "count" reaches zero. |
|
| 279 | + * |
|
| 280 | + * @param integer Positive number of coupon codes including zero |
|
| 281 | + * @since 2014.05 |
|
| 282 | + * @category User |
|
| 283 | + * @category Developer |
|
| 284 | + */ |
|
| 285 | + $allowed = $context->getConfig()->get( 'client/html/basket/standard/coupon/allowed', 1 ); |
|
| 286 | + |
|
| 287 | + if( $allowed <= count( $cntl->get()->getCoupons() ) ) { |
|
| 288 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Number of coupon codes exceeds the limit' ) ); |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + $cntl->addCoupon( $coupon ); |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + break; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + parent::process(); |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + |
|
| 301 | + /** |
|
| 302 | + * Returns the list of sub-client names configured for the client. |
|
| 303 | + * |
|
| 304 | + * @return array List of HTML client names |
|
| 305 | + */ |
|
| 306 | + protected function getSubClientNames() |
|
| 307 | + { |
|
| 308 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 309 | + } |
|
| 310 | 310 | } |
| 311 | 311 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->couponBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/basket/standard/coupon/standard/template-body'; |
| 101 | 101 | $default = 'basket/standard/coupon-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->couponHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/basket/standard/coupon/standard/template-header'; |
| 147 | 147 | $default = 'basket/standard/coupon-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/basket/standard/coupon/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the basket standard coupon html client |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @see client/html/basket/standard/coupon/decorators/excludes |
| 233 | 233 | * @see client/html/basket/standard/coupon/decorators/global |
| 234 | 234 | */ |
| 235 | - return $this->createSubClient( 'basket/standard/coupon/' . $type, $name ); |
|
| 235 | + return $this->createSubClient('basket/standard/coupon/'.$type, $name); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -246,25 +246,25 @@ discard block |
||
| 246 | 246 | $view = $this->getView(); |
| 247 | 247 | $context = $this->getContext(); |
| 248 | 248 | |
| 249 | - switch( $view->param( 'b_action' ) ) |
|
| 249 | + switch ($view->param('b_action')) |
|
| 250 | 250 | { |
| 251 | 251 | case 'coupon-delete': |
| 252 | 252 | |
| 253 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 253 | + if (($coupon = $view->param('b_coupon')) != '') |
|
| 254 | 254 | { |
| 255 | 255 | $this->clearCached(); |
| 256 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 257 | - $cntl->deleteCoupon( $coupon ); |
|
| 256 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 257 | + $cntl->deleteCoupon($coupon); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | break; |
| 261 | 261 | |
| 262 | 262 | default: |
| 263 | 263 | |
| 264 | - if( ( $coupon = $view->param( 'b_coupon' ) ) != '' ) |
|
| 264 | + if (($coupon = $view->param('b_coupon')) != '') |
|
| 265 | 265 | { |
| 266 | 266 | $this->clearCached(); |
| 267 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 267 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 268 | 268 | |
| 269 | 269 | /** client/html/basket/standard/coupon/allowed |
| 270 | 270 | * Number of coupon codes a customer is allowed to enter |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | * @category User |
| 283 | 283 | * @category Developer |
| 284 | 284 | */ |
| 285 | - $allowed = $context->getConfig()->get( 'client/html/basket/standard/coupon/allowed', 1 ); |
|
| 285 | + $allowed = $context->getConfig()->get('client/html/basket/standard/coupon/allowed', 1); |
|
| 286 | 286 | |
| 287 | - if( $allowed <= count( $cntl->get()->getCoupons() ) ) { |
|
| 288 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Number of coupon codes exceeds the limit' ) ); |
|
| 287 | + if ($allowed <= count($cntl->get()->getCoupons())) { |
|
| 288 | + throw new \Aimeos\Client\Html\Exception(sprintf('Number of coupon codes exceeds the limit')); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - $cntl->addCoupon( $coupon ); |
|
| 291 | + $cntl->addCoupon($coupon); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | break; |
@@ -305,6 +305,6 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | protected function getSubClientNames() |
| 307 | 307 | { |
| 308 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 308 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,268 +19,268 @@ |
||
| 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/basket/standard/detail/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the basket standard detail section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2015.11 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/basket/standard/detail/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/basket/standard/detail/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the basket standard detail section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2015.11 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/basket/standard/detail/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->detailBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->detailBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/basket/standard/detail/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the basket standard detail client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * (second one) should be replaced by the name of the new class in lower |
|
| 95 | - * case. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2015.11 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/basket/standard/detail/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/basket/standard/detail/standard/template-body'; |
|
| 103 | - $default = 'common/summary/detail-body-default.php'; |
|
| 81 | + /** client/html/basket/standard/detail/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the basket standard detail client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * (second one) should be replaced by the name of the new class in lower |
|
| 95 | + * case. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2015.11 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/basket/standard/detail/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/basket/standard/detail/standard/template-body'; |
|
| 103 | + $default = 'common/summary/detail-body-default.php'; |
|
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | 120 | |
| 121 | - $html = ''; |
|
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | - } |
|
| 125 | - $view->detailHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->detailHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/basket/standard/detail/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the basket standard detail client. |
|
| 129 | - * |
|
| 130 | - * The template file contains the HTML code and processing instructions |
|
| 131 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | - * of the rendered page in the frontend. The configuration string is the |
|
| 133 | - * path to the template file relative to the templates directory (usually |
|
| 134 | - * in client/html/templates). |
|
| 135 | - * |
|
| 136 | - * You can overwrite the template file configuration in extensions and |
|
| 137 | - * provide alternative templates. These alternative templates should be |
|
| 138 | - * named like the default one but with the string "standard" replaced by |
|
| 139 | - * an unique name. You may use the name of your project for this. If |
|
| 140 | - * you've implemented an alternative client class as well, "standard" |
|
| 141 | - * (second one) should be replaced by the name of the new class in lower |
|
| 142 | - * case. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2015.11 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/basket/standard/detail/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/basket/standard/detail/standard/template-header'; |
|
| 150 | - $default = 'common/summary/detail-header-default.php'; |
|
| 127 | + /** client/html/basket/standard/detail/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the basket standard detail client. |
|
| 129 | + * |
|
| 130 | + * The template file contains the HTML code and processing instructions |
|
| 131 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | + * of the rendered page in the frontend. The configuration string is the |
|
| 133 | + * path to the template file relative to the templates directory (usually |
|
| 134 | + * in client/html/templates). |
|
| 135 | + * |
|
| 136 | + * You can overwrite the template file configuration in extensions and |
|
| 137 | + * provide alternative templates. These alternative templates should be |
|
| 138 | + * named like the default one but with the string "standard" replaced by |
|
| 139 | + * an unique name. You may use the name of your project for this. If |
|
| 140 | + * you've implemented an alternative client class as well, "standard" |
|
| 141 | + * (second one) should be replaced by the name of the new class in lower |
|
| 142 | + * case. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2015.11 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/basket/standard/detail/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/basket/standard/detail/standard/template-header'; |
|
| 150 | + $default = 'common/summary/detail-header-default.php'; |
|
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/basket/standard/detail/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the basket standard detail html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/basket/standard/detail/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/basket/standard/detail/decorators/global |
|
| 188 | - * @see client/html/basket/standard/detail/decorators/local |
|
| 189 | - */ |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/basket/standard/detail/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the basket standard detail html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/basket/standard/detail/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/basket/standard/detail/decorators/global |
|
| 188 | + * @see client/html/basket/standard/detail/decorators/local |
|
| 189 | + */ |
|
| 190 | 190 | |
| 191 | - /** client/html/basket/standard/detail/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the basket standard detail html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/basket/standard/detail/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/basket/standard/detail/decorators/excludes |
|
| 212 | - * @see client/html/basket/standard/detail/decorators/local |
|
| 213 | - */ |
|
| 191 | + /** client/html/basket/standard/detail/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the basket standard detail html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/basket/standard/detail/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/basket/standard/detail/decorators/excludes |
|
| 212 | + * @see client/html/basket/standard/detail/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/basket/standard/detail/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the basket standard detail html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/basket/standard/detail/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/basket/standard/detail/decorators/excludes |
|
| 236 | - * @see client/html/basket/standard/detail/decorators/global |
|
| 237 | - */ |
|
| 238 | - return $this->createSubClient( 'basket/standard/detail/' . $type, $name ); |
|
| 239 | - } |
|
| 215 | + /** client/html/basket/standard/detail/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the basket standard detail html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Basket\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/basket/standard/detail/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Basket\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/basket/standard/detail/decorators/excludes |
|
| 236 | + * @see client/html/basket/standard/detail/decorators/global |
|
| 237 | + */ |
|
| 238 | + return $this->createSubClient( 'basket/standard/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 | - $view = parent::setViewParams( $view ); |
|
| 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 | + $view = parent::setViewParams( $view ); |
|
| 264 | 264 | |
| 265 | - if( !isset( $this->cache ) ) |
|
| 266 | - { |
|
| 267 | - $basket = $view->standardBasket; |
|
| 265 | + if( !isset( $this->cache ) ) |
|
| 266 | + { |
|
| 267 | + $basket = $view->standardBasket; |
|
| 268 | 268 | |
| 269 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 270 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 271 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 272 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 269 | + $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 270 | + $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 271 | + $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 272 | + $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 273 | 273 | |
| 274 | - $view->summaryParams = $view->get( 'standardParams', array() ); |
|
| 275 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 276 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 277 | - $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 278 | - $view->summaryEnableModify = true; |
|
| 279 | - $view->summaryBasket = $basket; |
|
| 274 | + $view->summaryParams = $view->get( 'standardParams', array() ); |
|
| 275 | + $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 276 | + $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 277 | + $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 278 | + $view->summaryEnableModify = true; |
|
| 279 | + $view->summaryBasket = $basket; |
|
| 280 | 280 | |
| 281 | - $this->cache = $view; |
|
| 282 | - } |
|
| 281 | + $this->cache = $view; |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - return $this->cache; |
|
| 285 | - } |
|
| 284 | + return $this->cache; |
|
| 285 | + } |
|
| 286 | 286 | } |
| 287 | 287 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->detailBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/basket/standard/detail/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/detail-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->detailHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/basket/standard/detail/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/detail-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/basket/standard/detail/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the basket standard detail html client |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @see client/html/basket/standard/detail/decorators/excludes |
| 236 | 236 | * @see client/html/basket/standard/detail/decorators/global |
| 237 | 237 | */ |
| 238 | - return $this->createSubClient( 'basket/standard/detail/' . $type, $name ); |
|
| 238 | + return $this->createSubClient('basket/standard/detail/'.$type, $name); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function getSubClientNames() |
| 248 | 248 | { |
| 249 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 249 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,23 +258,23 @@ discard block |
||
| 258 | 258 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 259 | 259 | * @return \Aimeos\MW\View\Iface Modified view object |
| 260 | 260 | */ |
| 261 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 261 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 262 | 262 | { |
| 263 | - $view = parent::setViewParams( $view ); |
|
| 263 | + $view = parent::setViewParams($view); |
|
| 264 | 264 | |
| 265 | - if( !isset( $this->cache ) ) |
|
| 265 | + if (!isset($this->cache)) |
|
| 266 | 266 | { |
| 267 | 267 | $basket = $view->standardBasket; |
| 268 | 268 | |
| 269 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 270 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 271 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 272 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 269 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 270 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 271 | + $action = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 272 | + $config = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 273 | 273 | |
| 274 | - $view->summaryParams = $view->get( 'standardParams', array() ); |
|
| 275 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 276 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 277 | - $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 274 | + $view->summaryParams = $view->get('standardParams', array()); |
|
| 275 | + $view->summaryUrlServicePayment = $view->url($target, $cntl, $action, array('c_step' => 'payment'), array(), $config); |
|
| 276 | + $view->summaryUrlServiceDelivery = $view->url($target, $cntl, $action, array('c_step' => 'delivery'), array(), $config); |
|
| 277 | + $view->summaryTaxRates = $this->getTaxRates($basket); |
|
| 278 | 278 | $view->summaryEnableModify = true; |
| 279 | 279 | $view->summaryBasket = $basket; |
| 280 | 280 | |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,69 +19,69 @@ |
||
| 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 standard basket 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/basket/standard/name |
|
| 37 | - * Class name of the used basket standard 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\Basket\Standard\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Basket\Standard\Mybasket |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/basket/standard/name = Mybasket |
|
| 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 "MyBasket"! |
|
| 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/basket/standard/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a standard basket 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/basket/standard/name |
|
| 37 | + * Class name of the used basket standard 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\Basket\Standard\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Basket\Standard\Mybasket |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/basket/standard/name = Mybasket |
|
| 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 "MyBasket"! |
|
| 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/basket/standard/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Basket\\Standard\\' . $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\\Basket\\Standard\\' . $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\\Basket\\Standard\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Basket\\Standard\\' . $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, 'basket/standard' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'basket/standard' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -31,7 +31,7 @@ discard block |
||
| 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/basket/standard/name |
| 37 | 37 | * Class name of the used basket standard client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/basket/standard/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/basket/standard/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\\Basket\\Standard\\' . $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\\Basket\\Standard\\'.$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\\Basket\\Standard\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Basket\\Standard\\'.$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, 'basket/standard' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'basket/standard'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |