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


class DBWorkHLDozStdplanUhr extends DBWorkHLBasis
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);

    $this->select = 'id, uhrvon, uhrbis, bemerkung';
  }

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

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

  
  public function getCurrentRow($pRefreshCache = false)
  {
    $obj = $this->getNewObject();
    $obj->id = $this->getDatamodulValue('id');
    $obj->uhrvon = $this->getDatamodulValue('uhrvon');
    $obj->uhrbis = $this->getDatamodulValue('uhrbis');
    $obj->bemerkung = $this->getDatamodulValue('bemerkung');

    return $obj;
  }

  
  public function getAll()
  {
    $sql = "SELECT $this->select FROM hldozstdplan_uhr order by uhrvon ASC";
    $this->dboperation->clear();
    $this->dboperation->query($sql);

    return $this->getAllRows();
  }

  
  public function getOne($pId)
  {
    $id = $this->dboperation->getInt4Sql($pId);
    $sql = "SELECT $this->select FROM hldozstdplan_uhr WHERE id = '$id'";
    $this->dboperation->clear();
    $this->dboperation->query($sql);
    if ($this->dboperation->rowcount() == 0) {
      return false;
    }

    return $this->getFirstRow();
  }
}