Location: PHPKode > scripts > GigKalender > calendar/backend_showAllGigs.php
<?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.
*/
  $_SESSION['MenuReminderCalendar'] = $page;
  if ( !loggedIn() ) echo $L_003;
  else
  {
    // Inhalt hier einfügen  
      if ( AnzahlAllerGigsInDatenbank()=='0' )
      {
        echo '<div id="PageMenu">';
        include('calendar/includes/buttonAddGig.php');
        echo '</div>';
        echo '<br />'.$L_156.'<br /><br />';
      }
      else
      { 
        // Publish or Not
          if ( isset($_REQUEST['job']) AND  $_REQUEST['job']=='changePublishState' )
            changeGigPublishing ($_REQUEST['GigID']);
        // moreChars
          if ( isset($_REQUEST['job']) AND $_REQUEST['job']=='moreChars' ) { setUserVar('UserCharsCalenderListFields', getUserVar(getCurrentUser(), 'UserCharsCalenderListFields')+1); }
        // lessChars
          if ( isset($_REQUEST['job']) AND  $_REQUEST['job']=='lessChars' ) { setUserVar('UserCharsCalenderListFields', getUserVar(getCurrentUser(), 'UserCharsCalenderListFields')-1); }
        $UserCharsCalenderListFields = getCurrentUserVar('UserCharsCalenderListFields');
        // IsPrivate or Not
          if ( isset($_REQUEST['job']) AND  $_REQUEST['job']=='changePrivateState' )
            changeGigIsPrivate ($_REQUEST['GigID']);
        // Seiten-Navigation definieren
        // Session-Variable 'Zeitraum' definieren
          if ( isset($_REQUEST['Zeitraum']) ) { $_SESSION["Zeitraum"] = $_REQUEST['Zeitraum']; $_SESSION['CurrentPageShowAllGigs']=1; }
          if ( !isset($_SESSION["Zeitraum"]) ) { $_SESSION["Zeitraum"] = "future"; }
          $Zeitraum = $_SESSION["Zeitraum"];
        // Sessioin-Variable 'Anzahl' definieren
          if ( isset($_REQUEST['Anzahl']) ) { $_SESSION["Anzahl"] = $_REQUEST['Anzahl']; $_SESSION['CurrentPageShowAllGigs']=1; }
          if ( !isset($_SESSION["Anzahl"]) ) { $_SESSION["Anzahl"] = "20"; }
          $EintraegeProSeite = $_SESSION["Anzahl"];
        // Sessioin-Variable 'GigStatus' definieren
          if ( isset($_REQUEST['AuswahlGigStatus']) ) { $_SESSION["AuswahlGigStatus"] = $_REQUEST['AuswahlGigStatus']; $_SESSION['CurrentPageShowAllGigs']=1;}
          if ( !isset($_SESSION["AuswahlGigStatus"]) ) { $_SESSION["AuswahlGigStatus"] = "all"; }
          $AuswahlGigStatus = $_SESSION["AuswahlGigStatus"];
        // Parameter für Navigation definieren
          $AnzahlGigsImZeitraum = AnzahlGigsImZeitraum($Zeitraum, $AuswahlGigStatus);
          if ( $EintraegeProSeite!='all' ) { $AnzahlSeiten = ceil($AnzahlGigsImZeitraum/$EintraegeProSeite); }
            else { $AnzahlSeiten = '0'; }
          if (isset($_REQUEST['subpage'])) { $_SESSION['CurrentPageShowAllGigs'] = $_REQUEST['subpage']; }
          if ( !isset($_SESSION['CurrentPageShowAllGigs']) ) { $_SESSION['CurrentPageShowAllGigs'] = "1"; }
          $aktuelleSeite = $_SESSION['CurrentPageShowAllGigs'];
          $obersterGig  = $EintraegeProSeite*($aktuelleSeite-1);

        // Ansichts-Parameter
        echo '<form name="myForm" method="post" action="index.php?submenu=calendar&amp;page=backend_showAllGigs">
                  <fieldset id="PageMenu">
                    <select name="Anzahl" onchange="parent.location.href=\'index.php?submenu=calendar&amp;page=backend_showAllGigs&amp;Anzahl=\' +this.options[this.selectedIndex].value">
                      <option value="all"'; if ($EintraegeProSeite=="all") echo ' selected="selected"'; echo'>'.$L_ShowAllGigs.'</option>';
                        for ($i=10; $i<=100; $i++)
                        {
                          echo '<option value="'.$i.'"';
                          if ($EintraegeProSeite==$i) echo ' selected="selected"';
                          echo'>'.$i.'</option>';
                        }
                  echo '</select>
                    <input type="hidden" name="thread[threadid]" value="$thread[threadid]" />
                    <select name="Zeitraum" onchange="parent.location.href=\'index.php?submenu=calendar&amp;page=backend_showAllGigs&amp;Zeitraum=\' +this.options[this.selectedIndex].value">
                      <option value="all"'; if ($Zeitraum=="all") echo ' selected="selected"'; echo'>'.$L_ShowAllGigs.'</option>
                      <option value="future"'; if ($Zeitraum=="future") echo ' selected="selected"'; echo'>'.$L_ShowFutureGigs.'</option>
                      <option value="past"'; if ($Zeitraum=="past") echo ' selected="selected"'; echo'>'.$L_ShowPastGigs.'</option>
                    </select>
                    <input type="hidden" name="thread[threadid]" value="$thread[threadid]" />
                    <select name="AuswahlGigStatus" onchange="parent.location.href=\'index.php?submenu=calendar&amp;page=backend_showAllGigs&amp;AuswahlGigStatus=\' +this.options[this.selectedIndex].value">
                      <option value="all"'; if ($AuswahlGigStatus=="all") echo ' selected="selected"'; echo'>'.$L_ShowAllGigs.'</option>
                      <option value="Gig"'; if ($AuswahlGigStatus=="Gig") echo ' selected="selected"'; echo'>'.$L_GigStatusGig.'</option>
                      <option value="Option"'; if ($AuswahlGigStatus=="Option") echo ' selected="selected"'; echo'>'.$L_GigStatusOption.'</option>
                      <option value="Rehearsal"'; if ($AuswahlGigStatus=="Rehearsal") echo ' selected="selected"'; echo'>'.$L_GigStatusRehearsal.'</option>
                      <option value="Blocked"'; if ($AuswahlGigStatus=="Blocked") echo ' selected="selected"'; echo'>'.$L_GigStatusBlocked.'</option>
                    </select>';
        // Button 'Add Gig'
          include('calendar/includes/buttonAddGig.php');
        // Button 'Delete Gigs'
          include('calendar/includes/buttonDeleteGigs.php');
        // Button 'Print'
          include('calendar/includes/buttonPrint.php');
        // Navigation
          include('calendar/includes/buttonPageNavigation.php');
        // Attribute-Editor
          include('calendar/includes/buttonAttributes.php');
        // Spaltenbreite 
          include('calendar/includes/buttonColumnsWidth.php');

        echo '</fieldset>';
      // Datensatz-Ausgabe festlegen
        $TimestampVonHeute = TimestampAusDatum(date("d"), date("m"), date("y")); 
        $sql = "SELECT * FROM ".$prefix."gigs";
        if ( $Zeitraum!='all' OR $AuswahlGigStatus!='all' ) $sql .= ' WHERE ';
        if ( $Zeitraum =="future" ) $sql .= "GigDate>=".$TimestampVonHeute;
        if ( $Zeitraum =="past" ) $sql .= "GigDate<".$TimestampVonHeute;
        if ( $Zeitraum!='all' && $AuswahlGigStatus!='all' ) $sql .= ' AND ';
        if ( $AuswahlGigStatus!='all' ) $sql .= " GigStatus='".$AuswahlGigStatus."'";
        if ( $Zeitraum =="future" ) $sql .= " order by GigDate, GigBeginning";
        if ( $Zeitraum =="past" ) $sql .= " order by GigDate DESC, GigBeginning DESC";
        if ( $Zeitraum =="all" ) $sql .= " order by GigDate";
        $sql .= " LIMIT ".$obersterGig.", ";
        if ( $EintraegeProSeite=='all') $sql .= $AnzahlGigsImZeitraum;
          else $sql .= $EintraegeProSeite;
        $resultat = mysql_query($sql);
      // Ausgabe der Gig-Übersicht
        if ( $AnzahlGigsImZeitraum!=0 ) // Einträge vorhanden
        {   
          $UserBackendCalenderListCols = getCurrentUserVar ('UserBackendCalenderListCols');
          if ( $UserBackendCalenderListCols!="" ) $Attribute = explode (', ',$UserBackendCalenderListCols);
            else $Attribute = array();
          echo '<table id="WideTable" summary="Tabelle_Zeige-Gigs">';
          // Spalten definieren
            echo '<colgroup>';
            // Delete & Edit
              if ( IsUserAdmin() )
              {
                echo '<col class="SpalteIcon" />';
                echo '<col class="SpalteIcon" />';
              }
            // Status (für Print)
              echo '<col class="GigPrint" />';
            // Variable Spalten
              $amountAttributes = count($Attribute);
              for ($i=0; $i<$amountAttributes; $i++)
                echo '<col id="'.$Attribute[$i].'" />';
            echo '</colgroup>';
          // Spaltenköpfe definieren
            echo '<tr id="TableColumnHead">';
            // Delete & Edit
              if ( IsUserAdmin() )
              {
                echo'<th><input class="checkbox" type="checkbox" name="Delete" value="1" onClick="changeCheckboxes(this.checked)"  /></th>';
                echo '<th>&nbsp;</th>';
              }
            // Status (für Print)
              echo '<th class="GigPrint">'.$L_GigStatus.'</th>';
            //echo '<th>'.$L_GigDate.' <input title="" name="AttributeUp" src="images/down.gif" style="border:0; width:12px;" type="image" value="'.$i.'" /></th>';
            // Variable Spalten
              for ($x=0; $x<$amountAttributes; $x++ )
              {
                if ( $x!=$amountAttributes-1 ) echo '<th>';
                  else echo '<th class="TabellenSpalte_Rechts">';
                switch ( $Attribute[$x] )
                {
                  case "GigIsPrivate": echo '<img src="images/private.png" alt="'.$L_Private.'" title="'.$L_Private.'" />'; break;
                  case "GigPublish": echo '<img src="images/frontend.gif" alt="'.$L_Publish.'" title="'.$L_Publish.'" />'; break;
                  case "GigBeginning": echo '<img src="images/time.png" alt="" title="" />'; break;
                  default: echo ''.${'L_'.$Attribute[$x]}; break;
                }
                echo '</th>';
              }
            //
            echo '</tr>';
          //
          while ($row = mysql_fetch_array($resultat))
          {
            extract($row);
  	        echo '<tr>';
            // Delete & Edit
              if ( IsUserAdmin() )
              {
                echo '<td class="'.$GigStatus.'">
                        <input type="checkbox" name="selectedGigs[]" value="'.$GigID.'" class="checkbox" />
                      </td>
                      
                      <td class="'.$GigStatus.'">
                        <a href="index.php?submenu=calendar&amp;page=backend_addGig&amp;job=edit&amp;id='.$GigID.'">
                          <img class="Icon" src="images/edit.png" alt="'.$L_010.'" title="'.$L_010.'" /></a>
                      </td>';
              }
              else
              {
                echo '<td class="'.$GigStatus.'">
                        <a href="index.php?submenu=calendar&amp;page=backend_showGig&amp;id='.$GigID.'">
                          <img src="images/show.gif" alt="'.$L_153.'" title="'.$L_153.'" /></a>
                      </td>';
              }
            // GigDate
              //echo '<td class="'.$GigStatus.'">'.date(getSetup('SetupBackendDateFormat'), $GigDate).'</td>';
            // Status (für Print)
              echo '<td class="GigPrint">'.$GigStatus.'</td>';
            // Variable Spalten
              for ($x=0; $x<$amountAttributes; $x++ )
              {
                if ( $x!=$amountAttributes-1 ) echo '<td class="'.$GigStatus.'">';
                  else echo '<td class="'.$GigStatus.' TabellenSpalte_Rechts">';
                include ('calendar/includes/showAllGigs/'.$Attribute[$x].'.php');
                echo '</td>';
              }
            //
            echo '</tr>';
            //$Location = '';
          }
          echo '</table>';
          include("calendar/backend_legende.php");
        }
        else
        {
          echo '<br />'.$L_154."<br /><br />";
          }
      echo '</form>';
      }
    // Inhalt zuende
  }
?>
Return current item: GigKalender