4
0

apiController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. class apiController extends ActionController {
  3. public function firstAction() {
  4. header('Content-type: application/json');
  5. $this->view->_useLayout (false);
  6. }
  7. public function getFavoritesAction () {
  8. $entryDAO = new EntryDAO ();
  9. $entryDAO->_nbItemsPerPage (-1);
  10. $entries_tmp = $entryDAO->listFavorites ('all', 'low_to_high');
  11. $entries = array ();
  12. foreach ($entries_tmp as $e) {
  13. $author = $e->author ();
  14. $feed = $e->feed (true);
  15. $content = 'Article publié initialement sur <a href="' . $feed->website () . '">' . $feed->name () . '</a>';
  16. if($author != '') {
  17. $content .= ' par ' . $author;
  18. }
  19. $content .= ', mis en favoris dans <a href="https://github.com/marienfressinaud/FreshRSS">FreshRSS</a>';
  20. $id = $e->id ();
  21. $entries[$id] = array ();
  22. $entries[$id]['title'] = $e->title ();
  23. $entries[$id]['content'] = $content;
  24. $entries[$id]['date'] = $e->date (true);
  25. $entries[$id]['lastUpdate'] = $e->date (true);
  26. $entries[$id]['tags'] = array ();
  27. $entries[$id]['url'] = $e->link ();
  28. $entries[$id]['type'] = 'url';
  29. }
  30. $this->view->entries = $entries;
  31. }
  32. public function getNbNotReadAction() {
  33. }
  34. }