16 import(
'lib.pkp.plugins.importexport.native.filter.NativeImportExportFilter');
26 parent::__construct($filterGroup);
36 return 'plugins.importexport.doaj.filter.DOAJJsonFilter';
49 $context = $deployment->getContext();
50 $plugin = $deployment->getPlugin();
51 $cache = $plugin->getCache();
55 $publication = $pubObject->getCurrentPublication();
56 $issueId = $publication->getData(
'issueId');
57 if ($cache->isCached(
'issues', $issueId)) {
58 $issue = $cache->get(
'issues', $issueId);
61 $issue = $issueDao->getById($issueId, $context->getId());
62 if ($issue) $cache->add($issue,
null);
66 $article[
'bibjson'][
'journal'] = array();
68 $publisher = $context->getData(
'publisherInstitution');
69 if (!empty($publisher)) $article[
'bibjson'][
'journal'][
'publisher'] = $publisher;
72 $journalTitle = $context->getName($context->getPrimaryLocale());
73 $article[
'bibjson'][
'journal'][
'title'] = $journalTitle;
76 $pissn = $context->getData(
'printIssn');
77 if (!empty($pissn)) $issns[] = $pissn;
78 $eissn = $context->getData(
'onlineIssn');
79 if (!empty($eissn)) $issns[] = $eissn;
80 if (!empty($issns)) $article[
'bibjson'][
'journal'][
'issns'] = $issns;
82 $volume = $issue->getVolume();
83 if (!empty($volume)) $article[
'bibjson'][
'journal'][
'volume'] = $volume;
84 $issueNumber = $issue->getNumber();
85 if (!empty($issueNumber)) $article[
'bibjson'][
'journal'][
'number'] = $issueNumber;
88 $article[
'bibjson'][
'title'] = $pubObject->getTitle($pubObject->getLocale());
90 $article[
'bibjson'][
'identifier'] = array();
92 $doi = $pubObject->getStoredPubId(
'doi');
93 if (!empty($doi)) $article[
'bibjson'][
'identifier'][] = array(
'type' =>
'doi',
'id' => $doi);
95 if (!empty($pissn)) $article[
'bibjson'][
'identifier'][] = array(
'type' =>
'pissn',
'id' => $pissn);
96 if (!empty($eissn)) $article[
'bibjson'][
'identifier'][] = array(
'type' =>
'eissn',
'id' => $eissn);
98 $publicationDate = $this->
formatDate($issue->getDatePublished());
99 if ($pubObject->getDatePublished()) {
100 $publicationDate = $this->
formatDate($pubObject->getDatePublished());
102 $yearMonth = explode(
'-', $publicationDate);
103 $article[
'bibjson'][
'year'] = $yearMonth[0];
104 $article[
'bibjson'][
'month'] = $yearMonth[1];
110 $startPage = $pubObject->getStartingPage();
111 $endPage = $pubObject->getEndingPage();
112 if (isset($startPage) && $startPage !==
"") {
113 $article[
'bibjson'][
'start_page'] = $startPage;
114 $article[
'bibjson'][
'end_page'] = $endPage;
118 $article[
'bibjson'][
'link'] = array();
119 $article[
'bibjson'][
'link'][] = array(
120 'url' => $request->url($context->getPath(),
'article',
'view', $pubObject->getId()),
121 'type' =>
'fulltext',
122 'content_type' =>
'html'
125 $article[
'bibjson'][
'author'] = array();
126 $articleAuthors = $pubObject->getAuthors();
127 foreach ($articleAuthors as $articleAuthor) {
128 $author = array(
'name' => $articleAuthor->getFullName(
false));
129 $affiliation = $articleAuthor->getAffiliation($pubObject->getLocale());
130 if (!empty($affiliation)) $author[
'affiliation'] = $affiliation;
131 $article[
'bibjson'][
'author'][] = $author;
134 $abstract = $pubObject->getAbstract($pubObject->getLocale());
138 $keywords = $dao->getKeywords($publication->getId(), array($pubObject->getLocale()));
139 $allowedNoOfKeywords = array_slice($keywords[$pubObject->getLocale()]??[], 0, 6);
140 if (!empty($keywords[$pubObject->getLocale()])) $article[
'bibjson'][
'keywords'] = $allowedNoOfKeywords;
151 $json = json_encode($article);
161 if ($date ==
'')
return null;
162 return date(
'Y-F', strtotime($date));