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

namespace Kufer\Web\KuferTools\Dozent\KursUebersicht\Detailsreiter\EMails;

class EMailsUseCase extends \Kufer\KuferTools\Basis\Kursdetails\DetailsReiter\EMails\EMailsUseCase
{
  public static function getToolId()
  {
    return \ToolsAPI::TOOL_KURSUEBERSICHT_DOZ;
  }

  public static function getToolSectionId()
  {
    return 802;
  }

  protected function getMainReiterId()
  {
    return 334;
  }

  protected function getButtons($pDatensaetzeVorhanden)
  {
    $buttonsObj = new \Kufer\KuferTools\Basis\Kursdetails\DetailsReiter\DozEMailsReiterButtons($this, $this->request, $this->response);
    $buttonsArray = $buttonsObj->getButtons($pDatensaetzeVorhanden);
    $selectionDependentButtons = array();
    $this->response->markierenButtons = $this->markierenButtonNotwendig($buttonsArray, $selectionDependentButtons);

    return $buttonsArray;
  }

  
  protected function getLinkForDatDoc($datdoc): string
  {
    $action = 'emailAnzeigen';

    return 'index.php?tool_id=' . $this->getToolId() . '&amp;action=' . $action
        . '&amp;knr=' . \CleanOperations::cleanStringForHtml($this->request->knr)
        . '&amp;lfdnr=' . $datdoc->lfdnr;
  }

  protected function getDatDoc($kurs)
  {
    $result = parent::getDatDoc($kurs);
    if (!$this->getUser()->isAdmin()) {
      $result->freigabe_doz_tools = true;
    }

    return $result;
  }
}