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

class ComboboxNation extends Combobox
{
  protected function getDatamodulAry()
  {
    $laender = \ConstantOperations::getLaenderAry();

    $tmpary = array();
    foreach ($laender as $land) {
      $tmpary[] = $this->getDatamodul($land, $land);
    }

    return $tmpary;
  }

  protected function getValueFieldName()
  {
    return 'land';
  }

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

  protected function getDefaultOption()
  {
    $option = new ComboboxOption();
    $option->value = '';
    $option->text = 'Land ausw&auml;hlen...';
    $option->isSelected = is_null($this->selectedValue);

    return $option;
  }

  private function getDatamodul($land, $text)
  {
    $datamodul = new \Datamodul();
    $datamodul->land = $land;
    $datamodul->text = $text;

    return $datamodul;
  }
}