-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.php.edit.php
executable file
·259 lines (201 loc) · 8.47 KB
/
list.php.edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?php
/********************************************************
*
* phpAbstracts
* http://www.phpabstracts.com
*
* For copyright and license information, see readme.txt
*
*********************************************************/
//Include header template
include('header.php');
//Grab user_id cookie
$user_id = $_COOKIE["user_id"];
//Check to see if a filter was selected
if ($_GET['by']) {
$filter = $_GET['by'];
$filter_s = $_GET['s'];
}
if ($_GET['s']) {
$filter_s = $_GET['s'];
}
//Database Connection Variables
include('db.php');
//Connect to database
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//Create view selecting all abstract IDs assigned to current user
$query2 = "CREATE OR REPLACE VIEW abstracts_view AS SELECT abstract_id FROM reviews WHERE user_id='$user_id'";
mysql_query($query2) or die(mysql_error());
//Select all abstracts from the view, but if admin is logged in, just select all abstracts
if ($admin) {
if ($filter) {
if ($filter_s) {
if ($filter_s == "yes")
$query3 = "SELECT * FROM abstracts WHERE master_status = '" . $filter . "' AND scholarship = 'on' ORDER BY abstract_id DESC";
else
$query3 = "SELECT * FROM abstracts WHERE master_status = '" . $filter . "' AND scholarship != 'on' ORDER BY abstract_id DESC";
}
else
$query3 = "SELECT * FROM abstracts WHERE master_status = '" . $filter . "' ORDER BY abstract_id DESC";
}
else $query3 = "SELECT * FROM abstracts ORDER BY abstract_id DESC";
}
else {
$query3 = "SELECT * FROM abstracts INNER JOIN abstracts_view WHERE abstracts.abstract_id = abstracts_view.abstract_id " .
"ORDER BY abstracts.abstract_id DESC";
}
$result = mysql_query($query3);
$num = mysql_numrows($result);
$num_abstracts = $num;
//Output breadcrumbs
echo "<div class='breadcrumbs'>" . $home_title . " /</div>";
//Output filters icon and user management icon
if ($admin) {
echo "<div style='float:right;'>" .
"<img src='images/user.png' style='vertical-align:middle;'> " .
"<a href='list_users.php'>User Management</a>" .
" | " .
"<img src='images/filters.png' style='vertical-align:middle;'> " .
"<a href='#' onClick='show(\"filters\");'>Status Filters</a>" .
"</div>";
}
//Output header
echo "<h1>List of Abstracts</h1>";
//Output filter list
if ($admin) {
if ($filter)
echo "<div id='filters' style='display:block;visibility:visible;'>";
else
echo "<div id='filters'>";
echo "<div style='float:right'><a href='#' onClick='hide(\"filters\");'>x</a></div>";
echo "<div class='master_column'><br />";
if ($filter != "") echo "<a href='list.php'>All</a><br />";
else echo "<strong>All</strong><br />";
if ($filter != "Unfiled") echo "<a href='list.php?by=Unfiled&s=no'>Unfiled</a><br />";
else echo "<strong>Unfiled</strong><br />";
if ($filter !="Rejected") echo "<a href='list.php?by=Rejected&s=no'>Rejected</a>";
else echo "<strong>Rejected</strong>";
echo "</div>";
echo "<div class='master_column'>";
echo "[ all ]<br />";
if (($filter == "Poster") && (!$filter_s)) echo "<strong>Poster</strong><br />";
else echo "<a href='list.php?by=Poster'>Poster</a><br />";
if (($filter == "Panel") && (!$filter_s)) echo "<strong>Panel</strong><br />";
else echo "<a href='list.php?by=Panel'>Panel</a><br />";
if (($filter == "Roundtable") && (!$filter_s)) echo "<strong>Roundtable</strong>";
else echo "<a href='list.php?by=Roundtable'>Roundtable</a>";
echo "</div>";
echo "<div class='master_column'>";
echo "[ with scholarship ]<br />";
if (($filter == "Poster") && ($filter_s == "yes")) echo "<strong>Poster</strong><br />";
else echo "<a href='list.php?by=Poster&s=yes'>Poster</a><br />";
if (($filter == "Panel") && ($filter_s == "yes")) echo "<strong>Panel</strong><br />";
else echo "<a href='list.php?by=Panel&s=yes'>Panel</a><br />";
if (($filter == "Roundtable") && ($filter_s == "yes")) echo "<strong>Roundtable</strong>";
else echo "<a href='list.php?by=Roundtable&s=yes'>Roundtable</a>";
echo "</div>";
echo "<div class='master_column'>";
echo "[ without scholarship ]<br />";
if (($filter == "Poster") && ($filter_s == "no")) echo "<strong>Poster</strong><br />";
else echo "<a href='list.php?by=Poster&s=no'>Poster</a><br />";
if (($filter == "Panel") && ($filter_s == "no")) echo "<strong>Panel</strong><br />";
else echo "<a href='list.php?by=Panel&s=no'>Panel</a><br />";
if (($filter == "Roundtable") && ($filter_s == "no")) echo "<strong>Roundtable</strong>";
else echo "<a href='list.php?by=Roundtable&s=no'>Roundtable</a>";
echo "</div>";
echo "<div style='clear:both;'> </div>";
echo "</div>";
echo "<br />";
}
//Output table headers
echo "<table class='sortable' style='width:875px;' align='center'><thead><tr><th>ID</th><th>Title</th>";
if ($admin) {
echo "<th>Organization</th>" .
"<th width='25'><img src='images/checkmark.gif' style='border:0px;' alt='Accepted' /></th>" .
"<th width='25'><img src='images/check_x.gif' style='border:0px;' alt='Rejected' /></th>";
}
echo "<th>Status</th><th class='sorttable_nosort'> </th>";
echo "</tr></thead>";
//Output table body
echo "<tbody>";
$i=0;
while ($i < $num) {
$abstract_id=mysql_result($result,$i,"abstract_id");
$date=mysql_result($result,$i,"date");
$title=mysql_result($result,$i,"title");
$name=mysql_result($result,$i,"name");
$master_status = mysql_result($result,$i,"master_status");
$scholarship = mysql_result($result,$i,"scholarship");
//search for reviews for this abstract if admin is logged in
if ($admin) {
$query5 = "SELECT * FROM reviews WHERE abstract_id='$abstract_id'";
$result5 = mysql_query($query5);
$num5 = mysql_numrows($result5);
$accept = 0;
$reject = 0;
//calculate number of accepted and rejected
$j=0;
while ($j < $num5) {
if ((mysql_result($result5,$j,"recommendation") == "Panel") ||
(mysql_result($result5,$j,"recommendation") == "Poster") ||
(mysql_result($result5,$j,"recommendation") == "Roundtable")) {
$accept = $accept + 1;
}
elseif (mysql_result($result5,$j,"recommendation") == "Reject") {
$reject = $reject + 1;
}
$j++;
}
//calculate status based on criteria (-- DISABLED --)
/*if ($num5 < 3) $status = "Unassigned";
elseif (($accept > 2) && ($reject == 0)) $status = "Accepted";
elseif (($accept == 0) && ($reject > 2)) $status = "Rejected";
elseif ($accept + $reject < 3) $status = "Assigned";
else $status = "TBD";*/
//MASTER STATUS UPDATE
$status = $master_status;
if ($scholarship == "on") $status = $status . " w/sch.";
//set outputs for admin
$view = "View";
}
//if admin is not logged in
else {
//check if user has completed this abstract
$user_id = $_COOKIE["user_id"];
$query6 = "SELECT * FROM reviews WHERE abstract_id='$abstract_id' AND user_id='$user_id'";
$result6 = mysql_query($query6);
$status = mysql_result($result6,0,"status");
//set output for user with big blue REVIEW button
if ($status == "Assigned")
$view = "Review";
else
$view = "View";
}
$view = "<form method='post' action='detail.php' id='detail_form'>" .
"<input type='hidden' id='abstract_id' name='abstract_id' value='" . $abstract_id . "' />" .
"<input type='submit' value='" . $view . "' class='detail_" . $view . "' />" .
"</form>";
//Output data for table
echo "<tr><td>" . $abstract_id. "</td><td>" . $title . "<div class='small'>" . $date . "</div></td><td> " .
$title . "</td><td>";
if ($admin) echo "<td>" . $organization1 . "<div class='small'>" . $name . "</td>" .
"<td>" .$accept . "</td><td>" . $reject; "</td>";
echo "<td>" . $status . "</td><td>" . $view . "</td></tr>";
$i++;
} //end while loop
//End table
echo "</tbody></table>";
echo "<br /><p>Hint: You can sort by clicking on the column headers.</p>";
if ($admin) echo "<p>Number of Abstracts: " . $num_abstracts;
//List e-mails
if ($admin && $filter) {
echo " | <script src='js/list_emails.js'></script>";
echo "<a href='#emails_container' onclick='showemails(\"" . $filter . "\", \"" . $filter_s . "\");'>Click here</a> to show e-mail addresses.</p>";
echo "<div id='emails_container' style='padding:10px;'> </div>";
}
//Close database
mysql_close();
//Include footer template
include('footer.php');
?>