16 import(
'lib.pkp.classes.plugins.PKPPubIdPlugin');
24 parent::__construct();
35 $pubObjectTypes = parent::getPubObjectTypes();
36 array_push($pubObjectTypes,
'Chapter');
37 return $pubObjectTypes;
48 $storedPubId = $pubObject->getStoredPubId($pubIdType);
49 if ($storedPubId)
return $storedPubId;
55 $submission = ($pubObjectType ==
'Submission' ? $pubObject :
null);
56 $representation = ($pubObjectType ==
'Representation' ? $pubObject :
null);
57 $submissionFile = ($pubObjectType ==
'SubmissionFile' ? $pubObject :
null);
58 $chapter = ($pubObjectType ==
'Chapter' ? $pubObject :
null);
61 if ($pubObjectType ==
'Submission') {
62 $contextId = $pubObject->getContextId();
65 if (is_a($pubObject,
'Chapter') || is_a($pubObject,
'Representation')) {
66 $publication =
Services::get(
'publication')->get($pubObject->getData(
'publicationId'));
67 $submission =
Services::get(
'submission')->get($publication->getData(
'submissionId'));
69 assert(is_a($pubObject,
'SubmissionFile'));
70 $submission =
Services::get(
'submission')->get($pubObject->getSubmissionId());
72 if (!$submission)
return null;
74 $contextId = $submission->getContextId();
78 if (!$context)
return null;
79 $contextId = $context->getId();
83 if (!$objectTypeEnabled)
return null;
87 if (empty($pubIdPrefix))
return null;
91 $suffixGenerationStrategy = $this->
getSetting($contextId, $suffixFieldName);
92 switch ($suffixGenerationStrategy) {
94 $pubIdSuffix = $pubObject->getData($suffixFieldName);
99 $pubIdSuffix = $this->
getSetting($contextId, $suffixPatternsFieldNames[$pubObjectType]);
105 if ($pubObject->getStoredPubId(
'publisher-id')) {
119 if ($representation) {
124 if ($submissionFile) {
135 $pubIdSuffix .=
'.' . $submission->getId();
139 $pubIdSuffix .=
'.c' . $chapter->getId();
142 if ($representation) {
143 $pubIdSuffix .=
'.' . $representation->getId();
146 if ($submissionFile) {
147 $pubIdSuffix .=
'.' . $submissionFile->getFileId();
150 if (empty($pubIdSuffix))
return null;
153 $pubId = $this->
constructPubId($pubIdPrefix, $pubIdSuffix, $contextId);
162 return array_merge(parent::getDAOs(), array(
'Chapter' =>
DAORegistry::getDAO(
'ChapterDAO')));
170 if ($type ===
'Chapter') {
171 $excludeTypeId = $type === $pubObjectType ? $excludeId :
null;