aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexis Degrugillier <github@ainw.org> 2014-04-13 07:28:41 -0400
committerGravatar Alexis Degrugillier <github@ainw.org> 2014-04-13 07:28:41 -0400
commit86066b1659e33eb5fdfbcae5fb7f0bd93604d442 (patch)
tree9df9b09b6beb785b9f126ac69ec4b0aa01e01f9c /app/Models
parentd25afa9def1b02b7989b12c861e33da5c90ccba1 (diff)
Add a new status for 'ALL'
I made the conversion in every file I can think of. It should not have any reference to the string 'all' for the state context
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/Configuration.php3
-rw-r--r--app/Models/EntryDAO.php9
2 files changed, 8 insertions, 4 deletions
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index f9ea47be6..e693542e0 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -1,6 +1,7 @@
<?php
class FreshRSS_Configuration {
+ const STATE_ALL = 0;
const STATE_READ = 1;
const STATE_NOT_READ = 2;
const STATE_FAVORITE = 4;
@@ -136,7 +137,7 @@ class FreshRSS_Configuration {
}
}
public function _default_view ($value) {
- $this->data['default_view'] = $value === 'all' ? 'all' : self::STATE_NOT_READ;
+ $this->data['default_view'] = $value === self::STATE_ALL ? self::STATE_ALL : self::STATE_NOT_READ;
}
public function _display_posts ($value) {
$this->data['display_posts'] = ((bool)$value) && $value !== 'no';
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index 2f5a9e1f6..b9cbfd584 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -406,7 +406,10 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
return isset ($entries[0]) ? $entries[0] : null;
}
- private function sqlListWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {
+ private function sqlListWhere($type = 'a', $id = '', $state = null , $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {
+ if (!$state) {
+ $state = FreshRSS_Configuration::STATE_ALL;
+ }
$where = '';
$joinFeed = false;
$values = array();
@@ -532,7 +535,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
. ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
}
- public function listWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {
+ public function listWhere($type = 'a', $id = '', $state = null, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault);
$sql = 'SELECT e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags '
@@ -548,7 +551,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
return self::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));
}
- public function listIdsWhere($type = 'a', $id = '', $state = 'all', $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For API
+ public function listIdsWhere($type = 'a', $id = '', $state = null, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For API
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault);
$stm = $this->bd->prepare($sql);