mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
* Locales: use http-accept-language or "language"-cookie * Add user-setting "locale" Rename CULTURE to DEFAULT_LOCALE * Use LocaleMiddleware also in dev mode * CORS: don't require authentication on OPTIONS * Use a standard user-settings-control and start a new generic user settings page, not a separate page for the locale setting * Fixed (broken by myself) link-return handling * Clarify language settings * Removed unneeded files * Better user settings icon * Added localization hints Co-authored-by: Bernd Bestel <bernd@berrnd.de>
66 lines
1.1 KiB
PHP
66 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Grocy\Services;
|
|
|
|
#use \Grocy\Services\DatabaseService;
|
|
#use \Grocy\Services\LocalizationService;
|
|
|
|
class BaseService
|
|
{
|
|
public function __construct() {
|
|
}
|
|
|
|
private static $instances = array();
|
|
|
|
public static function getInstance()
|
|
{
|
|
$className = get_called_class();
|
|
if(!isset(self::$instances[$className]))
|
|
{
|
|
self::$instances[$className] = new $className();
|
|
}
|
|
|
|
return self::$instances[$className];
|
|
}
|
|
|
|
protected function getDatabaseService()
|
|
{
|
|
return DatabaseService::getInstance();
|
|
}
|
|
|
|
protected function getDatabase()
|
|
{
|
|
return $this->getDatabaseService()->GetDbConnection();
|
|
}
|
|
|
|
protected function getLocalizationService()
|
|
{
|
|
return LocalizationService::getInstance(GROCY_LOCALE);
|
|
}
|
|
|
|
protected function getStockservice()
|
|
{
|
|
return StockService::getInstance();
|
|
}
|
|
|
|
protected function getTasksService()
|
|
{
|
|
return TasksService::getInstance();
|
|
}
|
|
|
|
protected function getChoresService()
|
|
{
|
|
return ChoresService::getInstance();
|
|
}
|
|
|
|
protected function getBatteriesService()
|
|
{
|
|
return BatteriesService::getInstance();
|
|
}
|
|
|
|
protected function getUsersService()
|
|
{
|
|
return UsersService::getInstance();
|
|
}
|
|
}
|