PageRenderTime 38ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/classes/paper/PaperComment.inc.php

https://github.com/lib-uoguelph-ca/ocs
PHP | 251 lines | 98 code | 36 blank | 117 comment | 4 complexity | 0cc04ef751cb9b967315a08097cd38b0 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * @file PaperComment.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 PaperComment
  9. * @ingroup paper
  10. * @see PaperCommentDAO
  11. *
  12. * @brief Class for PaperComment.
  13. */
  14. //$Id$
  15. /** Comment associative types. All types must be defined here. */
  16. define('COMMENT_TYPE_PEER_REVIEW', 0x01);
  17. define('COMMENT_TYPE_DIRECTOR_DECISION', 0x02);
  18. class PaperComment extends DataObject {
  19. /**
  20. * Constructor.
  21. */
  22. function PaperComment() {
  23. parent::DataObject();
  24. }
  25. /**
  26. * get paper comment id
  27. * @return int
  28. */
  29. function getCommentId() {
  30. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  31. return $this->getId();
  32. }
  33. /**
  34. * set paper comment id
  35. * @param $commentId int
  36. */
  37. function setCommentId($commentId) {
  38. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  39. return $this->setId($commentId);
  40. }
  41. /**
  42. * get comment type
  43. * @return int
  44. */
  45. function getCommentType() {
  46. return $this->getData('commentType');
  47. }
  48. /**
  49. * set comment type
  50. * @param $commentType int
  51. */
  52. function setCommentType($commentType) {
  53. return $this->setData('commentType', $commentType);
  54. }
  55. /**
  56. * get role id
  57. * @return int
  58. */
  59. function getRoleId() {
  60. return $this->getData('roleId');
  61. }
  62. /**
  63. * set role id
  64. * @param $roleId int
  65. */
  66. function setRoleId($roleId) {
  67. return $this->setData('roleId', $roleId);
  68. }
  69. /**
  70. * get role name
  71. * @return string
  72. */
  73. function getRoleName() {
  74. $roleDao =& DAORegistry::getDAO('RoleDAO');
  75. $roleName = $roleDao->getRoleName($this->getData('roleId'));
  76. return $roleName;
  77. }
  78. /**
  79. * get paper id
  80. * @return int
  81. */
  82. function getPaperId() {
  83. return $this->getData('paperId');
  84. }
  85. /**
  86. * set paper id
  87. * @param $paperId int
  88. */
  89. function setPaperId($paperId) {
  90. return $this->setData('paperId', $paperId);
  91. }
  92. /**
  93. * get assoc id
  94. * @return int
  95. */
  96. function getAssocId() {
  97. return $this->getData('assocId');
  98. }
  99. /**
  100. * set assoc id
  101. * @param $assocId int
  102. */
  103. function setAssocId($assocId) {
  104. return $this->setData('assocId', $assocId);
  105. }
  106. /**
  107. * get author id
  108. * @return int
  109. */
  110. function getAuthorId() {
  111. return $this->getData('authorId');
  112. }
  113. /**
  114. * set author id
  115. * @param $authorId int
  116. */
  117. function setAuthorId($authorId) {
  118. return $this->setData('authorId', $authorId);
  119. }
  120. /**
  121. * get author name
  122. * @return string
  123. */
  124. function getAuthorName() {
  125. static $authorFullName;
  126. if(!isset($authorFullName)) {
  127. $userDao =& DAORegistry::getDAO('UserDAO');
  128. $authorFullName = $userDao->getUserFullName($this->getAuthorId(), true);
  129. }
  130. return $authorFullName ? $authorFullName : '';
  131. }
  132. /**
  133. * get author email
  134. * @return string
  135. */
  136. function getAuthorEmail() {
  137. static $authorEmail;
  138. if(!isset($authorEmail)) {
  139. $userDao =& DAORegistry::getDAO('UserDAO');
  140. $authorEmail = $userDao->getUserEmail($this->getAuthorId(), true);
  141. }
  142. return $authorEmail ? $authorEmail : '';
  143. }
  144. /**
  145. * get comment title
  146. * @return string
  147. */
  148. function getCommentTitle() {
  149. return $this->getData('commentTitle');
  150. }
  151. /**
  152. * set comment title
  153. * @param $commentTitle string
  154. */
  155. function setCommentTitle($commentTitle) {
  156. return $this->setData('commentTitle', $commentTitle);
  157. }
  158. /**
  159. * get comments
  160. * @return string
  161. */
  162. function getComments() {
  163. return $this->getData('comments');
  164. }
  165. /**
  166. * set comments
  167. * @param $comments string
  168. */
  169. function setComments($comments) {
  170. return $this->setData('comments', $comments);
  171. }
  172. /**
  173. * get date posted
  174. * @return date
  175. */
  176. function getDatePosted() {
  177. return $this->getData('datePosted');
  178. }
  179. /**
  180. * set date posted
  181. * @param $datePosted date
  182. */
  183. function setDatePosted($datePosted) {
  184. return $this->setData('datePosted', $datePosted);
  185. }
  186. /**
  187. * get date modified
  188. * @return date
  189. */
  190. function getDateModified() {
  191. return $this->getData('dateModified');
  192. }
  193. /**
  194. * set date modified
  195. * @param $dateModified date
  196. */
  197. function setDateModified($dateModified) {
  198. return $this->setData('dateModified', $dateModified);
  199. }
  200. /**
  201. * get viewable
  202. * @return boolean
  203. */
  204. function getViewable() {
  205. return $this->getData('viewable');
  206. }
  207. /**
  208. * set viewable
  209. * @param $viewable boolean
  210. */
  211. function setViewable($viewable) {
  212. return $this->setData('viewable', $viewable);
  213. }
  214. }
  215. ?>