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


class DBWorkKurseWTINetAktiv extends DBWorkKurseINetAktiv
{
  
  public function getKurs($pKurs_Id, $pRefreshcache = false)
  {
    $kurs_id = $this->dboperation->getString4Sql($pKurs_Id);

    if ($kurs_id == '') {
      return $this->getNewObject();
    }

    static $kurs_cache = array();
    if (!$pRefreshcache && array_key_exists($kurs_id, $kurs_cache)) {
      return $kurs_cache[$kurs_id];
    }

    $sql = 'SELECT ' . $this->select . " \n
            FROM kurse k
            WHERE k.nr='" . $kurs_id . "' \n";

    $sql .= ' AND ' . $this->getGueltigPart('k.');
    if (isset($this->fromobject) && $this->fromobject->semester != '') {
      $semlist = $this->fromobject->semester;

      $sql .= ' AND k.semester in ('
      . $this->stringop->convertCommaSeparatedList2InList($semlist) . ') ';
    }
    $this->dboperation->clear();
    $this->dboperation->query($sql);
    $kurs_cache[$kurs_id] = $this->getFirstRow();

    return $kurs_cache[$kurs_id];
  }
}