|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package Exporter |
|
5
|
|
|
* @author Iurii Makukh |
|
6
|
|
|
* @copyright Copyright (c) 2017, Iurii Makukh |
|
7
|
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0+ |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace gplcart\modules\export; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Main class for Exporter module |
|
14
|
|
|
*/ |
|
15
|
|
|
class Main |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Implements hook "route.list" |
|
20
|
|
|
* @param array $routes |
|
21
|
|
|
*/ |
|
22
|
|
|
public function hookRouteList(array &$routes) |
|
23
|
|
|
{ |
|
24
|
|
|
$routes['admin/module/settings/export'] = array( |
|
25
|
|
|
'access' => 'module_edit', |
|
26
|
|
|
'handlers' => array( |
|
27
|
|
|
'controller' => array('gplcart\\modules\\export\\controllers\\Settings', 'editSettings') |
|
28
|
|
|
) |
|
29
|
|
|
); |
|
30
|
|
|
|
|
31
|
|
|
$routes['admin/tool/export'] = array( |
|
32
|
|
|
'menu' => array('admin' => /* @text */'Export'), |
|
33
|
|
|
'access' => 'export_product', |
|
34
|
|
|
'handlers' => array( |
|
35
|
|
|
'controller' => array('gplcart\\modules\\export\\controllers\\Export', 'doExport') |
|
36
|
|
|
) |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Implements hook "job.handlers" |
|
42
|
|
|
* @param array $handlers |
|
43
|
|
|
*/ |
|
44
|
|
|
public function hookJobHandlers(array &$handlers) |
|
45
|
|
|
{ |
|
46
|
|
|
$handlers['export_product'] = array( |
|
47
|
|
|
'handlers' => array( |
|
48
|
|
|
'process' => array('gplcart\\modules\\export\\handlers\\Export', 'process') |
|
49
|
|
|
), |
|
50
|
|
|
); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Implements hook "user.role.permissions" |
|
55
|
|
|
* @param array $permissions |
|
56
|
|
|
*/ |
|
57
|
|
|
public function hookUserRolePermissions(array &$permissions) |
|
58
|
|
|
{ |
|
59
|
|
|
$permissions['export_product'] = /* @text */'Exporter: export products'; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Implements hook "cron.run.after" |
|
64
|
|
|
*/ |
|
65
|
|
|
public function hookCronRunAfter() |
|
66
|
|
|
{ |
|
67
|
|
|
gplcart_file_empty(gplcart_file_private_module('export'), array('csv'), 24 * 60 * 60); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
|