<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

namespace Kufer\KuferTools\Dozent\Anwesenheiten\KurstageUebersicht;

class KurstageUebersichtController extends \Kufer\KuferTools\Basis\Controller\ToolController
{
  
  protected function getUseCase(): \Kufer\KuferTools\Basis\UseCase\UseCase
  {
    return new KurstageUebersichtUseCase(
      $this->getRequestObj()
    );
  }

  
  protected function getRequestObj()
  {
    $requestObj = new KurstageUebersichtRequest();
    $requestObj->einstieg = \GetOperations::isDefined('einstieg');

    $datum = \trim(\RequestOperations::getVarValue('datum', \DateTimeOperations::getDateNow()));
    $filter = new \InputfilterTools();
    $requestObj->datum = $filter->getValidDate($datum);
    if ($requestObj->datum == '01.01.2000') { 
      $requestObj->datum = \DateTimeOperations::getDateNow();
    }
    $requestObj->referer = \GetOperations::getVarValue('referer');
    $requestObj->refererLabel = \GetOperations::getVarValue('refererLabel');

    return $requestObj;
  }

  
  protected function getPresenter($pUseCaseResponse)
  {
    return new KurstageUebersichtPresenter($pUseCaseResponse);
  }
}