22 use \DAOResultFactory;
23 use \PKP\Services\interfaces\EntityPropertyInterface;
24 use \PKP\Services\interfaces\EntityReadInterface;
25 use \APP\Services\QueryBuilders\IssueQueryBuilder;
27 class IssueService implements EntityPropertyInterface, EntityReadInterface {
32 public function get($issueId) {
34 return $issueDao->getById($issueId);
73 if (isset($args[
'count'])) {
74 import(
'lib.pkp.classes.db.DBResultRange');
75 $range = new \DBResultRange($args[
'count'],
null, isset($args[
'offset']) ? $args[
'offset'] : 0);
79 if (isset($args[
'count'])) unset($args[
'count']);
80 if (isset($args[
'offset'])) unset($args[
'offset']);
83 $result = $issueDao->retrieveRange($issueListQO->toSql(), $issueListQO->getBindings(), $range);
86 return $queryResults->toIterator();
94 if (isset($args[
'count'])) unset($args[
'count']);
95 if (isset($args[
'offset'])) unset($args[
'offset']);
105 $defaultArgs = array(
106 'contextId' => CONTEXT_ID_NONE,
107 'orderBy' =>
'datePublished',
108 'orderDirection' =>
'DESC',
109 'isPublished' =>
null,
113 'searchPhrase' =>
'',
116 $args = array_merge($defaultArgs, $args);
120 ->filterByContext($args[
'contextId'])
121 ->orderBy($args[
'orderBy'], $args[
'orderDirection'])
122 ->filterByPublished($args[
'isPublished'])
123 ->filterByVolumes($args[
'volumes'])
124 ->filterByNumbers($args[
'numbers'])
125 ->filterByYears($args[
'years'])
126 ->searchPhrase($args[
'searchPhrase']);
128 if (isset($args[
'count'])) {
129 $issueListQB->limitTo($args[
'count']);
132 if (isset($args[
'offset'])) {
133 $issueListQB->offsetBy($args[
'count']);
150 import(
'classes.issue.IssueAction');
151 $issueAction = new \IssueAction();
153 $subscriptionRequired = $issueAction->subscriptionRequired($issue, $journal);
154 $subscribedUser = $issueAction->subscribedUser($journal, $issue);
155 $subscribedDomain = $issueAction->subscribedDomain($journal, $issue);
157 return !$subscriptionRequired || $issue->
getAccessStatus() == ISSUE_ACCESS_OPEN || $subscribedUser || $subscribedDomain;
167 import(
'classes.issue.Issue');
168 $accessStatus =
null;
170 switch ($journal->
getData(
'publishingMode')) {
171 case PUBLISHING_MODE_SUBSCRIPTION:
172 case PUBLISHING_MODE_NONE:
173 $accessStatus = ISSUE_ACCESS_SUBSCRIPTION;
175 case PUBLISHING_MODE_OPEN:
177 $accessStatus = ISSUE_ACCESS_OPEN;
181 return $accessStatus;
189 $request = $args[
'request'];
190 $context = $request->getContext();
191 $dispatcher = $request->getDispatcher();
192 $router = $request->getRouter();
195 foreach ($props as $prop) {
198 $values[$prop] = (int) $issue->getId();
201 $values[$prop] =
null;
202 if (!empty($args[
'slimRequest'])) {
203 $route = $args[
'slimRequest']->getAttribute(
'route');
204 $arguments = $route->getArguments();
205 $values[$prop] = $dispatcher->url(
208 $arguments[
'contextPath'],
209 'issues/' . $issue->getId()
214 $values[$prop] = $issue->getTitle(
null);
217 $values[$prop] = $issue->getDescription(
null);
219 case 'identification':
220 $values[$prop] = $issue->getIssueIdentification();
223 $values[$prop] = (int) $issue->getVolume();
226 $values[$prop] = $issue->getNumber();
229 $values[$prop] = (int) $issue->getYear();
232 $values[$prop] = (bool) $issue->getCurrent();
234 case 'datePublished':
235 $values[$prop] = $issue->getDatePublished();
238 $values[$prop] = $issue->getDateNotified();
241 $values[$prop] = $issue->getLastModified();
244 $values[$prop] =
null;
246 $values[$prop] = $dispatcher->url(
252 $issue->getBestIssueId()
257 $values[$prop] = array();
258 $submissionsIterator =
Services::get(
'submission')->getMany([
259 'contextId' => $issue->getJournalId(),
260 'issueIds' => $issue->getId(),
263 foreach ($submissionsIterator as $submission) {
264 $values[$prop][] =
\Services::get(
'submission')->getSummaryProperties($submission, $args);
268 $values[$prop] = array();
270 $sections = $sectionDao->getByIssueId($issue->getId());
271 if (!empty($sections)) {
272 foreach ($sections as $section) {
273 $sectionProperties =
\Services::get(
'section')->getSummaryProperties($section, $args);
274 $customSequence = $sectionDao->getCustomSectionOrder($issue->getId(), $section->getId());
275 if ($customSequence) {
276 $sectionProperties[
'seq'] = $customSequence;
278 $values[$prop][] = $sectionProperties;
282 case 'coverImageUrl':
283 $values[$prop] = $issue->getCoverImageUrls(
null);
285 case 'coverImageAltText':
286 $values[$prop] = $issue->getCoverImageAltText(
null);
289 case 'galleysSummary';
292 $galleys = $issueGalleyDao->getByIssueId($issue->getId());
294 $galleyArgs = array_merge($args, array(
'issue' => $issue));
295 foreach ($galleys as $galley) {
296 $data[] = ($prop ===
'galleys')
297 ? \
Services::get(
'galley')->getFullProperties($galley, $galleyArgs)
298 :
\Services::get(
'galley')->getSummaryProperties($galley, $galleyArgs);
301 $values[
'galleys'] = $data;
306 $values =
Services::get(
'schema')->addMissingMultilingualValues(SCHEMA_ISSUE, $values, $context->getSupportedFormLocales());
308 \HookRegistry::call(
'Issue::getProperties::values', array(&$values, $issue, $props, $args));
320 'id',
'_href',
'title',
'description',
'identification',
'volume',
'number',
'year',
321 'datePublished',
'publishedUrl',
'coverImageUrl',
'coverImageAltText',
'galleysSummary',
324 \HookRegistry::call(
'Issue::getProperties::summaryProperties', array(&$props, $issue, $args));
334 'id',
'_href',
'title',
'description',
'identification',
'volume',
'number',
'year',
'isPublished',
335 'isCurrent',
'datePublished',
'dateNotified',
'lastModified',
'publishedUrl',
'coverImageUrl',
336 'coverImageAltText',
'articles',
'sections',
'tableOfContetnts',
'galleysSummary',
339 \HookRegistry::call(
'Issue::getProperties::fullProperties', array(&$props, $issue, $args));