approveproject_list.php3 3.23 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
Leigh Stoller's avatar
Leigh Stoller committed
4
# Copyright (c) 2000-2004 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. 
#
Leigh Stoller's avatar
Leigh Stoller committed
35 36 37
$query_result = DBQueryFatal("SELECT *, ".
			     " DATE_FORMAT(created, '%m/%d/%y') as day_created ".
			     " from projects ".
38 39
			     "where approved='0' order by created desc");
			     
40 41 42 43
if (mysql_num_rows($query_result) == 0) {
    USERERROR("There are no projects to approve!", 1);
}

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

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

while ($projectrow = mysql_fetch_array($query_result)) {
    $pid      = $projectrow[pid];
    $headuid  = $projectrow[head_uid];
    $Purl     = $projectrow[URL];
    $Pname    = $projectrow[name];
Leigh Stoller's avatar
Leigh Stoller committed
71
    $Pcreated = $projectrow[day_created];
72

73 74
    $userinfo_result =
	DBQueryFatal("SELECT * from users where uid='$headuid'");
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];
Leigh Stoller's avatar
Leigh Stoller committed
82
    $status     = $row[status];
83 84 85 86 87

    echo "<tr>
              <td height=15 colspan=6></td>
          </tr>
          <tr>
Chad Barb's avatar
Chad Barb committed
88
              <td align=center valign=center rowspan=2>
89
                  <A href='approveproject_form.php3?pid=$pid'>
90 91
                     <img alt=\"o\" src=\"redball.gif\"></A></td>
              <td rowspan=2>
Leigh Stoller's avatar
Leigh Stoller committed
92 93
                  <A href='showproject.php3?pid=$pid'>$pid</A>
                  <br>$Pcreated</td>
94
              <td rowspan=2>
95
                  <A href='showuser.php3?target_uid=$headuid'>
96
                     $headuid</A></td>
Leigh Stoller's avatar
Leigh Stoller committed
97
              <td>$name";
98 99
    if ($status == TBDB_USERSTATUS_NEWUSER) {
	echo " (<font color=red>unverified</font>)";
Leigh Stoller's avatar
Leigh Stoller committed
100 101 102
    }
    echo "         </td>";
    echo "    <td>$title</td>
103 104 105 106 107 108 109 110 111
              <td>$email</td>
          </tr>\n";
    echo "<tr>
              <td>$Pname</td>
              <td>$affil</td>
              <td>$phone</td>
          </tr>\n";
}
echo "</table>\n";
112 113 114 115 116

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