First commit

This commit is contained in:
Patrick Niebeling
2025-03-12 10:33:41 +01:00
commit 05f50ea068
5 changed files with 168 additions and 0 deletions

44
lib/Settings/Personal.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace OCA\DeckFlow\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Settings\ISettings;
use OCP\IConfig;
use OCP\IUserSession;
use OCA\Deck\Service\BoardService;
use OCA\Deck\Service\StackService;
class Personal implements ISettings {
private IConfig $config;
private IUserSession $userSession;
private BoardService $boardService;
private StackService $stackService;
public function __construct(IConfig $config, IUserSession $userSession, BoardService $boardService, StackService $stackService) {
$this->config = $config;
$this->userSession = $userSession;
$this->boardService = $boardService;
$this->stackService = $stackService;
}
public function getForm() {
$userId = $this->userSession->getUser()->getUID();
$rules = json_decode($this->config->getUserValue($userId, 'deckflow', 'rules', '[]'), true);
$boards = $this->boardService->findAllBoards();
$stacks = [];
foreach ($boards as $board) {
$stacks[$board['id']] = $this->stackService->findAllStacksInBoard($board['id']);
}
return new TemplateResponse('deckflow', 'personal', [
'rules' => $rules,
'boards' => $boards,
'stacks' => $stacks
]);
}
public function getSection() { return 'deckflow'; }
public function getPriority() { return 50; }
}