-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.php
executable file
·88 lines (75 loc) · 2.73 KB
/
controller.php
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
85
86
87
88
<?php
/**
* @project: Simple Support System
*
* @author Fabian Bitter ([email protected])
* @copyright (C) 2020 Fabian Bitter (www.bitter.de)
* @version X.X.X
*/
namespace Concrete\Package\SimpleSupportSystem;
use Bitter\SimpleSupportSystem\Provider\ServiceProvider;
use Concrete\Core\Config\Repository\Repository;
use Concrete\Core\Error\ErrorList\ErrorList;
use Concrete\Core\Package\Package;
use Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface;
use Concrete\Core\Database\EntityManager\Provider\StandardPackageProvider;
use Concrete\Core\Page\Page;
use Concrete\Core\Site\Service;
use Exception;
class Controller extends Package implements ProviderAggregateInterface
{
protected $pkgHandle = 'simple_support_system';
protected $pkgVersion = '1.6.0';
protected $appVersionRequired = '9.0.0';
protected $pkgAutoloaderRegistries = [
'src/Bitter/SimpleSupportSystem' => 'Bitter\SimpleSupportSystem',
];
public function getPackageDescription()
{
return t('Feature-rich self-hosted support system that fully complies with GDPR and doesn\'t require any 3rd party services.');
}
public function getPackageName()
{
return t('Simple Support System');
}
public function getEntityManagerProvider()
{
return new StandardPackageProvider($this->app, $this, [
'src/Bitter/SimpleSupportSystem/Entity' => 'Bitter\SimpleSupportSystem\Entity'
]);
}
public function on_start()
{
/** @var ServiceProvider $serviceProvider */
$serviceProvider = $this->app->make(ServiceProvider::class);
$serviceProvider->register();
}
/**
* @param bool $testForAlreadyInstalled
* @return ErrorList|true|void
* @throws Exception
*/
public function testForInstall($testForAlreadyInstalled = true)
{
/** @var Repository $config */
$config = $this->app->make(Repository::class);
/*
if (!$config->get('concrete.api.enabled')) {
throw new Exception(t("You need to enable the API feature first to use this add-on."));
}
*/
if (!$config->get('concrete.user.registration.enabled')) {
throw new Exception(t("You need to enable public registration first to use this add-on."));
}
}
public function install()
{
parent::install();
$this->installContentFile('install.xml');
/** @var Service $siteService */
$siteService = $this->app->make(Service::class);
$site = $siteService->getSite();
$config = $site->getConfigRepository();
$config->save("simple_support_system.ticket_detail_page", Page::getByPath("/support/project/tickets")->getCollectionID());
}
}