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

/classes/schedConf/SchedConf.inc.php

https://github.com/lib-uoguelph-ca/ocs
PHP | 328 lines | 122 code | 46 blank | 160 comment | 5 complexity | 002be5c92f8626f666392abffe357c3f MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * @defgroup schedConf
  4. */
  5. /**
  6. * @file SchedConf.inc.php
  7. *
  8. * Copyright (c) 2000-2012 John Willinsky
  9. * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  10. *
  11. * @class SchedConf
  12. * @ingroup schedConf
  13. * @see SchedConfDAO
  14. *
  15. * @brief Describes basic scheduled conference properties.
  16. *
  17. */
  18. // $Id$
  19. define('SCHED_CONF_DATE_YEAR_OFFSET_FUTURE', '+2');
  20. define('REVIEW_MODE_ABSTRACTS_ALONE', 0x00000000);
  21. define('REVIEW_MODE_PRESENTATIONS_ALONE', 0x00000001);
  22. define('REVIEW_MODE_BOTH_SIMULTANEOUS', 0x00000002);
  23. define('REVIEW_MODE_BOTH_SEQUENTIAL', 0x00000003);
  24. define('REVIEW_DEADLINE_TYPE_RELATIVE', 0x00000001);
  25. define('REVIEW_DEADLINE_TYPE_ABSOLUTE', 0x00000002);
  26. define('SCHEDULE_LAYOUT_COMPACT', 0x00001);
  27. define('SCHEDULE_LAYOUT_EXPANDED', 0x00002);
  28. class SchedConf extends DataObject {
  29. //
  30. // Scheduled Conference functions: the following do not operate on data from the
  31. // SchedConfSettings or ConferenceSettings tables.
  32. //
  33. /**
  34. * Get the base URL to the scheduled conference.
  35. * @return string
  36. */
  37. function getUrl() {
  38. // This is potentially abusable, since there's no guarantee the conference
  39. // component of the URL hasn't been changed. However, there's nothing to
  40. // gain by doing so.
  41. return Request::url(null, $this->getPath());
  42. }
  43. /**
  44. * Get the conference for this scheduled conference.
  45. * @return string
  46. */
  47. function &getConference() {
  48. $conferenceDao =& DAORegistry::getDAO('ConferenceDAO');
  49. $returner =& $conferenceDao->getConference($this->getConferenceId());
  50. return $returner;
  51. }
  52. /**
  53. * get current
  54. * @return int
  55. */
  56. function getCurrent() {
  57. return $this->getData('current');
  58. }
  59. /**
  60. * set current
  61. * @param $current int
  62. */
  63. function setCurrent($current) {
  64. return $this->setData('current', $current);
  65. }
  66. /**
  67. * Get the localized title of the scheduled conference
  68. * @return string
  69. */
  70. function getLocalizedTitle() {
  71. return $this->getLocalizedSetting('title');
  72. }
  73. function getSchedConfTitle() {
  74. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  75. return $this->getLocalizedTitle();
  76. }
  77. /**
  78. * Get title of scheduled conference
  79. * @param $locale string
  80. * @return string
  81. */
  82. function getTitle($locale) {
  83. return $this->getSetting('title', $locale);
  84. }
  85. /**
  86. * Get the localized acronym of the scheduled conference
  87. * @return string
  88. */
  89. function getLocalizedAcronym() {
  90. return $this->getLocalizedSetting('acronym');
  91. }
  92. function getSchedConfAcronym() {
  93. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  94. return $this->getLocalizedAcronym();
  95. }
  96. /**
  97. * Get acronym of scheduled conference
  98. * @param $locale string
  99. * @return string
  100. */
  101. function getAcronym($locale) {
  102. return $this->getSetting('acronym', $locale);
  103. }
  104. /**
  105. * Get ID of scheduled conference.
  106. * @return int
  107. */
  108. function getSchedConfId() {
  109. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  110. return $this->getId();
  111. }
  112. /**
  113. * Set ID of scheduled conference.
  114. * @param $schedConfId int
  115. */
  116. function setSchedConfId($schedConfId) {
  117. if (Config::getVar('debug', 'deprecation_warnings')) trigger_error('Deprecated function.');
  118. return $this->setId($schedConfId);
  119. }
  120. /**
  121. * Get conference ID of scheduled conference.
  122. * @return int
  123. */
  124. function getConferenceId() {
  125. return $this->getData('conferenceId');
  126. }
  127. /**
  128. * Set conference ID of scheduled conference.
  129. * @param $schedConfId int
  130. */
  131. function setConferenceId($conferenceId) {
  132. return $this->setData('conferenceId', $conferenceId);
  133. }
  134. /**
  135. * Get path to scheduled conference (in URL).
  136. * @return string
  137. */
  138. function getPath() {
  139. return $this->getData('path');
  140. }
  141. /**
  142. * Set path to scheduled conference (in URL).
  143. * @param $path string
  144. */
  145. function setPath($path) {
  146. return $this->setData('path', $path);
  147. }
  148. /**
  149. * Get sequence of scheduled conference in site table of contents.
  150. * @return float
  151. */
  152. function getSequence() {
  153. return $this->getData('sequence');
  154. }
  155. /**
  156. * Set sequence of scheduled conference in site table of contents.
  157. * @param $sequence float
  158. */
  159. function setSequence($sequence) {
  160. return $this->setData('sequence', $sequence);
  161. }
  162. //
  163. // Scheduled conference start/end date functions
  164. //
  165. /**
  166. * Get start date of scheduled conference.
  167. * @return date
  168. */
  169. function getStartDate() {
  170. return $this->getData('startDate');
  171. }
  172. /**
  173. * Set start date of scheduled conference.
  174. * @param $startDate date
  175. */
  176. function setStartDate($startDate) {
  177. return $this->setData('startDate', $startDate);
  178. }
  179. /**
  180. * Get end date of scheduled conference.
  181. * @return date
  182. */
  183. function getEndDate() {
  184. return $this->getData('endDate');
  185. }
  186. /**
  187. * Set end date of scheduled conference.
  188. * @param $endDate date
  189. */
  190. function setEndDate($endDate) {
  191. return $this->setData('endDate', $endDate);
  192. }
  193. /**
  194. * Get the localized introduction of the scheduled conference
  195. * @return string
  196. */
  197. function getSchedConfIntroduction() {
  198. return $this->getLocalizedSetting('introduction');
  199. }
  200. //
  201. // Helper functions making use of both the scheduled conference
  202. // and Conference.
  203. //
  204. /**
  205. * Get full title of scheduled conference.
  206. * (Used to include conference title as well; this behavior was deprecated prior to 2.0 release.)
  207. * @return string
  208. */
  209. function getFullTitle() {
  210. return $this->getSchedConfTitle();
  211. }
  212. //
  213. // SchedConfSettings functions: the following make use of data in the
  214. // ConferenceSettings or SchedConfSettings tables.
  215. //
  216. /**
  217. * Retrieve array of scheduled conference settings.
  218. * @return array
  219. */
  220. function getSettings() {
  221. $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO');
  222. return $schedConfSettingsDao->getSchedConfSettings($this->getId());
  223. }
  224. /**
  225. * Get a localized scheduled conference setting.
  226. * @param $name string
  227. * @return mixed
  228. */
  229. function &getLocalizedSetting($name) {
  230. $returner = $this->getSetting($name, AppLocale::getLocale());
  231. if ($returner === null) {
  232. unset($returner);
  233. $returner = $this->getSetting($name, AppLocale::getPrimaryLocale());
  234. }
  235. return $returner;
  236. }
  237. /**
  238. * Retrieve a scheduled conference setting value.
  239. * @param $name
  240. * @param $locale string
  241. * @return mixed
  242. */
  243. function &getSetting($name, $locale = null) {
  244. $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO');
  245. $setting =& $schedConfSettingsDao->getSetting($this->getId(), $name, $locale);
  246. return $setting;
  247. }
  248. /**
  249. * Update a scheduled conference setting value.
  250. * @param $name string
  251. * @param $value mixed
  252. * @param $type string optional
  253. * @param $isLocalized boolean optional
  254. */
  255. function updateSetting($name, $value, $type = null, $isLocalized = false) {
  256. $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO');
  257. return $schedConfSettingsDao->updateSetting($this->getSchedConfId(), $name, $value, $type, $isLocalized);
  258. }
  259. /**
  260. * Return the primary locale of this scheduled conference.
  261. * @return string
  262. */
  263. function getPrimaryLocale() {
  264. $conference =& $this->getConference();
  265. return $conference->getPrimaryLocale();
  266. }
  267. /**
  268. * Set the primary locale of this conference.
  269. * @param $locale string
  270. */
  271. function setPrimaryLocale($primaryLocale) {
  272. return $this->setData('primaryLocale', $primaryLocale);
  273. }
  274. /**
  275. * Get CSS for this scheduled conference
  276. * @return string
  277. */
  278. function getStyleFilename() {
  279. return $this->getSetting('schedConfStyleSheet');
  280. }
  281. }
  282. ?>