approveproject_list.php3 2.93 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh 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 36 37
$query_result = DBQueryFatal("SELECT * from projects ".
			     "where approved='0' order by created desc");
			     
38 39 40 41
if (mysql_num_rows($query_result) == 0) {
    USERERROR("There are no projects to approve!", 1);
}

42
echo "<p>Below is the list of projects waiting for approval or denial. Click
43 44
      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.
45
      </p>\n";
46 47
      
echo "<table width=\"100%\" border=2 cellpadding=0 cellspacing=2
Chad Barb's avatar
Chad Barb committed
48
       >\n";
49 50

echo "<tr>
Chad Barb's avatar
Chad Barb committed
51 52 53 54 55 56
          <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>
57 58
      </tr>
      <tr>
Chad Barb's avatar
Chad Barb committed
59 60 61
          <th>Proj Name</th>
          <th>User Affil</th>
          <th>Phone</th>
62 63 64 65 66 67 68 69
      </tr>\n";

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

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

    $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
84
              <td align=center valign=center rowspan=2>
85
                  <A href='approveproject_form.php3?pid=$pid'>
86 87
                     <img alt=\"o\" src=\"redball.gif\"></A></td>
              <td rowspan=2>
88
                  <A href='showproject.php3?pid=$pid'>$pid</A></td>
89
              <td rowspan=2>
90
                  <A href='showuser.php3?target_uid=$headuid'>
91
                     $headuid</A></td>
92 93 94 95 96 97 98 99 100 101 102
              <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";
103 104 105 106 107

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