Open Monograph Press  3.3.0
Publication.inc.php
1 <?php
2 
16 import('lib.pkp.classes.publication.PKPPublication');
17 
18 class Publication extends PKPPublication {
19 
24  public function getEditorString() {
25  AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION);
26  $authors = $this->getData('authors');
27  $editorNames = [];
28  foreach ($authors as $author) {
29  if ($author->getIsVolumeEditor()) {
30  $editorNames[] = __('submission.editorName', array('editorName' => $author->getFullName()));
31  }
32  }
33 
34  // Spaces are stripped from the locale strings, so we have to add the
35  // space in here.
36  return join(__('common.commaListSeparator') . ' ', $editorNames);
37  }
38 
45  public function getLocalizedCoverImageUrl($contextId) {
46  $coverImage = $this->getLocalizedData('coverImage');
47 
48  if (!$coverImage) {
49  return Application::get()->getRequest()->getBaseUrl() . '/templates/images/book-default.png';
50  }
51 
52  import('classes.file.PublicFileManager');
53  $publicFileManager = new PublicFileManager();
54 
55  return join('/', [
56  Application::get()->getRequest()->getBaseUrl(),
57  $publicFileManager->getContextFilesPath($contextId),
58  $coverImage['uploadName'],
59  ]);
60  }
61 
68  public function getLocalizedCoverImageThumbnailUrl($contextId) {
69  $url = $this->getLocalizedCoverImageUrl($contextId);
70  $pathParts = pathinfo($url);
71  return join('/', [
72  $pathParts['dirname'],
73  Services::get('publication')->getThumbnailFilename($pathParts['basename']),
74  ]);
75  }
76 }
DataObject\getData
& getData($key, $locale=null)
Definition: DataObject.inc.php:100
AppLocale\requireComponents
static requireComponents()
Definition: env1/MockAppLocale.inc.php:56
PKPPublication
Base class for Publication.
Definition: PKPPublication.inc.php:17
Publication\getLocalizedCoverImageThumbnailUrl
getLocalizedCoverImageThumbnailUrl($contextId)
Definition: Publication.inc.php:68
PKPPublication\getLocalizedData
getLocalizedData($key, $preferredLocale=null)
Definition: PKPPublication.inc.php:32
Publication\getLocalizedCoverImageUrl
getLocalizedCoverImageUrl($contextId)
Definition: Publication.inc.php:45
PublicFileManager
Wrapper class for uploading files to a site/press' public directory.
Definition: PublicFileManager.inc.php:19
Publication
Class for Publication.
Definition: Publication.inc.php:18
Publication\getEditorString
getEditorString()
Definition: Publication.inc.php:24
PKPApplication\get
static get()
Definition: PKPApplication.inc.php:235
PKPServices\get
static get($service)
Definition: PKPServices.inc.php:49