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

namespace Kufer\Web\KuferTools\Utils\WssField\Kurs;

class WssFieldKursGebuehrTeilnehmer extends \Kufer\Web\KuferTools\Utils\WssField\WssField
{
  public function getValue($datamodulWert, $isFormular = false)
  {
    $tn = \SessionOperations::getCurrentWebToolsUser();
    $kurs = $datamodulWert->getDatamodulByName('kurs');
    $gebuehr = \APIGebuehren::getGebuehren($tn->tnr, $kurs->id);

    return $gebuehr . ' ' . \StringOperations::html_entity_decode(CURRENCY, ENT_COMPAT | ENT_HTML5);
  }

  public function isValueEmpty($value): bool
  {
    return $value === '0,00 ' . \StringOperations::htmlentities(\StringOperations::html_entity_decode(CURRENCY, ENT_COMPAT | ENT_HTML5));
  }
}