Passed
Push — master ( 154e9f...c95a25 )
by Aimeos
03:44
created

Standard::delete()   B

Complexity

Conditions 6
Paths 46

Size

Total Lines 51
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 29
nc 46
nop 0
dl 0
loc 51
rs 8.8337
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2017-2018
6
 * @package Admin
7
 * @subpackage JQAdm
8
 */
9
10
11
namespace Aimeos\Admin\JQAdm\Coupon;
12
13
sprintf( 'coupon' ); // for translation
14
15
16
/**
17
 * Default implementation of coupon 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
	/**
27
	 * Copies a resource
28
	 *
29
	 * @return string HTML output
30
	 */
31
	public function copy()
32
	{
33
		$view = $this->getView();
34
		$context = $this->getContext();
35
36
		try
37
		{
38
			if( ( $id = $view->param( 'id' ) ) === null ) {
39
				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) );
40
			}
41
42
			$manager = \Aimeos\MShop::create( $context, 'coupon' );
43
44
			$view->item = $manager->getItem( $id );
45
			$view->itemData = $this->toArray( $view->item, true );
46
			$view->itemSubparts = $this->getSubClientNames();
47
			$view->itemProviders = $this->getProviderNames();
48
			$view->itemDecorators = $this->getDecoratorNames();
49
			$view->itemAttributes = $this->getConfigAttributes( $view->item );
50
			$view->itemBody = '';
51
52
			foreach( $this->getSubClients() as $idx => $client )
53
			{
54
				$view->tabindex = ++$idx + 1;
55
				$view->itemBody .= $client->copy();
56
			}
57
		}
58
		catch( \Aimeos\MShop\Exception $e )
59
		{
60
			$error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
61
			$view->errors = $view->get( 'errors', [] ) + $error;
62
			$this->logException( $e );
63
		}
64
		catch( \Exception $e )
65
		{
66
			$error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
67
			$view->errors = $view->get( 'errors', [] ) + $error;
68
			$this->logException( $e );
69
		}
70
71
		return $this->render( $view );
72
	}
73
74
75
	/**
76
	 * Creates a new resource
77
	 *
78
	 * @return string HTML output
79
	 */
80
	public function create()
81
	{
82
		$view = $this->getView();
83
		$context = $this->getContext();
84
85
		try
86
		{
87
			$data = $view->param( 'item', [] );
88
89
			if( !isset( $view->item ) ) {
90
				$view->item = \Aimeos\MShop::create( $context, 'coupon' )->createItem();
91
			}
92
93
			$data['coupon.siteid'] = $view->item->getSiteId();
94
95
			$view->itemSubparts = $this->getSubClientNames();
96
			$view->itemDecorators = $this->getDecoratorNames();
97
			$view->itemProviders = $this->getProviderNames();
98
			$view->itemData = $data;
99
			$view->itemBody = '';
100
101
			foreach( $this->getSubClients() as $idx => $client )
102
			{
103
				$view->tabindex = ++$idx + 1;
104
				$view->itemBody .= $client->create();
105
			}
106
		}
107
		catch( \Aimeos\MShop\Exception $e )
108
		{
109
			$error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
110
			$view->errors = $view->get( 'errors', [] ) + $error;
111
			$this->logException( $e );
112
		}
113
		catch( \Exception $e )
114
		{
115
			$error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
116
			$view->errors = $view->get( 'errors', [] ) + $error;
117
			$this->logException( $e );
118
		}
119
120
		return $this->render( $view );
121
	}
122
123
124
	/**
125
	 * Deletes a resource
126
	 *
127
	 * @return string|null HTML output
128
	 */
129
	public function delete()
130
	{
131
		$view = $this->getView();
132
		$context = $this->getContext();
133
134
		$manager = \Aimeos\MShop::create( $context, 'coupon' );
135
		$manager->begin();
136
137
		try
138
		{
139
			if( ( $ids = $view->param( 'id' ) ) === null ) {
140
				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) );
141
			}
142
143
			$search = $manager->createSearch()->setSlice( 0, count( (array) $ids ) );
144
			$search->setConditions( $search->compare( '==', 'coupon.id', $ids ) );
145
			$items = $manager->searchItems( $search );
146
147
			foreach( $items as $item )
148
			{
149
				$view->item = $item;
150
151
				foreach( $this->getSubClients() as $client ) {
152
					$client->delete();
153
				}
154
155
				$manager->saveItem( $view->item );
156
			}
157
158
			$manager->deleteItems( array_keys( $items ) );
159
			$manager->commit();
160
161
			$this->nextAction( $view, 'search', 'coupon', null, 'delete' );
162
			return;
163
		}
164
		catch( \Aimeos\MShop\Exception $e )
165
		{
166
			$error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
167
			$view->errors = $view->get( 'errors', [] ) + $error;
168
			$this->logException( $e );
169
		}
170
		catch( \Exception $e )
171
		{
172
			$error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
173
			$view->errors = $view->get( 'errors', [] ) + $error;
174
			$this->logException( $e );
175
		}
176
177
		$manager->rollback();
178
179
		return $this->search();
180
	}
181
182
183
	/**
184
	 * Returns a single resource
185
	 *
186
	 * @return string HTML output
187
	 */
188
	public function get()
189
	{
190
		$view = $this->getView();
191
		$context = $this->getContext();
192
193
		try
194
		{
195
			if( ( $id = $view->param( 'id' ) ) === null ) {
196
				throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) );
197
			}
198
199
			$manager = \Aimeos\MShop::create( $context, 'coupon' );
200
201
			$view->item = $manager->getItem( $id );
202
			$view->itemData = $this->toArray( $view->item );
203
			$view->itemSubparts = $this->getSubClientNames();
204
			$view->itemDecorators = $this->getDecoratorNames();
205
			$view->itemProviders = $this->getProviderNames();
206
			$view->itemAttributes = $this->getConfigAttributes( $view->item );
207
			$view->itemBody = '';
208
209
			foreach( $this->getSubClients() as $idx => $client )
210
			{
211
				$view->tabindex = ++$idx + 1;
212
				$view->itemBody .= $client->get();
213
			}
214
		}
215
		catch( \Aimeos\MShop\Exception $e )
216
		{
217
			$error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
218
			$view->errors = $view->get( 'errors', [] ) + $error;
219
			$this->logException( $e );
220
		}
221
		catch( \Exception $e )
222
		{
223
			$error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
224
			$view->errors = $view->get( 'errors', [] ) + $error;
225
			$this->logException( $e );
226
		}
227
228
		return $this->render( $view );
229
	}
230
231
232
	/**
233
	 * Saves the data
234
	 *
235
	 * @return string HTML output
236
	 */
237
	public function save()
238
	{
239
		$view = $this->getView();
240
		$context = $this->getContext();
241
242
		$manager = \Aimeos\MShop::create( $context, 'coupon' );
243
		$manager->begin();
244
245
		try
246
		{
247
			$item = $this->fromArray( $view->param( 'item', [] ) );
248
			$view->item = $item->getId() ? $item : $manager->saveItem( $item );
249
			$view->itemBody = '';
250
251
			foreach( $this->getSubClients() as $client ) {
252
				$view->itemBody .= $client->save();
253
			}
254
255
			$manager->saveItem( clone $view->item );
256
			$manager->commit();
257
258
			$this->nextAction( $view, $view->param( 'next' ), 'coupon', $view->item->getId(), 'save' );
259
			return;
260
		}
261
		catch( \Aimeos\Admin\JQAdm\Exception $e )
262
		{
263
			// fall through to create
264
		}
265
		catch( \Aimeos\MShop\Exception $e )
266
		{
267
			$error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
268
			$view->errors = $view->get( 'errors', [] ) + $error;
269
			$this->logException( $e );
270
		}
271
		catch( \Exception $e )
272
		{
273
			$error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
274
			$view->errors = $view->get( 'errors', [] ) + $error;
275
			$this->logException( $e );
276
		}
277
278
		$manager->rollback();
279
280
		return $this->create();
281
	}
282
283
284
	/**
285
	 * Returns a list of resource according to the conditions
286
	 *
287
	 * @return string HTML output
288
	 */
289
	public function search()
290
	{
291
		$view = $this->getView();
292
		$context = $this->getContext();
293
294
		try
295
		{
296
			$total = 0;
297
			$params = $this->storeSearchParams( $view->param(), 'coupon' );
298
			$manager = \Aimeos\MShop::create( $context, 'coupon' );
299
			$search = $this->initCriteria( $manager->createSearch(), $params );
300
301
			$view->items = $manager->searchItems( $search, [], $total );
302
			$view->filterAttributes = $manager->getSearchAttributes( true );
303
			$view->filterOperators = $search->getOperators();
304
			$view->total = $total;
305
			$view->itemBody = '';
306
307
			foreach( $this->getSubClients() as $client ) {
308
				$view->itemBody .= $client->search();
309
			}
310
		}
311
		catch( \Aimeos\MShop\Exception $e )
312
		{
313
			$error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) );
314
			$view->errors = $view->get( 'errors', [] ) + $error;
315
			$this->logException( $e );
316
		}
317
		catch( \Exception $e )
318
		{
319
			$error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() );
320
			$view->errors = $view->get( 'errors', [] ) + $error;
321
			$this->logException( $e );
322
		}
323
324
		/** admin/jqadm/coupon/template-list
325
		 * Relative path to the HTML body template for the coupon list.
326
		 *
327
		 * The template file contains the HTML code and processing instructions
328
		 * to generate the result shown in the body of the frontend. The
329
		 * configuration string is the path to the template file relative
330
		 * to the templates directory (usually in admin/jqadm/templates).
331
		 *
332
		 * You can overwrite the template file configuration in extensions and
333
		 * provide alternative templates. These alternative templates should be
334
		 * named like the default one but with the string "default" replaced by
335
		 * an unique name. You may use the name of your project for this. If
336
		 * you've implemented an alternative client class as well, "default"
337
		 * should be replaced by the name of the new class.
338
		 *
339
		 * @param string Relative path to the template creating the HTML code
340
		 * @since 2016.04
341
		 * @category Developer
342
		 */
343
		$tplconf = 'admin/jqadm/coupon/template-list';
344
		$default = 'coupon/list-standard';
345
346
		return $view->render( $view->config( $tplconf, $default ) );
347
	}
348
349
350
	/**
351
	 * Returns the sub-client given by its name.
352
	 *
353
	 * @param string $type Name of the client type
354
	 * @param string|null $name Name of the sub-client (Default if null)
355
	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
356
	 */
357
	public function getSubClient( $type, $name = null )
358
	{
359
		/** admin/jqadm/coupon/decorators/excludes
360
		 * Excludes decorators added by the "common" option from the coupon JQAdm client
361
		 *
362
		 * Decorators extend the functionality of a class by adding new aspects
363
		 * (e.g. log what is currently done), executing the methods of the underlying
364
		 * class only in certain conditions (e.g. only for logged in users) or
365
		 * modify what is returned to the caller.
366
		 *
367
		 * This option allows you to remove a decorator added via
368
		 * "client/jqadm/common/decorators/default" before they are wrapped
369
		 * around the JQAdm client.
370
		 *
371
		 *  admin/jqadm/coupon/decorators/excludes = array( 'decorator1' )
372
		 *
373
		 * This would remove the decorator named "decorator1" from the list of
374
		 * common decorators ("\Aimeos\Admin\JQAdm\Common\Decorator\*") added via
375
		 * "client/jqadm/common/decorators/default" to the JQAdm client.
376
		 *
377
		 * @param array List of decorator names
378
		 * @since 2017.07
379
		 * @category Developer
380
		 * @see admin/jqadm/common/decorators/default
381
		 * @see admin/jqadm/coupon/decorators/global
382
		 * @see admin/jqadm/coupon/decorators/local
383
		 */
384
385
		/** admin/jqadm/coupon/decorators/global
386
		 * Adds a list of globally available decorators only to the coupon JQAdm client
387
		 *
388
		 * Decorators extend the functionality of a class by adding new aspects
389
		 * (e.g. log what is currently done), executing the methods of the underlying
390
		 * class only in certain conditions (e.g. only for logged in users) or
391
		 * modify what is returned to the caller.
392
		 *
393
		 * This option allows you to wrap global decorators
394
		 * ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client.
395
		 *
396
		 *  admin/jqadm/coupon/decorators/global = array( 'decorator1' )
397
		 *
398
		 * This would add the decorator named "decorator1" defined by
399
		 * "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client.
400
		 *
401
		 * @param array List of decorator names
402
		 * @since 2017.07
403
		 * @category Developer
404
		 * @see admin/jqadm/common/decorators/default
405
		 * @see admin/jqadm/coupon/decorators/excludes
406
		 * @see admin/jqadm/coupon/decorators/local
407
		 */
408
409
		/** admin/jqadm/coupon/decorators/local
410
		 * Adds a list of local decorators only to the coupon JQAdm client
411
		 *
412
		 * Decorators extend the functionality of a class by adding new aspects
413
		 * (e.g. log what is currently done), executing the methods of the underlying
414
		 * class only in certain conditions (e.g. only for logged in users) or
415
		 * modify what is returned to the caller.
416
		 *
417
		 * This option allows you to wrap local decorators
418
		 * ("\Aimeos\Admin\JQAdm\Coupon\Decorator\*") around the JQAdm client.
419
		 *
420
		 *  admin/jqadm/coupon/decorators/local = array( 'decorator2' )
421
		 *
422
		 * This would add the decorator named "decorator2" defined by
423
		 * "\Aimeos\Admin\JQAdm\Coupon\Decorator\Decorator2" only to the JQAdm client.
424
		 *
425
		 * @param array List of decorator names
426
		 * @since 2017.07
427
		 * @category Developer
428
		 * @see admin/jqadm/common/decorators/default
429
		 * @see admin/jqadm/coupon/decorators/excludes
430
		 * @see admin/jqadm/coupon/decorators/global
431
		 */
432
		return $this->createSubClient( 'coupon/' . $type, $name );
433
	}
434
435
436
	/**
437
	 * Returns the backend configuration attributes of the provider and decorators
438
	 *
439
	 * @param \Aimeos\MShop\Coupon\Item\Iface $item Coupon item incl. provider/decorator property
440
	 * @return \Aimeos\MW\Common\Critera\Attribute\Iface[] List of configuration attributes
441
	 */
442
	public function getConfigAttributes( \Aimeos\MShop\Coupon\Item\Iface $item )
443
	{
444
		$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );
445
446
		try {
447
			return $manager->getProvider( $item, '' )->getConfigBE();
448
		} catch( \Aimeos\MShop\Exception $e ) {
449
			return [];
450
		}
451
	}
452
453
454
	/**
455
	 * Returns the list of sub-client names configured for the client.
456
	 *
457
	 * @return array List of JQAdm client names
458
	 */
459
	protected function getSubClientNames()
460
	{
461
		/** admin/jqadm/coupon/standard/subparts
462
		 * List of JQAdm sub-clients rendered within the coupon section
463
		 *
464
		 * The output of the frontend is composed of the code generated by the JQAdm
465
		 * clients. Each JQAdm client can consist of serveral (or none) sub-clients
466
		 * that are responsible for rendering certain sub-parts of the output. The
467
		 * sub-clients can contain JQAdm clients themselves and therefore a
468
		 * hierarchical tree of JQAdm clients is composed. Each JQAdm client creates
469
		 * the output that is placed inside the container of its parent.
470
		 *
471
		 * At first, always the JQAdm code generated by the parent is printed, then
472
		 * the JQAdm code of its sub-clients. The order of the JQAdm sub-clients
473
		 * determines the order of the output of these sub-clients inside the parent
474
		 * container. If the configured list of clients is
475
		 *
476
		 *  array( "subclient1", "subclient2" )
477
		 *
478
		 * you can easily change the order of the output by reordering the subparts:
479
		 *
480
		 *  admin/jqadm/<clients>/subparts = array( "subclient1", "subclient2" )
481
		 *
482
		 * You can also remove one or more parts if they shouldn't be rendered:
483
		 *
484
		 *  admin/jqadm/<clients>/subparts = array( "subclient1" )
485
		 *
486
		 * As the clients only generates structural JQAdm, the layout defined via CSS
487
		 * should support adding, removing or reordering content by a fluid like
488
		 * design.
489
		 *
490
		 * @param array List of sub-client names
491
		 * @since 2017.07
492
		 * @category Developer
493
		 */
494
		return $this->getContext()->getConfig()->get( 'admin/jqadm/coupon/standard/subparts', [] );
495
	}
496
497
498
	/**
499
	 * Returns the names of the available coupon decorators
500
	 *
501
	 * @return string[] List of decorator class names
502
	 */
503
	protected function getDecoratorNames()
504
	{
505
		$ds = DIRECTORY_SEPARATOR;
506
		return $this->getClassNames( 'MShop' . $ds . 'Coupon' . $ds . 'Provider' . $ds . 'Decorator' );
507
	}
508
509
510
	/**
511
	 * Returns the names of the available coupon providers
512
	 *
513
	 * @return string[] List of provider class names
514
	 */
515
	protected function getProviderNames()
516
	{
517
		$ds = DIRECTORY_SEPARATOR;
518
		return $this->getClassNames( 'MShop' . $ds . 'Coupon' . $ds . 'Provider' );
519
	}
520
521
522
	/**
523
	 * Creates new and updates existing items using the data array
524
	 *
525
	 * @param array $data Data array
526
	 * @return \Aimeos\MShop\Coupon\Item\Iface New coupon item object
527
	 */
528
	protected function fromArray( array $data )
529
	{
530
		$conf = [];
531
532
		if( isset( $data['config']['key'] ) )
533
		{
534
			foreach( (array) $data['config']['key'] as $idx => $key )
535
			{
536
				if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) )
537
				{
538
					if( ( $val = json_decode( $data['config']['val'][$idx] ) ) === null ) {
539
						$conf[$key] = $data['config']['val'][$idx];
540
					} else {
541
						$conf[$key] = $val;
542
					}
543
				}
544
			}
545
		}
546
547
		$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );
548
549
		if( isset( $data['coupon.id'] ) && $data['coupon.id'] != '' ) {
550
			$item = $manager->getItem( $data['coupon.id'] );
551
		} else {
552
			$item = $manager->createItem();
553
		}
554
555
		$item->fromArray( $data, true );
556
		$item->setConfig( $conf );
0 ignored issues
show
Bug introduced by
The method setConfig() does not exist on Aimeos\MShop\Attribute\Item\Iface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

556
		$item->/** @scrutinizer ignore-call */ 
557
         setConfig( $conf );

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method setConfig() does not exist on Aimeos\MShop\Common\Item\Iface. It seems like you code against a sub-type of Aimeos\MShop\Common\Item\Iface such as Aimeos\MShop\Product\Item\Iface or Aimeos\MShop\Service\Item\Iface or Aimeos\MShop\Locale\Item\Site\Iface or Aimeos\MShop\Coupon\Item\Iface or Aimeos\MShop\Common\Item\Lists\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Plugin\Item\Iface or Aimeos\MShop\Catalog\Item\Standard or Aimeos\MShop\Plugin\Item\Standard or Aimeos\MShop\Locale\Item\Site\Standard or Aimeos\MShop\Common\Item\Lists\Standard or Aimeos\MShop\Service\Item\Standard or Aimeos\MShop\Coupon\Item\Standard or Aimeos\MShop\Product\Item\Standard or Aimeos\MShop\Product\Item\Iface or Aimeos\MShop\Service\Item\Iface or Aimeos\MShop\Coupon\Item\Iface or Aimeos\MShop\Common\Item\Lists\Iface or Aimeos\MShop\Plugin\Item\Iface or Aimeos\MShop\Locale\Item\Site\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Product\Item\Iface or Aimeos\MShop\Service\Item\Iface or Aimeos\MShop\Catalog\Item\Iface or Aimeos\MShop\Product\Item\Iface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

556
		$item->/** @scrutinizer ignore-call */ 
557
         setConfig( $conf );
Loading history...
557
558
		return $item;
559
	}
560
561
562
	/**
563
	 * Constructs the data array for the view from the given item
564
	 *
565
	 * @param \Aimeos\MShop\Coupon\Item\Iface $item Coupon item object
566
	 * @return string[] Multi-dimensional associative list of item data
567
	 */
568
	protected function toArray( \Aimeos\MShop\Coupon\Item\Iface $item, $copy = false )
569
	{
570
		$config = $item->getConfig();
571
		$data = $item->toArray( true );
572
		$data['config'] = [];
573
574
		if( $copy === true )
575
		{
576
			$data['coupon.siteid'] = $this->getContext()->getLocale()->getSiteId();
577
			$data['coupon.id'] = '';
578
		}
579
580
		ksort( $config );
581
582
		foreach( $config as $key => $value )
583
		{
584
			$data['config']['key'][] = $key;
585
			$data['config']['val'][] = $value;
586
		}
587
588
		return $data;
589
	}
590
591
592
	/**
593
	 * Returns the rendered template including the view data
594
	 *
595
	 * @param \Aimeos\MW\View\Iface $view View object with data assigned
596
	 * @return string HTML output
597
	 */
598
	protected function render( \Aimeos\MW\View\Iface $view )
599
	{
600
		/** admin/jqadm/coupon/template-item
601
		 * Relative path to the HTML body template for the coupon item.
602
		 *
603
		 * The template file contains the HTML code and processing instructions
604
		 * to generate the result shown in the body of the frontend. The
605
		 * configuration string is the path to the template file relative
606
		 * to the templates directory (usually in admin/jqadm/templates).
607
		 *
608
		 * You can overwrite the template file configuration in extensions and
609
		 * provide alternative templates. These alternative templates should be
610
		 * named like the default one but with the string "default" replaced by
611
		 * an unique name. You may use the name of your project for this. If
612
		 * you've implemented an alternative client class as well, "default"
613
		 * should be replaced by the name of the new class.
614
		 *
615
		 * @param string Relative path to the template creating the HTML code
616
		 * @since 2016.04
617
		 * @category Developer
618
		 */
619
		$tplconf = 'admin/jqadm/coupon/template-item';
620
		$default = 'coupon/item-standard';
621
622
		return $view->render( $view->config( $tplconf, $default ) );
623
	}
624
}
625