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



 
 
 
class ExportKursorte extends ExportBasis
{
  
  public function initiate()
  {
    ExportBasis::initiate();
  }

  
  public function export()
  {
    $this->clearResult();
    $this->exportresults = $this->exportsets;
  }

  public function add($pKo)
  {
    array_push($this->exportsets, $pKo);
  }

  
  public function getVarValue($varname)
  {
    switch ($this->getVarCategory($varname)) {
      default: return parent::getVarValue($varname);
      case 'ktort_':
      case 'kort_': return $this->expCalculation->getVarValue4Kursort($this->getVarName($varname), $this->exportresults[$this->actualset]);
      case 'foto_':   
        $foto = \FotoAPI::getFotoByVarname($varname, 'R', $this->exportresults[$this->actualset]->id);
        if (!is_null($foto)) {
          return (new \Kufer\Web\Classes\Export\ExportCalculation\ExportCalcFotos())->resolveVar($foto['fotovarname'], $foto['foto'], $varname);
        } else {
          return '';
        }
      
      
      case 'haus_':
        $dbwgebaeude = new DBWorkGebaeude();
        $gebaeude = $dbwgebaeude->getGebaeudeByKursortNr($this->exportresults[$this->actualset]->id);
        $exportCalc = new \Kufer\Web\Classes\Export\ExportCalculation\ExportCalcGebaeude($this->getExportCalcBlaettern());

        return $exportCalc->resolveVar($this->getVarName($varname), $gebaeude);
    }
  }
}