-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.php
218 lines (194 loc) · 10.2 KB
/
actions.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
<?php
require_once 'includes/auth.php';
require_once 'includes/helpers.php';
date_default_timezone_set('America/New_York');
if (!phpCAS::isAuthenticated()) {
header('location: ./index.php');
exit;
}
blockUnauthorized();
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['transaction'])) {
} else {
$result = false;
}
$pageTitle = "Actions";
$parameters = [];
$breadcrumbs = '';
if(isset($_GET['bodyUniqueId'])) {
$parameters['bodyUniqueId'] = $_GET['bodyUniqueId'];
$breadcrumbs .= "<li><a href='actions.php'>Actions</a></li>";
if(isset($_GET['sessionUniqueId'])) {
$parameters['sessionUniqueId'] = $_GET['sessionUniqueId'];
if(isset($_GET['meetingNum'])) {
$parameters['meetingNum'] = $_GET['meetingNum'];
$meeting = Meetings::getEntry("$_GET[bodyUniqueId]/$_GET[sessionUniqueId]/$_GET[meetingNum]");
$pageTitle .= ": " . constructMeetingTitle($meeting, $meeting['session']);
$breadcrumbs .= "<li><a href='actions.php?bodyUniqueId=$_GET[bodyUniqueId]&sessionUniqueId=$_GET[sessionUniqueId]'>" . $meeting['session']['name'] . "</a></li>";
$breadcrumbs .= "<li class='active'>" . constructMeetingTitle($meeting) . "</li>";
} else {
$session = Sessions::getEntry("$_GET[bodyUniqueId]/$_GET[sessionUniqueId]");
$pageTitle .= ": $session[name]";
$breadcrumbs .= "<li class='active'>$session[name]</li>";
}
} else {
header("location: ./actions.php");
exit;
}
} else if(isset($_GET['sessionUniqueId']) || isset($_GET['meetingNum'])) {
header("location: ./actions.php");
exit;
} else {
$breadcrumbs .= "<li class='active'>Actions</li>";
}
if(isset($_GET['meetingNum'])) {
if(!isset($_GET['sessionUniqueId'])) {
if(!isset($_GET['bodyUniqueId'])) {
header('location: ./actions.php');
exit;
} else {}
header('location: ./actions.php');
exit;
}
$parameters['meetingNum'] = $_GET['meetingNum'];
}
$actions = Actions::read($parameters);
?>
<!doctype html>
<html lang="en">
<?php include_once 'partials/head.php' ?>
<body>
<div class="wrapper">
<?php include_once 'partials/sidebar.php' ?>
<div class="main-panel">
<?php include_once 'partials/nav.php' ?>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-11">
<div class="card">
<div class="content content-even">
<ol class="breadcrumb">
<?=$breadcrumbs?>
</ol>
</div>
</div>
</div>
<div class="col-md-1">
<div class="card">
<div class="content content-even">
<a href="/new_action.php" class="btn btn-primary btn-fill btn-block btn-borderless">Create</a>
</div>
</div>
</div>
<div class="col-md-10">
<div class="card">
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Indicator</th>
<th>Description</th>
<th>Vote Count</th>
<th>Moved By</th>
<th>Seconded By</th>
<th width="10%"></th>
</tr>
</thead>
<tbody>
<?php
foreach($actions as $a) {
echo "<tr>";
echo "<td>$a[actionIndicator]</td>";
echo "<td>$a[description]</td>";
echo "<td>$a[votesFor]–$a[votesAgainst]–$a[abstentions]</td>";
if(isset($a['movingMemberId'])) {
echo "<td><a href='/person.php?rcsId=" . $a['movingMember']['person']['rcsId'] . "'>" . $a['movingMember']['person']['name'] . "</a></td>";
echo "<td><a href='/person.php?rcsId=" . $a['secondingMember']['person']['rcsId'] . "'>" . $a['secondingMember']['person']['name'] . "</a></td>";
} else if(isset($a['movingSubbodyUniqueId'])) {
echo "<td><a href='/subbody.php?bodyUniqueId=$a[bodyUniqueId]&sessionUniqueId=$a[sessionUniqueId]&uniqueId=$a[movingSubbodyUniqueId]'>" . $a['subbody']['name'] . "</a></td>";
echo "<td><em>N/A</em></td>";
} else if($a['movingOtherEntity']) {
echo "<td>$a[movingOtherEntity]</td>";
echo "<td><em>N/A</em></td>";
} else {
echo "<td><em>TBD</em></td>";
echo "<td><em>TBD</em></td>";
}
echo "<td><a href='/action.php?bodyUniqueId=$a[bodyUniqueId]&sessionUniqueId=$a[sessionUniqueId]&meetingNum=$a[meetingNum]&actionNum=$a[actionNum]' class='btn btn-primary btn-xs'><span class='fa fa-gear'></span> Manage</a></td>";
echo "</tr>";
}
if(count($actions) == 0) {
echo "<tr><td colspan='6' class='text-center'><em>No actions were found!</em></td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-2">
<div class="card">
<div class="header">
<h4 class="title">Filter by Session</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table">
<tbody>
<?php
$sessions = Sessions::read([
"active" => "true",
"sort" => "-name"
]);
foreach($sessions as $s) {
echo "<tr><td><a href='actions.php?bodyUniqueId=$s[bodyUniqueId]&sessionUniqueId=$s[uniqueId]'>";
if(isset($_GET['sessionUniqueId']) && $_GET['bodyUniqueId'] == $s['bodyUniqueId'] && $_GET['sessionUniqueId'] == $s['uniqueId']) {
echo "<strong>$s[name]</strong>";
} else {
echo "$s[name]";
}
echo "</a></td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<?php if(isset($_GET['sessionUniqueId'])) { ?>
<div class="card">
<div class="header">
<h4 class="title">Filter by Meeting</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table">
<tbody>
<?php
$meetings = Meetings::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sessionUniqueId" => $_GET['sessionUniqueId'],
"sort" => "-meetingNum"
]);
foreach($meetings as $m) {
echo "<tr><td><a href='actions.php?bodyUniqueId=$m[bodyUniqueId]&sessionUniqueId=$m[sessionUniqueId]&meetingNum=$m[meetingNum]'>";
if(isset($_GET['meetingNum']) && $_GET['bodyUniqueId'] == $m['bodyUniqueId'] && $_GET['sessionUniqueId'] == $m['sessionUniqueId'] && $_GET['meetingNum'] == $m['meetingNum']) {
echo "<strong>" . constructMeetingTitle($m). "</strong>";
} else {
echo constructMeetingTitle($m);
}
echo "</a></td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<?php require_once 'partials/footer.php' ?>
</div>
</div>
<?php require_once 'partials/scripts.php' ?>
</body>
</html>