00001 <?php 00002 00016 // $Id: ArticleGalley.inc.php,v 1.14 2008/07/01 01:16:09 asmecher Exp $ 00017 00018 00019 import('article.ArticleFile'); 00020 00021 class ArticleGalley extends ArticleFile { 00022 00026 function ArticleGalley() { 00027 parent::DataObject(); 00028 } 00029 00034 function isHTMLGalley() { 00035 return false; 00036 } 00037 00042 function isPdfGalley() { 00043 switch ($this->getFileType()) { 00044 case 'application/pdf': 00045 case 'application/x-pdf': 00046 case 'text/pdf': 00047 case 'text/x-pdf': 00048 return true; 00049 default: return false; 00050 } 00051 } 00052 00058 function isDependentFile($fileId) { 00059 return false; 00060 } 00061 00062 // 00063 // Get/set methods 00064 // 00065 00070 function getGalleyId() { 00071 return $this->getData('galleyId'); 00072 } 00073 00078 function setGalleyId($galleyId) { 00079 return $this->setData('galleyId', $galleyId); 00080 } 00081 00086 function getViews() { 00087 return $this->getData('views'); 00088 } 00089 00095 function setViews($views) { 00096 return $this->setData('views', $views); 00097 } 00098 00103 function getGalleyLabel() { 00104 $label = $this->getLabel(); 00105 if ($this->getLocale() != Locale::getLocale()) { 00106 $locales = Locale::getAllLocales(); 00107 $label .= ' (' . $locales[$this->getLocale()] . ')'; 00108 } 00109 return $label; 00110 } 00111 00116 function getLabel() { 00117 return $this->getData('label'); 00118 } 00119 00124 function setLabel($label) { 00125 return $this->setData('label', $label); 00126 } 00127 00132 function getLocale() { 00133 return $this->getData('locale'); 00134 } 00135 00140 function setLocale($locale) { 00141 return $this->setData('locale', $locale); 00142 } 00143 00148 function getSequence() { 00149 return $this->getData('sequence'); 00150 } 00151 00156 function setSequence($sequence) { 00157 return $this->setData('sequence', $sequence); 00158 } 00159 00164 function getPublicGalleyId() { 00165 // Ensure that blanks are treated as nulls. 00166 $returner = $this->getData('publicGalleyId'); 00167 if ($returner === '') return null; 00168 return $returner; 00169 } 00170 00175 function setPublicGalleyId($publicGalleyId) { 00176 return $this->setData('publicGalleyId', $publicGalleyId); 00177 } 00178 00186 function getBestGalleyId(&$journal) { 00187 if ($journal->getSetting('enablePublicGalleyId')) { 00188 $publicGalleyId = $this->getPublicGalleyId(); 00189 if (!empty($publicGalleyId)) return $publicGalleyId; 00190 } 00191 return $this->getGalleyId(); 00192 } 00193 } 00194 00195 ?>
1.5.6