/** * Internal function to return an Announcement object from a row. * @param $row array * @return Announcement */ function &_returnAnnouncementFromRow(&$row) { $announcement = new Announcement(); $announcement->setId($row['announcement_id']); $announcement->setAssocType($row['assoc_type']); $announcement->setAssocId($row['assoc_id']); $announcement->setTypeId($row['type_id']); $announcement->setDateExpire($this->dateFromDB($row['date_expire'])); $announcement->setDatePosted($this->datetimeFromDB($row['date_posted'])); $this->getDataObjectSettings('announcement_settings', 'announcement_id', $row['announcement_id'], $announcement); return $announcement; }
function importAnnouncements() { assert($this->xml->name == 'announcements'); $journal = $this->journal; $announcementTypeDAO =& DAORegistry::getDAO('AnnouncementTypeDAO'); $announcementDAO =& DAORegistry::getDAO('AnnouncementDAO'); $this->nextElement(); while ($this->xml->name == 'announcementType') { $announcementTypeXML = $this->getCurrentElementAsDom(); $announcementType = new AnnouncementType(); $announcementType->setAssocType(ASSOC_TYPE_JOURNAL); $announcementType->setAssocId($this->journal->getId()); $announcementTypeDAO->insertAnnouncementType($announcementType); $this->restoreDataObjectSettings($announcementTypeDAO, $announcementTypeXML->settings, 'announcement_type_settings', 'type_id', $announcementType->getId()); foreach ($announcementTypeXML->announcement as $announcementXML) { $announcement = new Announcement(); $announcement->setAssocType(ASSOC_TYPE_JOURNAL); $announcement->setAssocId($this->journal->getId()); $announcement->setTypeId($announcementType->getId()); $announcement->setDateExpire((string) $announcementXML->dateExpire); $announcement->setDatePosted((string) $announcementXML->datePosted); $announcementDAO->insertAnnouncement($announcement); $this->restoreDataObjectSettings($announcementDAO, $announcementXML->settings, 'announcement_settings', 'announcement_id', $announcement->getId()); } $this->nextElement(); } }