<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Utils\DatamodulHelper\KursTage;

class RaumGrafikKurstage extends KursTageHelper
{
  private $datVon;
  private $datBis;
  private $raumNr;

  public function __construct($toolSettings, $user, $raumNr, $datVon, $datBis)
  {
    parent::__construct($toolSettings, $user);
    $this->datVon = $datVon;
    $this->datBis = $datBis;
    $this->raumNr = $raumNr;
  }

  protected function getKurstageIds($dbwKurseTage)
  {
    return $dbwKurseTage->getOnlyIds(array($dbwKurseTage, 'getKurstagebyRaum'), array($this->raumNr));
  }

  protected function setzeFilter($dbwKurseTage, $pToolId)
  {
    if (($this->datVon != '') && (\StringOperations::strlen($this->datVon) == MAXLEN_DAT)
         && ($this->datBis != '') && (\StringOperations::strlen($this->datBis) == MAXLEN_DAT)) {
      $dbwKurseTage->fromobject->datum = $this->datVon;
      $dbwKurseTage->toobject->datum = $this->datBis;
    }

    return $dbwKurseTage;
  }
}