2013-12-23 02:55:53 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use PicoFarad\Router;
|
|
|
|
use PicoFarad\Response;
|
|
|
|
use PicoFarad\Request;
|
|
|
|
use PicoFarad\Session;
|
2014-03-17 02:56:43 +01:00
|
|
|
use PicoFarad\Template;
|
2013-12-23 02:55:53 +01:00
|
|
|
|
|
|
|
// Display history page
|
|
|
|
Router\get_action('history', function() {
|
|
|
|
|
|
|
|
$offset = Request\int_param('offset', 0);
|
|
|
|
$nb_items = Model\Item\count_by_status('read');
|
|
|
|
|
|
|
|
Response\html(Template\layout('history', array(
|
|
|
|
'items' => Model\Item\get_all(
|
|
|
|
'read',
|
|
|
|
$offset,
|
|
|
|
Model\Config\get('items_per_page'),
|
|
|
|
'updated',
|
|
|
|
Model\Config\get('items_sorting_direction')
|
|
|
|
),
|
|
|
|
'order' => '',
|
|
|
|
'direction' => '',
|
2014-05-29 16:57:23 +02:00
|
|
|
'display_mode' => Model\Config\get('items_display_mode'),
|
2013-12-23 02:55:53 +01:00
|
|
|
'nb_items' => $nb_items,
|
|
|
|
'offset' => $offset,
|
|
|
|
'items_per_page' => Model\Config\get('items_per_page'),
|
2013-12-23 19:33:16 +01:00
|
|
|
'nothing_to_read' => Request\int_param('nothing_to_read'),
|
2013-12-23 02:55:53 +01:00
|
|
|
'menu' => 'history',
|
|
|
|
'title' => t('History').' ('.$nb_items.')'
|
|
|
|
)));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Confirmation box to flush history
|
|
|
|
Router\get_action('confirm-flush-history', function() {
|
|
|
|
|
|
|
|
Response\html(Template\layout('confirm_flush_items', array(
|
|
|
|
'menu' => 'history',
|
|
|
|
'title' => t('Confirmation')
|
|
|
|
)));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Flush history
|
|
|
|
Router\get_action('flush-history', function() {
|
|
|
|
|
|
|
|
Model\Item\mark_all_as_removed();
|
|
|
|
Response\redirect('?action=history');
|
|
|
|
});
|