Location: PHPKode > projects > WebETB > kraefte/index.php4
<?php
/******************************************************************************/
/*	MODUL:	kraefte/index.php4      														*/
/*																										*/
/* DATUM:	27.03.2006, Version 0.1															*/
/* BESCHR.:	Hinzufuegen von neuen oder aendern von bestehenden Einsatzkraeften*/
/*																										*/
/*	AUTOR:   Marcus Groh																			*/
/*	LIZENZ:  GPL v2 vom Juni 1991 															*/
/*																										*/
/*	AENDERUNGEN:	01.07.2004        -initiale Version								   */
/*                27.03.2006 v 0.1, -Versionskennzeichnung eingefuehrt        */
/*                                  -Code unter GPL v2 gestellt               */
/*                                  -Tabellenname dynamisiert                 */
/*																										*/
/******************************************************************************/
$allowed_groups=array("elw");
include ('../_include/header_1.php4');
 
if ( ( $writemode == "TRUE" ) && ( $isclosed == "FALSE" ) )
{
   // Datensatz eintragen
   if ( (isset($insert))  && (isset($rufname)) && (isset($typ)) )
   {
      // pruefen ob eintrag bereits vorhanden
      $check_helper="Select rufname from $T_kraefte where eid=$eid and rufname like '$rufname'";
      $result=@mysql_db_query($database["database"],$check_helper,$db);
      $anzahl=mysql_num_rows($result);
      if ( $anzahl == 0 )
      {
         // Daten eintragen
         
         $insert_helper="Insert into $T_kraefte values ('%','$rufname','$typ','$fme','$mobil','$bemerkung','$frm_status','N','$eid')";
         mysql_db_query($database["database"],$insert_helper,$db);
      }
      // Werte zuruecksetzen
      $insert="";
      $rufname="";
      $typ=""; 
   }

   
   // Datensatz loeschen
   if ( ! isset($drop) ) { $drop="false"; }
       if  ( $drop == "true" )
       {
          //$delete_helper="delete from $T_kraefte where kid=$kid and eid=$eid";
          //mysql_db_query($database["database"],$delete_helper,$db);
          echo "<p id=\"RT10\" align=\"center\">Das l&ouml;schen ist momentan aus Konsistenzgr&uuml;nden deaktiviert.</p>\n";
          $drop="false";
       }

   // Datensatz aendern
       if ( isset($modify) )
       {
           $modify_helper="Update $T_kraefte set rufname='$rufname',typ='$typ' ,fme='$fme' ,mobil='$mobil' ,bemerkung='$bemerkung', status='$frm_status' where kid=$kid and eid=$eid";
           mysql_db_query($database["database"],$modify_helper,$db);
           $mod="";
           $modify="";
       }
}

// Formular fuer Datensatz neu / aendern
if ( ! isset($mod) ) { $mod="false"; }
?>
      <br>
      <center>
<?
if ( ( $writemode == "TRUE" ) && ( $isclosed == "FALSE" ) )
{
   if ( $mod == "true" )
   {
      ?>
         <form action="" method=post name="modify_kraefte">
         <table border="0" cellpadding="0" cellspacing="0" width="470">
         <tr>
            <th colspan="5">Datensatz &auml;ndern</th>
         </tr>
         <tr>
            <td width="100">Rufname</td>
            <?
            $select_kraefte="select * from $T_kraefte where eid=$eid and kid=$kid";
            $result=@mysql_db_query($database["database"],$select_kraefte,$db);
               while ( $row=mysql_fetch_array($result) )
                  {
                     $rufname=$row['rufname'];
                     $db_status=$row['status'];
                     $db_typ=$row['typ'];
                     $fme=$row['fme'];
                        if ( $fme == "0" ) { $fme=""; }
                     $mobil=$row['mobil'];
                     $bemerkung=$row['bemerkung'];
                  }

            ?>
            <td><input TYPE=text NAME="rufname" value="<? echo $rufname; ?>" style="width: 100px; border: 1px solid silver;"></td>
            <td width="20">&nbsp;</td>
            <td width="100">Typ</td>
            <td><select name="typ" size=1 style="width: 150px; border-width: 1px solid silver;">
                <option value="<? echo $db_typ; ?>"><? echo $db_typ; ?>
                <option value="">-----
                <option value="Abschnitt">Abschnitt
                <option value="Einrichtung">Einrichtung
                <option value="Fahrzeug">Fahrzeug
                <option value="Person">Person
                <option value="Team">Team</td>
         </tr>
         <tr>
            <td width="100">Funkmelder</td>
            <td><input TYPE=text NAME="fme" value="<? echo $fme; ?>" style="width: 50px; border: 1px solid silver;"></td>
            <td width="20">&nbsp;</td>
            <td width="100">Mobil</td>
            <td><input TYPE=text NAME="mobil" value="<? echo $mobil; ?>" style="width: 150px; border: 1px solid silver;"></td>
         </tr>
      <tr>
         <td width="100">Status</td>
         <td><select name="frm_status" size=1 style="width: 50px; border-width: 1px solid silver;">
             <option value="<? echo $db_status; ?>">S<? echo $db_status; ?>
             <option value="">-----
             <option value="0">S0
             <option value="1">S1
             <option value="2">S2
             <option value="3">S3
             <option value="4">S4
             <option value="5">S5
             <option value="6">S6
             <option value="7">S7
             <option value="8">S8
             <option value="9">S9
         </td>
         <td width="20">&nbsp;</td>
         <td width="100">FMS-Code&nbsp;&nbsp;
         <a href="fmskengen.php4?ruf=<? echo $rufname; ?>" target="_fmskengen" onFocus="blur();" style="text-decoration: none; font-size:15pt;">&rarr;</td>
         <td><input TYPE=text NAME="fmscode" style="width: 150px; border: 1px solid silver;"></td>
      </tr>
         <tr>
            <td width="100" valign=top">Bemerkung</td>
            <td colspan="4"><textarea NAME="bemerkung" style="width: 370px; height: 50px; border: 1px solid silver;"><? echo $bemerkung; ?></textarea></td>
         </tr>
         </table>
         <br>
         <input type=hidden name="modify" value="TRUE">
         <input type=submit VALUE="&Auml;ndern" style="border: 1px solid silver;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <input type=reset VALUE="Abbrechen" style="border: 1px solid silver;">

         </form>
      <?
      $mod="false";
   }
   else
   {
   ?>
      <form action="" method=post name="manage_kraefte">
      <table border="0" cellpadding="0" cellspacing="0" width="470">
      <tr>
         <th colspan="5">Einsatzkr&auml;fte verwalten</th>
      </tr>
      <tr>
         <td width="100">Rufname</td>
         <td><input TYPE=text NAME="rufname" value="" style="width: 100px; border: 1px solid silver;"></td>
         <td width="20">&nbsp;</td>
         <td width="100">Typ</td>
         <td><select name="typ" size=1 style="width: 150px; border-width: 1px solid silver;">
             <option value="Abschnitt">Abschnitt
             <option value="Einrichtung">Einrichtung
             <option selected value="Fahrzeug">Fahrzeug
             <option value="Person">Person
             <option value="Team">Team</td>
      </tr>
      <tr>
         <td width="100">Funkmelder</td>
         <td><input TYPE=text NAME="fme" style="width: 50px; border: 1px solid silver;"></td>
         <td width="20">&nbsp;</td>
         <td width="100">Mobil</td>
         <td><input TYPE=text NAME="mobil" style="width: 150px; border: 1px solid silver;"></td>
      </tr>
      <tr>
         <td width="100">Status</td>
         <td><select name="frm_status" size=1 style="width: 50px; border-width: 1px solid silver;">
             <option value="0">S0
             <option value="1">S1
             <option value="2">S2
             <option value="3">S3
             <option value="4">S4
             <option value="5">S5
             <option selected value="6">S6
             <option value="7">S7
             <option value="8">S8
             <option value="9">S9
         </td>
         <td width="20">&nbsp;</td>
         <td width="100">FMS-Code&nbsp;&nbsp;
         <a href="fmskengen.php4" target="_fmskengen" onFocus="blur();" style="text-decoration: none; font-size:15pt;">&rarr;</td>
         <td><input TYPE=text NAME="fmscode" style="width: 150px; border: 1px solid silver;"></td>
      </tr>
      <tr>
         <td width="100" valign=top">Bemerkung</td>
         <td colspan="4"><textarea NAME="bemerkung" style="width: 370px; height: 50px; border: 1px solid silver;"></textarea></td>
      </tr>
      </table>
      <br>
      <input type=submit VALUE="Anlegen" style="border: 1px solid silver;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type=reset VALUE="Abbrechen" style="border: 1px solid silver;">
      <input type=hidden name="insert" value="TRUE">
      </form>
   <?
   }
}
?>
   <br>
   <table border="0" cellpadding="0" cellspacing="0" width="920">
   <tr>
      <th colspan="8">Vorhandene Einsatzkr&auml;fte</th>
   </tr>
   <tr>
      <td width="100"><p id="GR07">Rufname</p></td>
      <td width="50"><p id="GR07">Status</p></td>
      <td width="100"><p id="GR07">Typ</p></td>
      <td width="50"><p id="GR07">FME</p></td>
      <td width="100"><p id="GR07">Mobil</p></td>
      <td width="480"><p id="GR07">Bemerkung</p></td>      
      <td width="20"><p id="GR07">&nbsp;</p></td>
      <td width="20"><p id="GR07">&nbsp;</p></td>
   </tr>
      <?
            // Bereits definierte kraefte auflisten
            $select_kraefte="select * from $T_kraefte where eid=$eid order by rufname";
            $result=@mysql_db_query($database["database"],$select_kraefte,$db);
            $anzahl=mysql_num_rows($result);
            if ( $anzahl <= 0 )
            {
               echo "<tr>\n<td colspan=\"7\">Noch keine Einsatzkr&auml;fte definiert.</td>\n</tr>\n";
            }
            else
            {
               while ( $row=mysql_fetch_array($result) )
               {
                  $rufname=$row['rufname'];
                  $db_status=$row['status'];
                  $typ=$row['typ'];
                  $fme=$row['fme'];
                     if ( $fme == "0" ) { $fme=""; }
                  $mobil=$row['mobil'];
                  $bemerkung=$row['bemerkung'];
                  $kid=$row['kid'];
                  
                  echo "<tr>";
                  echo "<td valign=\"top\"><p id=\"sw10_s\">$rufname</p></td>\n";
                  echo "<td><p id=\"sw10_s\">$db_status</p></td>\n";
                  echo "<td valign=\"top\"><p id=\"sw10_s\">$typ</p></td>\n";
                  echo "<td valign=\"top\"><p id=\"sw10_s\">$fme</p></td>\n";
                  echo "<td valign=\"top\"><p id=\"sw10_s\">$mobil</p></td>\n";
                  echo "<td><p id=\"sw10_s\">$bemerkung</p></td>\n";
                  if ( ( $writemode == "TRUE" ) && ( $isclosed == "FALSE" ) )
                  {
                  echo "<td><a href=\"?mod=true&kid=$kid&eid=$eid\" onFocus=blur(); style=\"text-decoration: none;\"><img src=\"../_img/props.png\" border=\"0\" title=\"&Auml;ndern\"></a></td>\n";
                  echo "<td><a href=\"?drop=true&kid=$kid&eid=$eid\" onFocus=blur(); style=\"text-decoration: none;\"><img src=\"../_img/drop.png\" border=\"0\" title=\"L&ouml;schen\"></a></td>\n</tr>\n";
                  }
                  else
                  {
                     echo "<td colspan=\"2\"><p id=\"sw10_s\">&nbsp;</p></td>\n";
                  }
                  echo "<tr>";
                  echo "   <td colspan=\"8\" height=\"1\" width=\"920\" style=\"background-color: #999999;\"><img src=\"../_img/spacer.gif\" height=\"1\" width=\"920\" border=\"0\"></td>\n";
                  echo "</tr>";
               }
            }
      ?>
   </table>
   </center>   
<?

include ('../_include/footer_1.php4');

?>
Return current item: WebETB