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


class DataMenuKurseLastMinute extends DataMenuKurse
{
  public function __construct($pUrlparam)
  {
    parent::__construct($pUrlparam);
    $this->dbwkurse->setOrderByValues($this->urlparameter, $this->sortierungWieFuerKurssuche($this->settings->sortkurselm), $this->settings->sortkurselmasc);
  }

  public function getClickPath()
  {
    $tmp = $this->_getClickPath();
    
    
    if ($this->toolsettings->clickLastMinuteText != '') {
      $trennzeichen = '';
      if (!empty($tmp)) {
        $trennzeichen = '<span class="trennzeichen"> ' . CleanOperations::cleanStringContainingHtml($this->toolsettings->trennzeichenKategorie) . ' </span>';
      }
      $tmp .= $trennzeichen . '<span class="clickadrbold">' . CleanOperations::cleanStringForHtml($this->toolsettings->clickLastMinuteText) . '</span>';
    }
    $retour = '<div class="hauptseite_clickpfad"><span class="clickpfad">' . "\n";
    $retour .= $tmp;
    $retour .= "</span></div>\n";

    return $retour;
  }

  public function getsight($sightid = 12)
  {
    parent::getsight($sightid);
  }

  public function getdataarraybody($pZeitBereich = 'noRestrict')
  {
    $this->setKursSearch();
    $startKurs = new Kurs();
    $startKurs->id = $this->addfstring->getfilledStr($this->urlparameter->knr, null);
    $anzahlLastMinuteTage = $this->toolsettings->anzahlLastMinuteTage;
    if (!is_numeric($anzahlLastMinuteTage)) {
      $anzahlLastMinuteTage = 0;
    }
    $nichtAnmeldbareKurseAusblenden = $this->toolsettings->lastMinuteNichtAnmeldbareKurseAusblenden;
    $kursids = $this->dbwkurse->getKurseLastMinuteLimit(
      $anzahlLastMinuteTage,
      $startKurs,
      $this->settings->kurseproseite,
      ($this->addfstring->getfilledStr($this->urlparameter->browse, 'forward') == 'forward'),
      $nichtAnmeldbareKurseAusblenden
    );

    $this->dataarraybody = WBKursStore::getKurseByIdArray($kursids);
  }
}