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

class ComboboxVeranstaltungsart extends Combobox
{
  protected function getDatamodulAry(): array
  {
    $db = new DBWorkVeranstaltungsart(1, true);
    $db->orderby = 'text ASC';

    return $db->getVeranstaltungsarten();
  }

  protected function getValueFieldName(): string
  {
    return 'kennz';
  }

  protected function getTextFieldName(): string
  {
    return 'text';
  }

  protected function getDefaultOption(): ?\ComboboxOption
  {
    $option = new ComboboxOption();
    $option->value = '';
    $option->text = '--Veranstaltungsart auswählen--';
    $option->isSelected = is_null($this->selectedValue);

    return $option;
  }
}