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

namespace Kufer\KuferTools\Basis\PdfListen\ShowPdfListen;


class ShowPdfListenPresenter extends \Kufer\KuferTools\Basis\Presenter\Presenter
{
  protected function getView()
  {
    return new ShowPdfListenView($this->getViewModel());
  }

  protected function getViewModel()
  {
    $viewModel = new ShowPdfListenViewModel();
    
    
    
    $listAry = $this->useCaseResponse->listAry;
    $showInfo = false;
    
    foreach ($listAry as $listObj) {
      $listObj->toolId = $this->useCaseResponse->toolId;
      $listObj->dnr = $this->useCaseResponse->dnr;
      $listObj->infoButton = $this->ShowInfoTextOderInfoButtonAnzeigen($listObj->showInfo, $this->useCaseResponse->druckAutomatischMeldung);
      $listObj->druckAutomatischMeldung = $this->ShowInfoTextOderInfoButtonAnzeigen($this->useCaseResponse->druckAutomatischMeldung, $showInfo);

      $this->_getActionParams($listObj);
    }

    $viewModel->listAry = $listAry;
    $viewModel->headerTitle = $this->_getHeaderTitle();
    $viewModel->infoButton = $this->ShowInfoTextOderInfoButtonAnzeigen($showInfo, $this->useCaseResponse->druckAutomatischMeldung);
    $viewModel->druckAutomatischMeldung = $this->ShowInfoTextOderInfoButtonAnzeigen($this->useCaseResponse->druckAutomatischMeldung, $showInfo);
    $viewModel->listgroesseClass = $this->useCaseResponse->listgroesseClass;
    $viewModel->toolId = $this->useCaseResponse->toolId;

    return $viewModel;
  }

  

  private function ShowInfoTextOderInfoButtonAnzeigen($pWert1, $pWert2)
  {
    if ($pWert1 === true && $pWert2 === false) {
      return $pWert1;
    } elseif ($pWert1 === false && $pWert2 === true) {
      return $pWert1;
    } else {
      return false;
    }
  }

  
  protected function _getActionParams(&$pListObj)
  {
  }

  
  protected function _getHeaderTitle()
  {
    return '';
  }
}