Location: PHPKode > projects > WebETB > action.php4
<?php
/******************************************************************************/
/*	MODUL:	action.php4             														*/
/*																										*/
/* DATUM:	27.03.2006, Version 0.1															*/
/* BESCHR.:	Dialog zum erstellen eines neuen oder zum verbinden mit einem     */
/*          bestehenden Einsatz.                                              */
/*																										*/
/*	AUTOR:   Marcus Groh																			*/
/*	LIZENZ:  GPL v2 vom Juni 1991 															*/
/*																										*/
/*	AENDERUNGEN:	29.06.2004        -initiale Version								   */
/*                27.03.2006 v 0.1, -Versionskennzeichnung eingefuehrt        */
/*                                  -Code unter GPL v2 gestellt               */
/*                                  -Tabellenname dynamisiert                 */
/*																										*/
/******************************************************************************/

include ('_include/header.php4');
include "./config/conf_glbl.php4";

if ( $access != "TRUE" )
{
   echo "<meta http-equiv=\"refresh\" content=\"0; URL=login.php4\">\n";
   exit;
}   

// store temporarily action
$action_tmp=$action;

if ( $action == "NEU" )
{
   // Neuen Einsatz anlegen
   ?>
   <br><br>
   <center>
   <table border="0" cellspacing="0" cellpadding="0">
   <form action="manage_action.php4" method=post name="new_action">
   <tr>
      <th colspan="9" width="470"><p id="GN15">Neuen Einsatz anlegen</p></th>
   </tr>
   <tr>
      <th colspan="9" width="470"style="background-color: #000000;"><img src="_img/spacer.gif" border="0" width="470" height="1"></th>
   </tr>   
   <tr>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" HEIGHT="30" BORDER="0"></td>
      <td colspan="3" width="200">Einsatzbeschreibung / Ort:</td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" HEIGHT="30" BORDER="0"></td>
      <td colspan="3"><input TYPE=text NAME="desc" style="width: 250px; border: 1px solid silver;"></td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" HEIGHT="30" BORDER="0"></td>
   </tr>
   <tr>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
      <td colspan="7" VALIGN="bottom">Einsatzbeginn:</td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
   </tr>
   <tr>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
      <td>Datum:</td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
      <td><input TYPE=text NAME="d_start" value="<? echo date("d.m.Y"); ?>" style="width: 80px; border: 1px solid silver;"></td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
      <td>Uhrzeit:</td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
      <td><input TYPE=text NAME="t_start" value="<? echo date("H:i:s"); ?>" style="width: 80px; border: 1px solid silver;"></td>
      <td width="5"><img src="_img/spacer.gif" WIDTH="5" BORDER="0"></td>
   </tr>
   </table>
   <br>
   <INPUT TYPE="submit" Value="Einsatz beginnen" style="border: 1px solid silver;">
   </form>   
   </center>
   
   <?
   // show also allready stored actions
  $no_act_cnt = 0;
  $action="MIT";
}

if ( $action == "MIT" )
{
   $action=$action_tmp;
   // An Einsatz mitarbeiten
   ?>
   <br><br><center>
   <table border="0" cellspacing="0" cellpadding="0" width="702">
   <tr>
      <td COLSPAN="3" HEIGHT="1" style="background-color: #000000;"><img src="_img/spacer.gif" HEIGHT="1" WIDTH="122" BORDER="0"></td>
   </tr>
   <tr>
      <td WIDTH="1" style="background-color: #000000;"><img src="_img/spacer.gif" WIDTH="1" BORDER="0"></td>
      <td>
         <form action="manage_action.php4" method=post name="get_action">
         <table border="0" cellspacing="0" cellpadding="5" width="700">
         <tr>
            <th COLSPAN="4" ALIGN="CENTER"><p id="RT15">Offene Eins&auml;tze</p></th>
         </tr>
         <tr>
            <td><p id="GR07">&nbsp;</p></td>
            <td><p id="GR07">Einsatzbeschreibung / Ort</p></td>
            <td><p id="GR07">Start-Datum</p></td>
            <td><p id="GR07">Start-Uhrzeit</p></td>
         </tr>
         <tr>
         <?php
            // Offene Einsetze aus db holen
            $no_act_cnt = 0;
            $select_einsatz_o="select eid, date_beg, time_beg, ort from $T_einsaetze where opened like 'Y' and closed  not like 'Y' order by date_beg DESC";
            $result=@mysql_db_query($database["database"],$select_einsatz_o,$db);
            $anzahl=mysql_num_rows($result);
            if ( $anzahl <= 0 )
            {
               $no_act_cnt++;
               echo "<tr>\n<td colspan=\"4\">Keine offenen Eins&auml;tze vorhanden.</td>\n</tr>\n";
            }
            else
            {
               while ( $row=mysql_fetch_array($result) )
               {
                  $eid=$row['eid'];
                  $ort=$row['ort'];
                  list ($Y, $M, $D) = split ('[/.-]', $row['date_beg']);
                  $date_beg="$D.$M.$Y";
                  $time_beg=$row['time_beg'];
 
                  echo "<tr>\n<td><input type=radio name=\"use_eid\" value=\"$eid\"></td>\n";
                  echo "<td width=\"500\"><p id=\"SW10\">$ort</p></td>\n";
                  echo "<td width=\"50\"><p id=\"SW10\">$date_beg</p></td>\n";
                  echo "<td width=\"50\"><p id=\"SW10\">$time_beg</p></td>\n</tr>\n";
               }
            }
         ?>
         </tr>
         </table>
      </td>
      <td WIDTH="1" style="background-color: #000000;"><img src="_img/spacer.gif" WIDTH="1" BORDER="0"></td>
   </tr>
   <tr>
      <td COLSPAN="3" HEIGHT="1" style="background-color: #000000;"><img src="_img/spacer.gif" HEIGHT="1" WIDTH="122" BORDER="0"></td>
   </tr>   
   </table>
   
   <br>
   
   <table border="0" cellspacing="0" cellpadding="0" width="702">
   <tr>
      <td COLSPAN="3" HEIGHT="1" style="background-color: #000000;"><img src="_img/spacer.gif" HEIGHT="1" WIDTH="122" BORDER="0"></td>
   </tr>
   <tr>
      <td WIDTH="1" style="background-color: #000000;"><img src="_img/spacer.gif" WIDTH="1" BORDER="0"></td>
      <td>   
         <table border="0" cellspacing="0" cellpadding="5" width="700">
         <tr>
            <th COLSPAN="4" ALIGN="CENTER"><p id="BL15">Abgeschlossene Eins&auml;tze</th>
         </tr>
         <tr>
            <td><p id="GR07">&nbsp;</p></td>
            <td><p id="GR07">Einsatzbeschreibung / Ort</p></td>
            <td><p id="GR07">Start-Datum</p></td>
            <td><p id="GR07">End-Datum</p></td>
         </tr>
         
            <?php
            // Abgeschlossene Einsetze aus db holen
            
            $select_einsatz_o="select eid, date_beg, date_end, ort from $T_einsaetze where closed like 'Y' order by date_beg DESC";
            $result=@mysql_db_query($database["database"],$select_einsatz_o,$db);
            $anzahl=mysql_num_rows($result);
            if ( $anzahl <= 0 )
            {
               $no_act_cnt++;
               echo "<tr>\n<td colspan=\"4\">Keine abgeschlossenen Eins&auml;tze vorhanden.</td>\n</tr>\n";
            }
            else
            {
               while ( $row=mysql_fetch_array($result) )
               {
                  $eid=$row['eid'];
                  $ort=$row['ort'];
                  list ($Y, $M, $D) = split ('[/.-]', $row['date_beg']);
                  $date_beg="$D.$M.$Y";
                  list ($Y, $M, $D) = split ('[/.-]', $row['date_end']);
                  $date_end="$D.$M.$Y";
 
                  echo "<tr>\n<td><input type=radio name=\"use_eid\" value=\"$eid\"></td>\n";
                  echo "<td width=\"500\">$ort</td>\n";
                  echo "<td width=\"50\">$date_beg</td>\n";
                  echo "<td width=\"50\">$date_end</td>\n</tr>\n";
               }
            }
            ?>
         </table>
      </td>
      <td WIDTH="1" style="background-color: #000000;"><img src="_img/spacer.gif" WIDTH="1" BORDER="0"></td>
   </tr>
   <tr>
      <td COLSPAN="3" HEIGHT="1" style="background-color: #000000;"><img src="_img/spacer.gif" HEIGHT="1" WIDTH="122" BORDER="0"></td>
   </tr>   
   </table>
            
   <br>
   <input TYPE="submit" Value="Mit Einsatz verbinden" style="border: 1px solid silver;">
   </form>
   </center>
   <br>
   <?   
   


}
   
include ('_include/footer.php4');
   
?>
Return current item: WebETB