ocs  2.3.6
About: OCS (Open Conference System) is a Web publishing tool that will create a complete Web presence for your scholarly conference.
  Fossies Dox: ocs-2.3.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

SchedConfDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
16 //$Id$
17 
18 import ('schedConf.SchedConf');
19 
20 class SchedConfDAO extends DAO {
27  function &getSchedConf($schedConfId, $conferenceId = null) {
28  $params = array($schedConfId);
29  if ($conferenceId !== null) $params[] = $conferenceId;
30  $result =& $this->retrieve(
31  'SELECT * FROM sched_confs WHERE sched_conf_id = ?' . ($conferenceId !== null?' AND conference_id = ?':''), $params
32  );
33 
34  $returner = null;
35  if ($result->RecordCount() != 0) {
36  $returner =& $this->_returnSchedConfFromRow($result->GetRowAssoc(false));
37  }
38  $result->Close();
39  unset($result);
40  return $returner;
41  }
42 
48  function &getSchedConfByPath($path, $conferenceId = null) {
49  $params = array($path);
50  if ($conferenceId) $params[] = (int) $conferenceId;
51 
52  $result =& $this->retrieve(
53  'SELECT * FROM sched_confs WHERE path = ?' . ($conferenceId?' AND conference_id = ?':''),
54  $params
55  );
56 
57  $returner = null;
58  if ($result->RecordCount() != 0) {
59  $returner =& $this->_returnSchedConfFromRow($result->GetRowAssoc(false));
60  }
61  $result->Close();
62  unset($result);
63  return $returner;
64  }
65 
71  function &_returnSchedConfFromRow(&$row) {
72  $schedConf = new SchedConf();
73  $schedConf->setSchedConfId($row['sched_conf_id']);
74  $schedConf->setPath($row['path']);
75  $schedConf->setSequence($row['seq']);
76  $schedConf->setConferenceId($row['conference_id']);
77  $schedConf->setStartDate($this->datetimeFromDB($row['start_date']));
78  $schedConf->setEndDate($this->datetimeFromDB($row['end_date']));
79 
80  HookRegistry::call('SchedConfDAO::_returnSchedConfFromRow', array(&$schedConf, &$row));
81 
82  return $schedConf;
83  }
84 
89  function insertSchedConf(&$schedConf) {
90  $this->update(
91  sprintf('INSERT INTO sched_confs
92  (conference_id, path, seq, start_date, end_date)
93  VALUES
94  (?, ?, ?, %s, %s)',
95  $this->datetimeToDB($schedConf->getStartDate()),
96  $this->datetimeToDB($schedConf->getEndDate())),
97  array(
98  $schedConf->getConferenceId(),
99  $schedConf->getPath(),
100  $schedConf->getSequence() == null ? 0 : $schedConf->getSequence()
101  )
102  );
103 
104  $schedConf->setSchedConfId($this->getInsertSchedConfId());
105  return $schedConf->getId();
106  }
107 
112  function updateSchedConf(&$schedConf) {
113  return $this->update(
114  sprintf('UPDATE sched_confs
115  SET
116  conference_id = ?,
117  path = ?,
118  seq = ?,
119  start_date = %s,
120  end_date = %s
121  WHERE sched_conf_id = ?',
122  $this->datetimeToDB($schedConf->getStartDate()),
123  $this->datetimeToDB($schedConf->getEndDate())),
124  array(
125  $schedConf->getConferenceId(),
126  $schedConf->getPath(),
127  $schedConf->getSequence(),
128  $schedConf->getId()
129  )
130  );
131  }
132 
137  function deleteSchedConf(&$schedConf) {
138  return $this->deleteSchedConfById($schedConf->getId());
139  }
140 
145  function &getSchedConfTitles($conferenceId) {
146  $schedConfs = array();
147  $schedConfIterator =& $this->getSchedConfsByConferenceId($conferenceId);
148  while ($schedConf =& $schedConfIterator->next()) {
149  $schedConfs[$schedConf->getId()] = $schedConf->getSchedConfTitle();
150  unset($schedConf);
151  }
152  return $schedConfs;
153  }
154 
160  function &getSchedConfsByConferenceId($conferenceId, $rangeInfo = null) {
161  $result =& $this->retrieveRange(
162  'SELECT i.*
163  FROM sched_confs i
164  WHERE i.conference_id = ?
165  ORDER BY seq',
166  array($conferenceId),
167  $rangeInfo
168  );
169 
170  $returner = new DAOResultFactory($result, $this, '_returnSchedConfFromRow');
171  return $returner;
172  }
173 
178  function deleteSchedConfsByConferenceId($conferenceId) {
179  $schedConfs = $this->getSchedConfsByConferenceId($conferenceId);
180 
181  while (!$schedConfs->eof()) {
182  $schedConf =& $schedConfs->next();
183  $this->deleteSchedConfById($schedConf->getId());
184  }
185  }
186 
191  function deleteSchedConfById($schedConfId) {
192  $schedConfSettingsDao =& DAORegistry::getDAO('SchedConfSettingsDAO');
193  $schedConfSettingsDao->deleteSettingsBySchedConf($schedConfId);
194 
195  $trackDao =& DAORegistry::getDAO('TrackDAO');
196  $trackDao->deleteTracksBySchedConf($schedConfId);
197 
198  $registrationDao =& DAORegistry::getDAO('RegistrationDAO');
199  $registrationDao->deleteRegistrationsBySchedConf($schedConfId);
200 
201  $registrationTypeDao =& DAORegistry::getDAO('RegistrationTypeDAO');
202  $registrationTypeDao->deleteRegistrationTypesBySchedConf($schedConfId);
203 
204  $registrationOptionDao =& DAORegistry::getDAO('RegistrationOptionDAO');
205  $registrationOptionDao->deleteRegistrationOptionsBySchedConf($schedConfId);
206 
207  $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
208  $announcementDao->deleteAnnouncementsByAssocId(ASSOC_TYPE_SCHED_CONF, $schedConfId);
209 
210  $buildingDao =& DAORegistry::getDAO('BuildingDAO');
211  $buildingDao->deleteBuildingsBySchedConfId($schedConfId);
212 
213  $specialEventDao =& DAORegistry::getDAO('SpecialEventDAO');
214  $specialEventDao->deleteSpecialEventsBySchedConfId($schedConfId);
215 
216  $paperDao =& DAORegistry::getDAO('PaperDAO');
217  $paperDao->deletePapersBySchedConfId($schedConfId);
218 
219  $roleDao =& DAORegistry::getDAO('RoleDAO');
220  $roleDao->deleteRoleBySchedConfId($schedConfId);
221 
222  $groupDao =& DAORegistry::getDAO('GroupDAO');
223  $groupDao->deleteGroupsByAssocId(ASSOC_TYPE_SCHED_CONF, $schedConfId);
224 
225  return $this->update(
226  'DELETE FROM sched_confs WHERE sched_conf_id = ?', $schedConfId
227  );
228  }
229 
234  function &getSchedConfs($rangeInfo = null) {
235  $result =& $this->retrieveRange(
236  'SELECT * FROM sched_confs ORDER BY seq',
237  false, $rangeInfo
238  );
239 
240  $returner = new DAOResultFactory($result, $this, '_returnSchedConfFromRow');
241  return $returner;
242  }
243 
249  function &getEnabledSchedConfs($conferenceId = null) {
250  $result =& $this->retrieve('
251  SELECT i.* FROM sched_confs i
252  LEFT JOIN conferences c ON (i.conference_id = c.conference_id)
253  WHERE c.enabled = 1'
254  . ($conferenceId?' AND i.conference_id = ?':'')
255  . ' ORDER BY c.seq, i.seq',
256  $conferenceId===null?false:$conferenceId);
257 
258  $resultFactory = new DAOResultFactory($result, $this, '_returnSchedConfFromRow');
259  return $resultFactory;
260  }
261 
267  function schedConfExistsByPath($path) {
268  $result =& $this->retrieve(
269  'SELECT COUNT(*) FROM sched_confs WHERE path = ?', $path
270  );
271  $returner = isset($result->fields[0]) && $result->fields[0] == 1 ? true : false;
272 
273  $result->Close();
274  unset($result);
275 
276  return $returner;
277  }
278 
282  function resequenceSchedConfs($conferenceId) {
283  $result =& $this->retrieve(
284  'SELECT sched_conf_id FROM sched_confs WHERE conference_id = ? ORDER BY seq',
285  $conferenceId
286  );
287 
288  for ($i=1; !$result->EOF; $i++) {
289  list($schedConfId) = $result->fields;
290  $this->update(
291  'UPDATE sched_confs SET seq = ? WHERE sched_conf_id = ?',
292  array(
293  $i,
294  $schedConfId
295  )
296  );
297 
298  $result->moveNext();
299  }
300 
301  $result->close();
302  unset($result);
303  }
304 
309  function getInsertSchedConfId() {
310  return $this->getInsertId('sched_confs', 'sched_conf_id');
311  }
312 
317  function &getCurrentSchedConfs($conferenceId) {
318  $result =& $this->retrieve('
319  SELECT i.* FROM sched_confs i
320  LEFT JOIN conferences c ON (i.conference_id = c.conference_id)
321  WHERE c.enabled = 1
322  AND i.conference_id = ?
323  AND i.start_date < NOW()
324  AND i.end_date > NOW()
325  ORDER BY c.seq, i.seq',
326  $conferenceId);
327 
328  $resultFactory = new DAOResultFactory($result, $this, '_returnSchedConfFromRow');
329  return $resultFactory;
330  }
331 
337  function archivedSchedConfsExist($conferenceId) {
338  $result =& $this->retrieve(
339  'SELECT COUNT(*) FROM sched_confs WHERE conference_id = ? AND end_date < now()', $conferenceId
340  );
341  $returner = isset($result->fields[0]) && $result->fields[0] >= 1 ? true : false;
342 
343  $result->Close();
344  unset($result);
345 
346  return $returner;
347  }
348 
354  function currentSchedConfsExist($conferenceId) {
355  $result =& $this->retrieve(
356  'SELECT COUNT(*) FROM sched_confs WHERE conference_id = ? AND start_date < now() AND end_date > now()', $conferenceId
357  );
358  $returner = isset($result->fields[0]) && $result->fields[0] >= 1 ? true : false;
359 
360  $result->Close();
361  unset($result);
362 
363  return $returner;
364  }
365 }
366 
367 ?>
archivedSchedConfsExist($conferenceId)
config TEMPLATE inc php
Definition: config.inc.php:4
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
resequenceSchedConfs($conferenceId)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
deleteSchedConf(&$schedConf)
Operations for retrieving and modifying SchedConf objects.
& getSchedConf($schedConfId, $conferenceId=null)
getInsertId($table='', $id='', $callHooks=true)
Definition: DAO.inc.php:225
& getSchedConfs($rangeInfo=null)
& getCurrentSchedConfs($conferenceId)
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:152
insertSchedConf(&$schedConf)
& getEnabledSchedConfs($conferenceId=null)
datetimeFromDB($dt)
Definition: DAO.inc.php:276
& getSchedConfTitles($conferenceId)
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
updateSchedConf(&$schedConf)
schedConfExistsByPath($path)
& getDAO($name, $dbconn=null)
& _returnSchedConfFromRow(&$row)
& getSchedConfsByConferenceId($conferenceId, $rangeInfo=null)
call($hookName, $args=null)
const ASSOC_TYPE_SCHED_CONF
datetimeToDB($dt)
Definition: DAO.inc.php:258
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186
currentSchedConfsExist($conferenceId)
deleteSchedConfById($schedConfId)
deleteSchedConfsByConferenceId($conferenceId)
& getSchedConfByPath($path, $conferenceId=null)
Describes basic scheduled conference properties.