PageRenderTime 52ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/classes/paper/SuppFile.inc.php

https://github.com/lib-uoguelph-ca/ocs
PHP | 414 lines | 151 code | 51 blank | 212 comment | 6 complexity | 79826a39a826875f81ca2d4d68c03ca0 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * @file SuppFile.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 SuppFile
  9. * @ingroup paper
  10. * @see SuppFileDAO
  11. *
  12. * @brief Supplementary file class.
  13. */
  14. //$Id$
  15. import('paper.PaperFile');
  16. class SuppFile extends PaperFile {
  17. /**
  18. * Constructor.
  19. */
  20. function SuppFile() {
  21. parent::DataObject();
  22. }
  23. //
  24. // Get/set methods
  25. //
  26. /**
  27. * Get ID of supplementary file.
  28. * @return int
  29. */
  30. function getSuppFileId() {
  31. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  32. return $this->getId();
  33. }
  34. /**
  35. * Set ID of supplementary file.
  36. * @param $suppFileId int
  37. */
  38. function setSuppFileId($suppFileId) {
  39. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  40. return $this->setId($suppFileId);
  41. }
  42. /**
  43. * Get public ID of supplementary file.
  44. * @return string
  45. */
  46. function getPublicSuppFileId() {
  47. // Ensure that blanks are treated as nulls
  48. $returner = $this->getData('publicSuppFileId');
  49. if ($returner === '') return null;
  50. return $returner;
  51. }
  52. /**
  53. * Set public ID of supplementary file.
  54. * @param $suppFileId string
  55. */
  56. function setPublicSuppFileId($publicSuppFileId) {
  57. return $this->setData('publicSuppFileId', $publicSuppFileId);
  58. }
  59. /**
  60. * Get ID of paper.
  61. * @return int
  62. */
  63. function getPaperId() {
  64. return $this->getData('paperId');
  65. }
  66. /**
  67. * Set ID of paper.
  68. * @param $paperId int
  69. */
  70. function setPaperId($paperId) {
  71. return $this->setData('paperId', $paperId);
  72. }
  73. /**
  74. * Get localized title
  75. * @return string
  76. */
  77. function getSuppFileTitle() {
  78. return $this->getLocalizedData('title');
  79. }
  80. /**
  81. * Get title.
  82. * @param $locale string
  83. * @return string
  84. */
  85. function getTitle() {
  86. return $this->getData('title');
  87. }
  88. /**
  89. * Set title.
  90. * @param $title string
  91. * @param $locale string
  92. */
  93. function setTitle($title, $locale) {
  94. return $this->setData('title', $title, $locale);
  95. }
  96. /**
  97. * Get localized creator
  98. * @return string
  99. */
  100. function getSuppFileCreator() {
  101. return $this->getLocalizedData('creator');
  102. }
  103. /**
  104. * Get creator.
  105. * @param $locale string
  106. * @return string
  107. */
  108. function getCreator($locale) {
  109. return $this->getData('creator', $locale);
  110. }
  111. /**
  112. * Set creator.
  113. * @param $creator string
  114. * @param $locale string
  115. */
  116. function setCreator($creator, $locale) {
  117. return $this->setData('creator', $creator, $locale);
  118. }
  119. /**
  120. * Get localized subject
  121. * @return string
  122. */
  123. function getSuppFileSubject() {
  124. return $this->getLocalizedData('subject');
  125. }
  126. /**
  127. * Get subject.
  128. * @param $locale string
  129. * @return string
  130. */
  131. function getSubject($locale) {
  132. return $this->getData('subject', $locale);
  133. }
  134. /**
  135. * Set subject.
  136. * @param $subject string
  137. * @param $locale string
  138. */
  139. function setSubject($subject, $locale) {
  140. return $this->setData('subject', $subject, $locale);
  141. }
  142. /**
  143. * Get type (method/approach).
  144. * @return string
  145. */
  146. function getType() {
  147. return $this->getData('type');
  148. }
  149. /**
  150. * Set type (method/approach).
  151. * @param $type string
  152. */
  153. function setType($type) {
  154. return $this->setData('type', $type);
  155. }
  156. /**
  157. * Get localized subject
  158. * @return string
  159. */
  160. function getSuppFileTypeOther() {
  161. return $this->getLocalizedData('typeOther');
  162. }
  163. /**
  164. * Get custom type.
  165. * @param $locale string
  166. * @return string
  167. */
  168. function getTypeOther($locale) {
  169. return $this->getData('typeOther', $locale);
  170. }
  171. /**
  172. * Set custom type.
  173. * @param $typeOther string
  174. * @param $locale string
  175. */
  176. function setTypeOther($typeOther, $locale) {
  177. return $this->setData('typeOther', $typeOther, $locale);
  178. }
  179. /**
  180. * Get localized description
  181. * @return string
  182. */
  183. function getSuppFileDescription() {
  184. return $this->getLocalizedData('description');
  185. }
  186. /**
  187. * Get file description.
  188. * @param $locale string
  189. * @return string
  190. */
  191. function getDescription($locale) {
  192. return $this->getData('description', $locale);
  193. }
  194. /**
  195. * Set file description.
  196. * @param $description string
  197. * @param $locale string
  198. */
  199. function setDescription($description, $locale) {
  200. return $this->setData('description', $description, $locale);
  201. }
  202. /**
  203. * Get localized publisher
  204. * @return string
  205. */
  206. function getSuppFilePublisher() {
  207. return $this->getLocalizedData('publisher');
  208. }
  209. /**
  210. * Get publisher.
  211. * @param $locale string
  212. * @return string
  213. */
  214. function getPublisher($locale) {
  215. return $this->getData('publisher', $locale);
  216. }
  217. /**
  218. * Set publisher.
  219. * @param $publisher string
  220. * @param $locale string
  221. */
  222. function setPublisher($publisher, $locale) {
  223. return $this->setData('publisher', $publisher, $locale);
  224. }
  225. /**
  226. * Get localized sponsor
  227. * @return string
  228. */
  229. function getSuppFileSponsor() {
  230. return $this->getLocalizedData('sponsor');
  231. }
  232. /**
  233. * Get sponsor.
  234. * @param $locale string
  235. * @return string
  236. */
  237. function getSponsor($locale) {
  238. return $this->getData('sponsor', $locale);
  239. }
  240. /**
  241. * Set sponsor.
  242. * @param $sponsor string
  243. * @param $locale string
  244. */
  245. function setSponsor($sponsor, $locale) {
  246. return $this->setData('sponsor', $sponsor, $locale);
  247. }
  248. /**
  249. * Get date created.
  250. * @return date
  251. */
  252. function getDateCreated() {
  253. return $this->getData('dateCreated');
  254. }
  255. /**
  256. * Set date created.
  257. * @param $dateCreated date
  258. */
  259. function setDateCreated($dateCreated) {
  260. return $this->setData('dateCreated', $dateCreated);
  261. }
  262. /**
  263. * Get localized source
  264. * @return string
  265. */
  266. function getSuppFileSource() {
  267. return $this->getLocalizedData('source');
  268. }
  269. /**
  270. * Get source.
  271. * @param $locale string
  272. * @return string
  273. */
  274. function getSource($locale) {
  275. return $this->getData('source', $locale);
  276. }
  277. /**
  278. * Set source.
  279. * @param $source string
  280. * @param $locale string
  281. */
  282. function setSource($source, $locale) {
  283. return $this->setData('source', $source, $locale);
  284. }
  285. /**
  286. * Get language.
  287. * @return string
  288. */
  289. function getLanguage() {
  290. return $this->getData('language');
  291. }
  292. /**
  293. * Set language.
  294. * @param $language string
  295. */
  296. function setLanguage($language) {
  297. return $this->setData('language', $language);
  298. }
  299. /**
  300. * Check if file is available to peer reviewers.
  301. * @return boolean
  302. */
  303. function getShowReviewers() {
  304. return $this->getData('showReviewers');
  305. }
  306. /**
  307. * Set if file is available to peer reviewers or not.
  308. * @param boolean
  309. */
  310. function setShowReviewers($showReviewers) {
  311. return $this->setData('showReviewers', $showReviewers);
  312. }
  313. /**
  314. * Get date file was submitted.
  315. * @return datetime
  316. */
  317. function getDateSubmitted() {
  318. return $this->getData('dateSubmitted');
  319. }
  320. /**
  321. * Set date file was submitted.
  322. * @param $dateSubmitted datetime
  323. */
  324. function setDateSubmitted($dateSubmitted) {
  325. return $this->setData('dateSubmitted', $dateSubmitted);
  326. }
  327. /**
  328. * Get sequence order of supplementary file.
  329. * @return float
  330. */
  331. function getSequence() {
  332. return $this->getData('sequence');
  333. }
  334. /**
  335. * Set sequence order of supplementary file.
  336. * @param $sequence float
  337. */
  338. function setSequence($sequence) {
  339. return $this->setData('sequence', $sequence);
  340. }
  341. /**
  342. * Return the "best" supp file ID -- If a public ID is set,
  343. * use it; otherwise use the internal Id. (Checks the sched conf
  344. * settings to ensure that the public ID feature is enabled.)
  345. * @param $schedConf Object the sched conf this paper is in
  346. * @return string
  347. */
  348. function getBestSuppFileId($schedConf = null) {
  349. // Retrieve the sched conf, if necessary.
  350. if (!isset($schedConf)) {
  351. $paperDao =& DAORegistry::getDAO('PaperDAO');
  352. $paper =& $paperDao->getPaper($this->getPaperId());
  353. $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
  354. $schedConf =& $schedConfDao->getSchedConf($paper->getSchedConfId());
  355. }
  356. if ($schedConf->getSetting('enablePublicSuppFileId')) {
  357. $publicSuppFileId = $this->getPublicSuppFileId();
  358. if (!empty($publicSuppFileId)) return $publicSuppFileId;
  359. }
  360. return $this->getId();
  361. }
  362. }
  363. ?>