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


class HinterlegungRaumart extends HinterlegungBasis
{
  
  public $data;

  
  public $filter;

  
  public function __construct()
  {
    parent::__construct();
    $dbwhlraumart = new DBWorkHLRaumart(1, true);
    $this->data = $dbwhlraumart->getAllRaumarten();
  }

  
  public function GetColumnCount()
  {
    return 1;
  }

  
  public function GetColumnTitle($index)
  {
    return 'Raumart';
  }

  
  public function GetColumnWidth($index)
  {
    return '95%';
  }

  
  public function GetIdColumnIndices()
  {
    return array(0);
  }

  
  public function GetRowCount()
  {
    return count($this->data);
  }

  
  public function GetValueAt($row, $col = 0)
  {
    return $this->data[$row]->raumart;
  }
}


class HinterlegungRaumartDialog extends HinterlegungDialogBasis
{
  
  public $data;

  public function __construct()
  {
    parent::__construct();
    $dbwhlraumart = new DBWorkHLRaumart(1, true);
    $this->data = $dbwhlraumart->getAllRaumarten();
  }

  public function GetColumnCount()
  {
    return 1;
  }

  public function GetColumnTitle($col)
  {
    return 'Raumart';
  }

  public function GetRowCount()
  {
    return count($this->data);
  }

  public function GetValueAt($row, $column)
  {
    return $this->data[$row]->raumart;
  }

  public function CreateTable($pMitJQueryChangeTrigger = false)
  {
    $rowCount = $this->GetRowCount();
    $columnCount = $this->GetColumnCount();

    $res = '<ul>' . "\n";
    for ($col = 0; $col < $columnCount; $col++) {
      $res .= '<li class="raumart_header"><span class="text">' . CleanOperations::cleanStringForHtml($this->GetColumnTitle($col)) . '</span></li>' . "\n";
    }
    for ($row = 0; $row < $rowCount; $row++) {
      $res .= '<li class="hl_zeile row_' . $row . ' opt">' . "\n";

      for ($col = 0; $col < $columnCount; $col++) {
        $cellValue = $this->GetValueAt($row, $col);
        if ($cellValue === '') {
          $cellValue = '&nbsp;';
        }
        $res .= '<a class="opt "   style="" aria-disabled="false" aria-selected="false">'
                . '<span class="text">' . CleanOperations::cleanStringForHtml($cellValue) . '</span></a>';
      }
      $res .= '</li>' . "\n";
    }
    $res .= '</ul>' . "\n";

    return $res;
  }
}