-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.php
90 lines (77 loc) · 2.5 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
89
90
<?php
namespace Concrete\Package\Xmailer;
defined('C5_EXECUTE') or die(_("Access Denied."));
use Concrete\Core\Asset\AssetList;
use Concrete\Core\Package\Package;
use Concrete\Core\Page\Single as SinglePage;
use Concrete\Core\Job\Job as Job;
class Controller extends Package
{
protected $pkgHandle = 'xmailer';
protected string $appVersionRequired = '8.5.4';
protected $pkgVersion = '2.2';
protected array $pkgAutoloaderRegistries = array(
'src/' => '\Xmailer'
);
public function getPackageDescription(): string
{
return t('xMailer to send emails to groups and users.');
}
public function getPackageName(): string
{
return t('xMailer');
}
public function install()
{
$this->setupAutoloader();
$pkg = parent::install();
//BlockType::installBlockTypeFromPackage('Mailer', $pkg);
Job::installByPackage('process_xmailer', $pkg);
Job::installByPackage('send_xmailer', $pkg);
//MailImporter::add(array('miHandle' => 'xmailer'), $pkg);
//SinglePage::add('/dashboard/xmailer', $pkg);
SinglePage::add('/dashboard/xmailer/mailboxes', $pkg);
SinglePage::add('/dashboard/xmailer/mailboxes/user', $pkg);
SinglePage::add('/dashboard/xmailer/mailboxes/group', $pkg);
SinglePage::add('/dashboard/xmailer/mailboxes/mailbox', $pkg);
SinglePage::add('/dashboard/xmailer/settings', $pkg);
}
public function upgrade()
{
parent::upgrade();
$pkg = Package::getByHandle('xmailer');
Job::installByPackage('process_xmailer', $pkg);
Job::installByPackage('send_xmailer', $pkg);
//MailImporter::remove(array('miHandle' => 'xmailer'), $pkg);
}
// public function uninstall()
// {
// parent::uninstall();
// $db = \Database::connection();
// $db->query('drop table xMailer');
// }
/**
* Initialize the autoloader when the system boots up.
*/
public function on_start()
{
$this->setupAutoloader();
$al = AssetList::getInstance();
$al->register(
'javascript',
'xmailer-settings-form',
'src/js/settings-form.js',
array(),
$this->pkgHandle
);
}
/**
* Configure the autoloader
*/
private function setupAutoloader()
{
if (file_exists($this->getPackagePath() . '/vendor')) {
require_once $this->getPackagePath() . '/vendor/autoload.php';
}
}
}