miniflux-legacy/app/controllers/history.php

46 lines
1.3 KiB
PHP
Raw Normal View History

<?php
namespace Miniflux\Controller;
2016-08-25 03:17:58 +02:00
use Miniflux\Router;
use Miniflux\Response;
use Miniflux\Request;
use Miniflux\Session\SessionStorage;
2016-08-25 03:17:58 +02:00
use Miniflux\Template;
use Miniflux\Model;
// Display history page
2016-04-18 01:44:45 +02:00
Router\get_action('history', function () {
$params = items_list(Model\Item\STATUS_READ);
2017-01-21 20:40:24 +01:00
Response\html(Template\layout('history/items', $params + array(
'title' => t('History') . ' (' . $params['nb_items'] . ')',
'menu' => 'history',
)));
});
// Confirmation box to flush history
2016-04-18 01:44:45 +02:00
Router\get_action('confirm-flush-history', function () {
$group_id = Request\int_param('group_id');
2017-01-21 20:40:24 +01:00
Response\html(Template\layout('history/flush', array(
'group_id' => $group_id,
'menu' => 'history',
'title' => t('Confirmation')
)));
});
// Flush history
2016-04-18 01:44:45 +02:00
Router\get_action('flush-history', function () {
$user_id = SessionStorage::getInstance()->getUserId();
$group_id = Request\int_param('group_id');
if ($group_id !== 0) {
Model\ItemGroup\change_items_status($user_id, $group_id, Model\Item\STATUS_READ, Model\Item\STATUS_REMOVED);
} else {
Model\Item\change_items_status($user_id, Model\Item\STATUS_READ, Model\Item\STATUS_REMOVED);
}
Response\redirect('?action=history');
});