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

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

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

  public static function getToolSectionId()
  {
    return 759;
  }

  protected function getMainReiterId()
  {
    return 377;
  }

  protected function getButtons($pDatensaetzeVorhanden)
  {
    $buttonsObj = new \Kufer\Web\KuferTools\Basis\Kursdetails\Detailsreiter\MaEMailsReiterButtons($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->versandtvom = \SessionOperations::getCurrentWebToolsMitarbeiter()->kennung;
      $result->freigabe_ma_tools = true;
    }

    return $result;
  }
}