1 | <?php |
||
29 | class SettingsService { |
||
30 | |||
31 | private $userId; |
||
32 | private $config; |
||
33 | private $appName; |
||
34 | public $settings; |
||
35 | public $userSettings; |
||
36 | |||
37 | |||
38 | private $numeric_settings = array( |
||
39 | 'link_sharing_enabled', |
||
40 | |||
41 | ); |
||
42 | |||
43 | public function __construct($UserId, IConfig $config, $AppName) { |
||
56 | |||
57 | /** |
||
58 | * Get all settings |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | public function getSettings() { |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Get all app settings |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | public function getAppSettings() { |
||
79 | |||
80 | /** |
||
81 | * Get all user settings |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | public function gettUserSettings() { |
||
88 | |||
89 | /** |
||
90 | * Get a app setting |
||
91 | * |
||
92 | * @param $key string |
||
93 | * @param null $default_value The default value if key does not exist |
||
94 | * @return mixed |
||
95 | */ |
||
96 | public function getAppSetting($key, $default_value = null) { |
||
104 | |||
105 | /** |
||
106 | * Set a app setting |
||
107 | * |
||
108 | * @param $key string Setting name |
||
109 | * @param $value mixed Value of the setting |
||
110 | */ |
||
111 | public function setAppSetting($key, $value) { |
||
115 | |||
116 | /** |
||
117 | * Set a user setting |
||
118 | * |
||
119 | * @param $key string Setting name |
||
120 | * @param $value mixed Value of the setting |
||
121 | */ |
||
122 | |||
123 | public function setUserSetting($key, $value) { |
||
126 | |||
127 | /** |
||
128 | * Check if an setting is enabled (value of 1) |
||
129 | * |
||
130 | * @param $setting |
||
131 | * @return bool |
||
132 | */ |
||
133 | public function isEnabled($setting) { |
||
137 | } |