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

namespace Kufer\Web\KuferTools\Veranstalter\KursUebersicht\Ics;


class IcsKalenderUseCase extends \Kufer\Web\KuferTools\Basis\Ics\IcsKalenderUseCase
{
  public static function getToolId()
  {
    return \ToolsAPI::TOOL_KURSUEBERSICHT_VA;
  }

  public static function getToolSectionId()
  {
    return 622;
  }

  public function hasAccess($pToolSectionId = null)
  {
    if (!parent::hasAccess()) {
      return false;
    }
    if (!$this->isRechtAllowed('622.0.3') && !$this->isRechtAllowed('632.0.6')) {
      return false;
    }

    return true;
  }

  protected function getAllowedKursnummern()
  {
    $kurshelper = $this->getKursHelper();

    return $kurshelper->getIdsOhneFilter();
  }

  
  protected function getResponse()
  {
    $this->response = parent::getResponse();
    $this->response->kursnummern = $this->request->kursnummern;

    return $this->response;
  }

  protected function getKursTage()
  {
    $kthelper = new \Kufer\Web\KuferTools\Utils\DatamodulHelper\KursTage\VaIcsKalenderKurstage($this->toolSettings, $this->getUser(), $this->request);

    return $kthelper->getDatamoduleMitFilter($this->getToolId());
  }
}