mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Code cleanup [skip-ci]
This commit is contained in:
@@ -3,43 +3,57 @@
|
||||
use Firefly\Helper\Preferences\PreferencesHelperInterface as PHI;
|
||||
use Firefly\Storage\Account\AccountRepositoryInterface as ARI;
|
||||
|
||||
/**
|
||||
* Class PreferencesController
|
||||
*/
|
||||
class PreferencesController extends BaseController
|
||||
{
|
||||
protected $accounts;
|
||||
protected $preferences;
|
||||
protected $_accounts;
|
||||
protected $_preferences;
|
||||
|
||||
/**
|
||||
* @param ARI $accounts
|
||||
* @param PHI $preferences
|
||||
*/
|
||||
public function __construct(ARI $accounts, PHI $preferences)
|
||||
{
|
||||
|
||||
$this->accounts = $accounts;
|
||||
$this->preferences = $preferences;
|
||||
$this->_accounts = $accounts;
|
||||
$this->_preferences = $preferences;
|
||||
View::share('menu', 'home');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$accounts = $this->accounts->getDefault();
|
||||
$accounts = $this->_accounts->getDefault();
|
||||
|
||||
$viewRange = $this->preferences->get('viewRange','1M');
|
||||
$viewRange = $this->_preferences->get('viewRange', '1M');
|
||||
$viewRangeValue = $viewRange->data;
|
||||
|
||||
// pref:
|
||||
$frontpage = $this->preferences->get('frontpageAccounts', []);
|
||||
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)->with('viewRange',$viewRangeValue);
|
||||
$frontpage = $this->_preferences->get('frontpageAccounts', []);
|
||||
return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage)
|
||||
->with('viewRange', $viewRangeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function postIndex()
|
||||
{
|
||||
|
||||
// frontpage accounts
|
||||
$frontpageAccounts = [];
|
||||
foreach(Input::get('frontpageAccounts') as $id) {
|
||||
foreach (Input::get('frontpageAccounts') as $id) {
|
||||
$frontpageAccounts[] = intval($id);
|
||||
}
|
||||
$this->preferences->set('frontpageAccounts',$frontpageAccounts);
|
||||
$this->_preferences->set('frontpageAccounts', $frontpageAccounts);
|
||||
|
||||
// view range:
|
||||
$this->preferences->set('viewRange',Input::get('viewRange'));
|
||||
$this->_preferences->set('viewRange', Input::get('viewRange'));
|
||||
// forget session values:
|
||||
Session::forget('start');
|
||||
Session::forget('end');
|
||||
|
Reference in New Issue
Block a user