firefly-iii/app/controllers/SearchController.php

40 lines
921 B
PHP
Raw Normal View History

<?php
2014-09-22 00:25:14 -05:00
use Firefly\Helper\Controllers\SearchInterface as SI;
2014-08-10 08:01:46 -05:00
/**
* Class SearchController
*/
class SearchController extends BaseController
{
2014-09-22 00:25:14 -05:00
protected $_helper;
public function __construct(SI $helper)
{
$this->_helper = $helper;
2014-09-22 00:25:14 -05:00
}
2014-08-10 08:01:46 -05:00
/**
2014-09-22 00:25:14 -05:00
* Results always come in the form of an array [results, count, fullCount]
2014-08-10 08:01:46 -05:00
*/
public function index()
{
2014-09-22 00:25:14 -05:00
$subTitle = null;
if (!is_null(Input::get('q'))) {
$rawQuery = trim(Input::get('q'));
$words = explode(' ', $rawQuery);
$subTitle = 'Results for "' . e($rawQuery) . '"';
/*
* Search for transactions:
*/
$result = $this->_helper->transactions($words);
}
return View::make('search.index')->with('title', 'Search')->with('subTitle', $subTitle)->with(
'mainTitleIcon', 'fa-search'
);
}
}