blob: a9903806832fb70b120ce5d88debb9c9aede20de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php
class entryController extends ActionController {
public function firstAction () {
$ajax = Request::param ('ajax');
if ($ajax) {
$this->view->_useLayout (false);
}
}
public function lastAction () {
$ajax = Request::param ('ajax');
if (!$ajax) {
Request::forward (array (), true);
}
}
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->listEntries ('not_read');
} 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);
}
}
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);
}
}
}
}
|