miniflux-legacy/app/controllers/search.php

43 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2016-05-04 02:15:20 +02:00
<?php
namespace Miniflux\Controller;
use Miniflux\Helper;
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;
2016-05-04 02:15:20 +02:00
Router\get_action('search', function() {
$user_id = SessionStorage::getInstance()->getUserId();
2016-05-04 02:15:20 +02:00
$text = Request\param('text', '');
$offset = Request\int_param('offset', 0);
$items = array();
$nb_items = 0;
if ($text) {
$items = Model\ItemSearch\get_all_items($user_id, $text, $offset, Helper\config('items_per_page'));
$nb_items = Model\ItemSearch\count_items($user_id, $text);
2016-05-04 02:15:20 +02:00
}
2017-01-21 20:40:24 +01:00
Response\html(Template\layout('search/items', array(
'favicons' => Model\Favicon\get_items_favicons($items),
'original_marks_read' => Helper\config('original_marks_read'),
2016-05-04 02:15:20 +02:00
'text' => $text,
'items' => $items,
'order' => '',
'direction' => '',
'display_mode' => Helper\config('items_display_mode'),
'item_title_link' => Helper\config('item_title_link'),
2016-05-04 02:15:20 +02:00
'group_id' => array(),
'nb_items' => $nb_items,
'offset' => $offset,
'items_per_page' => Helper\config('items_per_page'),
2016-05-04 02:15:20 +02:00
'nothing_to_read' => Request\int_param('nothing_to_read'),
'menu' => 'search',
'title' => t('Search').' ('.$nb_items.')'
)));
});