|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2021 |
|
6
|
|
|
* @package Admin |
|
7
|
|
|
* @subpackage JQAdm |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
namespace Aimeos\Admin\JQAdm\Dashboard\Order\Quick\Counttotal; |
|
12
|
|
|
|
|
13
|
|
|
sprintf( 'quick/counttotal' ); // for translation |
|
14
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Default implementation of dashboard quick/counttotal JQAdm client. |
|
18
|
|
|
* |
|
19
|
|
|
* @package Admin |
|
20
|
|
|
* @subpackage JQAdm |
|
21
|
|
|
*/ |
|
22
|
|
|
class Standard |
|
23
|
|
|
extends \Aimeos\Admin\JQAdm\Common\Admin\Factory\Base |
|
24
|
|
|
implements \Aimeos\Admin\JQAdm\Common\Admin\Factory\Iface |
|
25
|
|
|
{ |
|
26
|
|
|
/** admin/jqadm/dashboard/order/quick/counttotal/name |
|
27
|
|
|
* Name of the order quick/counttotal subpart used by the JQAdm dashboard implementation |
|
28
|
|
|
* |
|
29
|
|
|
* Use "Myname" if your class is named "\Aimeos\Admin\Jqadm\Dashboard\Order\Quick\Counttotal\Myname". |
|
30
|
|
|
* The name is case-sensitive and you should avoid camel case names like "MyName". |
|
31
|
|
|
* |
|
32
|
|
|
* @param string Last part of the JQAdm class name |
|
33
|
|
|
* @since 2021.04 |
|
34
|
|
|
* @category Developer |
|
35
|
|
|
*/ |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Returns a list of resource according to the conditions |
|
40
|
|
|
* |
|
41
|
|
|
* @return string Output to display |
|
42
|
|
|
*/ |
|
43
|
|
|
public function search() : ?string |
|
44
|
|
|
{ |
|
45
|
|
|
$view = $this->getView(); |
|
46
|
|
|
$view->quickCounttotalBody = parent::search(); |
|
47
|
|
|
|
|
48
|
|
|
/** admin/jqadm/dashboard/order/quick/counttotal/template-item |
|
49
|
|
|
* Relative path to the HTML body template of the order per quick/counttotal subpart for the dashboard. |
|
50
|
|
|
* |
|
51
|
|
|
* The template file contains the HTML code and processing instructions |
|
52
|
|
|
* to generate the result shown in the body of the frontend. The |
|
53
|
|
|
* configuration string is the path to the template file relative |
|
54
|
|
|
* to the templates directory (usually in admin/jqadm/templates). |
|
55
|
|
|
* |
|
56
|
|
|
* You can overwrite the template file configuration in extensions and |
|
57
|
|
|
* provide alternative templates. These alternative templates should be |
|
58
|
|
|
* named like the default one but with the string "default" replaced by |
|
59
|
|
|
* an unique name. You may use the name of your project for this. If |
|
60
|
|
|
* you've implemented an alternative client class as well, "default" |
|
61
|
|
|
* should be replaced by the name of the new class. |
|
62
|
|
|
* |
|
63
|
|
|
* @param string Relative path to the template creating the HTML code |
|
64
|
|
|
* @since 2021.04 |
|
65
|
|
|
* @category Developer |
|
66
|
|
|
*/ |
|
67
|
|
|
$tplconf = 'admin/jqadm/dashboard/order/quick/counttotal/template-item'; |
|
68
|
|
|
$default = 'dashboard/item-order-quick-counttotal-standard'; |
|
69
|
|
|
|
|
70
|
|
|
return $view->render( $view->config( $tplconf, $default ) ); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Returns the sub-client given by its name. |
|
76
|
|
|
* |
|
77
|
|
|
* @param string $type Name of the client type |
|
78
|
|
|
* @param string|null $name Name of the sub-client (Default if null) |
|
79
|
|
|
* @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
|
82
|
|
|
{ |
|
83
|
|
|
/** admin/jqadm/dashboard/order/quick/counttotal/decorators/excludes |
|
84
|
|
|
* Excludes decorators added by the "common" option from the dashboard JQAdm client |
|
85
|
|
|
* |
|
86
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
87
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
88
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
89
|
|
|
* modify what is returned to the caller. |
|
90
|
|
|
* |
|
91
|
|
|
* This option allows you to remove a decorator added via |
|
92
|
|
|
* "admin/jqadm/common/decorators/default" before they are wrapped |
|
93
|
|
|
* around the JQAdm client. |
|
94
|
|
|
* |
|
95
|
|
|
* admin/jqadm/dashboard/order/quick/counttotal/decorators/excludes = array( 'decorator1' ) |
|
96
|
|
|
* |
|
97
|
|
|
* This would remove the decorator named "decorator1" from the list of |
|
98
|
|
|
* common decorators ("\Aimeos\Admin\JQAdm\Common\Decorator\*") added via |
|
99
|
|
|
* "admin/jqadm/common/decorators/default" to the JQAdm client. |
|
100
|
|
|
* |
|
101
|
|
|
* @param array List of decorator names |
|
102
|
|
|
* @since 2021.04 |
|
103
|
|
|
* @category Developer |
|
104
|
|
|
* @see admin/jqadm/common/decorators/default |
|
105
|
|
|
* @see admin/jqadm/dashboard/order/quick/counttotal/decorators/global |
|
106
|
|
|
* @see admin/jqadm/dashboard/order/quick/counttotal/decorators/local |
|
107
|
|
|
*/ |
|
108
|
|
|
|
|
109
|
|
|
/** admin/jqadm/dashboard/order/quick/counttotal/decorators/global |
|
110
|
|
|
* Adds a list of globally available decorators only to the dashboard JQAdm client |
|
111
|
|
|
* |
|
112
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
113
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
114
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
115
|
|
|
* modify what is returned to the caller. |
|
116
|
|
|
* |
|
117
|
|
|
* This option allows you to wrap global decorators |
|
118
|
|
|
* ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client. |
|
119
|
|
|
* |
|
120
|
|
|
* admin/jqadm/dashboard/order/quick/counttotal/decorators/global = array( 'decorator1' ) |
|
121
|
|
|
* |
|
122
|
|
|
* This would add the decorator named "decorator1" defined by |
|
123
|
|
|
* "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client. |
|
124
|
|
|
* |
|
125
|
|
|
* @param array List of decorator names |
|
126
|
|
|
* @since 2021.04 |
|
127
|
|
|
* @category Developer |
|
128
|
|
|
* @see admin/jqadm/common/decorators/default |
|
129
|
|
|
* @see admin/jqadm/dashboard/order/quick/counttotal/decorators/excludes |
|
130
|
|
|
* @see admin/jqadm/dashboard/order/quick/counttotal/decorators/local |
|
131
|
|
|
*/ |
|
132
|
|
|
|
|
133
|
|
|
/** admin/jqadm/dashboard/order/quick/counttotal/decorators/local |
|
134
|
|
|
* Adds a list of local decorators only to the dashboard JQAdm client |
|
135
|
|
|
* |
|
136
|
|
|
* Decorators extend the functionality of a class by adding new aspects |
|
137
|
|
|
* (e.g. log what is currently done), executing the methods of the underlying |
|
138
|
|
|
* class only in certain conditions (e.g. only for logged in users) or |
|
139
|
|
|
* modify what is returned to the caller. |
|
140
|
|
|
* |
|
141
|
|
|
* This option allows you to wrap local decorators |
|
142
|
|
|
* ("\Aimeos\Admin\JQAdm\Dashboard\Decorator\*") around the JQAdm client. |
|
143
|
|
|
* |
|
144
|
|
|
* admin/jqadm/dashboard/order/quick/counttotal/decorators/local = array( 'decorator2' ) |
|
145
|
|
|
* |
|
146
|
|
|
* This would add the decorator named "decorator2" defined by |
|
147
|
|
|
* "\Aimeos\Admin\JQAdm\Dashboard\Decorator\Decorator2" only to the JQAdm client. |
|
148
|
|
|
* |
|
149
|
|
|
* @param array List of decorator names |
|
150
|
|
|
* @since 2021.04 |
|
151
|
|
|
* @category Developer |
|
152
|
|
|
* @see admin/jqadm/common/decorators/default |
|
153
|
|
|
* @see admin/jqadm/dashboard/order/quick/counttotal/decorators/excludes |
|
154
|
|
|
* @see admin/jqadm/dashboard/order/quick/counttotal/decorators/global |
|
155
|
|
|
*/ |
|
156
|
|
|
return $this->createSubClient( 'dashboard/order/quick/counttotal/' . $type, $name ); |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* Returns the list of sub-client names configured for the client. |
|
162
|
|
|
* |
|
163
|
|
|
* @return array List of JQAdm client names |
|
164
|
|
|
*/ |
|
165
|
|
|
protected function getSubClientNames() : array |
|
166
|
|
|
{ |
|
167
|
|
|
/** admin/jqadm/dashboard/order/quick/counttotal/subparts |
|
168
|
|
|
* List of JQAdm sub-clients rendered within the dashboard quick/counttotal section |
|
169
|
|
|
* |
|
170
|
|
|
* The output of the frontend is composed of the code generated by the JQAdm |
|
171
|
|
|
* clients. Each JQAdm client can consist of serveral (or none) sub-clients |
|
172
|
|
|
* that are responsible for rendering certain sub-parts of the output. The |
|
173
|
|
|
* sub-clients can contain JQAdm clients themselves and therefore a |
|
174
|
|
|
* hierarchical tree of JQAdm clients is composed. Each JQAdm client creates |
|
175
|
|
|
* the output that is placed inside the container of its parent. |
|
176
|
|
|
* |
|
177
|
|
|
* At first, always the JQAdm code generated by the parent is printed, then |
|
178
|
|
|
* the JQAdm code of its sub-clients. The order of the JQAdm sub-clients |
|
179
|
|
|
* determines the order of the output of these sub-clients inside the parent |
|
180
|
|
|
* container. If the configured list of clients is |
|
181
|
|
|
* |
|
182
|
|
|
* array( "subclient1", "subclient2" ) |
|
183
|
|
|
* |
|
184
|
|
|
* you can easily change the order of the output by reordering the subparts: |
|
185
|
|
|
* |
|
186
|
|
|
* admin/jqadm/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
187
|
|
|
* |
|
188
|
|
|
* You can also remove one or more parts if they shouldn't be rendered: |
|
189
|
|
|
* |
|
190
|
|
|
* admin/jqadm/<clients>/subparts = array( "subclient1" ) |
|
191
|
|
|
* |
|
192
|
|
|
* As the clients only generates structural JQAdm, the layout defined via CSS |
|
193
|
|
|
* should support adding, removing or reordering content by a fluid like |
|
194
|
|
|
* design. |
|
195
|
|
|
* |
|
196
|
|
|
* @param array List of sub-client names |
|
197
|
|
|
* @since 2021.04 |
|
198
|
|
|
* @category Developer |
|
199
|
|
|
*/ |
|
200
|
|
|
return $this->getContext()->getConfig()->get( 'admin/jqadm/dashboard/order/quick/counttotal/subparts', [] ); |
|
201
|
|
|
} |
|
202
|
|
|
} |
|
203
|
|
|
|