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


class DataMenuDetails extends DataMenuKurse
{
  public function __construct($pUrlparameter)
  {
    parent::__construct($pUrlparameter);
    $this->dbwkurse = new DBWorkKurseINetAktivFilter();
  }

  public function content()
  {
    echo $this->getcontent();
  }

  public function getcontent()
  {
    $this->urlparameter->explodeSettingStream();

    $this->getsight();
    $kursary = array($this->dbwkurse->getKurs($this->addfstring->getfilledStr($this->urlparameter->knr, '-1')));

    $this->exportadapter->export->initiate();
    $this->exportadapter->export->exportresults = $kursary;
    $this->exportadapter->export->setNrOfMainBodyElements(1);
    $html = "<div class='ansichtkurse'>\n";
    if ($this->exportadapter->export->resultCount() > 0 && !$kursary[0]->isEmpty()) {
      $this->exportadapter->filestream = $this->sight->header;
      $this->exportadapter->replaceVarNames();
      $html .= $this->exportadapter->resultlist[0];
      $this->exportadapter->filestream = $this->sight->body;
      $this->exportadapter->replaceVarNames();
      for ($i = 0;$i < $this->exportadapter->export->resultCount();$i++) {
        $html .= $this->exportadapter->resultlist[$i];
      }
      
      $this->exportadapter->export->initiate();
      $this->exportadapter->filestream = $this->sight->footer;
      $this->exportadapter->export->exportresults = $kursary;
      $this->exportadapter->replaceVarNames();
      $html .= $this->exportadapter->resultlist[0];
    } else {
      
      $this->exportadapter->export->initiate();
      $this->exportadapter->export->exportresults = array(new Datamodul());
      $this->exportadapter->filestream = $this->sight->nodata;
      $this->exportadapter->replaceVarNames();
      
      $html .= $this->exportadapter->resultlist[0];
    }

    $html .= "</div>\n";

    return $html;
  }

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