From 4b7ece614ff6b7412be0e0b458416b7ec52a982d Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 20 Aug 2016 18:06:41 -0300 Subject: [PATCH] Ivan - Backend - Add /system/get-settings path[skip ci] --- server/controllers/system.php | 2 ++ server/controllers/system/get-settings.php | 20 ++++++++++++++++++++ server/controllers/system/init-settings.php | 2 ++ server/models/Department.php | 12 ++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 server/controllers/system/get-settings.php diff --git a/server/controllers/system.php b/server/controllers/system.php index cea7f0c1..38e7db29 100644 --- a/server/controllers/system.php +++ b/server/controllers/system.php @@ -1,9 +1,11 @@ setGroupPath('/system'); $systemControllerGroup->addController(new InitSettingsController); +$systemControllerGroup->addController(new GetSettingsController); $systemControllerGroup->finalize(); \ No newline at end of file diff --git a/server/controllers/system/get-settings.php b/server/controllers/system/get-settings.php new file mode 100644 index 00000000..5593282c --- /dev/null +++ b/server/controllers/system/get-settings.php @@ -0,0 +1,20 @@ + 'any', + 'requestData' => [] + ]; + } + + public function handler() { + Response::respondSuccess([ + 'language' => Setting::getSetting('language')->getValue(), + 'reCaptchaKey' => Setting::getSetting('recaptcha-public')->getValue(), + 'departments' => Department::getDepartmentNames() + ]); + } +} \ No newline at end of file diff --git a/server/controllers/system/init-settings.php b/server/controllers/system/init-settings.php index b17aca96..24b8d357 100644 --- a/server/controllers/system/init-settings.php +++ b/server/controllers/system/init-settings.php @@ -25,6 +25,8 @@ class InitSettingsController extends Controller { private function storeGlobalSettings() { $this->storeSettings([ 'language' => 'en', + 'recaptcha-public' => '6LfM5CYTAAAAAGLz6ctpf-hchX2_l0Ge-Bn-n8wS', + 'recaptcha-private' => '6LfM5CYTAAAAAP3dfBJfC49X2qVm0tH9IZ-VZjzw', 'no-reply-email' => 'noreply@opensupports.com', 'smtp-host' => 'localhost', 'smtp-port' => 7070, diff --git a/server/models/Department.php b/server/models/Department.php index 05add3ff..a019bc77 100644 --- a/server/models/Department.php +++ b/server/models/Department.php @@ -1,4 +1,5 @@ name; + } + + return $departmentsNameList; + } } \ No newline at end of file