75 lines
1.7 KiB
PHP
75 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Evomedien\Vitec\Controller;
|
|
|
|
use Evomedien\Vitec\Domain\Repository\UsecaseRepository;
|
|
use Evomedien\Vitec\Domain\Model\Usecase;
|
|
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
/**
|
|
* This file is part of the "VITEC" Extension for TYPO3 CMS.
|
|
*
|
|
* For the full copyright and license information, please read the
|
|
* LICENSE.txt file that was distributed with this source code.
|
|
*
|
|
* (c) 2025
|
|
*/
|
|
|
|
/**
|
|
* UsecaseController
|
|
*/
|
|
class UsecaseController extends ActionController
|
|
{
|
|
/**
|
|
* usecaseRepository
|
|
*
|
|
* @var UsecaseRepository
|
|
*/
|
|
protected $usecaseRepository;
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param UsecaseRepository $usecaseRepository
|
|
*/
|
|
public function __construct(UsecaseRepository $usecaseRepository)
|
|
{
|
|
$this->usecaseRepository = $usecaseRepository;
|
|
}
|
|
|
|
/**
|
|
* action show
|
|
*
|
|
* @param Usecase $usecase
|
|
* @return ResponseInterface
|
|
*/
|
|
public function showAction(): ResponseInterface
|
|
{
|
|
$selectedUsecaseId = (int)$this->settings['usecase']; // Die ID aus dem Flexform
|
|
$usecase = null;
|
|
if ($selectedUsecaseId) {
|
|
$usecase = $this->usecaseRepository->findByUid($selectedUsecaseId);
|
|
}
|
|
|
|
$this->view->assign('usecase', $usecase);
|
|
|
|
return $this->htmlResponse();
|
|
}
|
|
|
|
/**
|
|
* action list
|
|
*
|
|
* @param Usecase $usecase
|
|
* @return ResponseInterface
|
|
*/
|
|
public function listAction(): ResponseInterface
|
|
{
|
|
$usecases = $this->usecaseRepository->findAllWithCategories();
|
|
$this->view->assign('usecases', $usecases);
|
|
|
|
return $this->htmlResponse();
|
|
}
|
|
} |