-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFutureIssueOverview.inc.php
More file actions
104 lines (94 loc) · 2.68 KB
/
FutureIssueOverview.inc.php
File metadata and controls
104 lines (94 loc) · 2.68 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
import('lib.pkp.classes.plugins.GenericPlugin');
class FutureIssueOverview extends GenericPlugin
{
/**
* @copydoc Plugin::getDisplayName()
*/
function getDisplayName()
{
return __('plugins.generic.issue.overview.displayName');
}
/**
* @copydoc Plugin::getDescription()
*/
function getDescription()
{
return __('plugins.generic.issue.overview.description');
}
/**
* @copydoc Plugin::register()
*/
function register($category, $path, $mainContextId = null)
{
if (parent::register($category, $path, $mainContextId)) {
if ($this->getEnabled()) {
// Register callbacks.
HookRegistry::register('LoadHandler', array($this, 'callbackLoadHandler'));
HookRegistry::register('TemplateManager::fetch', array($this, 'templateFetchCallback'));
$this->_registerTemplateResource(true);
}
return true;
}
return false;
}
/**
* Adds additional links to submission files grid row
* @param $hookName string The name of the invoked hook
* @param $args array Hook parameters
*/
public function templateFetchCallback($hookName, $params)
{
$request = $this->getRequest();
$router = $request->getRouter();
$dispatcher = $router->getDispatcher();
$templateMgr = $params[0];
$resourceName = $params[1];
if ($resourceName == 'controllers/grid/gridRow.tpl') {
$row = $templateMgr->getTemplateVars('row');
$gridId = $row->getGridId();
if ($gridId == 'grid-issues-futureissuegrid') {
$data = $row->getData();
if (!empty($data) && !empty($data->getId())) {
import('lib.pkp.classes.linkAction.request.RedirectAction');
$row->addAction(
new LinkAction(
'table',
new RedirectAction(
$dispatcher->url($request, ROUTE_PAGE, null, 'futureIssue', 'table', $data->getId(), null)
),
__('plugins.generic.issue.overview.link'),
null
)
);
}
}
}
}
public function callbackLoadHandler($hookName, $args)
{
$page = $args[0];
$op = $args[1];
$request = Application::get()->getRequest();
$templateMgr = TemplateManager::getManager($request);
switch ("$page/$op") {
case 'futureIssue/view':
case 'futureIssue/table':
define('HANDLER_CLASS', 'FutureIssueHandler');
define('ISSUE_PLUGIN_NAME', $this->getName());
$templateMgr->addStyleSheet(
'futureIssueStyle',
$request->getBaseUrl().'/'.$this->getPluginPath().'/css/futureIssue.css',
array('contexts' => 'backend')
);
$templateMgr->addJavaScript(
'futureIssueScript',
$request->getBaseUrl().'/'.$this->getPluginPath().'/js/futureIssue.js',
array('contexts' => 'backend')
);
$args[2] = $this->getPluginPath().'/'.'FutureIssueHandler.inc.php';
break;
}
return false;
}
}