-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFutureIssueHandler.inc.php
More file actions
109 lines (101 loc) · 3.97 KB
/
FutureIssueHandler.inc.php
File metadata and controls
109 lines (101 loc) · 3.97 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
105
106
107
108
109
<?php
import('classes.handler.Handler');
class FutureIssueHandler extends Handler
{
/** @copydoc PKPHandler::_isBackendPage */
var $_isBackendPage = true;
protected $plugin;
/**
* Constructor
*/
function __construct()
{
parent::__construct();
$this->plugin = PluginRegistry::getPlugin('generic', ISSUE_PLUGIN_NAME);
$this->addRoleAssignment(
array(ROLE_ID_MANAGER),
array(
'table',
)
);
}
/**
* @copydoc PKPHandler::authorize()
*/
function authorize($request, &$args, $roleAssignments)
{
import('lib.pkp.classes.security.authorization.PKPSiteAccessPolicy');
$this->addPolicy(new PKPSiteAccessPolicy($request, null, $roleAssignments));
return parent::authorize($request, $args, $roleAssignments);
}
public function table($args, $request)
{
$this->setupTemplate($request);
$context = $request->getContext();
$contextId = $context ? $context->getId() : CONTEXT_SITE;
$assignmentDao =& DAORegistry::getDAO('UserStageAssignmentDAO');
$editDecisionDao =& DAORegistry::getDAO('EditDecisionDAO');
$reviewDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('pubIdPlugins', $pubIdPlugins);
$issueId = isset($args[0]) ? (int)$args[0] : null;
$submissionsIterator =Services::get('submission')->getMany([
'contextId' => $contextId,
'issueIds' => $issueId,
'status' => [STATUS_SCHEDULED],
]);
$result = array();
foreach ($submissionsIterator as $submission) {
$section = null;
$publication = $submission->getCurrentPublication();
$sectionDao = DAORegistry::getDAO('SectionDAO'); /** @var $sectionDao SectionDAO */
if ($sectionId = $publication->getData('sectionId')) {
$section = $sectionDao->getById($sectionId);
}
$submissionId = $submission->getId();
$editDecisions = $editDecisionDao->getEditorDecisions($submissionId);
$accepted = null;
$reviews = $reviewDao->getBySubmissionId($submissionId);
$rounds = array();
foreach ($reviews as $review) {
if ($review->getStatus()>6)
$rounds[$review->getRound()][] = $review->getReviewerFullName();
}
foreach (array_reverse($editDecisions) as $editDecision) {
if ($editDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
$accepted = $editDecision['dateDecided'];
}
}
$primaryContact = Services::get('author')->get($publication->getData('primaryContactId'));
$authors = $publication->getData('authors');
$editors = $assignmentDao->getUsersBySubmissionAndStageId($submissionId, 1)->toArray();
$count = 0;
foreach ($editors as $editor) {
foreach ($authors as $author) {
if ($editor->getEmail() == $author->getEmail() || $editor->getFullName() == $author->getFullName()) {
unset($editors[$count]);
break;
}
}
$count++;
}
$art_res = array(
"articleId" => $submission->getId(),
"section" => $section,
"accepted" => $accepted,
"publication" => $submission,
"authors" => $authors,
"primary" => $primaryContact,
"assignedUsers" => $editors,
"reviewRounds" => $rounds
);
$result[] = $art_res;
}
$templateMgr->assign(array(
'result' => $result
)
);
$templateMgr->display($this->plugin->getTemplateResource('table.tpl'));
}
}