-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleModule.php
More file actions
84 lines (66 loc) · 1.85 KB
/
Copy pathExampleModule.php
File metadata and controls
84 lines (66 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace hmcswModule\ExampleModule\src;
use hmcsw\controller\web\cp\CPController;
use hmcsw\objects\user\teams\service\Service;
use hmcsw\objects\user\teams\service\ServiceRepository;
use hmcsw\service\module\ModuleServiceRepository;
class ExampleModule implements ModuleServiceRepository
{
private array $config;
public function __construct()
{
$this->config = json_decode(file_get_contents(__DIR__ . '/../config/config.json'), true);
}
public function startModule(): bool
{
if ($this->config['enabled']) {
return true;
} else {
return false;
}
}
public function getMessages(string $lang): array|bool
{
if (!file_exists(__DIR__ . '/../messages/' . $lang . '.json')) {
return false;
}
return json_decode(file_get_contents(__DIR__ . '/../messages/' . $lang . '.json'), true);
}
public function getModuleInfo(): array
{
return json_decode(file_get_contents(__DIR__ . '/../module.json'), true);
}
public function getProperties(): array
{
return json_decode(file_get_contents(__DIR__ . '/../properties.json'), true);
}
public function loadPage(array $args, ServiceRepository $serviceRepository, CPController $CPController): void
{
$get = $serviceRepository->getData();
$CPController->renderPage('/cp/teams/services/domain.twig', $args);
}
public function hook(): array
{
// your webhook logic
}
public function task()
{
// task every 1 minute
}
public function getConfig(): array
{
return $this->config;
}
public function getInstance(Service $service): ServiceRepository
{
return new ExampleModuleService($service, $this);
}
public function getOrderConfigurations(): array
{
return [];
}
public function validOrderConfiguration(array $configuration): void
{
// TODO: Implement validOrderConfiguration() method.
}
}