First version of a search interface.

This commit is contained in:
James Cole
2014-09-22 07:25:14 +02:00
parent e892b69a96
commit efcad0b935
6 changed files with 161 additions and 3 deletions

View File

@@ -1,16 +1,40 @@
<?php
use Firefly\Helper\Controllers\SearchInterface as SI;
/**
* Class SearchController
*/
class SearchController extends BaseController
{
protected $_helper;
public function __construct(SI $helper)
{
$this->_helper = $helper;
}
/**
*
* Results always come in the form of an array [results, count, fullCount]
*/
public function index()
{
$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'
);
}
}