<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
  echo '<div id="Table">';
  // output gigs
  if ($gigCount!=NULL) {
    $SetupFrontendCalendarShowMonthlySeparator = getSetup('SetupFrontendCalendarShowMonthlySeparator');
    $SetupFrontendCalendarCharsInFields = getSetup('SetupFrontendCalendarCharsInFields');
    $Attributes = explode (', ',getSetup ('SetupFrontendAttributes'));
    $AmountOfAttributes = count($Attributes);
    $colspan = 2+$AmountOfAttributes;
    $currentMonth = '';
    echo '<table>';
    // Table heads
    if (getSetup('SetupFrontendCalendarShowTableHeads')) {
      echo '<tr>';
      // GigDate
        echo '<th>'.$L_GigDate.'</th>';
      // GigBeginning
        echo '<th>'.$L_GigBeginning.'</th>';
      // Spalten definieren
        $Attributes = getSetup ('SetupFrontendAttributes');
        if ($Attributes!="") $Attributes = explode (', ', $Attributes);
        else $Attributes = array();
        for ($i=0; $i<count($Attributes); $i++) {
          echo '<th>'.${"L_$Attributes[$i]"}.'</th>'; }
        echo '</tr>'; }
    while ($row = mysqli_fetch_array($Result)) {
      extract($row);
      if ($GigNotes == "") $GigNotes = "&nbsp;";
      $Month = date('m', $GigDate);
      $NameOfMonth = getNameOfMonthFromNumberOfMonth($Month);
      $Year = date('Y', $GigDate);
      if ($currentMonth!=$Month AND $SetupFrontendCalendarShowMonthlySeparator)
        echo '<tr><td colspan="'.$colspan.'" class="NameOfMonth">'.$NameOfMonth.' '.$Year.'</td></tr>';
      $currentMonth = $Month;
      echo '<tr>';
      // GigDate
        echo '<td class="GigDate">';
        include ($Path.'calendar/includes/frontend/GigDate.php');
        echo '</td>';
      // GigBeginning
        echo '<td class="GigBeginning">';
        include ($Path.'calendar/includes/frontend/GigBeginning.php');
        echo '</td>';
      // Spalten definieren
        $FrontendType = 'table';
        for ($i=0; $i<$AmountOfAttributes; $i++) {
          echo '<td class="'.$Attributes[$i].'" style="white-space: nowrap;">';
          include($Path."calendar/includes/frontend/".$Attributes[$i].".php");
          echo '</td>'; }
      echo '</tr>'; }
    echo "</table>"; }
  else {
    if ( $SetupFrontendCalendarPeriodSelector=="future" ) echo $L_013."<br />";
    elseif ( $SetupFrontendCalendarPeriodSelector=="past" ) echo $L_014."<br />";
    elseif ( $SetupFrontendCalendarPeriodSelector=="all" ) echo $L_206."<br />"; }
  echo '</div>';
?>