/** * Internal function to return ExternalFeed object from a row. * @param $row array * @return ExternalFeed */ function &_returnExternalFeedFromRow($row) { $externalFeedPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName); $externalFeedPlugin->import('ExternalFeed'); $externalFeed = new ExternalFeed(); $externalFeed->setId($row['feed_id']); $externalFeed->setJournalId($row['journal_id']); $externalFeed->setUrl($row['url']); $externalFeed->setSequence($row['seq']); $externalFeed->setDisplayHomepage($row['display_homepage']); $externalFeed->setDisplayBlock($row['display_block']); $externalFeed->setLimitItems($row['limit_items']); $externalFeed->setRecentItems($row['recent_items']); $this->getDataObjectSettings('external_feed_settings', 'feed_id', $row['feed_id'], $externalFeed); return $externalFeed; }
/** * Save settings. */ function execute() { $plugin =& $this->plugin; $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); $plugin->import('ExternalFeed'); if (isset($this->feedId)) { $feed =& $externalFeedDao->getExternalFeed($this->feedId); } if (!isset($feed)) { $feed = new ExternalFeed(); } $feed->setJournalId($this->journalId); $feed->setUrl($this->getData('feedUrl')); $feed->setTitle($this->getData('title'), null); $feed->setDisplayHomepage($this->getData('displayHomepage') ? 1 : 0); $feed->setDisplayBlock($this->getData('displayBlock') ? $this->getData('displayBlock') : EXTERNAL_FEED_DISPLAY_BLOCK_NONE); $feed->setLimitItems($this->getData('limitItems') ? 1 : 0); $feed->setRecentItems($this->getData('recentItems') ? $this->getData('recentItems') : 0); // Update or insert external feed if ($feed->getId() != null) { $externalFeedDao->updateExternalFeed($feed); } else { $feed->setSequence(REALLY_BIG_NUMBER); $externalFeedDao->insertExternalFeed($feed); // Re-order the feeds so the new one is at the end of the list. $externalFeedDao->resequenceExternalFeeds($feed->getJournalId()); } }