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)  

ConferenceDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
16 //$Id$
17 
18 import ('conference.Conference');
19 
20 class ConferenceDAO extends DAO {
26  function &getConference($conferenceId) {
27  $result =& $this->retrieve(
28  'SELECT * FROM conferences WHERE conference_id = ?', $conferenceId
29  );
30 
31  $returner = null;
32  if ($result->RecordCount() != 0) {
33  $returner =& $this->_returnConferenceFromRow($result->GetRowAssoc(false));
34  }
35  $result->Close();
36  unset($result);
37  return $returner;
38  }
39 
45  function &getFreshestConference() {
46  $returner = null;
47  $result =& $this->retrieve(
48  'SELECT * FROM conferences ORDER BY conference_id DESC LIMIT 1'
49  );
50 
51  if ($result->RecordCount() != 0) {
52  $returner =& $this->_returnConferenceFromRow($result->GetRowAssoc(false));
53  }
54 
55  $result->Close();
56  unset($result);
57  return $returner;
58  }
59 
65  function &getConferenceByPath($path) {
66  $returner = null;
67  $result =& $this->retrieve(
68  'SELECT * FROM conferences WHERE path = ?', $path
69  );
70 
71  if ($result->RecordCount() != 0) {
72  $returner =& $this->_returnConferenceFromRow($result->GetRowAssoc(false));
73  }
74  $result->Close();
75  unset($result);
76  return $returner;
77  }
78 
84  function &_returnConferenceFromRow(&$row) {
85  $conference = new Conference();
86  $conference->setConferenceId($row['conference_id']);
87  $conference->setPath($row['path']);
88  $conference->setSequence($row['seq']);
89  $conference->setEnabled($row['enabled']);
90  $conference->setPrimaryLocale($row['primary_locale']);
91 
92  HookRegistry::call('ConferenceDAO::_returnConferenceFromRow', array(&$conference, &$row));
93 
94  return $conference;
95  }
96 
101  function insertConference(&$conference) {
102  $this->update(
103  'INSERT INTO conferences
104  (primary_locale, path, seq, enabled)
105  VALUES
106  (?, ?, ?, ?)',
107  array(
108  $conference->getPrimaryLocale(),
109  $conference->getPath(),
110  $conference->getSequence() == null ? 0 : $conference->getSequence(),
111  $conference->getEnabled() ? 1 : 0
112  )
113  );
114 
115  $conference->setConferenceId($this->getInsertConferenceId());
116  return $conference->getId();
117  }
118 
123  function updateConference(&$conference) {
124  return $this->update(
125  'UPDATE conferences
126  SET
127  primary_locale = ?,
128  path = ?,
129  seq = ?,
130  enabled = ?
131  WHERE conference_id = ?',
132  array(
133  $conference->getPrimaryLocale(),
134  $conference->getPath(),
135  $conference->getSequence(),
136  $conference->getEnabled() ? 1 : 0,
137  $conference->getId()
138  )
139  );
140  }
141 
146  function deleteConference(&$conference) {
147  return $this->deleteConferenceById($conference->getId());
148  }
149 
154  function deleteConferenceById($conferenceId) {
155  $conferenceSettingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO');
156  $conferenceSettingsDao->deleteSettingsByConference($conferenceId);
157 
158  $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
159  $emailTemplateDao->deleteEmailTemplatesByConference($conferenceId);
160 
161  $rtDao =& DAORegistry::getDAO('RTDAO');
162  $rtDao->deleteVersionsByConference($conferenceId);
163 
164  $roleDao =& DAORegistry::getDAO('RoleDAO');
165  $roleDao->deleteRoleByConferenceId($conferenceId);
166 
167  $groupDao =& DAORegistry::getDAO('GroupDAO');
168  $groupDao->deleteGroupsByAssocId(ASSOC_TYPE_CONFERENCE, $conferenceId);
169 
170  $pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
171  $pluginSettingsDao->deleteSettingsByConferenceId($conferenceId);
172 
173  $reviewFormDao =& DAORegistry::getDAO('ReviewFormDAO');
174  $reviewFormDao->deleteByAssocId(ASSOC_TYPE_CONFERENCE, $conferenceId);
175 
176  $announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
177  $announcementDao->deleteAnnouncementsByAssocId(ASSOC_TYPE_CONFERENCE, $conferenceId);
178 
179  $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
180  $announcementTypeDao->deleteAnnouncementTypesByAssocId(ASSOC_TYPE_CONFERENCE, $conferenceId);
181 
182  $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
183  $schedConfDao->deleteSchedConfsByConferenceId($conferenceId);
184 
185  return $this->update(
186  'DELETE FROM conferences WHERE conference_id = ?', $conferenceId
187  );
188  }
189 
194  function &getConferences($rangeInfo = null) {
195  $result =& $this->retrieveRange(
196  'SELECT * FROM conferences ORDER BY seq',
197  false, $rangeInfo
198  );
199 
200  $returner = new DAOResultFactory($result, $this, '_returnConferenceFromRow');
201  return $returner;
202  }
203 
208  function &getEnabledConferences() {
209  $result =& $this->retrieve(
210  'SELECT * FROM conferences WHERE enabled=1 ORDER BY seq'
211  );
212 
213  $resultFactory = new DAOResultFactory($result, $this, '_returnConferenceFromRow');
214  return $resultFactory;
215  }
216 
221  function &getConferenceTitles() {
222  $conferences = array();
223  $conferenceIterator =& $this->getConferences();
224  while ($conference =& $conferenceIterator->next()) {
225  $conferences[$conference->getId()] = $conference->getConferenceTitle();
226  unset($conference);
227  }
228  return $conferences;
229  }
230 
236  $conferences = array();
237  $conferenceIterator =& $this->getEnabledConferences();
238  while ($conference =& $conferenceIterator->next()) {
239  $conferences[$conference->getId()] = $conference->getConferenceTitle();
240  unset($conference);
241  }
242  return $conferences;
243  }
244 
250  function conferenceExistsByPath($path) {
251  $result =& $this->retrieve(
252  'SELECT COUNT(*) FROM conferences WHERE path = ?', $path
253  );
254  $returner = isset($result->fields[0]) && $result->fields[0] == 1 ? true : false;
255 
256  $result->Close();
257  unset($result);
258 
259  return $returner;
260  }
261 
266  $result =& $this->retrieve(
267  'SELECT conference_id FROM conferences ORDER BY seq'
268  );
269 
270  for ($i=1; !$result->EOF; $i++) {
271  list($conferenceId) = $result->fields;
272  $this->update(
273  'UPDATE conferences SET seq = ? WHERE conference_id = ?',
274  array(
275  $i,
276  $conferenceId
277  )
278  );
279 
280  $result->moveNext();
281  }
282 
283  $result->close();
284  unset($result);
285  }
286 
292  return $this->getInsertId('conferences', 'conference_id');
293  }
294 }
295 
296 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
& getConferences($rangeInfo=null)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
getInsertId($table='', $id='', $callHooks=true)
Definition: DAO.inc.php:225
& getConference($conferenceId)
& _returnConferenceFromRow(&$row)
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:152
conferenceExistsByPath($path)
const ASSOC_TYPE_CONFERENCE
insertConference(&$conference)
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
updateConference(&$conference)
deleteConferenceById($conferenceId)
Operations for retrieving and modifying Conference objects.
& getDAO($name, $dbconn=null)
deleteConference(&$conference)
call($hookName, $args=null)
& getConferenceByPath($path)
Describes basic conference properties.
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186