[ PHPXref.com ] [ Generated: Sun Jul 20 19:53:39 2008 ] [ PHProjekt 5.0.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/projects/ -> projects_sort.php (source)

   1  <?php
   2  
   3  // projects_sort.php - PHProjekt Version 5.0

   4  // copyright  ©  2000-2005 Albrecht Guenther  ag@phprojekt.com

   5  // www.phprojekt.com

   6  // Author: Albrecht Guenther, $Author: paolo $

   7  // $Id: projects_sort.php,v 1.3 2005/06/20 14:52:51 paolo Exp $

   8  
   9  function projects_sort($liste0) {
  10      global $liste2;
  11  
  12      $liste2 = array();
  13      for ($i=0; $i< count($liste0); $i++) {
  14          projects_sort2($liste0[$i]);
  15      }
  16      return $liste2;
  17  }
  18  
  19  function projects_sort2($ID) {
  20      global $liste2;
  21  
  22      $result2 = db_query("SELECT ID, next_mode, next_proj
  23                             FROM ".DB_PREFIX."projekte
  24                            WHERE ID = '$ID'") or db_die();
  25      $row2 = db_fetch_row($result2);
  26      // only consider this project if it hasn't been listed before

  27      if (!$liste2[0] or !in_array($row2[0], $liste2)) {
  28          // if a) this project is dependend from another or 2) as something in the list before, take this first

  29          if ($row2[1] == 1) projects_sort2($row2[2]);
  30          // now take the record itself to the list

  31          $liste2[] = $ID;
  32          // it has an entry after him? now consider this one.

  33          if ($row2[1] == 2) projects_sort2($row2[2]);
  34      }
  35  }
  36  
  37  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]