Location: PHPKode > projects > WebETB > doku/list_tree.php4
<?php
/******************************************************************************/
/*	MODUL:	doku/list_tree.php4           												*/
/*																										*/
/* DATUM:	27.03.2006, Version 0.1															*/
/* BESCHR.:	Anzeigen der angelegten Dokumentstruktur als Baumansicht          */
/*          Subfunktion von treeview.php4                                     */
/*																										*/
/*	AUTOR:   Marcus Groh																			*/
/*	LIZENZ:  GPL v2 vom Juni 1991 															*/
/*																										*/
/*	AENDERUNGEN:	25.07.2005        -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');
$file_to_open="";
       
function list_subs ($db_fid,$pos)
{
      include "../config/conf_glbl.php4";
      
      // Look for subfolders
      $select_file_pid="select * from $T_dokumnt where file_pid=$db_fid order by titel";
      $result_file_pid=@mysql_db_query($database["database"],$select_file_pid,$db);
      
      // if none exists return, otherwise print out
      if ( mysql_num_rows($result_file_pid) != 0 )
      {
         $pos=$pos + 3;
         while ($row=mysql_fetch_array($result_file_pid))
         {
            $picto="../_img/fold.gif";
            $linkstyle="style=\"text-decoration: none;\"";
            $db_sub_fid=$row['file_id'];
            $db_sub_titel=$row['titel'];
            $db_sub_typ=$row['typ'];
            
            echo "<tr>\n";
            echo "<td valign=\"middle\"><p id=\"sw10_s\">";
            for ($i=1; $i<=$pos; $i++)
                  { echo "&nbsp;"; }            
            
            
            if ( $db_sub_typ == 2 )
            {
               $picto="../_img/file.gif";    
               $db_fname=$row['f_name'];
               $doc_root=$_SERVER[DOCUMENT_ROOT];
               $path_to_file=ereg_replace($doc_root, "", $file_path);
               $file_to_open=$path_to_file . "/" . $db_fname;
               echo "<img src=\"$picto\" width=\"22\" height=\"22\" border=\"0\"> $db_sub_titel ";
               echo "<a href=\"$file_to_open\" style=\"text-decoration: none;\" target=\"_NEW\">(ansehen)</a></p></td>\n";
            }
            else
            {
               echo "<img src=\"$picto\" width=\"22\" height=\"22\" border=\"0\"> $db_sub_titel</p></td>\n";
            }
            
            echo "</tr>\n";
            list_subs ($db_sub_fid,$pos);            
         }
      }
      else
      {
         return ;         
      }
      
      return $pos;
}
   // Start inner table
   echo "</center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"904\">\n";
   
          // Get structure of files and folders, started by main-folder
          $select_all_entrys="select * from $T_dokumnt where file_pid like '0' order by titel";
          $result_all_entrys=@mysql_db_query($database["database"],$select_all_entrys,$db);
          if ( mysql_num_rows($result_all_entrys) == 0)
          {
            // We have a blank table
            echo "<tr>\n";
            echo "<td width=\"704\" ><p id=\"sw10_s\">&nbsp;Keine Eintr&auml;ge vorhanden.</p></td>";
            echo "</tr>\n";
          }
          else
          {
            // List files, folders and subfolders and files and bla
               while ( $row=mysql_fetch_array($result_all_entrys))
               {
                  $db_fid=$row['file_id'];
                  $db_titel=$row['titel'];
                  $db_descr=$row['descr'];
                  $pos=0;
                  echo "<tr>\n";
                  echo "<td width=\"904\" valign=\"middle\"><p id=\"sw10_s\">";
                  echo "<img src=\"../_img/fold.gif\" width=\"22\" height=\"22\" border=\"0\">";
                  echo "&nbsp;$db_titel</p></td>\n";
                  echo "</tr>\n";
                  list_subs($db_fid,$pos);
               }          
          }

   // Stop inner table
   echo "</table>\n";
include ('../_include/footer_2.php4');

?>
          
Return current item: WebETB