summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-01 00:55:00 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-03-01 00:55:00 +0100
commit57c0a448f5460240708f29bf1a083354ad894689 (patch)
tree09edc97637d2214d00fecee1af14a2fd1054b6e8
parent61aa1e2b22b9fb1714f40d413fe6acadf85596e5 (diff)
Ajout nombre d'articles non lus à l'API
-rw-r--r--app/configuration/routes.php5
-rwxr-xr-xapp/controllers/apiController.php10
-rw-r--r--app/views/api/getNbNotRead.phtml3
3 files changed, 15 insertions, 3 deletions
diff --git a/app/configuration/routes.php b/app/configuration/routes.php
index 2f36daa67..d32dca3ee 100644
--- a/app/configuration/routes.php
+++ b/app/configuration/routes.php
@@ -50,6 +50,11 @@ return array (
'controller' => 'api',
'action' => 'getFavorites'
),
+ array (
+ 'route' => '/api/get_nb_not_read',
+ 'controller' => 'api',
+ 'action' => 'getNbNotRead'
+ ),
// Entry
array (
diff --git a/app/controllers/apiController.php b/app/controllers/apiController.php
index 88b968cb9..5ef0f5b03 100755
--- a/app/controllers/apiController.php
+++ b/app/controllers/apiController.php
@@ -1,18 +1,19 @@
<?php
class apiController extends ActionController {
- public function getFavoritesAction () {
+ public function firstAction() {
header('Content-type: application/json');
$this->view->_useLayout (false);
+ }
+ public function getFavoritesAction () {
$entryDAO = new EntryDAO ();
$entryDAO->_nbItemsPerPage (-1);
$entries_tmp = $entryDAO->listFavorites ('all', 'low_to_high');
$entries = array ();
-
foreach ($entries_tmp as $e) {
$author = $e->author ();
$feed = $e->feed (true);
@@ -32,7 +33,10 @@ class apiController extends ActionController {
$entries[$id]['url'] = $e->link ();
$entries[$id]['type'] = 'url';
}
-
+
$this->view->entries = $entries;
}
+
+ public function getNbNotReadAction() {
+ }
}
diff --git a/app/views/api/getNbNotRead.phtml b/app/views/api/getNbNotRead.phtml
new file mode 100644
index 000000000..31c58f6ca
--- /dev/null
+++ b/app/views/api/getNbNotRead.phtml
@@ -0,0 +1,3 @@
+<?php
+echo json_encode($this->nb_not_read);
+