diff options
| author | 2020-08-05 09:40:58 +0200 | |
|---|---|---|
| committer | 2020-08-05 09:40:58 +0200 | |
| commit | ee31722072a8b114beaf074193b7a7a6fd65fd30 (patch) | |
| tree | 091a7469c4f6db62c2913a73da7b533ce7c2ad6d /app/Models/FeedDAO.php | |
| parent | c523f5a4e7d346a02528c9143767d0505664d0da (diff) | |
Change feed order in a category (#3131)
Before, the sorting was not human readable. Lower-cased feed names were
displayed after upper-cased feed names.
Now, the sorting is human readable. The sorting is done without taking into
account the name case.
See #3128
Diffstat (limited to 'app/Models/FeedDAO.php')
| -rw-r--r-- | app/Models/FeedDAO.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 6f675ead0..61f93d0b7 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -357,14 +357,18 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function listByCategory($cat) { - $sql = 'SELECT * FROM `_feed` WHERE category=? ORDER BY name'; + $sql = 'SELECT * FROM `_feed` WHERE category=?'; $stm = $this->pdo->prepare($sql); - $values = array($cat); + $stm->execute(array($cat)); - $stm->execute($values); + $feeds = self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); - return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); + usort($feeds, function ($a, $b) { + return strnatcasecmp($a->name(), $b->name()); + }); + + return $feeds; } public function countEntries($id) { |
