Location: PHPKode > projects > WebETB > etb/list_etb.php4
<?php
/******************************************************************************/
/*	MODUL:	etb/index.php4          														*/
/*																										*/
/* DATUM:	27.03.2006, Version 0.1															*/
/* BESCHR.:	Anzeigen der letzten 10 Datensaetze des Einsatztagebuches         */
/*          Subfunktion von index.php4                                        */
/*																										*/
/*	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_2.php4');

   echo "      </center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"964\">\n";
   
   // retrieve data from db
   $select_etb="select * from $T_etb where eid=$eid order by lfdnr DESC";
   $result=@mysql_db_query($database["database"],$select_etb,$db);
   $max_lfd=mysql_num_rows($result);
      
//   if ( $max_lfd >= 10 )
//   {
      $start_etb=$max_lfd - 10;
      $stop_etb=$max_lfd;
      $select_etb="select * from $T_etb where eid=$eid and lfdnr >= '$start_etb' order by lfdnr DESC";
      $result_etb=@mysql_db_query($database["database"],$select_etb,$db);
//   }
   
         while ( $row=mysql_fetch_array($result_etb) )
         {
 
            // sort fields
            $lfdnr=$row['lfdnr'];
            $von_kid=$row['von_kid'];
            $an_kid=$row['an_kid'];
            $von_txt=$row['von_txt'];
            $an_txt=$row['an_txt'];
            list ($Y, $M, $D) = split ('[/.-]', $row['datum']);
            $datum="$D.$M.$Y";            
            $zeit=$row['zeit'];
            $text=$row['text'];
            $bemerkung=$row['bemerkung'];
            $bezug=$row['bezug'];
      	   $db_uid=$row['uid'];

            // set readable text for field "VON"
            if ( $von_kid == "0" )
            {
                  $von=$von_txt;
            }
            else
            {
               $select_von="select rufname from $T_kraefte where eid=$eid and kid=$von_kid";
               $result_von=@mysql_db_query($database["database"],$select_von,$db);
               while ( $row=mysql_fetch_array($result_von) )
               {
                  $von=$row['rufname'];
               }
            }

            // set readable text for field "AN"
            if ( $an_kid == "0" )
            {
                  $an=$an_txt;
            }
            else
            {
               $select_an="select rufname from $T_kraefte where eid=$eid and kid=$an_kid";
               $result_an=@mysql_db_query($database["database"],$select_an,$db);
               while ( $row=mysql_fetch_array($result_an) )
               {
                  $an=$row['rufname'];
               }
            }
 
            // set readable text for field "BEARBEITER"
            $select_user="select u_name from $T_user where uid=$db_uid";
            $result_user=@mysql_db_query($database["database"],$select_user,$db);
            while ( $row=mysql_fetch_array($result_user) )
            {
               $user=$row['u_name'];
            }

            // set readable text for field "PATIENT"
            $select_bezug="select pat_nr from $T_patient where eid=$eid and pid=$bezug";
            $result_bezug=@mysql_db_query($database["database"],$select_bezug,$db);
            $count_bezug=mysql_num_rows($result_bezug);
            if ( $count_bezug <= 0 )
            {
               $aufgabe="";
            }
            else
            {
                while ( $row=mysql_fetch_array($result_bezug) )
                {
                   $aufgabe="<a href=\"../patient/all.php4?view=true&pid=$bezug\" target=\"_parent\" onFocus=\"blur();\" style=\"text-decoration: none; \">" . $row['pat_nr'] ."</a>";
                }
            }
            
            // print values
            ?>
            <tr>
               <td width="30"  valign="top" align="middle"><p id="sw10_s"><? echo $lfdnr; ?></p></td>
               <td width="70"  valign="top" align="middle"><p id="sw10_s"><? echo $datum; ?></p></td>
               <td width="60"  valign="top" align="middle"><p id="sw10_s"><? echo $zeit; ?></p></td>
               <td width="80"  valign="top" align="middle"><p id="sw10_s"><? echo $von; ?></p></td>
               <td width="80"  valign="top" align="middle"><p id="sw10_s"><? echo $an; ?></p></td>
               <td width="360" valign="top" align="left"  ><p id="sw10_s"><? echo $text; ?></p></td>
               <td width="100" valign="top" align="left"  ><p id="sw10_s"><? echo $bemerkung; ?></p></td>
               <td width="100" valign="top" align="middle"><p id="sw10_s"><? echo $aufgabe; ?></p></td>
               <td width="84"  valign="top" align="middle"><p id="sw10_s"><? echo $user; ?></p></td>
            </tr>
            <tr>
               <td colspan="9" height="1" width="964" style="background-color: #999999;"><img src="../_img/spacer.gif" height="1" width="964" border="0"></td>
            </tr>
            <?
 
         } 
   ?>
   </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_2.php4');

?>
Return current item: WebETB