<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */


class TabCollectionKursdetails extends TabCollectionDetails
{
  
  private $_searchkurs;
  private $_knr;
  private $_listenSection;
  private $_statusMessage;
  
  
  private $_displayRestriction;

  public function __construct(
    $pPageTitle,
    $pPageId,
    $pTool,
    $pContentHeader,
    $pData,
    $pKnr,
    $pListenId = '',
    $pAnzahlAllerKurse = 1,
    $pAnzahlKurseProSeite = 1,
    $pStatusMessage = '',
    $pDisplayRestriction = false
  ) {
    parent::__construct($pPageTitle, $pPageId, $pTool, $pContentHeader, $pData, $pAnzahlAllerKurse, $pAnzahlKurseProSeite);
    $this->_knr = $pKnr;
    $this->_searchkurs = ((GetOperations::getVarValue('searchkurs', false)) ? '&searchkurs=1' : '');
    $this->setContentId('kursdetails');
    
    $this->_listenSection = $pListenId;
    $this->_statusMessage = $pStatusMessage;
    $this->_displayRestriction = $pDisplayRestriction;
  }

  
  protected function getStatusMessage()
  {
    
    return $this->_statusMessage;
  }

  
  public function addStatusMessage($pMessage)
  {
    $this->_statusMessage .= $pMessage;
  }

  public function getSpecialCSS()
  {
    return array_merge(parent::getSpecialCSS(), array('./css/kursdetails.css'));
  }

  
  public function getJSDeclarations()
  {
    $result = parent::getJSDeclarations();
    $result .= " registerNamespace('KuferTools');\n";
    $result .= JsOperations::getDeclarationInt('KuferTools.ToolSectionId', $this->id);

    
    $result .= JsOperations::getDeclarationInt('KuferTools.ToolId4KursAuswahl', \ToolsAPI::TOOL_ANMELDUNGBUCHEN_MA);
    $result .= JsOperations::getDeclarationInt('KuferTools.ToolSectionId4KursAuswahl', 19);

    $result .= JsOperations::getDeclarationString('KuferTools.CurrentIndex', GetOperations::getVarValue('currentIndex'));

    if ($this->_listenSection != '') {
      $result .= JsOperations::getDeclarationInt('KuferTools.ListenSection', $this->_listenSection);
    }

    $result .= JsOperations::getDeclarationBoolean('KuferTools.isBLAK', DBWorkBASysSettings::isBlak());
    $user = $this->tool->getUser();
    $dbwTeiln = new DBWorkTeilnehmer();
    $teilnehm = $dbwTeiln->getTeilnehm($user->tnr);
    $tnrKonto = $teilnehm->konto;
    $tnrIban = $teilnehm->iban;
    if (!SessionOperations::isReplikat()) {
      $tnrKonto = SecurityOperations::anonymizeString($tnrKonto);
      $tnrIban = SecurityOperations::anonymizeString($tnrIban);
    }
    
    
    $result .= 'registerNamespace("KuferTools.KursDetails"); ';
    $result .= 'registerNamespace("KuferTools.UserInfo"); ' . "\n";
    $result .= JsOperations::getDeclarationString('KuferTools.KursDetails.CurrentUserEmail', $user->email);

    $anmZf = isset($this->toolSettings->anm_zahlverfahren) ? $this->toolSettings->anm_zahlverfahren : null;
    if ($anmZf == ANM_ZAHLVERFAHREN_SEPA_KTO || $anmZf == ANM_ZAHLVERFAHREN_NUR_KTO) {
      $result .= JsOperations::getDeclarationString('KuferTools.UserInfo.CurrentUserKonto', StringOperations::htmlentities($tnrKonto, ENT_QUOTES));
      $result .= JsOperations::getDeclarationBoolean('KuferTools.UserInfo.UseKto', true);
    }
    if ($anmZf == ANM_ZAHLVERFAHREN_SEPA_KTO || $anmZf == ANM_ZAHLVERFAHREN_NUR_SEPA) {
      $result .= JsOperations::getDeclarationString('KuferTools.UserInfo.CurrentUserIban', StringOperations::htmlentities($tnrIban, ENT_QUOTES));
      $result .= JsOperations::getDeclarationBoolean('KuferTools.UserInfo.UseSepa', true);
    }

    $result .= JsOperations::getDeclarationBoolean('KuferTools.UserInfo.HasSepaMandat', isset($this->links['hasSepaMandat']) && $this->links['hasSepaMandat']);

    $result .= JsOperations::getDeclarationString('KuferTools.UserInfo.NewsletterErlaubt', $teilnehm->newsl_erlaubt);

    
    $newsletterErlaubt = isset($this->toolSettings->newsletterAnmeldung_erlaubt) ? $this->toolSettings->newsletterAnmeldung_erlaubt : '';
    $result .= JsOperations::getDeclarationBoolean('KuferTools.NewsletterAnmeldung_erlaubt', $newsletterErlaubt);

    if ($this->_data instanceof Belegung) {
      $result .= JsOperations::getDeclarationInt('KuferTools.KursDetails.BelegungsId', $this->_data->id);
    }
    $result .= JsOperations::getDeclarationJsonBase64('KuferTools.ErlaubteZahlarten', $this->toolSettings->getErlaubteZahlArten());

    
    $doznr = -1;
    if (SessionOperations::getCurrentWebToolsUser()->dnr > 0) {
      $doznr = SessionOperations::getCurrentWebToolsUser()->dnr;
    }
    
    $result .= JsOperations::getDeclarationInt('KuferTools.KursDetails.Dnr', $doznr);

    if ($this->_data instanceof Belegung) {
      $kurs = $this->_data->kurs;
    } elseif ($this->_data instanceof Kurs) {
      $kurs = $this->_data;
    } else {
      return $result;
    }


    $gebuehr = APIGebuehren::getGebuehren(SessionOperations::getCurrentWebToolsUser()->tnr, $kurs->id);

    $guthaben = '';
    
    if (DBWorkBASysSettings::isBlak() && $gebuehr > 0 && MathOperations::stringToFloat($teilnehm->guthaben) > 0 && !($kurs->elearningKursID > 0)) {
      $guthaben = StringOperations::htmlentities($teilnehm->guthaben . ' ', ENT_QUOTES) . CURRENCY;
    }
    $result .= JsOperations::getDeclarationString('KuferTools.UserInfo.CurrentUserGuthaben', $guthaben);

    if (isset($this->links['emptyMandatorys']) && is_array($this->links['emptyMandatorys'])) {
      $result .= JsOperations::getDeclarationJson('KuferTools.UserInfo.EmptyMandatorys', $this->links['emptyMandatorys']);
    }

    
    
    
    $toBeReplaced = array("\r\n", "\n\r", "\r", "\n");
    $gebuehrErgaenzText = StringOperations::htmlentities($kurs->gebuehrergaenztext, ENT_QUOTES);
    $gebuehrErgaenzText = trim(str_replace($toBeReplaced, ' ', $gebuehrErgaenzText));

    $result .= " registerNamespace('KuferTools.KursDetails.Kurs');\n"
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Knr', StringOperations::htmlentities($kurs->id, ENT_QUOTES))
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Titel', StringOperations::htmlentities($kurs->getVarValue('titel_zeile1'), ENT_QUOTES))
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Zeitraum', StringOperations::htmlentities($kurs->getVarValue('beginn_ende_komplett'), ENT_QUOTES))
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Ort', StringOperations::htmlentities($kurs->ort, ENT_QUOTES))
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Gebuehr', StringOperations::htmlentities($gebuehr . ' ' . CURRENCY, ENT_QUOTES))
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.GebuehrenErgaenzText', $gebuehrErgaenzText)
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Folgekurs', StringOperations::htmlentities($kurs->folgekurs, ENT_QUOTES));

    
    $result .= JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Zeitbeg', StringOperations::htmlentities($kurs->beginn, ENT_QUOTES))
              . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Zeitende', StringOperations::htmlentities($kurs->ende, ENT_QUOTES))
              . JsOperations::getDeclarationFloatMitKomma('KuferTools.KursDetails.Kurs.Ue', StringOperations::htmlentities($kurs->stundenanz, ENT_QUOTES));

    
    
    
    if (DBWorkBASysSettings::isMDS()) {
      $result
            .= JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Beginn', StringOperations::htmlentities($kurs->beginn_dat, ENT_QUOTES))
            . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Ende', StringOperations::htmlentities($kurs->ende_dat, ENT_QUOTES))
            . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.Anm_Ende', StringOperations::htmlentities($kurs->anm_ende, ENT_QUOTES))
            . JsOperations::getDeclarationString('KuferTools.KursDetails.Kurs.VortagBeginn', StringOperations::htmlentities(DateTimeOperations::computeDate($kurs->beginn_dat, '- 1 day'), ENT_QUOTES));
    }


    
    
    if ($this->tool->getToolId() == \ToolsAPI::TOOL_ANMELDUNGBUCHEN_TN) {
      
      $result .= JsOperations::getDeclarationString('KuferTools.SepaTextOhneMandat', StringOperations::convertLinebreaks2HTML($this->toolSettings->sepaTextOhneMandat));
      $result .= JsOperations::getDeclarationString('KuferTools.SepaTextMitMandat', StringOperations::convertLinebreaks2HTML($this->toolSettings->sepaTextMitMandat));
      $result .= JsOperations::getDeclarationString('KuferTools.SepaTextDruckLink', $this->toolSettings->sepaTextDruckLink);
      
      $result .= JsOperations::getDeclarationString('KuferTools.AnmZusatzText', StringOperations::convertLinebreaks2HTML($this->toolSettings->anm_zusatzText));
      $result .= JsOperations::getDeclarationString('KuferTools.AnmZusatzAufforderung', StringOperations::convertLinebreaks2HTML($this->toolSettings->anm_zusatzAufforderung));
    }

    if (DBWorkBASysSettings::isBlak() && ($this->tool->getToolId() == \ToolsAPI::TOOL_TN || $this->tool->getToolId() == \ToolsAPI::TOOL_ANMELDUNGBUCHEN_TN)) {
      $result .= 'registerNamespace(\'KuferTools.Kontakt\');' . "\n";
      $result .= 'registerNamespace(\'KuferTools.Kontakte\');' . "\n";
      $tool0Settings = ToolSettingsAPI::getToolSettings(0);
      if ($tool0Settings->dokuUploadAllowByExclude) {
        
        $fileExtStr = $tool0Settings->uploadBlacklist4Ext;
        $allowByExclude = true;
      } else {
        
        $fileExtStr = $tool0Settings->uploadWhitelist4Ext;
        $allowByExclude = false;
      }
      $result .= JsOperations::getDeclarationBoolean('KuferTools.Kontakt.AllowUploadByExclude', $allowByExclude);
      $result .= JsOperations::getDeclarationString('KuferTools.Kontakt.FileExtStr', $fileExtStr);
      $statusMessageStr4FileExt = DokuUploadUserAPI::getStatusMessagePart4FileExt($tool0Settings);
      $result .= JsOperations::getDeclarationString('KuferTools.Kontakt.FileExtMessagePart', $statusMessageStr4FileExt);

      
      $result .= JsOperations::getDeclarationBoolean('KuferTools.Kontakt.UseAllowedExt4Attach', $tool0Settings->useAllowedExt4Attach);

      $result .= JsOperations::getDeclarationBoolean('KuferTools.isBGLU', $kurs->isBGLU());
    }

    return $result;
  }

  
  public function getSpecialJS()
  {
    $result = parent::getSpecialJS();

    
    $js = 'js/anmelden.js';
    if (((isset($this->links['anmelden']) && $this->links['anmelden'] != '') || DBWorkBASysSettings::isMDS())
          && !in_array($js, $result)) {
      $result[] = $js;
    }
    
    
    $js = 'js/pdfdruck.js';
    if (((isset($this->links['tnlisten']) && $this->links['tnlisten'] != '')
        || (isset($this->links['druck_small']) && $this->links['druck_small'] != '')) && !in_array($js, $result)) {
      $result[] = $js;
    }

    $js = 'js/kursdetails.js';
    if (!in_array($js, $result)) {
      $result[] = $js;
    }

    if (DBWorkBASysSettings::isBlak() && ($this->tool->getToolId() == \ToolsAPI::TOOL_TN || $this->tool->getToolId() == \ToolsAPI::TOOL_ANMELDUNGBUCHEN_TN)) {
      $result[] = 'js/Formulare/kontakte.js';
    }

    return $result;
  }

  
  protected function getButtonLeiste()
  {
    
    $sprachsettings = new SprachSettingsObject();
    $buttonObjAry = array();
    if (isset($this->links['weitermelden']) && $this->links['weitermelden'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_weitermelden_haken.gif',
                               'alt' => 'Weitermelden',
                               'href' => $this->links['weitermelden']);
    }
    if (isset($this->links['abmelden']) && $this->links['abmelden'] != '') {
      if (DBWorkBASysSettings::isBlak()) {
        
        $buttonObjAry[] = array('src' => 'layout/button_sub_stornieren.gif',
                                'alt' => 'Stornieren',
                                'href' => isset($this->links['abmelden']) ? $this->links['abmelden'] : '');
      } else {
        
        $buttonObjAry[] = array('src' => 'layout/button_sub_abmelden.gif',
                                'alt' => 'Abmelden',
                                'href' => isset($this->links['abmelden']) ? $this->links['abmelden'] : '');
      }
    }
    if (isset($this->links['anmelden']) && $this->links['anmelden'] != '') {
      $dbwkurs = new DBWorkKurse();
      $kurs = $dbwkurs->getKurs($this->_knr);
      
      if (DBWorkBASysSettings::isBlak() && is_a($this->_data, 'Kurs') && !is_a($this->tool, 'ToolFaAnmeldung')) {
        $tnr = $this->tool->getUser()->tnr;

        $dbwKennz = new DBWorkKennz();
        $tnKennzIDAry = $dbwKennz->getKennzShort4Teilnehmer($tnr);
        if ($dbwKennz->isTnKennzInKurs($tnKennzIDAry, $this->_data->id)) {
          $showLink = true;
        } else {
          $showLink = false;
        }
      } else {
        $showLink = true;
      }
      if (!$showLink) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerboten',
                                'href' => '#');
      } elseif (isset($this->links['emptyMandatorys']) && !empty($this->links['emptyMandatorys'])) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenFehlendePflichtangaben',
                                'href' => '#');
      } elseif ($this->_data->ausfall) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenAusfall',
                                'href' => '#');
      } elseif ($this->_data->webflags & \Kurs::WEBFLAG_KEINE == 1) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenNichtFreigegeben',
                                'href' => '#');
      } elseif ($this->_data->anm_ende != '' && DateTimeOperations::isDatebeforeNow($this->_data->anm_ende)) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenAnmeldeschlussErreicht',
                                'href' => '#');
      } elseif ($this->_data->ende_dat != '' && DateTimeOperations::isDatebeforeNow($this->_data->ende_dat)) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenEndeErreicht',
                                'href' => '#');
      } elseif ($kurs->elearningKursID > 0 && $this->tool->getToolId() == \ToolsAPI::TOOL_ANMELDUNGBUCHEN_FA) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenFirma',
                                'href' => '#');
      } elseif (!ToolsAPI::isTnMoodleRegisterableOrAlreadyRegistered(\SessionOperations::getCurrentWebToolsTeilnehmer(), $kurs)) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenMoodleNotRegisterable',
                                'href' => '#');
      } elseif (ToolsAPI::isPersonWithoutMoodleCredentialsForElearningCourse(SessionOperations::getCurrentWebToolsUser(), $kurs)) {
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButtonVerbotenNoMoodleCredentials',
                                'href' => '#');
      } else {
        $bgluClass = (DBWorkBASysSettings::isBlak() && $kurs->isBGLU() ? 'isbgluKurs' : '');
        $fspClass = (DBWorkBASysSettings::isBlak() && $kurs->isFSP() ? 'isfspKurs' : '');
        $buttonObjAry[] = array('src' => 'layout/button_anmelden_haken.gif',
                                'alt' => 'Anmelden',
                                'class' => 'AnmeldenButton ' . $bgluClass . ' ' . $fspClass,
                                'href' => '#',
                                
                                
                                
                                'zusatz' => '> <input type="hidden" value="' . CleanOperations::cleanStringForHtml($this->links['anmelden']) . '" class="anm_link" ');
      }
    }

    
    if (isset($this->links['BLAK_hinweis_button']) && $this->links['BLAK_hinweis_button']) {
      
      $onclick = $this->getShowMessage4ExternerKursBLAK($this->_data);
      $buttonObjAry[] = array('src' => 'layout/button_externer_kurs.gif',
                              'alt' => 'Informationen zum externen Kurs',
                              'class' => 'externen_kurs_blak',
                              'zusatz' => $onclick,
                              'href' => '');
    }

    
    if (isset($this->links['BLAK_nachweis_button']) && $this->links['BLAK_nachweis_button']) {
      $buttonObjAry[] = HTMLOperations::createButtonSpan('BGLU-Nachweis nachreichen', 'BGLU-Nachweis nachreichen', 'nachweis_hochladen_blak', 'nachweisLinkUpload_blak');
    }

    if (isset($this->links['punkteBest']) && $this->links['punkteBest'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_150_punkte_best.gif',
                               'aClass' => 'PunkteBestaetigenButton',
                               'alt' => 'Punkte bestätigen',
                               'href' => '#');
    }

    if (isset($this->links['feedback']) && $this->links['feedback'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_sub_feedback.gif',
                               'alt' => 'Feedback',
                               'href' => $this->links['feedback']);
    }
    if (isset($this->links['infoAnDoz']) && $this->links['infoAnDoz'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_sub_info_dozent.gif',
                               'alt' => 'Nachricht',
                               'href' => $this->links['infoAnDoz']);
    }
    if (isset($this->links['bescheinigung']) && $this->links['bescheinigung'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_sub_bescheinigung.gif',
                                      'alt' => 'Bescheinigung',
                                      'href' => $this->links['bescheinigung']);
    }
    if (isset($this->links['rechnung']) && $this->links['rechnung'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_sub_rechnung.gif',
                                      'alt' => 'Rechnung',
                                      'href' => $this->links['rechnung']);
    }
    if (isset($this->links['tnlisten']) && $this->links['tnlisten'] != '') {
      $buttonBezeichnungAPI = new ButtonBeschriftung_DozKursUebersicht();
      $teilnehmerButonText = $buttonBezeichnungAPI->getBeschriftung(ButtonBeschriftung_DozKursUebersicht::BUTTON_TEILNEHMER, $this->toolSettings);
      $buttonObjAry[] = '<a href="#" id="tnListDruckButton4Details">'
        . HTMLOperations::createButtonSpan(
          $teilnehmerButonText,
          'Druck von ' . $sprachsettings->Teilnehmer['Plural']['Nominativ'],
          'leftspace',
          '',
          'images/print_small.gif',
          ''
        )
      . '</a>';
    }
    if (isset($this->links['anwesenheiten']) && $this->links['anwesenheiten'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_klassenbuch.gif',
                               'alt' => 'Anwesenheiten',
                               'href' => $this->links['anwesenheiten']);
    }
    if (isset($this->links['anwesenheiten4kurs']) && $this->links['anwesenheiten4kurs'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_anwesenheiten.gif',

                               'alt' => 'Anwesenheiten zu ' . $sprachsettings->Kurs['Singular_mit_Artikel']['Dativ'],
                               'href' => $this->links['anwesenheiten4kurs']);
    }

    if (isset($this->links['druckarbeitsbericht']) && $this->links['druckarbeitsbericht']) {
      $buttonObjAry[] = array('src' => 'layout/button_druck_arbeitsberichte.gif',
                               'alt' => 'Arbeitsbericht',
                               'id' => 'dozListDruckButtonArbeitsbericht',
                               'href' => $this->links['druckarbeitsbericht']);
    }

    if (isset($this->links['icsTermine']) && $this->links['icsTermine'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_ics_small.gif',
                               'alt' => 'Meine ' . $sprachsettings->Kurstag['Plural']['Nominativ'] . ' nach Outlook',
                               'href' => '#',
                               'aClass' => 'terminenachoutlooklink',
                               'id' => 'icsTermineButton4Details');
    }

    if (isset($this->links['druck_small']) && $this->links['druck_small'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_druck_small.gif',
                               'alt' => $sprachsettings->KursZusammengesetzt['Singular']['Nominativ'] . 'zettel',
                               'href' => $this->links['druck_small'],
                               'target' => '_blank');
    }

    
    if (isset($this->links['druck_smallJs']) && $this->links['druck_smallJs'] != '') {
      $buttonObjAry[] = array('src' => 'layout/button_druck_small.gif',
                               'alt' => 'Details drucken',
                               'href' => $this->links['druck_smallJs']);
    }



    $buttons = '<div class="buttonleiste_kursdetails">' . "\n";

    if (isset($this->links['kursbearbeiten']) && $this->links['kursbearbeiten'] != '') {
      $title = $sprachsettings->Kurs['Singular']['Akkusativ'] . ' bearbeiten';
      $buttons .= '<div class="buttonleiste_kursdetails_button">'
                    . HTMLOperations::createButtonSpan('Bearbeiten', $title, 'kurs_bearbeiten', '', 'images/edit.gif')
                  . '</div>';
    }

    if (isset($this->links['noten_der_mitarbeiter']) && $this->links['noten_der_mitarbeiter'] != '') {
      $title = 'Noten der Mitarbeiter';
      $buttons .= '<div class="buttonleiste_kursdetails_button"><a href="' . CleanOperations::cleanStringForHtml($this->links['noten_der_mitarbeiter']) . '">'
                    . HTMLOperations::createButtonSpan('Noten der Mitarbeiter', $title, 'mitarbeiter_noten', '', 'images/noten.gif')
                  . '</a></div>';
    }

    foreach ($buttonObjAry as $buttonObj) {
      $buttons .= '<div class="buttonleiste_kursdetails_button">' . "\n";

      if (!is_array($buttonObj)) {
        $buttons .= $buttonObj;
      } else {
        $id4href = '';
        if (isset($buttonObj['id']) && $buttonObj['id'] != '') {
          $id4href = ' id="' . CleanOperations::cleanStringForHtml($buttonObj['id']) . '"';
        }

        $a4href = '';
        if (isset($buttonObj['aClass']) && $buttonObj['aClass'] != '') {
          $a4href = ' class="' . CleanOperations::cleanStringForHtml($buttonObj['aClass']) . '"';
        }

        $a4target = '';
        if (isset($buttonObj['target']) && $buttonObj['target'] != '') {
          $a4target = ' target="' . CleanOperations::cleanStringForHtml($buttonObj['target']) . '"';
        }

        if ($buttonObj['href'] != '') {
          $buttons .= '<a href="' . CleanOperations::cleanStringForHtml($buttonObj['href']) . '"' . $id4href . $a4href . $a4target . '>';
        }
        $class = '';
        if (isset($buttonObj['class']) && $buttonObj['class'] != '') {
          $class = ' class="' . CleanOperations::cleanStringForHtml($buttonObj['class']) . '"';
        }

        $buttons .= '<img src="' . CleanOperations::cleanStringForHtml($buttonObj['src']) . '" alt="' . CleanOperations::cleanStringForHtml($buttonObj['alt']) . '" 
                    title="' . CleanOperations::cleanStringForHtml($buttonObj['alt']) . '" ' . $class . ' '
                . (isset($buttonObj['zusatz']) ? $buttonObj['zusatz'] : '') . '>';
        if ($buttonObj['href'] != '') {
          $buttons .= '</a>' . "\n";
        }
      }
      $buttons .= '</div>' . "\n";
    }

    
    $buttons .= '<div class="buttonleiste_kursdetails_steuerbuttons">' . "\n";
    
    if (!$this->_displayRestriction) {
      $buttons .= $this->getNavigaton();
    }

    if (isset($this->links['back']) && $this->links['back'] != '') {
      
      
      if (DBWorkBASysSettings::isMDS()) {
        $this->links['back'] = 'usertools.php?tool_id=21&toolsection_id=305';
      }
      $backLink = ToolsAPI::buildValidLink($this->links['back'], $this->_searchkurs);
      $buttons .= HTMLOperations::CreateBackButton($backLink);
    }

    $buttons .= '</div>' . "\n";

    $buttons .= '</div>' . "\n";

    return $buttons;
  }
}