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



class KursDokumenteMobilePage extends DefaultMobilePage {

  public function __construct(){
    if(isset($_REQUEST['nr'])){
      parent::__construct(364, TOOL_MOB_KURSDETAILS, RequestOperations::getVarValue('nr'));
    } else {
      parent::__construct(364, TOOL_MOB_KURSDETAILS, 'Downloads');
    }
    $this->dbwork = new DBWorkDokumenteWeb();
    $this->fetchData();
  }

  public function fetchData(){
    if(isset($this->urlParameter['nr'])){
      $this->data = $this->dbwork->getDokumente4Kurs($this->urlParameter['nr']);
    } else {
      $this->data = NULL;
    }
    $this->dataCount = count($this->data);
  }

  public function getMobileHtml(){
    $retour =  '<ul data-role="listview" data-filter="true">'."\n";
    if($this->dataCount > 0){
      $retour .= $this->getListHTML();
    } else {
      $retour .= ' <li>'."\n";
      $retour .= '   <p class="listKeineDaten">keine Dokumente gefunden</p>'."\n";
      $retour .= ' </li>'."\n";
    }
    $retour .= '</ul>'."\n";
    return $retour;
  }
}
?>