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

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

class WssFieldKursGebuehrTeilnehmer extends \Kufer\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));
  }
}