2025-02-07 08:47:09 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
*/
|
2026-05-28 08:54:31 -04:00
|
|
|
|
2025-02-07 08:47:09 -05:00
|
|
|
namespace OCA\DAV\Settings;
|
|
|
|
|
|
|
|
|
|
use OCA\DAV\AppInfo\Application;
|
2025-06-18 05:32:35 -04:00
|
|
|
use OCA\DAV\Service\ExampleContactService;
|
2025-06-03 07:45:43 -04:00
|
|
|
use OCA\DAV\Service\ExampleEventService;
|
2025-02-07 08:47:09 -05:00
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
2025-06-18 05:32:35 -04:00
|
|
|
use OCP\AppFramework\Services\IAppConfig;
|
2025-02-07 08:47:09 -05:00
|
|
|
use OCP\AppFramework\Services\IInitialState;
|
|
|
|
|
use OCP\Settings\ISettings;
|
2025-11-17 05:58:02 -05:00
|
|
|
use OCP\Util;
|
2025-02-07 08:47:09 -05:00
|
|
|
|
|
|
|
|
class ExampleContentSettings implements ISettings {
|
|
|
|
|
public function __construct(
|
2025-06-05 04:59:28 -04:00
|
|
|
private readonly IAppConfig $appConfig,
|
2025-06-03 07:45:43 -04:00
|
|
|
private readonly IInitialState $initialState,
|
|
|
|
|
private readonly ExampleEventService $exampleEventService,
|
2025-06-18 05:32:35 -04:00
|
|
|
private readonly ExampleContactService $exampleContactService,
|
2025-02-07 08:47:09 -05:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 13:35:30 -04:00
|
|
|
#[\Override]
|
2025-02-07 08:47:09 -05:00
|
|
|
public function getForm(): TemplateResponse {
|
2026-06-21 13:13:07 -04:00
|
|
|
$this->initialState->provideInitialState('create_example_event', $this->exampleEventService->shouldCreateExampleEvent());
|
|
|
|
|
$this->initialState->provideInitialState('has_custom_example_event', $this->exampleEventService->hasCustomExampleEvent());
|
|
|
|
|
$this->initialState->provideInitialState('enableDefaultContact', $this->exampleContactService->isDefaultContactEnabled());
|
|
|
|
|
$this->initialState->provideInitialState('hasCustomDefaultContact', $this->appConfig->getAppValueBool('hasCustomDefaultContact'));
|
2025-06-03 07:45:43 -04:00
|
|
|
|
2025-11-17 05:58:02 -05:00
|
|
|
Util::addStyle(Application::APP_ID, 'settings-admin-example-content');
|
|
|
|
|
Util::addScript(Application::APP_ID, 'settings-admin-example-content');
|
2025-10-22 17:07:55 -04:00
|
|
|
return new TemplateResponse(Application::APP_ID, 'settings-admin-example-content');
|
2025-02-07 08:47:09 -05:00
|
|
|
}
|
2025-06-03 07:45:43 -04:00
|
|
|
|
2026-04-28 13:35:30 -04:00
|
|
|
#[\Override]
|
2025-02-07 08:47:09 -05:00
|
|
|
public function getSection(): ?string {
|
|
|
|
|
return 'groupware';
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 13:35:30 -04:00
|
|
|
#[\Override]
|
2025-02-07 08:47:09 -05:00
|
|
|
public function getPriority(): int {
|
|
|
|
|
return 10;
|
|
|
|
|
}
|
|
|
|
|
}
|