| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- declare(strict_types=1);
- namespace Meramo\Begriffmgt\Controller;
- use Meramo\Begriffmgt\Domain\Repository\TypeRepository;
- use Meramo\Begriffmgt\Domain\Repository\UrlRepository;
- use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
- use Meramo\Begriffmgt\Domain\Repository\TermRepository;
- use Meramo\Begriffmgt\Domain\Repository\CategoryRepository;
- class DashboardController extends ActionController
- {
- protected $termRepository;
- protected $termController;
- protected $categoryRepository;
- protected $categoryController;
- protected $typeRepository;
- protected $typeController;
- protected $urlRepository;
- protected $urlController;
- public function __construct(
- TermRepository $termRepository,
- CategoryRepository $categoryRepository,
- CategoryController $categoryController,
- TypeRepository $typeRepository,
- TypeController $typeController,
- UrlRepository $urlRepository,
- UrlController $urlController,
- TermController $termController
- ) {
- $this->termRepository = $termRepository;
- $this->categoryRepository = $categoryRepository;
- $this->categoryController = $categoryController;
- $this->termController = $termController;
- $this->typeRepository = $typeRepository;
- $this->typeController = $typeController;
- $this->urlRepository = $urlRepository;
- $this->urlController = $urlController;
- }
- public function indexAction(): void
- {
- $terms = $this->termRepository->findAll();
- $categories = $this->categoryRepository->findAll();
- $types = $this->typeRepository->findAll();
- $urls = $this->urlRepository->findAll();
- $this->view->assignMultiple([
- 'terms' => $terms,
- 'categories' => $categories,
- 'types' => $types,
- 'urls' => $urls
- ]);
- }
- public function newAction(): void {
- }
- public function listAction(): void {
- $terms = $this->termRepository->findAll();
- $this->view->assign('terms', $terms);
- }
- public function createAction(string $termList, string $categoryTitle, string $typeTitle, string $urlTitle): void {
- $terms = array_map('trim', explode(',', $termList));
- $category = $this->categoryController->createAction($categoryTitle);
- $categoryObj = $this->categoryRepository->findByUid($category);
- $type = $this->typeController->createAction($typeTitle);
- $typeObj = $this->typeRepository->findByUid($type);
- $url = $this->urlController->createAction($urlTitle);
- $urlObj = $this->urlRepository->findByUid($url);
- $this->termController->createAction($terms, $categoryObj, $typeObj, $urlObj);
- $this->redirect('index');
- }
- }
|