-
Notifications
You must be signed in to change notification settings - Fork 0
/
OASwitchboardPlugin.php
73 lines (63 loc) · 2.14 KB
/
OASwitchboardPlugin.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
<?php
/**
* @file plugins/generic/OASwitchboard/OASwitchboardPlugin.php
*
* Copyright (c) 2024 Lepidus Tecnologia
* Distributed under the GNU GPL v3. For full terms see the file LICENSE.
*
* @class OASwitchboardPlugin
* @ingroup plugins_generic_OASwitchboard
*
* @brief OASwitchboard plugin class
*/
namespace APP\plugins\generic\OASwitchboard;
use PKP\plugins\GenericPlugin;
use PKP\plugins\Hook;
use APP\core\Application;
use APP\plugins\generic\OASwitchboard\classes\Message;
use APP\plugins\generic\OASwitchboard\classes\Resources;
use APP\plugins\generic\OASwitchboard\classes\settings\Manage;
use APP\plugins\generic\OASwitchboard\classes\settings\Actions;
class OASwitchboardPlugin extends GenericPlugin
{
public function register($category, $path, $mainContextId = null)
{
$success = parent::register($category, $path);
if ($success && $this->getEnabled()) {
$message = new Message($this);
$resources = new Resources($this);
Hook::add('Publication::publish', [$message, 'sendToOASwitchboard']);
Hook::add('TemplateManager::display', [$resources, 'addWorkflowNotificationsJavaScript']);
Hook::add('Form::config::before', [$message, 'validateBeforePublicationEvent']);
}
return $success;
}
public function getDisplayName()
{
return __('plugins.generic.OASwitchboard.displayName');
}
public function getDescription()
{
return __('plugins.generic.OASwitchboard.description');
}
public function getActions($request, $actionArgs)
{
$actions = new Actions($this);
return $actions->execute($request, $actionArgs, parent::getActions($request, $actionArgs));
}
public function manage($args, $request)
{
$manage = new Manage($this);
return $manage->execute($args, $request);
}
public function getCanEnable()
{
$request = Application::get()->getRequest();
return $request->getContext() !== null;
}
public function getCanDisable()
{
$request = Application::get()->getRequest();
return $request->getContext() !== null;
}
}