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


class DBWorkHLNiveau extends DBWork
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);
    $this->select = 'id, niveau, bemerkung';
    $this->orderby = 'niveau';
    $this->orderbyasc = true;
  }

  
  public function getNewObject()
  {
    return new HLNiveau();
  }

  public function getTableName(): string
  {
    return 'hlniveau';
  }

  
  public function getCurrentRow($pRefreshCache = false)
  {
    $tmp = $this->getNewObject();

    $tmp->id = $this->getDatamodulValue('id');
    $tmp->niveau = $this->getDatamodulValue('niveau');
    $tmp->bemerkung = $this->getDatamodulValue('bemerkung');

    return $tmp;
  }

  public function getAll()
  {
    $sql = "SELECT $this->select FROM hlniveau "
                      . $this->getCompleteOrderByDefault('niveau');
    $this->dboperation->clear();
    $this->dboperation->query($sql);

    return $this->getAllRows();
  }
}