Standard   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 173
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 173
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

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