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

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

class EMailsUseCase extends \Kufer\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\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;
  }
}