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)  

AnnouncementDAO.inc.php
Go to the documentation of this file.
1 <?php
2 
16 // $Id$
17 
18 import('announcement.Announcement');
19 import('announcement.PKPAnnouncementDAO');
20 
22 
23  function &getAnnouncementsByConferenceId($conferenceId, $schedConfId = 0, $rangeInfo = null) {
24  $conferenceArgs = array(ASSOC_TYPE_CONFERENCE, $conferenceId);
25  if($schedConfId == -1) {
26  $schedConfDAO =& DAORegistry::getDAO('SchedConfDAO');
27  $schedConfs = $schedConfDAO->getSchedConfsByConferenceId($conferenceId);
28  $schedConfArgs = array();
29  while (!$schedConfs->eof()) {
30  $schedConf =& $schedConfs->next();
31  $schedConfArgs[] = ASSOC_TYPE_SCHED_CONF;
32  $schedConfArgs[] = $schedConf->getId();
33  }
34  } else {
35  $schedConfArgs = array(ASSOC_TYPE_SCHED_CONF, $schedConfId);
36  }
37 
38  $result =& $this->retrieveRange(
39  'SELECT *
40  FROM announcements
41  WHERE (assoc_type = ? AND assoc_id = ?)' .
42  (count($schedConfArgs) ? str_repeat(' OR (assoc_type = ? AND assoc_id = ?)', count($schedConfArgs)/2):'') .
43  ' ORDER BY announcement_id DESC',
44  array_merge($conferenceArgs, $schedConfArgs),
45  $rangeInfo
46  );
47 
48  $returner = new DAOResultFactory($result, $this, '_returnAnnouncementFromRow');
49  return $returner;
50  }
51 
52  function &getAnnouncementsNotExpiredByConferenceId($conferenceId, $schedConfId = 0, $rangeInfo = null) {
53 
54  $conferenceArgs = array(ASSOC_TYPE_CONFERENCE, $conferenceId);
55  if($schedConfId == -1) {
56  $schedConfDAO =& DAORegistry::getDAO('SchedConfDAO');
57  $schedConfs = $schedConfDAO->getSchedConfsByConferenceId($conferenceId);
58  $schedConfArgs = array();
59  while (!$schedConfs->eof()) {
60  $schedConf =& $schedConfs->next();
61  $schedConfArgs[] = ASSOC_TYPE_SCHED_CONF;
62  $schedConfArgs[] = $schedConf->getId();
63  }
64  } else {
65  $schedConfArgs = array(ASSOC_TYPE_SCHED_CONF, $schedConfId);
66  }
67 
68  $result =& $this->retrieveRange(
69  'SELECT *
70  FROM announcements
71  WHERE (assoc_type = ? AND assoc_id = ?)' .
72  (count($schedConfArgs) ? str_repeat(' OR (assoc_type = ? AND assoc_id = ?)', count($schedConfArgs)/2):'') .
73  ' AND (date_expire IS NULL OR date_expire > CURRENT_DATE)
74  ORDER BY announcement_id DESC',
75  array_merge($conferenceArgs, $schedConfArgs),
76  $rangeInfo
77  );
78 
79  $returner = new DAOResultFactory($result, $this, '_returnAnnouncementFromRow');
80  return $returner;
81  }
82 
83  function &getNumAnnouncementsNotExpiredByConferenceId($conferenceId, $schedConfId = 0, $numAnnouncements, $rangeInfo = null) {
84  $conferenceArgs = array(ASSOC_TYPE_CONFERENCE, $conferenceId);
85  if($schedConfId == -1) {
86  $schedConfDAO =& DAORegistry::getDAO('SchedConfDAO');
87  $schedConfs = $schedConfDAO->getSchedConfsByConferenceId($conferenceId);
88  $schedConfArgs = array();
89  while (!$schedConfs->eof()) {
90  $schedConf =& $schedConfs->next();
91  $schedConfArgs[] = ASSOC_TYPE_SCHED_CONF;
92  $schedConfArgs[] = $schedConf->getId();
93  }
94  } else {
95  $schedConfArgs = array(ASSOC_TYPE_SCHED_CONF, $schedConfId);
96  }
97 
98  $result =& $this->retrieveRange(
99  'SELECT *
100  FROM announcements
101  WHERE (assoc_type = ? AND assoc_id = ?)' .
102  (count($schedConfArgs) ? str_repeat(' OR (assoc_type = ? AND assoc_id = ?)', count($schedConfArgs)/2):'') .
103  ' AND (date_expire IS NULL OR date_expire > CURRENT_DATE)
104  ORDER BY announcement_id DESC LIMIT ?',
105  array_merge($conferenceArgs, $schedConfArgs, array($numAnnouncements)),
106  $rangeInfo
107  );
108 
109  $returner = new DAOResultFactory($result, $this, '_returnAnnouncementFromRow');
110  return $returner;
111  }
112 }
113 
114 ?>
config TEMPLATE inc php
Definition: config.inc.php:4
Operations for retrieving and modifying Announcement objects.
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:152
const ASSOC_TYPE_CONFERENCE
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
& getAnnouncementsNotExpiredByConferenceId($conferenceId, $schedConfId=0, $rangeInfo=null)
& getDAO($name, $dbconn=null)
& getNumAnnouncementsNotExpiredByConferenceId($conferenceId, $schedConfId=0, $numAnnouncements, $rangeInfo=null)
const ASSOC_TYPE_SCHED_CONF
& getAnnouncementsByConferenceId($conferenceId, $schedConfId=0, $rangeInfo=null)
Operations for retrieving and modifying Announcement objects.