forked from kaschioudi/sword
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathSwordDepositNotification.php
More file actions
57 lines (49 loc) · 1.79 KB
/
SwordDepositNotification.php
File metadata and controls
57 lines (49 loc) · 1.79 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
<?php
/**
* @file SwordDepositNotification.php
*
* Copyright (c) 2025 Simon Fraser University
* Copyright (c) 2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SwordDepositNotification
* @brief Email sent to a submitting author when they have the opportunity to deposit their submission elsewhere via SWORD
*/
namespace APP\plugins\generic\sword;
use APP\mail\variables\ContextEmailVariable;
use APP\submission\Submission;
use PKP\context\Context;
use PKP\mail\Mailable;
use PKP\mail\traits\Configurable;
use PKP\mail\traits\Recipient;
use APP\core\Application;
use PKP\security\Role;
class SwordDepositNotification extends Mailable
{
use Recipient;
use Configurable;
protected Submission $submission;
protected static ?string $name = 'emails.swordDepositNotification.name';
protected static ?string $description = 'emails.swordDepositNotification.description';
protected static ?string $emailTemplateKey = 'SWORD_DEPOSIT_NOTIFICATION';
protected static bool $canDisable = false;
protected static array $groupIds = [self::GROUP_SUBMISSION];
protected static array $fromRoleIds = [self::FROM_SYSTEM];
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
public function __construct(Context $context, Submission $submission)
{
parent::__construct(func_get_args());
$this->submission = $submission;
}
/**
* @copydoc Mailable::setData()
*/
public function setData(?string $locale = null): void
{
parent::setData($locale);
$request = Application::get()->getRequest();
$this->addData([
'swordDepositUrl' => $request->getDispatcher()->url($request, ROUTE_PAGE, null, 'sword', 'index', [$this->submission->getId()])
]);
}
}