Location: PHPKode > scripts > GigKalender > calendar/backend_addGig.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.
*/
  $GigDate  = '';
  $GigEvent = '';
  $GigEventURL = '';
  $GigLineup = '';
  $GigVisitors = '';
  $GigStageBuilding = '';
  $GigBeginning = '';
  $GigDuration = '';
  $GigEnding = '';
  $GigNotes = '';
  $GigEntranceFee = '';
  $GigDateDay = '';
  $GigDateMonth = '';
  $GigDateYear = '';
  $GigStatus = '';
  $GigPublish = '';
  $GigIsPrivate = '';
  $GigDateOfLastEdit = '';
  $GigLastEditor = '';
  $GigAddedFrom = '';
  $GigDateOfAdding = '';
  $GigIDToEdit = '';
  $GigVenueID = '';
  $GigOrganizerID = '';
  $GigArtistID = '';
  // POST-Variablen definieren
    if ( isset($_POST['senden']) )
    {
      foreach ($_POST as $key => $value)
      {
        if (get_magic_quotes_gpc()) $$key = stripslashes($value);
        else $$key = $value;
      }
      // Formular überprüfen
        if ( $senden
             && $GigDateDay
             && $GigDateMonth
             && $GigDateYear
             && checkGigDatum ( $GigDateDay, $GigDateMonth, $GigDateYear )
             && ( !$GigEventURL OR checkURL( $GigEventURL) )
             && $GigStatus
             && $GigPublish!=""
             && $GigIsPrivate!=""
             && (
                  ( $_REQUEST['job']=='add' AND ( getSetup('SetupAllowDoubleDates')
                                                  OR !testDoppelteGigs($GigDateDay, $GigDateMonth, $GigDateYear) ))
                  OR
                  ( $_REQUEST['job']=='edit' AND (  $_REQUEST['GigDate']==TimestampAusDatum ($GigDateDay, $GigDateMonth, $GigDateYear)
                                                    OR
                                                    (
                                                      getSetup('SetupAllowDoubleDates')
                                                      OR !testDoppelteGigs($GigDateDay, $GigDateMonth, $GigDateYear)
                                                    )
                                                 )
                  )
                )
           )
        {
          $FormularKorrektAusgefuellt = true;
        }
        else 
        { 
          $FormularKorrektAusgefuellt = false; 
          $GigIDToEdit = '';
          $GigDateOfAdding = '';
          $GigAddedFrom = '';
          $GigDateOfLastEdit = '';
          $GigLastEditor = '';
        }
    }
    else
    {  
      if ( isset($_REQUEST['id'])  ) { $GigID = $_REQUEST['id']; }
        else $GigID ="";
      if ($_REQUEST['job']=='edit')
      { 
        $SQL = "SELECT * FROM ".$prefix."gigs Where GigID = '$GigID'";
        $resultat = mysql_query($SQL);
        while ($row = mysql_fetch_array($resultat)) { extract($row); }
      }
      if ( $GigID )
      {
        $GigDateDay = date('d', $GigDate);
        $GigDateMonth = date('m', $GigDate);
        $GigDateYear = date('Y', $GigDate);
      }
      $FormularKorrektAusgefuellt = false;
      $senden = ''; 
    }
  if ( !IsUserAdmin() ) { echo $L_015; }
  else
  {
    // Inhalt hier einfügen
      if ($FormularKorrektAusgefuellt == true)
      { 
          $Gig = array( $GigID,
          	            $GigDateDay,
          	            $GigDateMonth,
                        $GigDateYear,
                        $GigEvent,
                        $GigEventURL,
                        $GigEntranceFee,                      
                        $GigLineup,
                        $GigVisitors,
                        $GigStageBuilding,
                        $GigBeginning,
                        $GigDuration,
                        $GigEnding,
                        $GigNotes,
                        $GigStatus,
                        $GigPublish,
                        $GigIsPrivate,
                        '',
                        '',
                        getCurrentUserVar("UserName"),
                        date("U"),
                        $GigVenueID,
                        $GigOrganizerID,
                        $GigArtistID);

        // Gig hinzufügen
        if ($_REQUEST['job']=='add')
        {
          if (addGig($Gig, "add")) echo $L_043.'<br />';
            else echo $L_044.'<br />';
        }
        // Gig bearbeiten
        if ($_REQUEST['job']=='edit')
        {
          if (addGig($Gig, "edit")) echo $L_040.'<br />';
            else echo $L_041.'<br />';
        }
      echo '<br />
        <form method="post" action="index.php?submenu=calendar&amp;page=backend_showAllGigs">
          <fieldset>
            <input type="submit" value="'.$L_Button26.'" class="button" />
          </fieldset>
        </form>';
      }
      else
      {
        // Post-Variablen in Variablen speichern
          foreach ($_POST as $key => $value)
          {
            if (get_magic_quotes_gpc()) $$key = stripslashes($value);
            else $$key = $value;
          }
        echo '<form method="post" action="index.php?submenu=calendar&amp;page=backend_addGig&amp;job='.$_REQUEST['job'].'">
          <table summary="AddGig" style="float:left;">';
            //include ('calendar/includes/addGig/GigDate.php');
            //include ('calendar/includes/addGig/GigStatus.php');
            //include ('calendar/includes/addGig/GigIsPrivate.php');
            //include ('calendar/includes/addGig/GigPublish.php');
            // Attribute definieren
              $SetupCalendarAttributeInAddGigForm = getSetup('SetupCalendarAttributeInAddGigForm');
              if ( $SetupCalendarAttributeInAddGigForm!="" ) $Attribute = explode (', ',$SetupCalendarAttributeInAddGigForm);
              else $Attribute = array();
            // Attribute ausgeben
            for ( $x = 0; $x < count ( $Attribute ); $x++ )
            {   
              ${$Attribute[$x]} = htmlspecialchars(${$Attribute[$x]});
              include ('calendar/includes/addGig/'.$Attribute[$x].'.php');
            }
            // evtl. Ausgeblendete Attribute-Inhalte übergeben
              $allBackendCalenderFormAttributes = explode (', ',$allBackendCalenderFormAttributes);
              $result = array_diff ( $allBackendCalenderFormAttributes, $Attribute );
              while ( list ( $key, $val ) = each ( $result ) )
              { 
                if ( $val!='GigNotes')
                {
                  echo '<tr><td></td><td><input type="hidden" name="'.$val.'" value="'.${$val}.'" /></td></tr>';
                }
                else
                {
                  echo '<tr>
                          <td></td>
                          <td>
                            <textarea style="display:none" id="'.$val.'" name="'.$val.'" rows="" cols="">'.wordwrap(${$val}).'</textarea>
                          </td>
                        </tr>';
                }
                
              }
            // Formular-Buttons
            echo '<tr>
              <td></td>
              <td>
                <input type="submit" name="senden" value="'.$L_Button01.'" class="button" />
                <input type="button" value="'.$L_Button03.'" onclick="self.location.href=\'index.php?submenu=calendar\'" class="button"/>
                <input type="hidden" name="GigID" value="'.$GigID.'" />
                <input type="hidden" name="GigDate" value="'.$GigDate.'" />
              </td>
            </tr>
          </table>
          <table style="float:right;">
            <tr>
              <td>'.$L_GigDateOfAdding.':</td>
              <td>'.DatumMitUhrzeitAusTimestamp($GigDateOfAdding);
                if ($GigAddedFrom) echo ' (';
                echo $GigAddedFrom;
                if ($GigAddedFrom) echo ')';
                echo'</td>
            </tr>
            <tr>
              <td>'.$L_GigDateOfLastEdit.':</td>
              <td>'.DatumMitUhrzeitAusTimestamp($GigDateOfLastEdit);
                if ($GigLastEditor) echo ' (';
                echo $GigLastEditor;
                if ($GigLastEditor) echo ')';
                echo'</td>
            </tr>
            <tr>
              <td>';
                // Attribut-Editor
                  if ( !isset($timestamp) ) $timestamp = '';
                  echo '<button name="Klickmich" type="button" value="'.$L_Button28.'" onclick="self.location.href=\'index.php?submenu=calendar&amp;page=backend_editAttributes&amp;Selector=backend_addGig&amp;referer=backend_addGig&amp;job='.$job.'&amp;id='.$GigID.'&amp;timestamp='.$timestamp.'\'" class="SmallButton" >
                          '.$L_Button28.'
                        </button>';
              echo '</td>
              <td></td>
            </tr>
          </table>
          </form>          
        ';
      }
    // Inhalt zuende
  }
?>
Return current item: GigKalender