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

namespace Kufer\Web\KuferTools\Mitarbeiter\DozentenInfo\SammelEMail;

class SammelEMailView extends \Kufer\Web\KuferTools\Basis\DozentenInfo\SammelEMail\SammelEMailView
{
  public function getTemplatePathRelative()
  {
    return 'mitarbeiter/dozenteninfo/sammelemail.sgt';
  }

  protected function getDefaultDataModulArray()
  {
    return array_map(function($datamodul) {
      $datamodul->emailandozentsendermultiple = $this->viewModel->emailAnDozentSenderMultiple;
      $datamodul->ma = $this->viewModel->ma;

      return $datamodul;
    }, parent::getDefaultDataModulArray());
  }

  protected function getDefaultExportAdapter()
  {
    return new class() extends \ExpBasis {
      public function initiate()
      {
        $this->export = new class() extends \ExportBasis {
          public function getVarValue($varname)
          {
            switch ($this->getVarCategory($varname)) {
              default:
                return parent::getVarValue($varname);
              case 'ma_':
                return $this->expCalculation->getDefaultVarValue($this->getVarName($varname), $this->exportresults[$this->actualset]->ma ?? new \BASysBenutzer());
              case 'email_':
                return $this->expCalculation->getDefaultVarValue($this->getVarName($varname), $this->exportresults[$this->actualset]);
            }
          }
        };
      }
    };
  }
}