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

class DataMenuVerlauf extends DataMenuOhneStatus
{
  public function __construct($pUrlparameter)
  {
    parent::__construct($pUrlparameter);
    $this->exportadapter = new ExpKursuebersicht();
  }

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

  public function _getClickPath($pName = 'Zuletzt besuchte Kurse')
  {
    if ($this->toolsettings->clickVerlauf != '') {
      $pName = $this->toolsettings->clickVerlauf;
    }

    return CleanOperations::cleanStringForHtml($pName);
  }

  
  public function getdataarraybody()
  {
    $dbwWarenkorbVerlauf = new DBWorkWarenkorbVerlauf();
    $eintraege = $dbwWarenkorbVerlauf->getEntries();
    $this->dataarraybody = array();
    if (is_array($eintraege)) {
      $limit = count($eintraege);
      for ($i = 0; $i < $limit; $i++) {
        array_push($this->dataarraybody, $eintraege[$i]->kurs);
      }
    } 
  }

  



  

  public function mainmenu()
  {
    $this->getsight();
    $this->getdataarrayheader();
    $this->getdataarraybody();
    $this->getdataarrayfooter();
    $this->getdataarraynodata();
    $this->getdataarraynocolumn();
    if ($this->toolsettings->showClickpfad) {
      echo $this->getClickPath();
    }

    if (count($this->dataarraybody) > 0) {
      $this->showheader();
      $this->showbody();
      $this->showfooter();
    } else {
      $this->shownodata();
    }
  }

  public function getContent()
  {
    $this->_init();

    $result = '';
    if (count($this->dataarraybody) > 0) {
      $result .= $this->getheader();
      $result .= $this->getbody();
      $result .= $this->getfooter();
    } else {
      $result .= $this->getnodata();
    }

    return $result;
  }

  public function shownodata()
  {
    if(!REMOVE_DIV_HAUPTSEITE_OHNE_STATUS) {
      echo " <div class=\"hauptseite_ohnestatus\">\n";
      DataMenu::shownodata();
      echo " </div>\n\n";
    } else {
      DataMenu::shownodata();
    }
  }
}