approveproject_list.php3 3.49 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2004, 2006 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
18
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
19
20
21
22

#
# Of course verify that this uid has admin privs!
#
23
$isadmin = ISADMIN();
24
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 pid_idx, ".
Leigh B. Stoller's avatar
Leigh B. Stoller committed
36
37
			     " 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);
}

Chad Barb's avatar
   
Chad Barb committed
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.
Chad Barb's avatar
   
Chad Barb committed
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
      </tr>\n";

while ($projectrow = mysql_fetch_array($query_result)) {
67
68
    $pid_idx  = $projectrow["pid_idx"];
    $Pcreated = $projectrow["day_created"];
69

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
    if (! ($project = Project::Lookup($pid_idx))) {
	TBERROR("Could not lookup project $pid_idx", 1);
    }
    if (! ($leader = $project->GetLeader())) {
	TBERROR("Could not get leader for project $pid_idx", 1);
    }
    $pid        = $project->pid();
    $Purl       = $project->URL();
    $Pname      = $project->name();
    $headuid    = $leader->uid();
    $name	= $leader->name();
    $email	= $leader->email();
    $title	= $leader->title();
    $affil	= $leader->affil();
    $phone	= $leader->phone();
    $status     = $leader->status();
86

87
88
89
    $apprproj_url = CreateURL("approveproject_form", $project);
    $showproj_url = CreateURL("showproject", $project);
    $showuser_url = CreateURL("showuser", $leader);
90
91
92
93
94

    echo "<tr>
              <td height=15 colspan=6></td>
          </tr>
          <tr>
Chad Barb's avatar
   
Chad Barb committed
95
              <td align=center valign=center rowspan=2>
96
                  <A href='$apprproj_url'>
97
98
                     <img alt=\"o\" src=\"redball.gif\"></A></td>
              <td rowspan=2>
99
                  <A href='$showproj_url'>$pid</A>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
100
                  <br>$Pcreated</td>
101
              <td rowspan=2>
102
                  <A href='$showuser_url'>$headuid</A></td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
103
              <td>$name";
104
105
    if ($status == TBDB_USERSTATUS_NEWUSER) {
	echo " (<font color=red>unverified</font>)";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
106
107
108
    }
    echo "         </td>";
    echo "    <td>$title</td>
109
110
111
112
113
114
115
116
117
              <td>$email</td>
          </tr>\n";
    echo "<tr>
              <td>$Pname</td>
              <td>$affil</td>
              <td>$phone</td>
          </tr>\n";
}
echo "</table>\n";
118
119
120
121
122

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