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)  

EditAssignmentDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
16 //$Id$
17 
18 import('submission.editAssignment.EditAssignment');
19 
20 class EditAssignmentDAO extends DAO {
26  function &getEditAssignment($editId) {
27  $result =& $this->retrieve(
28  'SELECT e.*,
29  u.first_name,
30  u.last_name,
31  u.email,
32  u.initials,
33  r.role_id AS director_role_id
34  FROM papers p
35  LEFT JOIN edit_assignments e ON (e.paper_id = p.paper_id)
36  LEFT JOIN users u ON (e.director_id = u.user_id)
37  LEFT JOIN roles r ON (r.user_id = e.director_id AND r.role_id = ' . ROLE_ID_DIRECTOR . ' AND r.sched_conf_id = p.sched_conf_id)
38  WHERE e.edit_id = ? AND p.paper_id = e.paper_id',
39  $editId
40  );
41 
42  $returner = null;
43  if ($result->RecordCount() != 0) {
44  $returner =& $this->_returnEditAssignmentFromRow($result->GetRowAssoc(false));
45  }
46 
47  $result->Close();
48  unset($result);
49 
50  return $returner;
51  }
52 
58  function &getEditAssignmentsByPaperId($paperId) {
59  $result =& $this->retrieve(
60  'SELECT e.*, u.first_name, u.last_name, u.email, u.initials, r.role_id AS director_role_id
61  FROM papers p
62  LEFT JOIN edit_assignments e ON (p.paper_id = e.paper_id)
63  LEFT JOIN users u ON (e.director_id = u.user_id)
64  LEFT JOIN roles r ON (r.user_id = e.director_id AND r.role_id = ' . ROLE_ID_DIRECTOR . ' AND r.sched_conf_id = p.sched_conf_id)
65  WHERE e.paper_id = ? AND p.paper_id = e.paper_id ORDER BY e.date_notified ASC',
66  $paperId
67  );
68 
69  $returner = new DAOResultFactory($result, $this, '_returnEditAssignmentFromRow');
70  return $returner;
71  }
72 
78  function &getDirectorAssignmentsByPaperId($paperId) {
79  $result =& $this->retrieve(
80  'SELECT e.*, u.first_name, u.last_name, u.email, u.initials, r.role_id AS director_role_id FROM papers a, edit_assignments e, users u, roles r WHERE r.user_id = e.director_id AND r.role_id = ' . ROLE_ID_DIRECTOR . ' AND e.paper_id = ? AND r.sched_conf_id = a.sched_conf_id AND a.paper_id = e.paper_id AND e.director_id = u.user_id ORDER BY e.date_notified ASC',
81  $paperId
82  );
83 
84  $returner = new DAOResultFactory($result, $this, '_returnEditAssignmentFromRow');
85  return $returner;
86  }
87 
95  $result =& $this->retrieve(
96  'SELECT e.*, u.first_name, u.last_name, u.email, u.initials, r.role_id AS director_role_id
97  FROM papers p
98  LEFT JOIN edit_assignments e ON (p.paper_id = e.paper_id)
99  LEFT JOIN users u ON (e.director_id = u.user_id)
100  LEFT JOIN roles r ON (r.user_id = e.director_id AND r.role_id = ' . ROLE_ID_DIRECTOR . ' AND r.sched_conf_id = p.sched_conf_id)
101  WHERE e.paper_id = ? AND p.paper_id = e.paper_id AND r.role_id IS NULL ORDER BY e.date_notified ASC',
102  $paperId
103  );
104 
105  $returner = new DAOResultFactory($result, $this, '_returnEditAssignmentFromRow');
106  return $returner;
107  }
108 
114  function &getEditAssignmentsByUserId($userId) {
115  $result =& $this->retrieve(
116  'SELECT e.*, u.first_name, u.last_name, u.email, u.initials, r.role_id AS director_role_id
117  FROM papers p
118  LEFT JOIN edit_assignments e ON (p.paper_id = e.paper_id)
119  LEFT JOIN users u ON (e.director_id = u.user_id)
120  LEFT JOIN roles r ON (r.user_id = e.director_id AND r.role_id = ' . ROLE_ID_DIRECTOR . ' AND r.sched_conf_id = p.sched_conf_id)
121  WHERE e.director_id = ? AND p.paper_id = e.paper_id ORDER BY e.date_notified ASC',
122  $userId
123  );
124 
125  $returner = new DAOResultFactory($result, $this, '_returnEditAssignmentFromRow');
126  return $returner;
127  }
128 
134  function &_returnEditAssignmentFromRow(&$row) {
135  $editAssignment = new EditAssignment();
136  $editAssignment->setEditId($row['edit_id']);
137  $editAssignment->setPaperId($row['paper_id']);
138  $editAssignment->setDirectorId($row['director_id']);
139  $editAssignment->setDirectorFullName($row['first_name'].' '.$row['last_name']);
140  $editAssignment->setDirectorFirstName($row['first_name']);
141  $editAssignment->setDirectorLastName($row['last_name']);
142  $editAssignment->setDirectorInitials($row['initials']);
143  $editAssignment->setDirectorEmail($row['email']);
144  $editAssignment->setIsDirector($row['director_role_id']==ROLE_ID_DIRECTOR?1:0);
145  $editAssignment->setDateUnderway($this->datetimeFromDB($row['date_underway']));
146  $editAssignment->setDateNotified($this->datetimeFromDB($row['date_notified']));
147 
148  HookRegistry::call('EditAssignmentDAO::_returnEditAssignmentFromRow', array(&$editAssignment, &$row));
149 
150  return $editAssignment;
151  }
152 
157  function insertEditAssignment(&$editAssignment) {
158  $this->update(
159  sprintf('INSERT INTO edit_assignments
160  (paper_id, director_id, date_notified, date_underway)
161  VALUES
162  (?, ?, %s, %s)',
163  $this->datetimeToDB($editAssignment->getDateNotified()),
164  $this->datetimeToDB($editAssignment->getDateUnderway())),
165  array(
166  $editAssignment->getPaperId(),
167  $editAssignment->getDirectorId()
168  )
169  );
170 
171  $editAssignment->setEditId($this->getInsertEditId());
172  return $editAssignment->getEditId();
173  }
174 
179  function updateEditAssignment(&$editAssignment) {
180  return $this->update(
181  sprintf('UPDATE edit_assignments
182  SET paper_id = ?,
183  director_id = ?,
184  date_notified = %s,
185  date_underway = %s
186  WHERE edit_id = ?',
187  $this->datetimeToDB($editAssignment->getDateNotified()),
188  $this->datetimeToDB($editAssignment->getDateUnderway())),
189  array(
190  $editAssignment->getPaperId(),
191  $editAssignment->getDirectorId(),
192  $editAssignment->getEditId()
193  )
194  );
195  }
196 
201  function deleteEditAssignmentById($editId) {
202  return $this->update(
203  'DELETE FROM edit_assignments WHERE edit_id = ?',
204  $editId
205  );
206  }
207 
212  function deleteEditAssignmentsByPaper($paperId) {
213  return $this->update(
214  'DELETE FROM edit_assignments WHERE paper_id = ?',
215  $paperId
216  );
217  }
218 
223  function getInsertEditId() {
224  return $this->getInsertId('edit_assignments', 'edit_id');
225  }
226 
231  function getDirectorStatistics($schedConfId) {
232  $statistics = Array();
233 
234  // Get counts of completed submissions
235  $result =& $this->retrieve(
236  'SELECT ea.director_id,
237  COUNT(ea.paper_id) AS complete
238  FROM edit_assignments ea,
239  papers p
240  WHERE ea.paper_id=p.paper_id AND
241  p.sched_conf_id = ? AND (
242  p.status = ' . STATUS_ARCHIVED . ' OR
243  p.status = ' . STATUS_PUBLISHED . ' OR
244  p.status = ' . STATUS_DECLINED . '
245  )
246  GROUP BY ea.director_id',
247  $schedConfId
248  );
249 
250  while (!$result->EOF) {
251  $row = $result->GetRowAssoc(false);
252  if (!isset($statistics[$row['director_id']])) $statistics[$row['director_id']] = array();
253  $statistics[$row['director_id']]['complete'] = $row['complete'];
254  $result->MoveNext();
255  }
256  $result->Close();
257  unset($result);
258 
259  // Get counts of incomplete submissions
260  $result =& $this->retrieve(
261  'SELECT ea.director_id,
262  COUNT(ea.paper_id) AS incomplete
263  FROM edit_assignments ea,
264  papers p
265  WHERE ea.paper_id = p.paper_id AND
266  p.sched_conf_id = ? AND
267  p.status = ' . STATUS_QUEUED . '
268  GROUP BY ea.director_id',
269  $schedConfId
270  );
271 
272  while (!$result->EOF) {
273  $row = $result->GetRowAssoc(false);
274  if (!isset($statistics[$row['director_id']])) $statistics[$row['director_id']] = array();
275  $statistics[$row['director_id']]['incomplete'] = $row['incomplete'];
276  $result->MoveNext();
277  }
278  $result->Close();
279  unset($result);
280 
281  return $statistics;
282  }
283 }
284 
285 ?>
const STATUS_QUEUED
Definition: Paper.inc.php:26
updateEditAssignment(&$editAssignment)
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
& getEditAssignmentsByPaperId($paperId)
Describes edit assignment properties.
getInsertId($table='', $id='', $callHooks=true)
Definition: DAO.inc.php:225
& getDirectorAssignmentsByPaperId($paperId)
& getTrackDirectorAssignmentsByPaperId($paperId)
const ROLE_ID_DIRECTOR
Definition: Role.inc.php:25
deleteEditAssignmentsByPaper($paperId)
datetimeFromDB($dt)
Definition: DAO.inc.php:276
Class for DAO relating directors to papers.
const STATUS_DECLINED
Definition: Paper.inc.php:28
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
& getEditAssignmentsByUserId($userId)
insertEditAssignment(&$editAssignment)
getDirectorStatistics($schedConfId)
call($hookName, $args=null)
datetimeToDB($dt)
Definition: DAO.inc.php:258
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:186
const STATUS_ARCHIVED
Definition: Paper.inc.php:25
const STATUS_PUBLISHED
Definition: Paper.inc.php:27