Location: PHPKode > projects > WebETB > kraefte/status.php4
<?php
/******************************************************************************/
/*	MODUL:	kraefte/status.php4     														*/
/*																										*/
/* DATUM:	27.03.2006, Version 0.1															*/
/* BESCHR.:	Statusuebersicht aller eingesetzen Kraefte                        */
/*																										*/
/*	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","trans");
include ('../_include/header_1.php4');

if (isset($sortit))
{     
      if ( $sort_order == "status" )
      {
         $sort_text="Status";
         $sort_order="status";
      }
      else
      {
         $sort_text="Rufname";
         $sort_order="rufname";
      }
 
      $last_sort_order = $sort_order;
      $last_sort_text = $sort_text;
      $sortit = "";  
}
else
{
      if ( !isset($last_sort_order) )
      {
            $sort_text="Status";
            $sort_order="status";
      }
      else
      {
            $sort_order = $last_sort_order;
            $sort_text = $last_sort_text;
      }
   
}

function status_disp($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i,$db_sosi)
{
            // sosi or not :)
            $sosisign="&nbsp;";
            if ( $db_sosi== "Y" )
            {
               $sosisign="<img src=\"../_img/sosi.gif\" width=\"10\" height=\"40\">";
            }

            // start new row
            if ($i == 0 ) 
            { echo "\t<tr>\n"; }
            
            echo "\t\t<td align=\"middle\" style=\"background-color: $STATUS_COL;\"><a href=\"\" title=\"$last_msg_state\" style=\"color: #000000; text-decoration:none;\">$db_rufname<BR>Status $db_status</a></td>\n";
            echo "\t\t<td style=\"background-color: #E0E0E0;\" valign=\"bottom\">$sosisign</td>\n";
            
             // end new row
            $i++;
            if ($i == 10 ) 
            { 
               echo "\t</tr>\n"; 
               echo "<tr>\t\t<td colspan=\"21\" style=\"background-color: #E0E0E0;\" height=\"2\"></td>\n\t</tr>";
               $i = 0;
            }
   return $i;
}
?>
   <br>
   <center>
   <form action="" name="sort_kraefte" method=POST>
   <table border="0" cellpadding="0" cellspacing="0" width="290">
   <tr>
      <td style="background-color: #E0E0E0;">&nbsp;&nbsp;Sortieren nach:</td>
      <td style="background-color: #E0E0E0;" width="20">&nbsp;</td>
      <td style="background-color: #E0E0E0;"><select name="sort_order" size=1 style="width: 100px; border-width: 1px solid silver;">
         <option selected value="status" >Status
         <option          value="rufname">Rufname
      </td>
      <td style="background-color: #E0E0E0;"><input type=submit VALUE="OK" style="border: 1px solid silver;"></td>
   </tr>
   </table>
   <input type="hidden" name="sortit" value="TRUE">
   </form>

   <table border="0" cellpadding="0" cellspacing="0" width="900">
      <tr>
         <th colspan="19">Status&uuml;bersicht der Einsatzkr&auml;fte (Nach <? echo $sort_text; ?>)</th>
         <th width="20" style="background-color: #E0E0E0;"><img src="../_img/spacer.gif" border="0" width="20" height="1"></th>
      </tr>
      <?
         // define table layout
         echo "\t<tr>\n";
         for ( $i = 1; $i <= 10; $i++ )
         {
            $showheight = 0;
            echo "<td width=\"70\" height=\"$showheight\" style=\"background-color: #E0E0E0;\"><img src=\"../_img/spacer.gif\" border=\"0\" width=\"70\" height=\"$showheight\"></td>\n";
            echo "<td width=\"20\" height=\"$showheight\" style=\"background-color: #E0E0E0;\"><img src=\"../_img/spacer.gif\" border=\"0\" width=\"20\" height=\"$showheight\"></td>\n";
         }
         echo "\t</tr>\n";

         // get status information
if ($sort_order == "status" )
{         
         $select_status_inf="select kid, rufname, status, sosi from $T_kraefte where eid=$eid order by status, rufname";
         $result_status_inf=@mysql_db_query($database["database"],$select_status_inf,$db);
         $anzahl_status_inf=mysql_num_rows($result_status_inf);
         
         // create inner table fields, each row has 10
         $i0 = 0;
         $i1 = 0;         
         $i2 = 0;
         $i3 = 0;
         $i4 = 0;
         $i5 = 0;
         $i6 = 0;
         $i7 = 0;
         $i8 = 0;
         $i9 = 0;
         
         while ( $row=mysql_fetch_array($result_status_inf) )
         {
            $db_kid=$row['kid'];
            $db_status=$row['status'];
            $db_sosi=$row['sosi'];
            $db_rufname=$row['rufname'];
            
            if (!isset($old_status))
            {
               $old_status = $db_status;
            }          
            
            if ($old_status != $db_status)
            {
               echo "\t</tr>\t<tr>";
               echo "\t\t<td style=\"background-color: #E0E0E0;\" colspan=\"20\" width=\"900\" height=\"5\"><img src=\"../_img/spacer.gif\" border=\"0\"
               width=\"900\" height=\"20\"></td>\n";
               echo "\t</tr>\t<tr>";
            }
            
                     // Get last state info from etb
         $select_last_state="select text,zeit from $T_etb where eid=$eid and von_kid=$db_kid order by lfdnr desc limit 1";
         $result_last_state=@mysql_db_query($database["database"],$select_last_state,$db);
         if ( mysql_num_rows($result_last_state) != 0 )
         {
            while ( $row=mysql_fetch_array($result_last_state) )
            {
               $last_msg_zeit=$row['zeit'];
               $last_msg_text=$row['text'];
               $last_msg_state=$last_msg_zeit . ":" . $last_msg_text;
            }
         }
         else
         {
               $last_msg_state="Keine Eintragung vorhanden";
         }
            // define color
            switch ($db_status) 
            {
               case 0:  $STATUS_COL=$STATUS_0;
                        $i0=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i0,$db_sosi);
                        break;
               case 1:  $STATUS_COL=$STATUS_1;
                        $i1=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i1,$db_sosi);
                        break;
               case 2:  $STATUS_COL=$STATUS_2;
                        $i2=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i2,$db_sosi);
                        break;
               case 3:  $STATUS_COL=$STATUS_3;
                        $i3=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i3,$db_sosi);
                        break;
               case 4:  $STATUS_COL=$STATUS_4;
                        $i4=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i4,$db_sosi);
                        break;
               case 5:  $STATUS_COL=$STATUS_5;
                        $i5=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i5,$db_sosi);
                        break;
               case 6:  $STATUS_COL=$STATUS_6;
                        $i6=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i6,$db_sosi);
                        break;
               case 7:  $STATUS_COL=$STATUS_7;
                        $i7=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i7,$db_sosi);
                        break;
               case 8:  $STATUS_COL=$STATUS_8;
                        $i8=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i8,$db_sosi);
                        break;
               case 9:  $STATUS_COL=$STATUS_9;
                        $i9=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$i9,$db_sosi);
                        break;          
            }
            
            $old_status = $db_status;
         }
}
else
{
         $select_status_inf="select kid, rufname, status, sosi from $T_kraefte where eid=$eid order by rufname";
         $result_status_inf=@mysql_db_query($database["database"],$select_status_inf,$db);
         $anzahl_status_inf=mysql_num_rows($result_status_inf);
         $ii = 0;
         while ( $row=mysql_fetch_array($result_status_inf) )
         {
            $db_kid=$row['kid'];
            $db_status=$row['status'];
            $db_sosi=$row['sosi'];
            $db_rufname=$row['rufname'];
            switch ($db_status) 
            {
               case 0:  $STATUS_COL=$STATUS_0;
                        break;
               case 1:  $STATUS_COL=$STATUS_1;
                        break;
               case 2:  $STATUS_COL=$STATUS_2;
                        break;
               case 3:  $STATUS_COL=$STATUS_3;
                        break;
               case 4:  $STATUS_COL=$STATUS_4;
                        break;
               case 5:  $STATUS_COL=$STATUS_5;
                        break;
               case 6:  $STATUS_COL=$STATUS_6;
                        break;
               case 7:  $STATUS_COL=$STATUS_7;
                        break;
               case 8:  $STATUS_COL=$STATUS_8;
                        break;
               case 9:  $STATUS_COL=$STATUS_9;
                        break;          
            }
         // Get last state info from etb
         $select_last_state="select text,zeit from $T_etb where eid=$eid and von_kid=$db_kid order by lfdnr desc limit 1";
         $result_last_state=@mysql_db_query($database["database"],$select_last_state,$db);
         if ( mysql_num_rows($result_last_state) != 0 )
         {
            while ( $row=mysql_fetch_array($result_last_state) )
            {
               $last_msg_zeit=$row['zeit'];
               $last_msg_text=$row['text'];
               $last_msg_state=$last_msg_zeit . ":" . $last_msg_text;
            }
         }
         else
         {
               $last_msg_state="Keine Eintragung vorhanden";
         }
         $ii=status_disp ($STATUS_COL, $db_rufname, $db_status,$last_msg_state,$ii,$db_sosi);
            
         }
}         


      ?>
   </table>
   <table border="0" cellspacing="0" cellpadding="0">
   <tr>
      <td  HEIGHT="0" WIDTH="0">
         <iframe src="reload.php4" HEIGHT="0" WIDTH="0" name="_reload" target="_reload" FRAMEBORDER="0" FRAMESPACING="0" BORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0"
         TOPMARGIN="0" NORESIZE SCROLLING="no"></iframe>
      </td>
   </tr>
   </table>   
   </center>
<?
include ('../_include/footer_1.php4');
?>
Return current item: WebETB