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

namespace Kufer\Web\KuferTools\Basis\Kursdetails\Detailsreiter\Teilnehmer\Bescheinigung;

use Kufer\Web\Classes\Pdf\ExtFPDITcPDF;

abstract class BescheinigungView extends \Kufer\Web\KuferTools\Basis\View\ViewSight
{
  public function show()
  {
    $html = parent::show();

    $pdf = new ExtFPDITcPDF('P', 'mm', 'A4', true, 'UTF-8', false, 2);
    $pdf->AddPage();
    $pdf->writeHTML($html);
    $pdf->Output('bestaetigung-' . \CodingOperations::convertSingleFileNameSpecialChars($this->viewModel->kurs->getVarValue('nr_anzeige')) . '.pdf');

    return '';
  }

  protected function getHeaderDataModulArray()
  {
    return array($this->viewModel->kurs);
  }

  protected function getHeaderExportAdapter()
  {
    return new \ExpKurse();
  }

  protected function getBodyDataModulArray()
  {
    return $this->viewModel->belegungen;
  }

  protected function getBodyExportAdapter()
  {
    return new \ExpBelegung();
  }

  protected function getFooterDataModulArray()
  {
    return array($this->viewModel->kurs);
  }

  protected function getFooterExportAdapter()
  {
    return new \ExpKurse();
  }
}