diff --git a/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php b/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php index 80b244579cc..a802c0cbca1 100644 --- a/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php +++ b/plugins/generic/announcementFeed/AnnouncementFeedGatewayPlugin.php @@ -15,8 +15,8 @@ namespace APP\plugins\generic\announcementFeed; -use APP\facades\Repo; use APP\template\TemplateManager; +use PKP\announcement\Announcement; use PKP\core\Core; use PKP\db\DAORegistry; use PKP\plugins\GatewayPlugin; @@ -128,12 +128,12 @@ public function fetch($args, $request) } // Get limit setting, if any - $collector = Repo::announcement()->getCollector()->filterByContextIds([$journal->getId()])->filterByActive(); + $announcements = Announcement::withContextIds([$journal->getId()])->withActiveByDate(); $recentItems = (int) $this->_parentPlugin->getSetting($journal->getId(), 'recentItems'); if ($recentItems > 0) { - $collector->limit($recentItems); + $announcements->limit($recentItems); } - $announcements = $collector->getMany(); + $announcements = $announcements->get(); // Get date of most recent announcement $lastDateUpdated = $this->_parentPlugin->getSetting($journal->getId(), 'dateUpdated'); @@ -145,7 +145,7 @@ public function fetch($args, $request) $dateUpdated = $lastDateUpdated; } } else { - $dateUpdated = $announcements->first()->getDatetimePosted(); + $dateUpdated = $announcements->first()->getAttribute('datePosted'); if (empty($lastDateUpdated) || (strtotime($dateUpdated) > strtotime($lastDateUpdated))) { $this->_parentPlugin->updateSetting($journal->getId(), 'dateUpdated', $dateUpdated, 'string'); } diff --git a/plugins/generic/announcementFeed/templates/atom.tpl b/plugins/generic/announcementFeed/templates/atom.tpl index 55177becc6f..a184b535ede 100644 --- a/plugins/generic/announcementFeed/templates/atom.tpl +++ b/plugins/generic/announcementFeed/templates/atom.tpl @@ -36,21 +36,21 @@ {foreach from=$announcements item=announcement} {* required elements *} - {url page="announcement" op="view" path=$announcement->getId()} - {$announcement->getLocalizedTitleFull()|strip|escape:"html"} - {$announcement->getDatetimePosted()|date_format:"%Y-%m-%dT%T%z"|regex_replace:"/00$/":":00"} + {url page="announcement" op="view" path=$announcement->getKey()} + {$announcement->getLocalizedData('fullTitle')|strip|escape:"html"} + {$announcement->getAttribute('datePosted')|date_format:"%Y-%m-%dT%T%z"|regex_replace:"/00$/":":00"} {$journal->getLocalizedName()|strip|escape:"html"} - getId()}" /> - {if $announcement->getLocalizedDescription()} - getId()}">{$announcement->getLocalizedDescription()|strip|escape:"html"} + getKey()}" /> + {if $announcement->getLocalizedData('description')} + getKey()}">{$announcement->getLocalizedData('description')|strip|escape:"html"} {/if} {* optional elements *} {* *} {* *} - {$announcement->getDatetimePosted()|date_format:"%Y-%m-%dT%T%z"|regex_replace:"/00$/":":00"} + {$announcement->getAttribute('datePosted')|date_format:"%Y-%m-%dT%T%z"|regex_replace:"/00$/":":00"} {* *} {* *} diff --git a/plugins/generic/announcementFeed/templates/rss.tpl b/plugins/generic/announcementFeed/templates/rss.tpl index 3193e4a66dc..4da99e0720e 100644 --- a/plugins/generic/announcementFeed/templates/rss.tpl +++ b/plugins/generic/announcementFeed/templates/rss.tpl @@ -34,24 +34,24 @@ {foreach from=$announcements item=announcement} - getId()}"/> + getKey()}"/> {/foreach} {foreach from=$announcements item=announcement} - getId()}"> + getKey()}"> {* required elements *} - {$announcement->getLocalizedTitleFull()|strip|escape:"html"} - {url page="announcement" op="view" path=$announcement->getId()} + {$announcement->getLocalizedData('fullTitle')|strip|escape:"html"} + {url page="announcement" op="view" path=$announcement->getKey()} {* optional elements *} - {if $announcement->getLocalizedDescription()} - {$announcement->getLocalizedDescription()|strip|escape:"html"} + {if $announcement->getLocalizedData('description')} + {$announcement->getLocalizedData('description')|strip|escape:"html"} {/if} {$journal->getLocalizedName()|strip|escape:"html"} - {$announcement->getDatePosted()|date_format:"%Y-%m-%d"} + {$announcement->getAttribute('datePosted')|date_format:"%Y-%m-%d"} {/foreach}