From 638fa9005f7e523265444ce8df182f8536a9f12f Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 12 Nov 2014 07:31:48 +0100 Subject: [PATCH] Excluded more files from the "old" libraries and included new ones instead. This should greatly clean up the code base. --- app/controllers/AccountController.php | 2 +- app/controllers/BudgetController.php | 2 +- app/controllers/CategoryController.php | 2 +- app/controllers/GoogleTableController.php | 2 +- app/controllers/PiggybankController.php | 2 +- app/controllers/PreferencesController.php | 37 +++++++++---------- app/controllers/ProfileController.php | 12 +++--- .../FireflyIII/Exception/FireflyException.php | 14 +++++++ .../Exception/ValidationException.php | 11 ++++++ 9 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 app/lib/FireflyIII/Exception/FireflyException.php create mode 100644 app/lib/FireflyIII/Exception/ValidationException.php diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index c875e0be64..2397451853 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -1,6 +1,6 @@ _accounts = $accounts; - $this->_preferences = $preferences; - View::share('title','Preferences'); - View::share('mainTitleIcon','fa-gear'); + View::share('title', 'Preferences'); + View::share('mainTitleIcon', 'fa-gear'); } /** @@ -31,13 +22,16 @@ class PreferencesController extends BaseController */ public function index() { - $accounts = $this->_accounts->getDefault(); + /** @var \FireflyIII\Database\Account $acct */ + $acct = App::make('FireflyIII\Database\Account'); - $viewRange = $this->_preferences->get('viewRange', '1M'); + /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ + $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); + + $accounts = $acct->getAssetAccounts(); + $viewRange = $preferences->get('viewRange', '1M'); $viewRangeValue = $viewRange->data; - - // pref: - $frontpage = $this->_preferences->get('frontpageAccounts', []); + $frontpage = $preferences->get('frontpageAccounts', []); return View::make('preferences.index')->with('accounts', $accounts)->with('frontpageAccounts', $frontpage) ->with('viewRange', $viewRangeValue); @@ -49,15 +43,18 @@ class PreferencesController extends BaseController public function postIndex() { + /** @var \FireflyIII\Shared\Preferences\Preferences $preferences */ + $preferences = App::make('FireflyIII\Shared\Preferences\Preferences'); + // frontpage accounts $frontpageAccounts = []; foreach (Input::get('frontpageAccounts') as $id) { $frontpageAccounts[] = intval($id); } - $this->_preferences->set('frontpageAccounts', $frontpageAccounts); + $preferences->set('frontpageAccounts', $frontpageAccounts); // view range: - $this->_preferences->set('viewRange', Input::get('viewRange')); + $preferences->set('viewRange', Input::get('viewRange')); // forget session values: Session::forget('start'); Session::forget('end'); diff --git a/app/controllers/ProfileController.php b/app/controllers/ProfileController.php index beda24d3cf..6692e02872 100644 --- a/app/controllers/ProfileController.php +++ b/app/controllers/ProfileController.php @@ -23,9 +23,9 @@ class ProfileController extends BaseController public function index() { return View::make('profile.index') - ->with('title', 'Profile') - ->with('subTitle', Auth::user()->email) - ->with('mainTitleIcon', 'fa-user'); + ->with('title', 'Profile') + ->with('subTitle', Auth::user()->email) + ->with('mainTitleIcon', 'fa-user'); } /** @@ -34,9 +34,9 @@ class ProfileController extends BaseController public function changePassword() { return View::make('profile.change-password') - ->with('title', Auth::user()->email) - ->with('subTitle', 'Change your password') - ->with('mainTitleIcon', 'fa-user'); + ->with('title', Auth::user()->email) + ->with('subTitle', 'Change your password') + ->with('mainTitleIcon', 'fa-user'); } /** diff --git a/app/lib/FireflyIII/Exception/FireflyException.php b/app/lib/FireflyIII/Exception/FireflyException.php new file mode 100644 index 0000000000..566a0cb437 --- /dev/null +++ b/app/lib/FireflyIII/Exception/FireflyException.php @@ -0,0 +1,14 @@ +