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

class ComboboxZielgruppe extends Combobox
{
  protected function getDatamodulAry(): array
  {
    $dbw = new DBWorkZielgruppeProgrammheft(1, true);

    return $dbw->getZielgruppen();
  }

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

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

  protected function getText($datamodul): string
  {
    return $datamodul->getVarValue('text');
  }

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

    return $option;
  }
}