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

class Kommunikation extends Datamodul
{
  public const TYP_TEILNEHMER = 'T';
  public const TYP_DOZENT = 'D';
  public const TYP_ADRESSE = 'A';
  public const TYP_AUSSENSTELLE = 'S';

  public $wert;

  
  public $typ;

  
  public $art;
  public $nr;
  public $bezeichner;
  public $sort;
  public $druck;
  public $sperre_inet;

  public function getTyp($pFieldName)
  {
    switch ($pFieldName) {
      default:
        return parent::getTyp($pFieldName);
      case 'sort':
        return \DatamodulVarType::TYPE_INT;
      case 'sperre_inet':
        return \DatamodulVarType::TYPE_BOOL;
    }
  }

  public function getDMZValue($fieldname)
  {
    $dmzValue = parent::getDMZValue($fieldname);
    
    if ($fieldname == 'nr') {
      $dmzValue = $this->nr;
    }

    return $dmzValue;
  }

  public function __toString()
  {
    return isset($this->wert) ? $this->wert : '';
  }
}