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

namespace Kufer\Web\KuferTools\Dozent\SammelVertraege\Drucken;

use Kufer\KuferTools\Basis\Presenter\BasePresenter;

class SammelVertragDruckenPresenter implements BasePresenter
{
  protected $decoded;

  public function __construct($useCaseResponse)
  {
    $this->decoded = base64_decode($useCaseResponse->datDoc->ContentBase64);
  }

  public function present()
  {
    return $this->decoded;
  }

  public function setRequestHeader()
  {
    header('Content-Length: ' . strlen($this->decoded));
    header('Content-Type: application/octetstream');
    header('Content-Disposition: inline; filename="' . rawurlencode('Sammelvertrag.pdf') . '"');
  }

  public function getEncoding()
  {
    return UTF_8;
  }

  public function getExternalEncoding()
  {
    return $this->getEncoding();
  }
}