<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Basis\DozentenInfo\NewDozent\HandleDozentInsert;

abstract class HandleDozentInsertController extends \Kufer\Web\KuferTools\Basis\Controller\ToolController
{
  abstract protected function getToolId();

  abstract protected function getToolSectionId();

  abstract protected function getUser();

  protected function getRequestObj()
  {
    $requestObj = new HandleDozentInsertRequest();
    $requestObj->dnr = \GetOperations::getVarValue('dnr', -1);

    $wssHandler = new \Kufer\Web\KuferTools\Utils\WssHandler($this->getToolId(), $this->getToolSectionId(), $this->getUser());
    $requestObj->columnValues = $wssHandler->getColumnValuesFromPost();
    $requestObj->wssHandler = $wssHandler;

    $action = $this->getActionVal();

    return $this->handleXsrf($requestObj, $action);
  }

  protected function getPresenter($pUseCaseResponse)
  {
    
    return null;
  }

  
  abstract protected function getDozentenDetailsToolId();

  protected function getControllerToForward($pUseCaseResponse)
  {
    if ($pUseCaseResponse->dnr == -1) {
      header('Location: index.php?tool_id=' . $this->getDozentenDetailsToolId());
    } else {
      header('Location: index.php?tool_id=' . $this->getDozentenDetailsToolId() . '&action=dozentdetails&dnr=' . $pUseCaseResponse->dnr);
    }

    die();
  }
}