First commit
This commit is contained in:
44
lib/Settings/Personal.php
Normal file
44
lib/Settings/Personal.php
Normal 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; }
|
||||
}
|
Reference in New Issue
Block a user