projectlist.php3 1.58 KB
Newer Older
1 2 3 4 5 6
<?php
include("defs.php3");

#
# Standard Testbed Header
#
Jay Lepreau's avatar
Jay Lepreau committed
7 8 9
# Change when do check for number of experiments.
# PAGEHEADER("Projects that have actively used emulab.net");
PAGEHEADER("Projects that have used emulab.net");
10 11

#
Jay Lepreau's avatar
Jay Lepreau committed
12
# We let anyone access this page.  It's basically a pretty-printed version of the
13 14 15 16 17 18 19 20 21 22
# current testbed clients, who have not opted out from this display.
#
# Complete information is better viewed with the "Project Information" link.
# That requires a logged in user though. 
#

#
# Get the project list.
#
$query_result = mysql_db_query($TBDBNAME,
23 24 25
	"SELECT pid,name,URL,usr_affil FROM projects ".
	"left join users on projects.head_uid=users.uid ".
	"where public=1 and approved=1 order by pid");
26 27 28 29 30 31 32 33 34 35 36

if (! $query_result) {
    $err = mysql_error();
    TBERROR("Database Error getting project list: $err\n", 1);
}

# Not likely to happen!
if (mysql_num_rows($query_result) == 0) {
    USERERROR("There are no projects!", 1);
}

37
echo "<table width=\"100%\" border=0 cellpadding=2 cellspacing=2
38 39 40
       align='center'>\n";

echo "<tr>
41
          <td><h4>Name</td>
42
          <td><h4>Institution</td>
43
      </tr>\n";
44 45
echo "<tr></tr>\n";
echo "<tr></tr>\n";
46 47 48 49

while ($projectrow = mysql_fetch_array($query_result)) {
    $pname  = $projectrow[name];
    $url    = $projectrow[URL];
50
    $affil  = $projectrow[usr_affil];
51

52
    echo "<tr>\n";
53 54

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

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

63 64 65 66 67 68 69 70 71 72
    echo "</tr>\n";

}
echo "</table>\n";

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