apiController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 getPublicFeedAction () {
  8. $entryDAO = new EntryDAO ();
  9. $entryDAO->_nbItemsPerPage (-1);
  10. $entries_tmp = $entryDAO->listPublic ('low_to_high');
  11. $entries = array ();
  12. foreach ($entries_tmp as $e) {
  13. $author = $e->author ();
  14. $notes = $e->notes ();
  15. if ($notes == '') {
  16. $feed = $e->feed (true);
  17. if($author != '') {
  18. $notes = Translate::t ('article_published_on_author', $feed->website (), $feed->name (), $author);
  19. } else {
  20. $notes = Translate::t ('article_published_on', $feed->website (), $feed->name ());
  21. }
  22. }
  23. $id = $e->id ();
  24. $entries[$id] = array ();
  25. $entries[$id]['title'] = $e->title ();
  26. $entries[$id]['content'] = $notes;
  27. $entries[$id]['date'] = $e->date (true);
  28. $entries[$id]['lastUpdate'] = $e->lastUpdate (true);
  29. $entries[$id]['tags'] = $e->tags ();
  30. $entries[$id]['url'] = $e->link ();
  31. $entries[$id]['type'] = 'url';
  32. }
  33. $this->view->entries = $entries;
  34. }
  35. public function getNbNotReadAction() {
  36. }
  37. }