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

class DataMenuAktuellesWb extends DataMenu
{
  public function __construct($pUrlparameter)
  {
    parent::__construct($pUrlparameter);
    $this->exportadapter = new ExpAktuellesWB();
  }

  public function getsight($pSightID = 278)
  {
    parent::getsight($pSightID);
  }

  public function getdataarraybody()
  {
    $dbw = new DBWorkAktuellesWB();
    $this->dataarraybody = $dbw->getNewsForHomepage();
  }

  public function isRecursive()
  {
    $this->getsight();
    $sightContent = $this->sight->header . $this->sight->body . $this->sight->footer . $this->sight->nodata . $this->sight->nocolumn;

    return (StringOperations::strpos($sightContent, '{%sys_news%}') !== false);
  }
}

class DataMenuAktuellesWbUebersicht extends DataMenuSelfBlaettern
{
  public function __construct($pUrlparameter)
  {
    parent::__construct($pUrlparameter);
    $this->exportadapter = new ExpAktuellesWB();
  }

  public function getsight($pSightID = 278)
  {
    parent::getsight($pSightID);
  }

  public function _getClickPath($pName = 'News', $pPHP53DummyParam = '')
  {
    
    DataMenuMain::_getClickPath();
    
    if ($this->toolsettings->titleKursBereich != '') {
      $this->clickpfad = "<span class='clickadresse'>" . ' ' . CleanOperations::cleanStringForHtml(stripslashes($this->toolsettings->titleKursBereich)) . ' ' . "</span>\n";
      $this->clickpfad .= "<span class='trennzeichen'>" . ' ' . CleanOperations::cleanStringContainingHtml($this->toolsettings->trennzeichenKategorie) . ' ' . '</span>';
    }

    if ($this->toolsettings->clickNewsUebersicht != '') {
      $pName = $this->toolsettings->clickNewsUebersicht;
    }

    $this->clickpfad .= "<span class='clickadrbold'> " . CleanOperations::cleanStringForHtml($pName) . "</span>\n";
    
    return $this->clickpfad;
  }

  public function getdataarraybody($pZeitBereich = 'noRestrict')
  {
    $dbw = new DBWorkAktuellesWB();

    $this->dataarraybody = $dbw->getNewsForHomepage();
  }
}

class DataMenuAktuellesWbDetails extends DataMenuSelfBlaettern
{
  public function __construct($pUrlparameter)
  {
    parent::__construct($pUrlparameter);
    $this->exportadapter = new ExpAktuellesWB();
  }

  public function getsight($pSightID = 279)
  {
    parent::getsight($pSightID);
  }

  public function _getClickPath($pName = 'News', $pPHP53DummyParam = '')
  {
    
    DataMenuMain::_getClickPath();
    
    if ($this->toolsettings->titleKursBereich != '') {
      $this->clickpfad = "<span class='clickadresse'>" . ' ' . CleanOperations::cleanStringForHtml(stripslashes($this->toolsettings->titleKursBereich)) . ' ' . "</span>\n";
      $this->clickpfad .= "<span class='trennzeichen'>" . ' ' . CleanOperations::cleanStringContainingHtml($this->toolsettings->trennzeichenKategorie) . ' ' . '</span>';
    }

    if ($this->toolsettings->clickNewsDetails != '') {
      $pName = $this->toolsettings->clickNewsDetails;
    }

    $this->clickpfad .= "<span class='clickadrbold'> " . CleanOperations::cleanStringForHtml($pName) . "</span>\n";
    
    return $this->clickpfad;
  }

  public function getdataarraybody($pZeitBereich = 'noRestrict')
  {
    $dbw = new DBWorkAktuellesWB();

    if (is_numeric($this->urlparameter->dsnr)) {
      $this->dataarraybody = array($dbw->getNewsById($this->urlparameter->dsnr));
    } else {
      $this->dataarraybody = array();
    }
  }
}