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

namespace Kufer\Web\Classes\Export\ExportCalculation;

class ExportCalcLoginPasswortVergessenEdit extends ExportCalc
{
  public function resolveVar(string $varname, ?\Datamodul $datamodul = null): string
  {
    $pflicht = '';
    $varparam = '';
    if (\StringOperations::isVarPflichtfeld($varname)) {
      $feldname = \StringOperations::substr($varname, 0, \StringOperations::strpos($varname, '_pflichtfeld:') + 12);
      $feldtext = \StringOperations::substr($varname, \StringOperations::strpos($varname, '_pflichtfeld:') + 13, \StringOperations::strlen($varname) - 1);
      $varparam = $feldtext;
      $pflicht = PHP_EOL . \HTMLOperations::CreateInputTag(
        'wbledit_' . $feldname,
        'hidden',
        '',
        'wbledit wbledit_' . $feldname . 'class',
        urlencode($feldtext)
      );
      $varname = \StringOperations::substr($varname, 0, \StringOperations::strpos($varname, '_pflichtfeld:'));
    } else {
      
      
      
      
      if (\StringOperations::strpos($varname, ':') > 0) {
        $parts = explode(':', $varname);
        $varname = $parts[0];
        $varparam = $parts[1];
      }
    }
    switch ($varname) {
      case 'password':
      case 'password2':
        $fieldname = 'wbledit_' . $varname;

        return \HTMLOperations::CreateInputTag(
          $fieldname,
          'password',
          $fieldname,
          '',
          ''
        ) . $pflicht;
      default:
        $fieldname = 'wbledit_' . $varname;

        return \HTMLOperations::CreateInputTag(
          $fieldname,
          'text',
          $fieldname,
          '',
          \RequestOperations::getVarValue($fieldname)
        ) . $pflicht;
    }
  }
}