summaryrefslogtreecommitdiff
path: root/app/controllers/entryController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-21 18:47:57 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-21 18:47:57 +0200
commitfb57be5a5af3a2fb46b2dbf2b503ffe78eb5cf49 (patch)
tree9440fc7846d8a56a7005b9ef029669c96ad959aa /app/controllers/entryController.php
First commit
Diffstat (limited to 'app/controllers/entryController.php')
-rwxr-xr-xapp/controllers/entryController.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php
new file mode 100755
index 000000000..e180cc7f1
--- /dev/null
+++ b/app/controllers/entryController.php
@@ -0,0 +1,58 @@
+<?php
+
+class entryController extends ActionController {
+ public function readAction () {
+ $id = Request::param ('id');
+ $is_read = Request::param ('is_read');
+
+ if ($is_read) {
+ $is_read = true;
+ } else {
+ $is_read = false;
+ }
+
+ $entryDAO = new EntryDAO ();
+ if ($id == false) {
+ $entries = $entryDAO->listNotReadEntries ();
+ } else {
+ $entry = $entryDAO->searchById ($id);
+ $entries = $entry !== false ? array ($entry) : array ();
+ }
+
+ foreach ($entries as $entry) {
+ $values = array (
+ 'is_read' => $is_read,
+ );
+
+ $entryDAO->updateEntry ($entry->id (), $values);
+ }
+
+ Request::forward (array (), true);
+ }
+
+ public function bookmarkAction () {
+ $id = Request::param ('id');
+ $is_fav = Request::param ('is_favorite');
+
+ if ($is_fav) {
+ $is_fav = true;
+ } else {
+ $is_fav = false;
+ }
+
+ $entryDAO = new EntryDAO ();
+ if ($id != false) {
+ $entry = $entryDAO->searchById ($id);
+
+ if ($entry != false) {
+ $values = array (
+ 'is_favorite' => $is_fav,
+ );
+
+ $entryDAO->updateEntry ($entry->id (), $values);
+ }
+ }
+
+ Request::forward (array (), true);
+ }
+}