/** * Register the article's metadata with the SWORD deposit. */ function setMetadata() { $this->package->setCustodian($this->journal->getSetting('contactName')); $this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8')); $this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8')); $this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale())); // The article can be published or not. Support either. if (is_a($this->article, 'PublishedArticle')) { $doi = $this->article->getPubId('doi'); if ($doi !== null) { $this->package->setIdentifier($doi); } } foreach ($this->article->getAuthors() as $author) { $creator = $author->getFullName(true); $affiliation = $author->getAffiliation($this->journal->getPrimaryLocale()); if (!empty($affiliation)) { $creator .= "; {$affiliation}"; } $this->package->addCreator($creator); } // The article can be published or not. Support either. if (is_a($this->article, 'PublishedArticle')) { $plugin = PluginRegistry::loadPlugin('citationFormats', 'bibtex'); $this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8')); } }
/** * @see DataObjectRequiredPolicy::dataObjectEffect() */ function dataObjectEffect() { $issueId = (int) $this->getDataObjectId(); if (!$issueId) { return AUTHORIZATION_DENY; } // Make sure the issue belongs to the journal. $issueDao = DAORegistry::getDAO('IssueDAO'); if ($this->journal->getSetting('enablePublicIssueId')) { $issue = $issueDao->getByBestId($issueId, $this->journal->getId()); } else { $issue = $issueDao->getById((int) $issueId, null, true); } if (!is_a($issue, 'Issue')) { return AUTHORIZATION_DENY; } // The issue must be published, or we must have pre-publication // access to it. $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); if (!$issue->getPublished() && count(array_intersect($userRoles, array(ROLE_ID_SITE_ADMIN, ROLE_ID_MANAGER, ROLE_ID_SECTION_EDITOR, ROLE_ID_ASSISTANT))) == 0) { return AUTHORIZATION_DENY; } // Save the issue to the authorization context. $this->addAuthorizedContextObject(ASSOC_TYPE_ISSUE, $issue); return AUTHORIZATION_PERMIT; }