projectlist.php3 1.99 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2002, 2007 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5 6
# All rights reserved.
#
7 8 9 10 11
include("defs.php3");

#
# Standard Testbed Header
#
Jay Lepreau's avatar
Jay Lepreau committed
12
# Change when do check for number of experiments.
Chad Barb's avatar
Chad Barb committed
13
PAGEHEADER("Projects that have actively used ".strtolower($THISHOMEBASE));
14 15

#
16 17
# We let anyone access this page.  Its basically a pretty-printed version
# of the current testbed clients, who have not opted out from this display.
18 19 20 21 22 23
#
# Complete information is better viewed with the "Project Information" link.
# That requires a logged in user though. 
#

#
24 25 26 27 28
# Helper
#
function GENPLIST ($query_result)
{
    echo "<tr>
Chad Barb's avatar
Chad Barb committed
29 30
             <th>Name</th>
             <th>Institution</th>
31 32 33
          </tr>\n";

    while ($projectrow = mysql_fetch_array($query_result)) {
34 35 36
	$pname  = $projectrow["name"];
	$url    = $projectrow["URL"];
	$affil  = $projectrow["usr_affil"];
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

	echo "<tr>\n";

	if (!$url || strcmp($url, "") == 0) {
	    echo "<td>$pname</td>\n";
	}
	else {
	    echo "<td><A href=\"$url\">$pname</A></td>\n";
	}

	echo "<td>$affil</td>\n";

	echo "</tr>\n";

    }
}

#
# Get the "active" project list.
56
#
57 58
$query_result =
    DBQueryFatal("SELECT pid,name,URL,usr_affil FROM projects ".
59
		 "left join users on projects.head_idx=users.uid_idx ".
60 61
		 "where public=1 and approved=1 and expt_count>0 ".
		 "order by name");
62

63
echo "<table width=\"100%\" border=0 cellpadding=2 cellspacing=2
64
             align='center'>\n";
65

66 67 68
if (mysql_num_rows($query_result)) {
    GENPLIST($query_result);
}
69

70 71 72
#
# Get the "inactive" project list.
#
73 74
$query_result =
    DBQueryFatal("SELECT pid,name,URL,usr_affil FROM projects ".
75
		 "left join users on projects.head_idx=users.uid_idx ".
76 77
		 "where public=1 and approved=1 and expt_count=0 ".
		 "order by name");
78

79
if (mysql_num_rows($query_result)) {
Chad Barb's avatar
Chad Barb committed
80 81 82
    echo "<tr><th colspan=2>
              Other projects registered on Emulab.Net:</h4>
              </th>
83 84
          </tr>\n";
    GENPLIST($query_result);
85
}
86

87 88 89 90 91 92 93
echo "</table>\n";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>