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


class TabDozentKurse extends TabPersonKurse
{
  public function __construct(
    $pTabName,
    $pData,
    $pSightId,
    $pKursIdAry4User,
    $pAdr4KursDetailLink = array(),
    $pSemlist = '',
    $pJustNoAusfall = false
  ) {
    parent::__construct($pTabName, $pData, $pSightId, $pKursIdAry4User, $pAdr4KursDetailLink, $pSemlist, $pJustNoAusfall);
  }

  protected function getSight4Tab()
  {
    return new DozentKurseSight4Tab($this->_data->id, $this->_kursIdAry4User, $this->_adr4KursDetailLink, $this->_sightId);
  }

  

  protected function getPersonControlDiv()
  {
    return '<div id="dozdetails_kursControlDiv" class="tab_controlDiv">' . "\n";
  }

  protected function getTabClassName()
  {
    return 'tab_dozenten';
  }

  protected function getJSDeclarations4Drucklist()
  {
    $result = '';
    
    
    $selectedIds = SessionOperations::getVarValueWTIntern('selnrstr_');
    $selIds = array();
    if (StringOperations::strlen($selectedIds) > 0) {
      $selIds = explode(':', $selectedIds);
    }
    $result .= JsOperations::getDeclarationJson('KuferTools.SelectedIds', $selIds);

    return $result;
  }

  
  public function getSpecialJS()
  {
    $jsAry = parent::getSpecialJS();
    $jsAry[] = 'js/MATool/dozinfo.js';

    return $jsAry;
  }

  
  public function setPageLinks4Druck($pPageLinks4Druck)
  {
    $this->links['listen'] = $pPageLinks4Druck['listen'];
    $this->links['honlisten'] = $pPageLinks4Druck['honlisten'];
    $this->links['grafiken'] = $pPageLinks4Druck['grafiken'];
    $this->links['anderelisten'] = $pPageLinks4Druck['anderelisten'];
    $this->links['teilnehmer'] = $pPageLinks4Druck['teilnehmer'];
  }

  

  
  public function getKursTable4Tab()
  {
    if (!$this->isSightInitialized()) {
      $this->initSight();
    }
    
    $pageLinks = $this->links;

    
    $honlistenAllowed = isset($pageLinks['honlisten']) && $pageLinks['honlisten'];
    $listenAllowed = isset($pageLinks['listen']) && $pageLinks['listen'];
    $grafikenAllowed = isset($pageLinks['grafiken']) && $pageLinks['grafiken'];
    $vertraegeAllowed = isset($pageLinks['anderelisten']) && $pageLinks['anderelisten'];
    $tnAllowed = isset($pageLinks['teilnehmer']) && $pageLinks['teilnehmer'];

    $markAllowed = $tnAllowed || $honlistenAllowed || $listenAllowed || $grafikenAllowed || $vertraegeAllowed;

    
    $this->_sight->setMarkAllowed($markAllowed);

    $this->_sight->setFilterInput($this->_kursFilterInput);
    
    $this->_sight->setSemester($this->_semlist);
    $this->_sight->setKeineAusgefalleneKurse($this->_justNoAusfall);
    $this->_sight->createSight();

    return $this->_sight->sight;
  }
}