2014-07-29 13:30:50 -05:00
|
|
|
<?php
|
2014-11-12 03:54:53 -06:00
|
|
|
use FireflyIII\Exception\NotImplementedException;
|
2014-09-22 00:25:14 -05:00
|
|
|
|
2014-08-10 08:01:46 -05:00
|
|
|
/**
|
|
|
|
* Class SearchController
|
|
|
|
*/
|
2014-08-09 06:50:54 -05:00
|
|
|
class SearchController extends BaseController
|
2014-07-29 13:30:50 -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
|
|
|
*/
|
2014-07-29 13:30:50 -05:00
|
|
|
public function index()
|
|
|
|
{
|
2014-11-12 03:54:53 -06:00
|
|
|
throw new NotImplementedException;
|
2014-09-22 00:25:14 -05:00
|
|
|
$subTitle = null;
|
2014-09-26 23:06:31 -05:00
|
|
|
$rawQuery = null;
|
|
|
|
$result = [];
|
2014-09-22 00:25:14 -05:00
|
|
|
if (!is_null(Input::get('q'))) {
|
|
|
|
$rawQuery = trim(Input::get('q'));
|
|
|
|
$words = explode(' ', $rawQuery);
|
|
|
|
$subTitle = 'Results for "' . e($rawQuery) . '"';
|
|
|
|
|
2014-09-26 23:06:31 -05:00
|
|
|
$transactions = $this->_helper->searchTransactions($words);
|
|
|
|
$accounts = $this->_helper->searchAccounts($words);
|
|
|
|
$categories = $this->_helper->searchCategories($words);
|
|
|
|
$budgets = $this->_helper->searchBudgets($words);
|
|
|
|
$tags = $this->_helper->searchTags($words);
|
|
|
|
$result = [
|
|
|
|
'transactions' => $transactions,
|
|
|
|
'accounts' => $accounts,
|
|
|
|
'categories' => $categories,
|
|
|
|
'budgets' => $budgets,
|
|
|
|
'tags' => $tags
|
|
|
|
];
|
2014-09-22 00:25:14 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return View::make('search.index')->with('title', 'Search')->with('subTitle', $subTitle)->with(
|
|
|
|
'mainTitleIcon', 'fa-search'
|
2014-09-26 23:06:31 -05:00
|
|
|
)->with('query', $rawQuery)->with('result',$result);
|
2014-07-29 13:30:50 -05:00
|
|
|
}
|
|
|
|
}
|