diff options
| author | 2016-09-24 17:36:33 +0200 | |
|---|---|---|
| committer | 2016-09-24 17:36:33 +0200 | |
| commit | 44f22ab8b4c46befab98440f69a05725928bed75 (patch) | |
| tree | 71a9c76629514af82bf5706a1c64c850e7d305c2 /app/Models | |
| parent | d9bf9b2c6f0b2cc9dec3b638841b7e3040dcf46f (diff) | |
API move feed to another category
https://github.com/jangernert/FeedReader/issues/59
https://github.com/FreshRSS/FreshRSS/issues/443
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/FeedDAO.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 475d39286..2fd2c6194 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -136,6 +136,19 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } } + public function moveFeed($feed_id, $cat_id) { + if ($cat_id <= 0) { + // If category was not given get the default one. + $catDAO = new FreshRSS_CategoryDAO(); + $catDAO->checkDefault(); + $def_cat = $catDAO->getDefault(); + $cat_id = $def_cat->id(); + } + $feed = $this->searchById($feed_id); + return $feed && ($feed->category() == $cat_id || + $this->updateFeed($feed_id, array('category' => $cat_id))); + } + public function deleteFeed($id) { $sql = 'DELETE FROM `' . $this->prefix . 'feed` WHERE id=?'; $stm = $this->bd->prepare($sql); |
