-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathops_list_group.php
103 lines (83 loc) · 2.93 KB
/
ops_list_group.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
<?php require_once('access_and_open.php'); require_once('secure.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Op Session Email List</title>
</head>
<body>
<h1>Op Session Email List</h1>
<a href="index.php">Back to main page</a><p/>
<?php
include_once('mysql2i.class.php'); // migration step
require_once('ops_assign_common.php');
// parse out arguments
parse_str($_SERVER["QUERY_STRING"], $args);
// first, see if there's a "?cy=" in the arguments
if (! array_key_exists('cy', $args) ) {
echo "This is the starting page for printing email lists for op session assignments.<p/>";
echo "Please provide a cycle name and press start start. (Your cycle must exist)";
echo '<form method="get" action="ops_list_group.php">
Cycle Name: <input name="cy"></textarea>
<button type="submit">Start</button>
</form>
';
// display existing cycles & number of assignments)
echo '<h3>Existing cycles</h3><table><tr><th>Cycle Name</th><th>N Assigned</th></tr>';
global $opts, $event_tools_db_prefix, $event_tools_href_add_on;
mysql_connect($opts['hn'],$opts['un'],$opts['pw']);
@mysql_select_db($opts['db']) or die( "Unable to select database");
$query="
SELECT opsreq_group_cycle_name, SUM(status)
FROM ".$event_tools_db_prefix."eventtools_ops_group_session_assignments
WHERE status = 1
GROUP BY opsreq_group_cycle_name
ORDER BY opsreq_group_cycle_name
;
";
$result=mysql_query($query);
$num = mysql_numrows($result);
for ($i = 0; $i < $num; $i++) {
echo '<tr><td><a href="?cy='.mysql_result($result,$i,"opsreq_group_cycle_name").'">'.mysql_result($result,$i,"opsreq_group_cycle_name").'</a></td><td>'.mysql_result($result,$i,1).'</td></tr>';
}
echo '</table>';
return;
} else {
$cycle = $args["cy"];
}
// here, the cycle name exists,
echo '<h2>Cycle: '.$cycle.'</h2>';
// Try to load it
global $opts, $event_tools_db_prefix, $event_tools_href_add_on;
mysql_connect($opts['hn'],$opts['un'],$opts['pw']);
@mysql_select_db($opts['db']) or die( "Unable to select database");
$query="
SELECT *
FROM ".$event_tools_db_prefix."eventtools_opsreq_group
WHERE opsreq_group_cycle_name = '".$cycle."'
;
";
$result=mysql_query($query);
$num = mysql_numrows($result);
if ($num == 0) {
// no rows found, load
echo "That cycle doesn't exist. Click 'Back' and try again.<p/>";
return;
}
$query="
SELECT opsreq_person_email
FROM ".$event_tools_db_prefix."eventtools_ops_group_names
WHERE opsreq_group_cycle_name = '".$cycle."'
ORDER BY opsreq_group_id
;
";
$result=mysql_query($query);
$num = mysql_numrows($result);
echo "<p>";
for ($i = 0; $i < $num; $i++) {
echo mysql_result($result,$i,"opsreq_person_email")."<br>";
}
?>
</body>
</html>