showexp_form.php3 2.46 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1 2 3 4 5 6 7 8 9
<html>
<head>
<title>Show Experiment Information</title>
<link rel="stylesheet" href="tbstyle.css" type="text/css">
</head>
<body>
<?php
include("defs.php3");

10 11 12
#
# Only known and logged in users can end experiments.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
13 14
$uid = "";
if ( ereg("php3\?([[:alnum:]]+)",$REQUEST_URI,$Vals) ) {
15 16
    $uid=$Vals[1];
    addslashes($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
17
} else {
18
    unset($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
19
}
20
LOGGEDINORDIE($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
21

22 23
$isadmin = ISADMIN($uid);

Leigh B. Stoller's avatar
Leigh B. Stoller committed
24 25
#
# Show a menu of all experiments for all projects that this uid
26
# is a member of. Or, if an admin type person, show them all!
Leigh B. Stoller's avatar
Leigh B. Stoller committed
27
#
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
if ($isadmin) {
    $projmemb_result = mysql_db_query($TBDBNAME,
	"SELECT DISTINCT pid FROM proj_memb");
    if (mysql_num_rows($projmemb_result) == 0) {
        USERERROR("There are no experiments to ".
                  "show any experiment information", 1);
    }
}
else {
    $projmemb_result = mysql_db_query($TBDBNAME,
	"SELECT pid FROM proj_memb WHERE uid=\"$uid\"");
    if (mysql_num_rows($projmemb_result) == 0) {
        USERERROR("You are not a member of any Projects, so you cannot ".
                  "show any experiment information", 1);
    }
Leigh B. Stoller's avatar
Leigh B. Stoller committed
43 44
}

45 46 47 48 49
#
# Lets see if the user is even part of any experiements before
# presenting a bogus option list.
#
$experiments = "";
50 51
while ($projrow = mysql_fetch_array($projmemb_result)) {
    $pid = $projrow[pid];
52 53 54 55 56
    $exp_result = mysql_db_query($TBDBNAME,
	"SELECT eid FROM experiments WHERE pid=\"$pid\"");
    while ($exprow = mysql_fetch_array($exp_result)) {
        $eid = $exprow[eid];
        $experiments = "$experiments " .
57
                      "<option value=\"$pid\$\$$eid\">$pid/$eid</option>\n";
58 59 60 61 62 63 64
    }
}
if (strcmp($experiments, "") == 0) {
    USERERROR("There are no experiments running in any of the projects ".
              "you are a member of.", 1);
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
65 66 67 68 69 70 71 72 73 74 75
?>

<center>
<h1>Experiment Information Selection</h1>
<h2>Select an experiment from the list below.<br>
These are the experiments in the projects
you are a member of.</h2>
<table align="center" border="1">

<?php
echo "<form action=\"showexp.php3?$uid\" method=\"post\">";
76 77 78 79 80
echo "<tr>
          <td align='center'>Project/Experiment</td>
      </tr>\n";
echo "<tr></tr>";
echo "<tr></tr>";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
81 82 83 84 85 86

#
# Suck the current info out of the database and display a list of
# experiments as an option list.
#
echo "<tr>";
87
echo "    <td><select name=\"exp_pideid\">";
88 89
echo "        $experiments";
echo "        </select>";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
90 91 92 93 94 95 96 97 98 99 100
echo "    </td>
      </tr>\n";

?>
<td align="center">
<b><input type="submit" value="Submit"></b></td></tr>
</form>
</table>
</center>
</body>
</html>