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

namespace Kufer\KuferTools\Veranstalter\Anmeldung\NachlassDialog;

class NachlassDialogUseCase extends \Kufer\KuferTools\Basis\NachlassDialog\NachlassDialogUseCase
{
  public static function getToolSectionId()
  {
    return 634;
  }

  public static function getToolId()
  {
    return \ToolsAPI::TOOL_ANMELDUNGBUCHEN_VA;
  }

  protected function getFormularAction()
  {
    $xsrf = new \Xsrf();
    $xsrfKey = $xsrf->generateKey4Action('handleAnmeldung', $this->request->knr);
    
    return 'index.php?tool_id=' . self::getToolId() . '&action=handleAnmeldung&knr='
                  . $this->request->knr . '&xsrf=' . $xsrfKey;
  }

  private function isFormReadonly()
  {
    return \SessionOperations::getVarValueWTIntern('AnmeldungReadonly_' . $this->getToolId()) == 1;
  }

  protected function getResponse()
  {
    $response = parent::getResponse();
    $response->disabled = $this->isFormReadonly();

    return $response;
  }
}