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


class KurseSight4Tab extends NormalSight
{
  
  protected $_tabHelper;

  private $_markAllowed;
  public $dbwkurse;
  public $dbwkursesmall;
  
  private $_kursIdAry4User;
  
  public $_adr4KursDetailLink;
  
  protected $_personId;
  
  protected $_kursFilterInput;

  
  
  protected $_semlist;
  protected $_justNoAusfall = false;

  public function __construct($pPersonId, $pKursIdAry4User, $pAdr4KursDetailLink, $pSightId)
  {
    
    parent::__construct();
    $this->_adr4KursDetailLink = $pAdr4KursDetailLink;
    $this->sightid = $pSightId;
    $this->_tabHelper = new TabHelper($this);

    $this->dbwkurse = new DBWorkKurseWT();
    $this->dbwkursesmall = new DBWorkKurseWTSmall();
    $this->_personId = $pPersonId;
    $this->_kursIdAry4User = $pKursIdAry4User;
  }

  
  public function setMarkAllowed($pMarkAllowed)
  {
    $this->_markAllowed = $pMarkAllowed;
  }

  
  public function getMarkAllowed()
  {
    return $this->_markAllowed;
  }

  public function getTitle()
  {
    return '';
  }

  
  public function getColumns($justallowedcolumns = true)
  {
    parent::getColumns($justallowedcolumns);
    

    if (count($this->columnsary) > 0) {
      
      
      
      $column = new Column();
      $column->title = '';
      $column->accesslevel = 1;
      $column->name = 'invisibleAusfall';
      $column->fieldname = 'invisibleAusfall';
      $column->datamodul = 'kurs';
      $column->fontsize = '1';
      $this->columnsary[] = $column;

      
      $column = new Column();
      $column->title = '';
      $column->accesslevel = 1;
      $column->name = 'invisibleSemester';
      $column->fieldname = 'invisibleSemester';
      $column->datamodul = 'kurs';
      $column->fontsize = '1';
      $this->columnsary[] = $column;
      
    }
  }

  
  public function setFilterInput($pKursFilterInput)
  {
    $this->_kursFilterInput = $pKursFilterInput;
  }

  
  public function setSemester($pSemlist)
  {
    $this->_semlist = $pSemlist;
  }

  public function setKeineAusgefalleneKurse($pKeineAusgefalleneKurse)
  {
    $this->_justNoAusfall = $pKeineAusgefalleneKurse;
  }

  
  public function getHeader()
  {
    return $this->_tabHelper->getHeader();
  }

  public function getTableHeaderCol($colindex)
  {
    return $this->_tabHelper->getTableHeaderCol($colindex);
  }

  
  public function getTableRowContent($rowindex, $colindex)
  {
    
    
    
    
    
    $fieldname = $this->columnsary[$colindex]->fieldname;
    $datamodul = $this->columnsary[$colindex]->datamodul;
    if ($fieldname == 'id' && $datamodul == 'kurs') {
      $knr = $this->dataary[$rowindex]->getVarValue('id');
      $value = $this->dataary[$rowindex]->getVarValueEx($fieldname, $datamodul);
      
      
      
      if (in_array($knr, $this->_kursIdAry4User)) {
        
        $toToolId = $this->_adr4KursDetailLink[0]; 
        $toSectionId = $this->_adr4KursDetailLink[1]; 
        $kursDetailsLink = 'usertools.php?tool_id=' . $toToolId . '&amp;toolsection_id=' . $toSectionId . '&amp;nr=' . $knr . '&amp;fromOtherTool=1';

        return Menu::getUserLink(CleanOperations::cleanStringContainingHtml($value), $kursDetailsLink, 2, false);
      }
    } 
    

    return parent::getTableRowContent($rowindex, $colindex);
  }

  

  
  public function getTableCell($pValue, $pColumn, $pTextcolor = true)
  {
    
    
    return $this->_tabHelper->getTableCell($pValue, $pColumn, $pTextcolor);
  }

  protected function getTrOpen($pColor)
  {
    return $this->_tabHelper->getTrOpen($pColor);
  }

  protected function getTBodyOpen()
  {
    return $this->_tabHelper->getTBodyOpen();
  }

  protected function getTBodyClose()
  {
    return $this->_tabHelper->getTBodyClose();
  }

  protected function getTHeadOpen()
  {
    return $this->_tabHelper->getTHeadOpen();
  }

  protected function getTHeadClose()
  {
    return $this->_tabHelper->getTHeadClose();
  }

  
  public function getTable()
  {
    return $this->_tabHelper->getTable();
  }

  public function getParentTable()
  {
    return parent::getTable();
  }

  
  public function getTableHeaderCheckCells()
  {
    return $this->_tabHelper->getTableHeaderCheckCells();
  }

  
  public function getTableRowSelection($pRowindex)
  {
    return $this->_tabHelper->getTableRowSelection($pRowindex);
  }

  
  public function getData()
  {
  }
}