Skip to content

Commit

Permalink
pkp/pkp-lib#10292 removed extended vocab classes
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Nov 15, 2024
1 parent 23c3943 commit 4679c4f
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 22 deletions.
11 changes: 9 additions & 2 deletions classes/search/ArticleSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
use APP\core\Request;
use APP\facades\Repo;
use APP\issue\IssueAction;
use PKP\controlledVocab\ControlledVocab;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
use PKP\plugins\Hook;
use PKP\search\SubmissionSearch;
use PKP\submission\PKPSubmission;
use PKP\submission\SubmissionKeywordVocab;

class ArticleSearch extends SubmissionSearch
{
Expand Down Expand Up @@ -334,7 +334,14 @@ public function getSimilarityTerms($submissionId)
$article = Repo::submission()->get($submissionId);
if ($article->getData('status') === PKPSubmission::STATUS_PUBLISHED) {
// Retrieve keywords (if any).
$allSearchTerms = array_filter(SubmissionKeywordVocab::getKeywords($article->getCurrentPublication()->getId(), [Locale::getLocale(), $article->getData('locale'), Locale::getPrimaryLocale()]));
$allSearchTerms = array_filter(
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$article->getCurrentPublication()->getId(),
[Locale::getLocale(), $article->getData('locale'), Locale::getPrimaryLocale()]
)
);
foreach ($allSearchTerms as $locale => $localeSearchTerms) {
$searchTerms += $localeSearchTerms;
}
Expand Down
10 changes: 8 additions & 2 deletions plugins/importexport/doaj/filter/DOAJJsonFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
use APP\facades\Repo;
use APP\plugins\importexport\doaj\DOAJExportDeployment;
use APP\plugins\importexport\doaj\DOAJExportPlugin;
use PKP\controlledVocab\ControlledVocab;
use PKP\core\PKPString;
use PKP\plugins\importexport\PKPImportExportFilter;
use PKP\submission\SubmissionKeywordVocab;

class DOAJJsonFilter extends PKPImportExportFilter
{
Expand Down Expand Up @@ -175,7 +175,13 @@ public function &process(&$pubObject)
$article['bibjson']['abstract'] = PKPString::html2text($abstract);
}
// Keywords
$keywords = SubmissionKeywordVocab::getKeywords($publication->getId(), [$publicationLocale]);
$keywords = Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId(),
[$publicationLocale]
);

$allowedNoOfKeywords = array_slice($keywords[$publicationLocale] ?? [], 0, 6);
if (!empty($keywords[$publicationLocale])) {
$article['bibjson']['keywords'] = $allowedNoOfKeywords;
Expand Down
9 changes: 7 additions & 2 deletions plugins/importexport/doaj/filter/DOAJXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
use APP\plugins\importexport\doaj\DOAJExportPlugin;
use APP\publication\Publication;
use APP\submission\Submission;
use PKP\controlledVocab\ControlledVocab;
use PKP\core\PKPString;
use PKP\i18n\LocaleConversion;
use PKP\submission\SubmissionKeywordVocab;

class DOAJXmlFilter extends \PKP\plugins\importexport\native\filter\NativeExportFilter
{
Expand Down Expand Up @@ -191,7 +191,12 @@ public function &process(&$pubObjects)

// Keywords
$supportedLocales = $context->getSupportedFormLocales();
$articleKeywords = SubmissionKeywordVocab::getKeywords($publication->getId(), $supportedLocales);
$articleKeywords = Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId(),
$supportedLocales
);

if (array_key_exists($publication->getData('locale'), $articleKeywords)) {
$keywordsInArticleLocale = $articleKeywords[$publication->getData('locale')];
Expand Down
17 changes: 13 additions & 4 deletions plugins/metadata/dc11/filter/Dc11SchemaArticleAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
use APP\oai\ojs\OAIDAO;
use APP\plugins\PubIdPlugin;
use APP\submission\Submission;
use PKP\controlledVocab\ControlledVocab;
use PKP\core\PKPApplication;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
use PKP\metadata\MetadataDataObjectAdapter;
use PKP\metadata\MetadataDescription;
use PKP\plugins\Hook;
use PKP\plugins\PluginRegistry;
use PKP\submission\SubmissionKeywordVocab;
use PKP\submission\SubmissionSubjectVocab;

class Dc11SchemaArticleAdapter extends MetadataDataObjectAdapter
{
Expand Down Expand Up @@ -92,8 +91,18 @@ public function &extractMetadataFromDataObject(&$article)
// Subject
$supportedLocales = $journal->getSupportedFormLocales();
$subjects = array_merge_recursive(
SubmissionKeywordVocab::getKeywords($publication->getId(), $supportedLocales),
SubmissionSubjectVocab::getSubjects($publication->getId(), $supportedLocales)
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId(),
$supportedLocales
),
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId(),
$supportedLocales
)
);
$this->_addLocalizedElements($dc11Description, 'dc:subject', $subjects);

Expand Down
18 changes: 14 additions & 4 deletions plugins/oaiMetadataFormats/rfc1807/OAIMetadataFormat_RFC1807.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
namespace APP\plugins\oaiMetadataFormats\rfc1807;

use APP\core\Application;
use APP\facades\Repo;
use APP\issue\IssueAction;
use PKP\controlledVocab\ControlledVocab;
use PKP\oai\OAIMetadataFormat;
use PKP\oai\OAIUtils;
use PKP\submission\SubmissionKeywordVocab;
use PKP\submission\SubmissionSubjectVocab;

class OAIMetadataFormat_RFC1807 extends OAIMetadataFormat
{
Expand Down Expand Up @@ -68,8 +68,18 @@ public function toXml($record, $format = null)
// Subject
$supportedLocales = $journal->getSupportedFormLocales();
$subjects = array_merge_recursive(
SubmissionKeywordVocab::getKeywords($publication->getId(), $supportedLocales),
SubmissionSubjectVocab::getSubjects($article->getCurrentPublication()->getId(), $supportedLocales)
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$publication->getId(),
$supportedLocales
),
Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
Application::ASSOC_TYPE_PUBLICATION,
$article->getCurrentPublication()->getId(),
$supportedLocales
)
);
$subject = $subjects[$journal->getPrimaryLocale()] ?? '';

Expand Down
33 changes: 25 additions & 8 deletions plugins/reports/articles/ArticleReportPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@

namespace APP\plugins\reports\articles;

use APP\core\Application;
use APP\decision\Decision;
use APP\facades\Repo;
use PKP\controlledVocab\ControlledVocab;
use PKP\facades\Locale;
use PKP\plugins\ReportPlugin;
use PKP\security\Role;
use PKP\stageAssignment\StageAssignment;
use PKP\submission\PKPSubmission;
use PKP\submission\SubmissionAgencyVocab;
use PKP\submission\SubmissionDisciplineVocab;
use PKP\submission\SubmissionKeywordVocab;
use PKP\submission\SubmissionSubjectVocab;

class ArticleReportPlugin extends ReportPlugin
{
Expand Down Expand Up @@ -153,10 +151,29 @@ public function display($args, $request)
$sectionTitles[$sectionId] = $section->getLocalizedTitle();
}

$subjects = SubmissionSubjectVocab::getSubjects($submission->getCurrentPublication()->getId());
$disciplines = SubmissionDisciplineVocab::getDisciplines($submission->getCurrentPublication()->getId());
$keywords = SubmissionKeywordVocab::getKeywords($submission->getCurrentPublication()->getId());
$agencies = SubmissionAgencyVocab::getAgencies($submission->getCurrentPublication()->getId());
$subjects = Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_SUBJECT,
Application::ASSOC_TYPE_PUBLICATION,
$submission->getCurrentPublication()->getId()
);

$disciplines = Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_DISCIPLINE,
Application::ASSOC_TYPE_PUBLICATION,
$submission->getCurrentPublication()->getId()
);

$keywords = Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_KEYWORD,
Application::ASSOC_TYPE_PUBLICATION,
$submission->getCurrentPublication()->getId()
);

$agencies = Repo::controlledVocab()->getBySymbolic(
ControlledVocab::CONTROLLED_VOCAB_SUBMISSION_AGENCY,
Application::ASSOC_TYPE_PUBLICATION,
$submission->getCurrentPublication()->getId()
);

// Store the submission results
$results[] = [
Expand Down

0 comments on commit 4679c4f

Please sign in to comment.