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

namespace Kufer\KuferTools\Veranstalter\KursUebersicht\Ics;


class IcsKalenderUseCase extends \Kufer\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\KuferTools\Utils\DatamodulHelper\KursTageHelper\VaIcsKalenderKurstage($this->toolSettings, $this->getUser(), $this->request);

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