PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/classes/submission/reviewAssignment/ReviewAssignment.inc.php

https://github.com/lib-uoguelph-ca/ocs
PHP | 608 lines | 239 code | 78 blank | 291 comment | 3 complexity | 1e23dfdeaddc103b1441d33b18f043a2 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * @file ReviewAssignment.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 ReviewAssignment
  9. * @ingroup submission
  10. * @see ReviewAssignmentDAO
  11. *
  12. * @brief Describes review assignment properties.
  13. */
  14. //$Id$
  15. define('SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT', 1);
  16. define('SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS', 2);
  17. define('SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE', 4);
  18. define('SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE', 5);
  19. define('SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS', 6);
  20. define('SUBMISSION_REVIEWER_RATING_VERY_GOOD', 5);
  21. define('SUBMISSION_REVIEWER_RATING_GOOD', 4);
  22. define('SUBMISSION_REVIEWER_RATING_AVERAGE', 3);
  23. define('SUBMISSION_REVIEWER_RATING_POOR', 2);
  24. define('SUBMISSION_REVIEWER_RATING_VERY_POOR', 1);
  25. class ReviewAssignment extends DataObject {
  26. /** @var array PaperFiles the revisions of the reviewer file */
  27. var $reviewerFileRevisions;
  28. /**
  29. * Constructor.
  30. */
  31. function ReviewAssignment() {
  32. parent::DataObject();
  33. }
  34. //
  35. // Get/set methods
  36. //
  37. /**
  38. * Get ID of review assignment.
  39. * @return int
  40. */
  41. function getReviewId() {
  42. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  43. return $this->getId();
  44. }
  45. /**
  46. * Set ID of review assignment
  47. * @param $reviewId int
  48. */
  49. function setReviewId($reviewId) {
  50. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  51. return $this->setId($reviewId);
  52. }
  53. /**
  54. * Get ID of paper.
  55. * @return int
  56. */
  57. function getPaperId() {
  58. return $this->getData('paperId');
  59. }
  60. /**
  61. * Set ID of paper.
  62. * @param $paperId int
  63. */
  64. function setPaperId($paperId) {
  65. return $this->setData('paperId', $paperId);
  66. }
  67. /**
  68. * Get ID of reviewer.
  69. * @return int
  70. */
  71. function getReviewerId() {
  72. return $this->getData('reviewerId');
  73. }
  74. /**
  75. * Set ID of reviewer.
  76. * @param $reviewerId int
  77. */
  78. function setReviewerId($reviewerId) {
  79. return $this->setData('reviewerId', $reviewerId);
  80. }
  81. /**
  82. * Get full name of reviewer.
  83. * @return string
  84. */
  85. function getReviewerFullName() {
  86. return $this->getData('reviewerFullName');
  87. }
  88. /**
  89. * Set full name of reviewer.
  90. * @param $reviewerFullName string
  91. */
  92. function setReviewerFullName($reviewerFullName) {
  93. return $this->setData('reviewerFullName', $reviewerFullName);
  94. }
  95. /**
  96. * Get reviewer comments.
  97. * @return string
  98. */
  99. function getComments() {
  100. return $this->getData('comments');
  101. }
  102. /**
  103. * Set reviewer comments.
  104. * @param $comments string
  105. */
  106. function setComments($comments) {
  107. return $this->setData('comments', $comments);
  108. }
  109. /**
  110. * Get reviewer recommendation.
  111. * @return string
  112. */
  113. function getRecommendation() {
  114. return $this->getData('recommendation');
  115. }
  116. /**
  117. * Set reviewer recommendation.
  118. * @param $recommendation string
  119. */
  120. function setRecommendation($recommendation) {
  121. return $this->setData('recommendation', $recommendation);
  122. }
  123. /**
  124. * Get the date the reviewer was rated.
  125. * @return string
  126. */
  127. function getDateRated() {
  128. return $this->getData('dateRated');
  129. }
  130. /**
  131. * Set the date the reviewer was rated.
  132. * @param $dateRated string
  133. */
  134. function setDateRated($dateRated) {
  135. return $this->setData('dateRated', $dateRated);
  136. }
  137. /**
  138. * Get the date of the last modification.
  139. * @return date
  140. */
  141. function getLastModified() {
  142. return $this->getData('lastModified');
  143. }
  144. /**
  145. * Set the date of the last modification.
  146. * @param $dateModified date
  147. */
  148. function setLastModified($dateModified) {
  149. return $this->setData('lastModified', $dateModified);
  150. }
  151. /**
  152. * Stamp the date of the last modification to the current time.
  153. */
  154. function stampModified() {
  155. return $this->setLastModified(Core::getCurrentDate());
  156. }
  157. /**
  158. * Get the reviewer's assigned date.
  159. * @return string
  160. */
  161. function getDateAssigned() {
  162. return $this->getData('dateAssigned');
  163. }
  164. /**
  165. * Set the reviewer's assigned date.
  166. * @param $dateAssigned string
  167. */
  168. function setDateAssigned($dateAssigned) {
  169. return $this->setData('dateAssigned', $dateAssigned);
  170. }
  171. /**
  172. * Get the reviewer's notified date.
  173. * @return string
  174. */
  175. function getDateNotified() {
  176. return $this->getData('dateNotified');
  177. }
  178. /**
  179. * Set the reviewer's notified date.
  180. * @param $dateNotified string
  181. */
  182. function setDateNotified($dateNotified) {
  183. return $this->setData('dateNotified', $dateNotified);
  184. }
  185. /**
  186. * Get the reviewer's confirmed date.
  187. * @return string
  188. */
  189. function getDateConfirmed() {
  190. return $this->getData('dateConfirmed');
  191. }
  192. /**
  193. * Set the reviewer's confirmed date.
  194. * @param $dateConfirmed string
  195. */
  196. function setDateConfirmed($dateConfirmed) {
  197. return $this->setData('dateConfirmed', $dateConfirmed);
  198. }
  199. /**
  200. * Get the reviewer's completed date.
  201. * @return string
  202. */
  203. function getDateCompleted() {
  204. return $this->getData('dateCompleted');
  205. }
  206. /**
  207. * Set the reviewer's completed date.
  208. * @param $dateCompleted string
  209. */
  210. function setDateCompleted($dateCompleted) {
  211. return $this->setData('dateCompleted', $dateCompleted);
  212. }
  213. /**
  214. * Get the reviewer's acknowledged date.
  215. * @return string
  216. */
  217. function getDateAcknowledged() {
  218. return $this->getData('dateAcknowledged');
  219. }
  220. /**
  221. * Set the reviewer's acknowledged date.
  222. * @param $dateAcknowledged string
  223. */
  224. function setDateAcknowledged($dateAcknowledged) {
  225. return $this->setData('dateAcknowledged', $dateAcknowledged);
  226. }
  227. /**
  228. * Get the reviewer's last reminder date.
  229. * @return string
  230. */
  231. function getDateReminded() {
  232. return $this->getData('dateReminded');
  233. }
  234. /**
  235. * Set the reviewer's last reminder date.
  236. * @param $dateReminded string
  237. */
  238. function setDateReminded($dateReminded) {
  239. return $this->setData('dateReminded', $dateReminded);
  240. }
  241. /**
  242. * Get the reviewer's due date.
  243. * @return string
  244. */
  245. function getDateDue() {
  246. return $this->getData('dateDue');
  247. }
  248. /**
  249. * Set the reviewer's due date.
  250. * @param $dateDue string
  251. */
  252. function setDateDue($dateDue) {
  253. return $this->setData('dateDue', $dateDue);
  254. }
  255. /**
  256. * Get the declined value.
  257. * @return boolean
  258. */
  259. function getDeclined() {
  260. return $this->getData('declined');
  261. }
  262. /**
  263. * Set the reviewer's declined value.
  264. * @param $declined boolean
  265. */
  266. function setDeclined($declined) {
  267. return $this->setData('declined', $declined);
  268. }
  269. /**
  270. * Get the replaced value.
  271. * @return boolean
  272. */
  273. function getReplaced() {
  274. return $this->getData('replaced');
  275. }
  276. /**
  277. * Set the reviewer's replaced value.
  278. * @param $replaced boolean
  279. */
  280. function setReplaced($replaced) {
  281. return $this->setData('replaced', $replaced);
  282. }
  283. /**
  284. * Get a boolean indicating whether or not the last reminder was automatic.
  285. * @return boolean
  286. */
  287. function getReminderWasAutomatic() {
  288. return $this->getData('reminderWasAutomatic')==1?1:0;
  289. }
  290. /**
  291. * Set the boolean indicating whether or not the last reminder was automatic.
  292. * @param $wasAutomatic boolean
  293. */
  294. function setReminderWasAutomatic($wasAutomatic) {
  295. return $this->setData('reminderWasAutomatic', $wasAutomatic);
  296. }
  297. /**
  298. * Get the cancelled value.
  299. * @return boolean
  300. */
  301. function getCancelled() {
  302. return $this->getData('cancelled');
  303. }
  304. /**
  305. * Set the reviewer's cancelled value.
  306. * @param $cancelled boolean
  307. */
  308. function setCancelled($cancelled) {
  309. return $this->setData('cancelled', $cancelled);
  310. }
  311. /**
  312. * Get reviewer file id.
  313. * @return int
  314. */
  315. function getReviewerFileId() {
  316. return $this->getData('reviewerFileId');
  317. }
  318. /**
  319. * Set reviewer file id.
  320. * @param $reviewerFileId int
  321. */
  322. function setReviewerFileId($reviewerFileId) {
  323. return $this->setData('reviewerFileId', $reviewerFileId);
  324. }
  325. /**
  326. * Get reviewer file viewable.
  327. * @return boolean
  328. */
  329. function getReviewerFileViewable() {
  330. return $this->getData('reviewerFileViewable');
  331. }
  332. /**
  333. * Set reviewer file viewable.
  334. * @param $reviewerFileViewable boolean
  335. */
  336. function setReviewerFileViewable($reviewerFileViewable) {
  337. return $this->setData('reviewerFileViewable', $reviewerFileViewable);
  338. }
  339. /**
  340. * Get quality.
  341. * @return int
  342. */
  343. function getQuality() {
  344. return $this->getData('quality');
  345. }
  346. /**
  347. * Set quality.
  348. * @param $quality int
  349. */
  350. function setQuality($quality) {
  351. return $this->setData('quality', $quality);
  352. }
  353. /**
  354. * Get stage.
  355. * @return int
  356. */
  357. function getStage() {
  358. return $this->getData('stage');
  359. }
  360. /**
  361. * Set stage.
  362. * @param $stage int
  363. */
  364. function setStage($stage) {
  365. return $this->setData('stage', $stage);
  366. }
  367. /**
  368. * Get review file id.
  369. * @return int
  370. */
  371. function getReviewFileId() {
  372. return $this->getData('reviewFileId');
  373. }
  374. /**
  375. * Set review file id.
  376. * @param $reviewFileId int
  377. */
  378. function setReviewFileId($reviewFileId) {
  379. return $this->setData('reviewFileId', $reviewFileId);
  380. }
  381. /**
  382. * Get review file.
  383. * @return object
  384. */
  385. function &getReviewFile() {
  386. $returner =& $this->getData('reviewFile');
  387. return $returner;
  388. }
  389. /**
  390. * Set review file.
  391. * @param $reviewFile object
  392. */
  393. function setReviewFile($reviewFile) {
  394. return $this->setData('reviewFile', $reviewFile);
  395. }
  396. /**
  397. * Get review revision.
  398. * @return int
  399. */
  400. function getReviewRevision() {
  401. return $this->getData('reviewRevision');
  402. }
  403. /**
  404. * Set review revision.
  405. * @param $reviewRevision int
  406. */
  407. function setReviewRevision($reviewRevision) {
  408. return $this->setData('reviewRevision', $reviewRevision);
  409. }
  410. /**
  411. * Get review form id.
  412. * @return int
  413. */
  414. function getReviewFormId() {
  415. return $this->getData('reviewFormId');
  416. }
  417. /**
  418. * Set review form id.
  419. * @param $reviewFormId int
  420. */
  421. function setReviewFormId($reviewFormId) {
  422. return $this->setData('reviewFormId', $reviewFormId);
  423. }
  424. //
  425. // Files
  426. //
  427. /**
  428. * Get reviewer file.
  429. * @return PaperFile
  430. */
  431. function &getReviewerFile() {
  432. $returner =& $this->getData('reviewerFile');
  433. return $returner;
  434. }
  435. /**
  436. * Set reviewer file.
  437. * @param $reviewFile PaperFile
  438. */
  439. function setReviewerFile($reviewerFile) {
  440. return $this->setData('reviewerFile', $reviewerFile);
  441. }
  442. /**
  443. * Get all reviewer file revisions.
  444. * @return array PaperFiles
  445. */
  446. function getReviewerFileRevisions() {
  447. return $this->reviewerFileRevisions;
  448. }
  449. /**
  450. * Set all reviewer file revisions.
  451. * @param $reviewerFileRevisions array PaperFiles
  452. */
  453. function setReviewerFileRevisions($reviewerFileRevisions) {
  454. return $this->reviewerFileRevisions = $reviewerFileRevisions;
  455. }
  456. /**
  457. * Get supplementary files for this paper.
  458. * @return array SuppFiles
  459. */
  460. function &getSuppFiles() {
  461. $returner =& $this->getData('suppFiles');
  462. return $returner;
  463. }
  464. /**
  465. * Set supplementary file for this paper.
  466. * @param $suppFiles array SuppFiles
  467. */
  468. function setSuppFiles($suppFiles) {
  469. return $this->setData('suppFiles', $suppFiles);
  470. }
  471. /**
  472. * Get number of weeks until review is due (or number of weeks overdue).
  473. * @return int
  474. */
  475. function getWeeksDue() {
  476. $dateDue = $this->getDateDue();
  477. if ($dateDue === null) return null;
  478. return round((strtotime($dateDue) - time()) / (86400 * 7.0));
  479. }
  480. //
  481. // Comments
  482. //
  483. /**
  484. * Get most recent peer review comment.
  485. * @return PaperComment
  486. */
  487. function getMostRecentPeerReviewComment() {
  488. return $this->getData('peerReviewComment');
  489. }
  490. /**
  491. * Set most recent peer review comment.
  492. * @param $peerReviewComment PaperComment
  493. */
  494. function setMostRecentPeerReviewComment($peerReviewComment) {
  495. return $this->setData('peerReviewComment', $peerReviewComment);
  496. }
  497. /**
  498. * Get an associative array matching reviewer recommendation codes with locale strings.
  499. * (Includes default '' => "Choose One" string.)
  500. * @return array recommendation => localeString
  501. */
  502. function &getReviewerRecommendationOptions() {
  503. // Bring in reviewer constants
  504. import('submission.reviewer.ReviewerSubmission');
  505. static $reviewerRecommendationOptions = array(
  506. '' => 'common.chooseOne',
  507. SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT => 'reviewer.paper.decision.accept',
  508. SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS => 'reviewer.paper.decision.pendingRevisions',
  509. SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE => 'reviewer.paper.decision.resubmitElsewhere',
  510. SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE => 'reviewer.paper.decision.decline',
  511. SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS => 'reviewer.paper.decision.seeComments'
  512. );
  513. return $reviewerRecommendationOptions;
  514. }
  515. /**
  516. * Get an associative array matching reviewer rating codes with locale strings.
  517. * @return array recommendation => localeString
  518. */
  519. function &getReviewerRatingOptions() {
  520. static $reviewerRatingOptions = array(
  521. SUBMISSION_REVIEWER_RATING_VERY_GOOD => 'director.paper.reviewerRating.veryGood',
  522. SUBMISSION_REVIEWER_RATING_GOOD => 'director.paper.reviewerRating.good',
  523. SUBMISSION_REVIEWER_RATING_AVERAGE => 'director.paper.reviewerRating.average',
  524. SUBMISSION_REVIEWER_RATING_POOR => 'director.paper.reviewerRating.poor',
  525. SUBMISSION_REVIEWER_RATING_VERY_POOR => 'director.paper.reviewerRating.veryPoor'
  526. );
  527. return $reviewerRatingOptions;
  528. }
  529. }
  530. ?>