Open Journal Systems  3.3.0
ArticleGalley.inc.php
1 <?php
2 
17 import('lib.pkp.classes.submission.Representation');
18 
21  var $_submissionFile;
22 
23 
24  //
25  // Get/set methods
26  //
31  function getViews() {
33  $fileId = $this->getFileId();
34  if ($fileId) {
35  return $application->getPrimaryMetricByAssoc(ASSOC_TYPE_SUBMISSION_FILE, $fileId);
36  } else {
37  return 0;
38  }
39  }
40 
45  function getLabel() {
46  return $this->getData('label');
47  }
48 
53  function setLabel($label) {
54  return $this->setData('label', $label);
55  }
56 
61  function getLocale() {
62  return $this->getData('locale');
63  }
64 
69  function setLocale($locale) {
70  return $this->setData('locale', $locale);
71  }
72 
78  function getBestGalleyId() {
79  return $this->getData('urlPath')
80  ? $this->getData('urlPath')
81  : $this->getId();
82  }
83 
88  function setFileId($fileId) {
89  $this->setData('fileId', $fileId);
90  }
91 
96  function getFileId() {
97  return $this->getData('fileId');
98  }
99 
104  function getFile() {
105  if (!isset($this->_submissionFile)) {
106  $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */
107  $this->_submissionFile = $submissionFileDao->getLatestRevision($this->getFileId());
108  }
109  return $this->_submissionFile;
110  }
111 
116  function getFileType() {
117  $galleyFile = $this->getFile();
118  return isset($galleyFile) ? $galleyFile->getFileType() : null;
119  }
120 
125  function isPdfGalley() {
126  return $this->getFileType() == 'application/pdf';
127  }
128 
133  function getGalleyLabel() {
134  $label = $this->getLabel();
135  if ($this->getLocale() != AppLocale::getLocale()) {
137  $label .= ' (' . $locales[$this->getLocale()] . ')';
138  }
139  return $label;
140  }
141 
151  function getName($locale) {
152  return array($this->getLocale() => $this->getLabel());
153  }
154 
160  function getLocalizedName() {
161  return $this->getLabel();
162  }
163 }
164 
165 
DataObject\getData
& getData($key, $locale=null)
Definition: DataObject.inc.php:100
PKPLocale\getAllLocales
static & getAllLocales()
Definition: PKPLocale.inc.php:537
$application
$application
Definition: index.php:65
DAORegistry\getDAO
static & getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:57
ArticleGalley\getName
getName($locale)
Definition: ArticleGalley.inc.php:154
ArticleGalley\setLocale
setLocale($locale)
Definition: ArticleGalley.inc.php:72
ArticleGalley\getBestGalleyId
getBestGalleyId()
Definition: ArticleGalley.inc.php:81
ArticleGalley
A galley is a final presentation version of the full-text of an article.
Definition: ArticleGalley.inc.php:19
ArticleGalley\setFileId
setFileId($fileId)
Definition: ArticleGalley.inc.php:91
ArticleGalley\getFile
getFile()
Definition: ArticleGalley.inc.php:107
ArticleGalley\isPdfGalley
isPdfGalley()
Definition: ArticleGalley.inc.php:128
ArticleGalley\setLabel
setLabel($label)
Definition: ArticleGalley.inc.php:56
ArticleGalley\getLabel
getLabel()
Definition: ArticleGalley.inc.php:48
DataObject\getId
getId()
Definition: DataObject.inc.php:206
ArticleGalley\getFileId
getFileId()
Definition: ArticleGalley.inc.php:99
ArticleGalley\$_submissionFile
$_submissionFile
Definition: ArticleGalley.inc.php:24
PKPApplication\get
static get()
Definition: PKPApplication.inc.php:235
ArticleGalley\getFileType
getFileType()
Definition: ArticleGalley.inc.php:119
Representation
A submission's representation (Publication Format, Galley, ...)
Definition: Representation.inc.php:18
ArticleGalley\getLocalizedName
getLocalizedName()
Definition: ArticleGalley.inc.php:163
AppLocale\getLocale
static getLocale()
Definition: env1/MockAppLocale.inc.php:40
ArticleGalley\getViews
getViews()
Definition: ArticleGalley.inc.php:34
DataObject\setData
setData($key, $value, $locale=null)
Definition: DataObject.inc.php:132
ArticleGalley\getGalleyLabel
getGalleyLabel()
Definition: ArticleGalley.inc.php:136
ArticleGalley\getLocale
getLocale()
Definition: ArticleGalley.inc.php:64