approveproject_list.php3 4.08 KB
Newer Older
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
#
3
# Copyright (c) 2000-2007, 2017 University of Utah and the Flux Group.
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23
#
24
25
26
27
28
include("defs.php3");

#
# Only known and logged in users can do this. uid came in with the URI.
#
29
30
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
31
$isadmin   = ISADMIN();
32
33
34
35
36

#
# Of course verify that this uid has admin privs!
#
if (! $isadmin) {
Chad Barb's avatar
Chad Barb committed
37
    USERERROR("You do not have admin privileges to approve projects!", 1);
38
39
}

40
41
42
43
44
if ($TBMAINSITE) {
    header("Location: portal/approve-projects.php");
    return;
}

45
46
47
48
49
#
# The reason for this call is to make sure that globals are set properly.
#
$reqargs = RequiredPageArguments();

50
51
52
53
54
#
# Standard Testbed Header
#
PAGEHEADER("New Project Approval List");

55
56
57
58
59
60
61
#
# 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. 
#
62
63
64
$projlist = Project::PendingProjectList();

if (count($projlist) == 0) {
65
66
67
    USERERROR("There are no projects to approve!", 1);
}

Chad Barb's avatar
   
Chad Barb committed
68
echo "<p>Below is the list of projects waiting for approval or denial. Click
69
70
      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
71
      </p>\n";
72
73
      
echo "<table width=\"100%\" border=2 cellpadding=0 cellspacing=2
Chad Barb's avatar
   
Chad Barb committed
74
       >\n";
75
76

echo "<tr>
Chad Barb's avatar
   
Chad Barb committed
77
78
79
80
81
82
          <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>
83
84
      </tr>
      <tr>
Chad Barb's avatar
   
Chad Barb committed
85
86
87
          <th>Proj Name</th>
          <th>User Affil</th>
          <th>Phone</th>
88
89
      </tr>\n";

90
91
92
foreach ($projlist as $project) {
    $pid_idx  = $project->pid_idx();
    $Pcreated = $project->GetTempData();
93

94
95
96
97
98
99
100
101
102
103
104
105
106
    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();
107

108
109
110
    $apprproj_url = CreateURL("approveproject_form", $project);
    $showproj_url = CreateURL("showproject", $project);
    $showuser_url = CreateURL("showuser", $leader);
111
112
113
114
115

    echo "<tr>
              <td height=15 colspan=6></td>
          </tr>
          <tr>
Chad Barb's avatar
   
Chad Barb committed
116
              <td align=center valign=center rowspan=2>
117
                  <A href='$apprproj_url'>
118
119
                     <img alt=\"o\" src=\"redball.gif\"></A></td>
              <td rowspan=2>
120
                  <A href='$showproj_url'>$pid</A>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
121
                  <br>$Pcreated</td>
122
              <td rowspan=2>
123
                  <A href='$showuser_url'>$headuid</A></td>
Leigh B. Stoller's avatar
Leigh B. Stoller committed
124
              <td>$name";
125
126
    if ($status == TBDB_USERSTATUS_NEWUSER) {
	echo " (<font color=red>unverified</font>)";
Leigh B. Stoller's avatar
Leigh B. Stoller committed
127
128
129
    }
    echo "         </td>";
    echo "    <td>$title</td>
130
131
132
133
134
135
136
137
138
              <td>$email</td>
          </tr>\n";
    echo "<tr>
              <td>$Pname</td>
              <td>$affil</td>
              <td>$phone</td>
          </tr>\n";
}
echo "</table>\n";
139
140
141
142
143

#
# Standard Testbed Footer
# 
PAGEFOOTER();
144
145
?>