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

class DataMenuDozDetailsSelf extends DataMenuDetailsSelf
{
  public $dbwDozenten;

  public function __construct($urlparam)
  {
    parent::__construct($urlparam);
    $this->dbwDozenten = new DBWorkDozentenWB(1, true);
    $this->exportadapter = new ExpDozenten();
  }

  
  public function _getClickPath($pPHP53DummyParam1 = '', $pPHP53DummyParam2 = '')
  {
    DataMenuMain::_getClickPath();

    $zwischenschritt = '';
    
    if ($this->urlparameter->kathauptalt == 212) {
      
      if ($this->toolsettings->clickDozGruppiertText != '') {
        $vhs = BASysSettingsAPI::getBASysSettings();
        $name = $this->toolsettings->clickDozGruppiertText;
        $param1 = array('kathaupt', 'kathauptname');
        $param2 = array('222', $name);
        if ((StringOperations::substr($vhs->vhsbezeichnung, 0, 4) == 'Linz') && (StringOperations::strtoupper(StringOperations::substr($vhs->vhskurzbezeichnung, 0, 3)) == 'VHS')) {
          $param1[] = 'letter';
          $param2[] = 'A';
        }
        $zwischenschritt .= $this->getClickPathStep(
          $this->urlparameter->getEmptyStreamWith(
            $param1,
            $param2
          ),
          $name . ' öffnen',
          $name
        );
      }
      
      $name = $this->toolsettings->clickDozUebersichtText;
      $zwischenschritt .= $this->getClickPathStep(
        $this->urlparameter->getEmptyStreamWith(
          array('kathaupt', 'kathauptname', 'blkeep'),
          array('212', $name, 'true')
        ),
        $name . ' öffnen',
        $name
      );
    }
    
    elseif ($this->urlparameter->kathauptalt == 222) {
      $name = $this->toolsettings->clickDozGruppiertText;
      $zwischenschritt .= $this->getClickPathStep(
        $this->urlparameter->getEmptyStreamWith(
          array('kathaupt', 'kathauptname', 'letter'),
          array('222', $name, $this->urlparameter->letter)
        ),
        $name . ' öffnen',
        $name
      );
    
    } else {
      if ($this->toolsettings->clickDozGruppiertText != '') {
        $vhs = BASysSettingsAPI::getBASysSettings();
        $name = $this->toolsettings->clickDozGruppiertText;
        $param1 = array('kathaupt', 'kathauptname');
        $param2 = array('222', $name);
        if ((StringOperations::substr($vhs->vhsbezeichnung, 0, 4) == 'Linz') && (StringOperations::strtoupper(StringOperations::substr($vhs->vhskurzbezeichnung, 0, 3)) == 'VHS')) {
          $param1[] = 'letter';
          $param2[] = 'A';
        }
        $zwischenschritt .= $this->getClickPathStep(
          $this->urlparameter->getEmptyStreamWith(
            $param1,
            $param2
          ),
          $name . ' öffnen',
          $name
        );
      }
      if ($this->toolsettings->clickDozUebersichtText != '') {
        $name = $this->toolsettings->clickDozUebersichtText;
        $zwischenschritt .= $this->getClickPathStep(
          $this->urlparameter->getEmptyStreamWith(
            array('kathaupt', 'kathauptname', 'blkeep'),
            array('212', $name, 'true')
          ),
          $name . ' öffnen',
          $name
        );
      }
    }

    $tmp = 'Dozentendetails';
    if ($this->toolsettings->clickDozDetailText != '') {
      $tmp = $this->toolsettings->clickDozDetailText;
    } else {
      $dozent = $this->getDoz();
      if (!$dozent->isEmpty()) {
        if ($dozent->getVarValue('kuenstlername') != '') {
          $tmp = $dozent->getVarValue('kuenstlername');
        } else {
          $tmp = $dozent->getVarValue('vorname') . ' ' . $dozent->getVarValue('name');
        }
      }
    }

    return parent::_getClickPath($tmp, $zwischenschritt);
  }

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

  
  public function getdataarrayheader()
  {
    $this->urlparameter->explodeSettingStream();
    $this->dataarrayheader = array($this->getDoz());
  }

  
  public function getdataarraybody($pZeitBereich = 'noRestrict')
  {
    $this->urlparameter->explodeSettingStream();
    $this->dataarraybody = array($this->getDoz());
  }

  
  public function getdataarrayfooter()
  {
    $this->urlparameter->explodeSettingStream();
    $this->dataarrayfooter = array($this->getDoz());
  }

  protected function getDoz()
  {
    if ($this->settings->dozUebersichtShowAll) {
      return $this->dbwDozenten->getDozent($this->urlparameter->dsnr);
    } else {
      return $this->dbwDozenten->getDozentMitKurs($this->urlparameter->dsnr, $this->settings->semlist);
    }
  }

  public function get2ndColumn()
  {
    $tmp = $this->sight;
    $this->getsight(218);
    $this->getdataarraynocolumn();
    $retour = $this->getnocolumn();
    $this->sight = $tmp;

    return $retour;
  }
}