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

9 10 11 12 13
#
# Standard Testbed Header
#
PAGEHEADER("New Project Approval List");

14 15 16
#
# Only known and logged in users can do this. uid came in with the URI.
#
17
$uid = GETLOGIN();
18 19 20 21 22 23 24
LOGGEDINORDIE($uid);

#
# Of course verify that this uid has admin privs!
#
$isadmin = ISADMIN($uid);
if (! $isadmin) {
Chad Barb's avatar
Chad Barb committed
25
    USERERROR("You do not have admin privileges to approve projects!", 1);
26 27 28 29 30 31 32 33 34
}

#
# Look in the projects table to see which projects have not been approved.
# Present a menu of options to either approve or deny the projects.
# Approving a project implies approving the project leader. Denying a project
# implies denying the project leader account, when there is just a single
# project pending for that project leader. 
#
35
$query_result = DBQueryFatal("SELECT * from projects where approved='0'");
36 37 38 39
if (mysql_num_rows($query_result) == 0) {
    USERERROR("There are no projects to approve!", 1);
}

Chad Barb's avatar
 
Chad Barb committed
40
echo "<p>Below is the list of projects waiting for approval or denial. Click
41 42
      on a particular project to act on it, and you will be zapped to a
      page with more information about the project, and your options menu.
Chad Barb's avatar
 
Chad Barb committed
43
      </p>\n";
44 45
      
echo "<table width=\"100%\" border=2 cellpadding=0 cellspacing=2
Chad Barb's avatar
 
Chad Barb committed
46
       >\n";
47 48

echo "<tr>
Chad Barb's avatar
 
Chad Barb committed
49 50 51 52 53 54
          <th rowspan=2>Act</th>
          <th rowspan=2>Project Info</th>
          <th rowspan=2>User</th>
          <th>User Name</th>
          <th>Title</th>
          <th>E-mail</th>
55 56
      </tr>
      <tr>
Chad Barb's avatar
 
Chad Barb committed
57 58 59
          <th>Proj Name</th>
          <th>User Affil</th>
          <th>Phone</th>
60 61 62 63 64 65 66 67
      </tr>\n";

while ($projectrow = mysql_fetch_array($query_result)) {
    $pid      = $projectrow[pid];
    $headuid  = $projectrow[head_uid];
    $Purl     = $projectrow[URL];
    $Pname    = $projectrow[name];

68 69
    $userinfo_result =
	DBQueryFatal("SELECT * from users where uid='$headuid'");
70 71 72 73 74 75 76 77 78 79 80 81

    $row	= mysql_fetch_array($userinfo_result);
    $name	= $row[usr_name];
    $email	= $row[usr_email];
    $title	= $row[usr_title];
    $affil	= $row[usr_affil];
    $phone	= $row[usr_phone];

    echo "<tr>
              <td height=15 colspan=6></td>
          </tr>
          <tr>
Chad Barb's avatar
 
Chad Barb committed
82
              <td align=center valign=center rowspan=2>
83
                  <A href='approveproject_form.php3?pid=$pid'>
84 85
                     <img alt=\"o\" src=\"redball.gif\"></A></td>
              <td rowspan=2>
86
                  <A href='showproject.php3?pid=$pid'>$pid</A></td>
87
              <td rowspan=2>
88
                  <A href='showuser.php3?target_uid=$headuid'>
89
                     $headuid</A></td>
90 91 92 93 94 95 96 97 98 99 100
              <td>$name</td>
              <td>$title</td>
              <td>$email</td>
          </tr>\n";
    echo "<tr>
              <td>$Pname</td>
              <td>$affil</td>
              <td>$phone</td>
          </tr>\n";
}
echo "</table>\n";
101 102 103 104 105

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