PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/classes/paper/PaperGalley.inc.php

https://github.com/lib-uoguelph-ca/ocs
PHP | 163 lines | 64 code | 22 blank | 77 comment | 5 complexity | 5da31bee49562e22db9f98d392722e37 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * @file PaperGalley.inc.php
  4. *
  5. * Copyright (c) 2000-2012 John Willinsky
  6. * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  7. *
  8. * @class PaperGalley
  9. * @ingroup paper
  10. * @see PaperGalleyDAO
  11. *
  12. * @brief A galley is a final presentation version of the full-text of a paper.
  13. */
  14. //$Id$
  15. import('paper.PaperFile');
  16. class PaperGalley extends PaperFile {
  17. /**
  18. * Constructor.
  19. */
  20. function PaperGalley() {
  21. parent::DataObject();
  22. }
  23. /**
  24. * Check if galley is an HTML galley.
  25. * @return boolean
  26. */
  27. function isHTMLGalley() {
  28. return false;
  29. }
  30. /**
  31. * Check if galley is a PDF galley.
  32. * @return boolean
  33. */
  34. function isPdfGalley() {
  35. switch ($this->getFileType()) {
  36. case 'application/pdf':
  37. case 'application/x-pdf':
  38. case 'text/pdf':
  39. case 'text/x-pdf':
  40. return true;
  41. default: return false;
  42. }
  43. }
  44. /**
  45. * Check if the specified file is a dependent file.
  46. * @param $fileId int
  47. * @return boolean
  48. */
  49. function isDependentFile($fileId) {
  50. return false;
  51. }
  52. //
  53. // Get/set methods
  54. //
  55. /**
  56. * Get ID of galley.
  57. * @return int
  58. */
  59. function getGalleyId() {
  60. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  61. return $this->getId();
  62. }
  63. /**
  64. * Set ID of galley.
  65. * @param $galleyId int
  66. */
  67. function setGalleyId($galleyId) {
  68. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  69. return $this->setId($galleyId);
  70. }
  71. /**
  72. * Get views count.
  73. * @return int
  74. */
  75. function getViews() {
  76. return $this->getData('views');
  77. }
  78. /**
  79. * Set views count.
  80. * NOTE that the views count is NOT stored by the DAO update or insert functions.
  81. * @param $views int
  82. */
  83. function setViews($views) {
  84. return $this->setData('views', $views);
  85. }
  86. /**
  87. * Get the localized value of the galley label.
  88. * @return $string
  89. */
  90. function getGalleyLabel() {
  91. $label = $this->getLabel();
  92. if ($this->getLocale() != AppLocale::getLocale()) {
  93. $locales = AppLocale::getAllLocales();
  94. $label .= ' (' . $locales[$this->getLocale()] . ')';
  95. }
  96. return $label;
  97. }
  98. /**
  99. * Get label/title.
  100. * @return string
  101. */
  102. function getLabel() {
  103. return $this->getData('label');
  104. }
  105. /**
  106. * Set label/title.
  107. * @param $label string
  108. */
  109. function setLabel($label) {
  110. return $this->setData('label', $label);
  111. }
  112. /**
  113. * Get locale.
  114. * @return string
  115. */
  116. function getLocale() {
  117. return $this->getData('locale');
  118. }
  119. /**
  120. * Set locale.
  121. * @param $locale string
  122. */
  123. function setLocale($locale) {
  124. return $this->setData('locale', $locale);
  125. }
  126. /**
  127. * Get sequence order of supplementary file.
  128. * @return float
  129. */
  130. function getSequence() {
  131. return $this->getData('sequence');
  132. }
  133. /**
  134. * Set sequence order of supplementary file.
  135. * @param $sequence float
  136. */
  137. function setSequence($sequence) {
  138. return $this->setData('sequence', $sequence);
  139. }
  140. }
  141. ?>