ASC / DESC
Hello,
I wanted to have unread items ascending and other descending (acording to datetime), so I have done it this simple not very clean way (see patch). Are you interested, if I will do it more clean way (maybe as configuration option new_ascending = true / false) for all DBs and send you patch, or do you want to implement it yourself, or not interested at all?
Kind regards,
xvasek
@@ -21,14 +21,17 @@ class Items extends \daos\mysql\Items {
public function get($options = array()) {
$params = array();
$where = '';
+ $direction = 'DESC';
// only starred
if(isset($options['type']) && $options['type']=='starred')
$where .= ' AND starred=true ';
// only unread
- else if(isset($options['type']) && $options['type']=='unread')
+ else if(isset($options['type']) && $options['type']=='unread') {
$where .= ' AND unread=true ';
+ $direction = 'ASC';
+ }
// search
if(isset($options['search']) && strlen($options['search'])>0) {
@@ -64,7 +67,7 @@ class Items extends \daos\mysql\Items {
items.id, datetime, items.title AS title, content, unread, starred, source, thumbnail, i
FROM items, sources
WHERE items.source=sources.id '.$where.'
- ORDER BY items.datetime DESC
+ ORDER BY items.datetime '.$direction.'
LIMIT ' . $options['items'] . ' OFFSET ' . $options['offset'], $params);
}