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)  

TrackDirectorsDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
15 //$Id$
16 
17 class TrackDirectorsDAO extends DAO {
24  function insertDirector($schedConfId, $trackId, $userId) {
25  return $this->update(
26  'INSERT INTO track_directors
27  (sched_conf_id, track_id, user_id)
28  VALUES
29  (?, ?, ?)',
30  array(
31  $schedConfId,
32  $trackId,
33  $userId
34  )
35  );
36  }
37 
44  function deleteDirector($schedConfId, $trackId, $userId) {
45  return $this->update(
46  'DELETE FROM track_directors WHERE sched_conf_id = ? AND track_id = ? AND user_id = ?',
47  array(
48  $schedConfId,
49  $trackId,
50  $userId
51  )
52  );
53  }
54 
61  function &getTracksByUserId($schedConfId, $userId) {
62  $tracks = array();
63 
64  $trackDao =& DAORegistry::getDAO('TrackDAO');
65 
66  $result =& $this->retrieve(
67  'SELECT t.* FROM tracks t, track_directors td WHERE t.track_id = td.track_id AND t.sched_conf_id = ? AND td.user_id = ?',
68  array($schedConfId, $userId)
69  );
70 
71  while (!$result->EOF) {
72  $tracks[] =& $trackDao->_returnTrackFromRow($result->GetRowAssoc(false));
73  $result->moveNext();
74  }
75 
76  $result->Close();
77  unset($result);
78 
79  return $tracks;
80  }
81 
88  function &getDirectorsByTrackId($schedConfId, $trackId) {
89  $users = array();
90 
91  $userDao =& DAORegistry::getDAO('UserDAO');
92 
93  $result =& $this->retrieve(
94  'SELECT u.* FROM users AS u, track_directors AS e WHERE u.user_id = e.user_id AND e.sched_conf_id = ? AND e.track_id = ? ORDER BY last_name, first_name',
95  array($schedConfId, $trackId)
96  );
97 
98  while (!$result->EOF) {
99  $users[] =& $userDao->_returnUserFromRow($result->GetRowAssoc(false));
100  $result->moveNext();
101  }
102 
103  $result->Close();
104  unset($result);
105 
106  return $users;
107  }
108 
115  function &getDirectorsNotInTrack($schedConfId, $trackId) {
116  $users = array();
117 
118  $userDao =& DAORegistry::getDAO('UserDAO');
119 
120  $result =& $this->retrieve(
121  'SELECT u.*
122  FROM users u
123  LEFT JOIN roles r ON (r.user_id = u.user_id)
124  LEFT JOIN track_directors e ON (e.user_id = u.user_id AND e.sched_conf_id = r.sched_conf_id AND e.track_id = ?)
125  WHERE r.sched_conf_id = ? AND
126  r.role_id = ? AND
127  e.track_id IS NULL
128  ORDER BY last_name, first_name',
129  array($trackId, $schedConfId, ROLE_ID_TRACK_DIRECTOR)
130  );
131 
132  while (!$result->EOF) {
133  $users[] =& $userDao->_returnUserFromRow($result->GetRowAssoc(false));
134  $result->moveNext();
135  }
136 
137  $result->Close();
138  unset($result);
139 
140  return $users;
141  }
142 
148  function deleteDirectorsByTrackId($trackId, $schedConfId = null) {
149  if (isset($schedConfId)) return $this->update(
150  'DELETE FROM track_directors WHERE sched_conf_id = ? AND track_id = ?',
151  array($schedConfId, $trackId)
152  );
153  else return $this->update(
154  'DELETE FROM track_directors WHERE track_id = ?',
155  $trackId
156  );
157  }
158 
163  function deleteDirectorsBySchedConfId($schedConfId) {
164  return $this->update(
165  'DELETE FROM track_directors WHERE sched_conf_id = ?', $schedConfId
166  );
167  }
168 
175  function deleteDirectorsByUserId($userId, $schedConfId = null, $trackId = null) {
176  return $this->update(
177  'DELETE FROM track_directors WHERE user_id = ?' . (isset($schedConfId) ? ' AND sched_conf_id = ?' : '') . (isset($trackId) ? ' AND track_id = ?' : ''),
178  isset($schedConfId) && isset($trackId) ? array($userId, $schedConfId, $trackId)
179  : (isset($schedConfId) ? array($userId, $schedConfId)
180  : (isset($trackId) ? array($userId, $trackId) : $userId))
181  );
182  }
183 
191  function directorExists($schedConfId, $trackId, $userId) {
192  $result =& $this->retrieve(
193  'SELECT COUNT(*) FROM track_directors WHERE sched_conf_id = ? AND track_id = ? AND user_id = ?', array($schedConfId, $trackId, $userId)
194  );
195  $returner = isset($result->fields[0]) && $result->fields[0] == 1 ? true : false;
196 
197  $result->Close();
198  unset($result);
199 
200  return $returner;
201  }
202 }
203 
204 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:30
Class for DAO relating tracks to directors.
& getDirectorsNotInTrack($schedConfId, $trackId)
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:62
directorExists($schedConfId, $trackId, $userId)
const ROLE_ID_TRACK_DIRECTOR
Definition: Role.inc.php:28
deleteDirector($schedConfId, $trackId, $userId)
& getTracksByUserId($schedConfId, $userId)
deleteDirectorsBySchedConfId($schedConfId)
deleteDirectorsByTrackId($trackId, $schedConfId=null)
& getDAO($name, $dbconn=null)
deleteDirectorsByUserId($userId, $schedConfId=null, $trackId=null)
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186
insertDirector($schedConfId, $trackId, $userId)
& getDirectorsByTrackId($schedConfId, $trackId)