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


class DBWorkWebToolsStdTempl extends DBWorkGenerated
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);
    $this->select = 'validfrom, validuntil, stammtyp, tool_id, template_id, id';
    $this->_dataModulFields = array('validfrom', 'validuntil', 'stammtyp', 'tool_id', 'template_id', 'id');
  }

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

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

  public function get4Doz()
  {
    return $this->getForStammtyp(1);
  }

  public function get4Teilnehmer()
  {
    return $this->getForStammtyp(0);
  }

  public function getForStammtyp($stammtyp)
  {
    $sql = 'SELECT ' . $this->select
           . ' FROM ' . $this->getTableName()
           . ' WHERE stammtyp = ' . $stammtyp;
    $this->dboperation->clear();
    $this->dboperation->query($sql);

    return $this->getAllRows();
  }
}