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)  

ConferenceEventLogDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
20 //$Id$
21 
22 import ('conference.log.ConferenceEventLogEntry');
23 
24 class ConferenceEventLogDAO extends DAO {
25 
29  function ConferenceEventLogDAO() {
30  parent::DAO();
31  }
32 
39  function &getLogEntry($logId, $conferenceId = null, $schedConfId = null) {
40  $primaryLocale = AppLocale::getPrimaryLocale();
41  $locale = AppLocale::getLocale();
42  $args = array(
43  'title', // Conference
44  $primaryLocale,
45  'title',
46  $locale,
47  'title', // Scheduled Conference
48  $primaryLocale,
49  'title',
50  $locale,
51  $logId
52  );
53 
54  if (isset($conferenceId))
55  $args[] = $conferenceId;
56 
57  if (isset($schedConfId))
58  $args[] = $schedConfId;
59 
60  $result =& $this->retrieve(
61  'SELECT e.*,
62  COALESCE(sctl.setting_value, sct.setting_value) AS sched_conf_title,
63  COALESCE(ctl.setting_value, ct.setting_value) AS conference_title
64  FROM conference_event_log e
65  LEFT JOIN sched_confs sc ON (e.sched_conf_id = sc.sched_conf_id)
66  LEFT JOIN conferences c ON (e.conference_id = c.conference_id)
67  LEFT JOIN conference_settings ct ON (ct.setting_name = ? AND ct.locale = ? AND ct.conference_id = e.conference_id)
68  LEFT JOIN conference_settings ctl ON (ctl.setting_name = ? AND ctl.locale = ? AND ctl.conference_id = e.conference_id)
69  LEFT JOIN sched_conf_settings sct ON (sct.setting_name = ? AND sct.locale = ? AND sct.sched_conf_id = e.sched_conf_id)
70  LEFT JOIN sched_conf_settings sctl ON (sctl.setting_name = ? AND sctl.locale = ? AND sctl.sched_conf_id = e.sched_conf_id)
71  WHERE e.log_id = ?' .
72  (isset($conferenceId) ? ' AND e.conference_id = ?' : '') .
73  (isset($schedConfId) ? ' AND e.sched_conf_id = ?' : ''),
74  $args
75  );
76 
77  $returner = null;
78  if ($result->RecordCount() != 0) {
79  $returner =& $this->_returnLogEntryFromRow($result->GetRowAssoc(false));
80  }
81 
82  $result->Close();
83  unset($result);
84 
85  return $returner;
86  }
87 
94  function &getConferenceLogEntries($conferenceId, $schedConfId = null, $rangeInfo = null) {
95  $returner =& $this->getConferenceLogEntriesByAssoc($conferenceId, $schedConfId, null, null, $rangeInfo);
96  return $returner;
97  }
98 
109  function &getConferenceLogEntriesByAssoc($conferenceId, $schedConfId = null, $assocType = null, $assocId = null, $rangeInfo = null) {
110  $primaryLocale = AppLocale::getPrimaryLocale();
111  $locale = AppLocale::getLocale();
112  $params = array(
113  'title', // Conference
114  $primaryLocale,
115  'title',
116  $locale,
117  'title', // Scheduled Conference
118  $primaryLocale,
119  'title',
120  $locale,
121  $conferenceId
122  );
123 
124  if (isset($schedConfId))
125  $params[] = $schedConfId;
126 
127  if (isset($assocType)) {
128  $params[] = $assocType;
129  if (isset($assocId))
130  $params[] = $assocId;
131  }
132 
133  $result =& $this->retrieveRange(
134  'SELECT e.*,
135  COALESCE(sctl.setting_value, sct.setting_value) AS sched_conf_title,
136  COALESCE(ctl.setting_value, ct.setting_value)
137  FROM conference_event_log e
138  LEFT JOIN sched_confs sc ON (e.sched_conf_id = sc.sched_conf_id)
139  LEFT JOIN conferences c ON (e.conference_id = c.conference_id)
140  LEFT JOIN conference_settings ct ON (ct.setting_name = ? AND ct.locale = ? AND ct.conference_id = e.conference_id)
141  LEFT JOIN conference_settings ctl ON (ctl.setting_name = ? AND ctl.locale = ? AND ctl.conference_id = e.conference_id)
142  LEFT JOIN sched_conf_settings sct ON (sct.setting_name = ? AND sct.locale = ? AND sct.sched_conf_id = e.sched_conf_id)
143  LEFT JOIN sched_conf_settings sctl ON (sctl.setting_name = ? AND sctl.locale = ? AND sctl.sched_conf_id = e.sched_conf_id)
144  WHERE e.conference_id = ?' .
145  (isset($schedConfId) ? ' AND e.sched_conf_id = ? ':'') .
146  (isset($assocType) ? ' AND e.assoc_type = ?' . (isset($assocId) ? ' AND e.assoc_id = ?' : '') : '') .
147  ' ORDER BY log_id DESC',
148  $params, $rangeInfo
149  );
150 
151  $returner = new DAOResultFactory($result, $this, '_returnLogEntryFromRow');
152  return $returner;
153  }
154 
160  function &_returnLogEntryFromRow(&$row) {
161  $entry = new ConferenceEventLogEntry();
162  $entry->setLogId($row['log_id']);
163  $entry->setConferenceId($row['conference_id']);
164  $entry->setSchedConfId($row['sched_conf_id']);
165  $entry->setUserId($row['user_id']);
166  $entry->setDateLogged($this->datetimeFromDB($row['date_logged']));
167  $entry->setIPAddress($row['ip_address']);
168  $entry->setLogLevel($row['log_level']);
169  $entry->setEventType($row['event_type']);
170  $entry->setAssocType($row['assoc_type']);
171  $entry->setSchedConfTitle($row['sched_conf_title']);
172  $entry->setConferenceTitle($row['conference_title']);
173  $entry->setAssocId($row['assoc_id']);
174  $entry->setIsTranslated($row['is_translated']);
175  $entry->setEntryParams(unserialize($row['entry_params']));
176  $entry->setMessage($row['message']);
177 
178  HookRegistry::call('ConferenceEventLogDAO::_returnLogEntryFromRow', array(&$entry, &$row));
179 
180  return $entry;
181  }
182 
187  function insertLogEntry(&$entry) {
188  if ($entry->getDateLogged() == null) {
189  $entry->setDateLogged(Core::getCurrentDate());
190  }
191  if ($entry->getIPAddress() == null) {
192  $entry->setIPAddress(Request::getRemoteAddr());
193  }
194  $this->update(
195  sprintf('INSERT INTO conference_event_log
196  (conference_id, sched_conf_id, user_id, date_logged, ip_address, log_level, event_type, assoc_type, assoc_id, is_translated, entry_params, message)
197  VALUES
198  (?, ?, ?, %s, ?, ?, ?, ?, ?, ?, ?, ?)',
199  $this->datetimeToDB($entry->getDateLogged())),
200  array(
201  $entry->getConferenceId(),
202  $entry->getSchedConfId(),
203  $entry->getUserId(),
204  $entry->getIPAddress(),
205  $entry->getLogLevel(),
206  $entry->getEventType(),
207  $entry->getAssocType(),
208  $entry->getAssocId(),
209  1, // is_translated: All new entries are.
210  $entry->getEntryParamsSerialized(),
211  $entry->getMessage()
212  )
213  );
214 
215  $entry->setLogId($this->getInsertLogId());
216  return $entry->getLogId();
217  }
218 
225  function deleteLogEntry($logId, $conferenceId, $schedConfId = null) {
226  $args = array($logId, $conferenceId);
227  if(isset($schedConfId))
228  $args[] = $schedConfId;
229 
230  return $this->update(
231  'DELETE FROM conference_event_log WHERE log_id = ?
232  AND conference_id = ?' .
233  (isset($schedConfId)? ' AND sched_conf_id = ?' : ''),
234  $args);
235  }
236 
241  function deleteConferenceLogEntries($conferenceId, $schedConfId = null) {
242  $args = array($conferenceId);
243 
244  if(isset($schedConfId))
245  $args[] = $schedConfId;
246 
247  return $this->update(
248  'DELETE FROM conference_event_log WHERE conference_id = ?' .
249  (isset($schedConfId) ? ' AND sched_conf_id = ?' : ''),
250  (count($args)>1 ? $args : array_shift($args)));
251  }
252 
258  function transferConferenceLogEntries($oldUserId, $newUserId) {
259  return $this->update(
260  'UPDATE conference_event_log SET user_id = ? WHERE user_id = ?',
261  array($newUserId, $oldUserId)
262  );
263  }
264 
269  function getInsertLogId() {
270  return $this->getInsertId('conference_event_log', 'log_id');
271  }
272 
273 }
274 
275 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
& getConferenceLogEntriesByAssoc($conferenceId, $schedConfId=null, $assocType=null, $assocId=null, $rangeInfo=null)
getInsertId($table='', $id='', $callHooks=true)
Definition: DAO.inc.php:225
& getConferenceLogEntries($conferenceId, $schedConfId=null, $rangeInfo=null)
getCurrentDate($ts=null)
Definition: Core.inc.php:90
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:152
deleteLogEntry($logId, $conferenceId, $schedConfId=null)
datetimeFromDB($dt)
Definition: DAO.inc.php:276
transferConferenceLogEntries($oldUserId, $newUserId)
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
& getLogEntry($logId, $conferenceId=null, $schedConfId=null)
deleteConferenceLogEntries($conferenceId, $schedConfId=null)
Describes an entry in the conference history log.
call($hookName, $args=null)
datetimeToDB($dt)
Definition: DAO.inc.php:258
Class for inserting/accessing conference history log entries.
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186