16 import(
'classes.handler.Handler');
41 public function get($args, $request) {
45 $citation = $plugin->getCitation($request, $this->article, $this->citationStyle, $this->issue, $this->publication);
47 if ($citation ===
false ) {
48 if ($this->returnJson) {
54 if ($this->returnJson) {
68 public function download($args, $request) {
72 $plugin->downloadCitation($request, $this->article, $this->citationStyle, $this->issue, $this->publication);
83 $userVars = $request->getUserVars();
84 $user = $request->getUser();
85 $context = $request->getContext();
87 if (empty($userVars[
'submissionId']) || !$context || empty($args)) {
88 $request->getDispatcher()->handle404();
95 $this->citationStyle = $args[0];
96 $this->returnJson = isset($userVars[
'return']) && $userVars[
'return'] ===
'json';
97 $this->article =
Services::get(
'submission')->get($userVars[
'submissionId']);
99 if (!$this->article) {
100 $request->getDispatcher()->handle404();
103 $this->publication = !empty($userVars[
'publicationId'])
104 ?
Services::get(
'publication')->get($userVars[
'publicationId'])
105 : $this->article->getCurrentPublication();
107 if ($this->article) {
110 $issueId = method_exists($this->article,
'getCurrentPublication') ? $this->article->getCurrentPublication()->getData(
'issueId') : $this->article->getIssueId();
111 $this->issue = $issueDao->getById($issueId, $context->getId());
117 if (!$this->issue || !$this->issue->getPublished() || $this->article->getStatus() != STATUS_PUBLISHED) {
118 $userCanAccess =
false;
120 if ($user && $user->hasRole([ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT], $context->getId())) {
124 $assignments = $stageAssignmentDao->getBySubmissionAndStageId($this->article->getId());
125 foreach ($assignments as $assignment) {
126 if ($assignment->getUser()->getId() !== $user->getId()) {
129 $userGroup = $userGroupDao->getById($assignment->getUserGroupId($context->getId()));
130 if (in_array($userGroup->getRoleId(), [ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT])) {
131 $userCanAccess =
true;
137 if ($user && $user->hasRole(ROLE_ID_MANAGER, $context->getId())) {
138 $userCanAccess =
true;
141 if (!$userCanAccess) {
142 $request->getDispatcher()->handle404();