Open Journal Systems
3.3.0
|
17 import(
'lib.pkp.classes.announcement.Announcement');
18 import(
'lib.pkp.classes.db.SchemaDAO');
35 'id' =>
'announcement_id',
36 'assocId' =>
'assoc_id',
37 'assocType' =>
'assoc_type',
38 'typeId' =>
'type_id',
39 'dateExpire' =>
'date_expire',
40 'datePosted' =>
'date_posted',
50 function getById($announcementId, $assocType =
null, $assocId =
null) {
51 $params = array((
int) $announcementId);
52 if ($assocType !==
null) $params[] = (int) $assocType;
53 if ($assocId !==
null) $params[] = (int) $assocId;
55 'SELECT * FROM announcements WHERE announcement_id = ?' .
56 ($assocType !==
null?
' AND assoc_type = ?':
'') .
57 ($assocId !==
null?
' AND assoc_id = ?':
''),
62 if ($result->RecordCount() != 0) {
63 $returner = $this->
_fromRow($result->GetRowAssoc(
false));
76 'SELECT assoc_id FROM announcements WHERE announcement_id = ?',
80 return isset($result->fields[0]) ? $result->fields[0] : 0;
90 'SELECT assoc_type FROM announcements WHERE announcement_id = ?',
94 return isset($result->fields[0]) ? $result->fields[0] : 0;
112 while ($announcement = $announcements->next()) {
123 $announcements = $this->
getByAssocId($assocType, $assocId);
124 while ($announcement = $announcements->next()) {
141 WHERE assoc_type = ? AND assoc_id = ?
142 ORDER BY date_posted DESC',
143 array((
int) $assocType, (
int) $assocId),
158 'SELECT * FROM announcements WHERE type_id = ? ORDER BY date_posted DESC',
180 ORDER BY date_posted DESC LIMIT ?',
181 array((
int) $assocType, (
int) $assocId, (
int) $numAnnouncements),
201 AND (date_expire IS NULL OR DATE(date_expire) > DATE(NOW()))
202 AND (DATE(date_posted) <= DATE(NOW()))
203 ORDER BY date_posted DESC',
204 array((
int) $assocType, (
int) $assocId),
225 AND (date_expire IS NULL OR DATE(date_expire) > DATE(NOW()))
226 AND (DATE(date_posted) <= DATE(NOW()))
227 ORDER BY date_posted DESC LIMIT ?',
228 array((
int) $assocType, (
int) $assocId, (
int) $numAnnouncements),
247 ORDER BY date_posted DESC LIMIT 1',
248 array((
int) $assocType, (
int) $assocId)
252 if ($result->RecordCount() != 0) {
253 $returner = $this->
_fromRow($result->GetRowAssoc(
false));
264 return $this->
_getInsertId(
'announcements',
'announcement_id');
getNumAnnouncementsByAssocId($assocType, $assocId, $numAnnouncements, $rangeInfo=null)
Wrapper around ADORecordSet providing "factory" features for generating objects from DAOs.
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
deleteByAssoc($assocType, $assocId)
& retrieve($sql, $params=false, $callHooks=true)
getAnnouncementAssocId($announcementId)
getAnnouncementsNotExpiredByAssocId($assocType, $assocId, $rangeInfo=null)
getById($announcementId, $assocType=null, $assocId=null)
Operations for retrieving and modifying Announcement objects.
getByAssocId($assocType, $assocId, $rangeInfo=null)
_getInsertId($table='', $id='')
Basic class describing a announcement.
getMostRecentAnnouncementByAssocId($assocType, $assocId)
getNumAnnouncementsNotExpiredByAssocId($assocType, $assocId, $numAnnouncements, $rangeInfo=null)
getAnnouncementAssocType($announcementId)
getByTypeId($typeId, $rangeInfo=null)
A base class for DAOs which rely on a json-schema file to define the data object.