This repository has been archived by the owner on Dec 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsession.php
643 lines (608 loc) · 41.8 KB
/
session.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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
<?php
require_once 'includes/auth.php';
require_once 'includes/helpers.php';
if (!phpCAS::isAuthenticated()) {
header('location: ./index.php');
exit;
}
blockUnauthorized();
$alertsToDisplay = "";
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['transaction'])) {
$data = $_POST;
$transaction = $data['transaction'];
unset($data['transaction']);
if ($transaction == 'update_session') {
$result = Sessions::update($data);
} else if($transaction == 'create_membership') {
$result = Memberships::create($data);
} else if($transaction == 'create_subbody') {
$result = Subbodies::create($data);
} else if($transaction == 'create_meeting') {
$result = Meetings::create($data);
} else if($transaction == 'create_project') {
$result = Projects::create($data);
} else if($transaction == 'delete_meeting') {
$result = Meetings::delete($data);
} else if($transaction == 'delete_project') {
$result = Projects::delete($data);
} else {
$result = false;
}
} else if(!isset($_GET['uniqueId']) || !isset($_GET['bodyUniqueId'])) {
header('location: ./sessions.php');
exit;
} else {
$result = false;
}
$session = Sessions::getEntry("$_GET[bodyUniqueId]/$_GET[uniqueId]");
$subbodies = Subbodies::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sessionUniqueId" => $_GET['uniqueId'],
]);
$memberships = Memberships::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sessionUniqueId" => $_GET['uniqueId'],
"sort" => "name,personRcsId",
]);
$positions = Positions::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sort" => "-presidingOfficer,name",
]);
$meetings = Meetings::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sessionUniqueId" => $_GET['uniqueId'],
]);
$projects = Projects::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sessionUniqueId" => $_GET['uniqueId'],
]);
$currentBylaws = Bylaws::read([
"bodyUniqueId" => $_GET['bodyUniqueId'],
"sessionUniqueId" => $_GET['uniqueId'],
"draft" => false,
"sort" => "-date,-updatedAt,-createdAt",
"count" => 1
]);
$pageTitle = "Manage Session: " . $session['name'];
$officersTable = "";
$votingMembersTable = "";
$otherMembersTable = "";
$officersCount = 0;
$votingMembersCount = 0;
$otherMembersCount = 0;
$membershipCount = 0;
$membershipHeaderRow = '<tr>
<th width="20%">Name</th>
<th width="40%">Position</th>
<th width="20%">Term</th>
<th width="20%"></th>
</tr>';
foreach($memberships as $m) {
$row = "<tr>";
$row .= "<td>" . $m['person']['name'] . "</td>";
$row .= "<td><a href='position.php?id=$m[positionId]'>$m[name]" . ($m['position']['presidingOfficer'] ? " <span class='text-muted'>(Presiding Officer)</span>" : "") . "</a></td>";
$row .= "<td>$m[term]</td>";
// $row .= "<td><a href='mailto:" . $m['person']['rcsId'] . "@rpi.edu'>" . $m['person']['rcsId'] . "@rpi.edu</a></td>";
$row .= "<td><a href='/person.php?rcsId=$m[personRcsId]' class='btn btn-primary btn-xs'><span class='fa fa-gear'></span> Manage</a></td>";
$row .= "</tr>";
if(!$session['active'] || $m['current']) {
if($m['position']['officer']) {
$officersTable .= $row;
$officersCount++;
} else if($m['position']['voting']) {
$votingMembersTable .= $row;
$votingMembersCount++;
} else {
$otherMembersTable .= $row;
$otherMembersCount++;
}
$membershipCount++;
}
}
?>
<!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-8">
<div class="card">
<div class="content content-even">
<ol class="breadcrumb">
<li><a href="sessions.php">Bodies & Sessions</a> <?=$alertsToDisplay?></li>
<li><a href="body.php?uniqueId=<?=$session['bodyUniqueId']?>"><?=$session['body']['name']?></a></li>
<li class="active"><?=$session['name']?></li>
</ol>
</div>
</div>
<div class="card">
<div class="content content-even">
<ul class="nav nav-pills">
<li role="presentation" <?=(!isset($_GET['section']) || $_GET['section'] == 'membership') ? 'class="active"' : ''?>>
<a href="<?=toggleGetParam('section','membership')?>">Membership</a>
</li>
<li role="presentation" <?=(isset($_GET['section']) && $_GET['section'] == 'subbodies') ? 'class="active"' : ''?>>
<a href="<?=toggleGetParam('section','subbodies')?>">Sub-Bodies</a>
</li>
<li role="presentation" <?=(isset($_GET['section']) && $_GET['section'] == 'meetings') ? 'class="active"' : ''?>>
<a href="<?=toggleGetParam('section','meetings')?>">Meetings</a>
</li>
<li role="presentation" <?=(isset($_GET['section']) && $_GET['section'] == 'projects') ? 'class="active"' : ''?>>
<a href="<?=toggleGetParam('section','projects')?>">Projects</a>
</li>
<li role="presentation" <?=(isset($_GET['section']) && $_GET['section'] == 'bylaws') ? 'class="active"' : ''?>>
<a href="<?=toggleGetParam('section','bylaws')?>">Bylaws</a>
</li>
</ul>
</div>
</div>
<?php if(!isset($_GET['section']) || $_GET['section'] == 'membership') { ?>
<div class="card">
<div class="header">
<h4 class="title"><?=$session['active'] ? 'Current ' : ''?>Officers</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<?=$membershipHeaderRow?>
</thead>
<tbody>
<?=$officersTable?>
<?=$officersCount == 0 ? ('<td colspan="4" class="text-center"><em class="text-muted">No officers ' . ($session['active'] ? 'are currently active' : 'exist') . ' in this session!</em></td>') : ''?>
</tbody>
</table>
</div>
</div>
<div class="card">
<div class="header">
<h4 class="title"><?=$session['active'] ? 'Current ' : ''?>Voting Members</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<?=$membershipHeaderRow?>
</thead>
<tbody>
<?=$votingMembersTable?>
<?=$votingMembersCount == 0 ? ('<td colspan="4" class="text-center"><em class="text-muted">No voting members ' . ($session['active'] ? 'are currently active' : 'exist') . ' in this session!</em></td>') : ''?>
</tbody>
</table>
</div>
</div>
<?php if($otherMembersCount > 0) { ?>
<div class="card">
<div class="header">
<h4 class="title">Current Other Members</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<tr>
<?=$membershipHeaderRow?>
</tr>
</thead>
<tbody>
<?=$otherMembersTable?>
</tbody>
</table>
</div>
</div>
<?php } ?>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'subbodies') { ?>
<div class="card">
<div class="header">
<h4 class="title">Sub-Bodies</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Name</th>
<th>Presiding Officer</th>
<th>Unique Identifier</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
foreach($subbodies as $sub) {
echo "<tr>";
echo "<td>$sub[name]</td>";
echo "<td>";
if(isset($sub['presidingOfficerPositionId'])) {
if(count($sub['presidingOfficerPosition']['memberships']) == 0) {
echo "<em>vacant</em>";
} else {
echo "<a href='/person.php?rcsId=" . $sub['presidingOfficerPosition']['memberships'][0]['personRcsId'] . "'>";
echo $sub['presidingOfficerPosition']['memberships'][0]['person']['name'];
echo "</a>";
}
} else {
echo "<em>no presiding position</em>";
}
echo "</td>";
echo "<td><span class='text-muted'>$session[fullUniqueId]/</span>$sub[uniqueId]</td>";
echo "<td><a href='/subbody.php?bodyUniqueId=$sub[bodyUniqueId]&sessionUniqueId=$sub[sessionUniqueId]&uniqueId=$sub[uniqueId]' class='btn btn-primary btn-xs'><span class='fa fa-gear'></span> Manage</a></td>";
echo "</tr>";
}
if(count($subbodies) == 0) {
echo "<td colspan=\"4\" class=\"text-center\"><em class=\"text-muted\">No subbodies exsthis session!</em></td>";
}
?>
</tbody>
</table>
</div>
</div>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'meetings') { ?>
<div class="card">
<div class="header">
<h4 class="title">Meetings</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Meeting</th>
<th>Date</th>
<th>Location</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
foreach($meetings as $m) {
echo "<tr>";
echo "<td>$session[name] - Meeting #$m[meetingNum]</td>";
echo "<td>$m[displayDate]</td>";
echo "<td>$m[location]</td>";
echo "<td></td>";
echo "<td>
<form class='form-inline' method='post' action='$_SERVER[REQUEST_URI]' onsubmit='return confirm(\"Are you sure you want to delete $session[name] - Meeting #$m[meetingNum]?\");'>
<a href='/meeting.php?bodyUniqueId=$m[bodyUniqueId]&sessionUniqueId=$m[sessionUniqueId]&meetingNum=$m[meetingNum]' class='btn btn-primary btn-xs'><span class='fa fa-gear'></span> Manage</a>
<input type=\"hidden\" name=\"transaction\" value=\"delete_meeting\">
<input type=\"hidden\" name=\"sessionUniqueId\" value=\"$_GET[uniqueId]\">
<input type=\"hidden\" name=\"bodyUniqueId\" value=\"$_GET[bodyUniqueId]\">
<input type=\"hidden\" name=\"meetingNum\" value=\"$m[meetingNum]\">
<button class=\"btn btn-default btn-xs\" type='submit'><span class='fa fa-trash'></span></button>
</form>
</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</div>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'projects') { ?>
<div class="card">
<div class="header">
<h4 class="title">Projects</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table table-hover table-striped">
<thead>
<tr>
<th>Name</th>
<th>Assigned Sub-Body</th>
<th>Contact Person</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if(count($projects) == 0) {
echo "<tr class='text-muted text-center'><td colspan='4'><em>No projects were found for the $session[name]!</em></td></tr>";
} else {
foreach ($projects as $p) {
echo "<tr>";
echo "<td>$p[name]</td>";
echo "<td>" . (isset($p['subbodyUniqueId']) ? ("<a href='/subbody.php?bodyUniqueId=$p[bodyUniqueId]&sessionUniqueId=$p[sessionUniqueId]&uniqueId=$p[subbodyUniqueId]'>" . $p['subbody']['name'] . "</a>") : "None") . "</td>";
echo "<td>" . (isset($p['contactPersonRcsId']) ? ("<a href='/person.php?rcsId=$p[contactPersonRcsId]'>" . $p['contactPerson']['name'] . "</a>") : "None") . "</td>";
echo "<td></td>";
echo "<td>
<form class='form-inline' method='post' action='$_SERVER[REQUEST_URI]' onsubmit='return confirm(\"Are you sure you want to delete $p[name]?\");'>
<a href='/project.php?id=$p[id]' class='btn btn-primary btn-xs'><span class='fa fa-gear'></span> Manage</a>
<input type=\"hidden\" name=\"transaction\" value=\"delete_project\">
<input type=\"hidden\" name=\"id\" value=\"$p[id]\">
<button class=\"btn btn-default btn-xs\" type='submit'><span class='fa fa-trash'></span></button>
</form>
</td>";
echo "</tr>";
}
}
?>
</tbody>
</table>
</div>
</div>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'bylaws') { ?>
<div class="card">
<div class="header">
<h4 class="title">Update the Bylaws of the <?=$session['name']?></h4>
</div>
<div class="content content-even">
<form>
<div class="form-group">
<textarea title="Bylaws" name="bylawsText" rows="16" class="form-control"
style="resize: vertical;" data-provide="markdown"
data-iconlibrary="fa"><?=count($currentBylaws) > 0 ? $currentBylaws[0]['text'] : ''?></textarea>
</div>
<div class="form-group">
<label for="date">Effective Date</label>
<input type="date" name="date" id="date" class="form-control" value="<?=date('Y-m-d')?>">
</div>
<button type="submit" class="btn btn-primary btn-sm btn-fill pull-right">Update Bylaws</button>
<div class="clearfix"></div>
</form>
</div>
</div>
<?php } ?>
</div>
<div class="col-md-4">
<div class="card">
<div class="header">
<h4 class="title">Session Membership Details</h4>
</div>
<div class="content table-responsive table-full-width">
<table class="table">
<tbody>
<tr>
<td>Total Membership</td>
<td><?=$membershipCount?></td>
</tr>
<tr>
<td>Officer Membership</td>
<td><?=$officersCount?></td>
</tr>
<tr>
<td>Voting Membership</td>
<td><?=$votingMembersCount?></td>
</tr>
<tr>
<td>Simple Majority</td>
<td><?=ceil($votingMembersCount*(1/2))?></td>
</tr>
<tr>
<td>Three-Fifths (3/5) Majority</td>
<td><?=ceil($votingMembersCount*(3/5))?></td>
</tr>
<tr>
<td>Two-Thirds (2/3) Majority</td>
<td><?=ceil($votingMembersCount*(2/3))?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="card">
<div class="header">
<h4 class="title">Edit Session Settings</h4>
</div>
<div class="content">
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Body Identifier <?=$requiredIndicator?></label>
<input type="text" class="form-control" disabled placeholder="Company" value="<?=$session['bodyUniqueId']?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Unique Identifier <?=$requiredIndicator?></label>
<input type="text" class="form-control" disabled placeholder="Company" value="<?=$session['uniqueId']?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Session Name <?=$requiredIndicator?></label>
<input type="text" name="name" class="form-control" placeholder="Session Name (e.g. 'Student Government')" value="<?=$session['name']?>">
</div>
</div>
</div>
<input type="hidden" name="transaction" value="update_session">
<input type="hidden" name="uniqueId" value="<?=$_GET['uniqueId']?>">
<input type="hidden" name="bodyUniqueId" value="<?=$_GET['bodyUniqueId']?>">
<button type="submit" class="btn btn-primary btn-sm btn-fill pull-right">Update Body</button>
<div class="clearfix"></div>
</form>
</div>
</div>
<?php if (!isset($_GET['section']) || $_GET['section'] == 'membership') { ?>
<?=generateAddMembershipCard('create_membership', $_GET['bodyUniqueId'], $_GET['uniqueId'], null)?>
<?php } else if (false) {//(!isset($_GET['section']) || $_GET['section'] == 'membership') { ?>
<div class="card">
<div class="header">
<h4 class="title">Add Member</h4>
</div>
<div class="content">
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<div class="form-group">
<label>RCS ID <?=$requiredIndicator?></label>
<input type="text" name="personRcsId" class="form-control" placeholder="RCS ID">
</div>
<div class="form-group">
<label>Position <?=$requiredIndicator?></label>
<select name="positionId" class="form-control">
<option disabled selected>Select a position...</option>
<?php
$presidingOfficerOptions = "";
$officerOptions = "";
$votingOptions = "";
$presidingOfficerCount = 0;
$officerCount = 0;
$votingCount = 0;
foreach($positions as $p) {
$option = "<option value='$p[id]'>$p[name]</option>";
if($p['presidingOfficer']) {
$presidingOfficerOptions .= $option;
$presidingOfficerCount++;
} else if($p['officer']) {
$officerOptions .= $option;
$officerCount++;
} else if($p['voting']) {
$votingOptions .= $option;
$votingCount++;
}
}
if($presidingOfficerCount > 0) {
echo "<optgroup label='Presiding Officer" . ($presidingOfficerCount > 1 ? 's' : '') ."'>$presidingOfficerOptions</optgroup>";
}
if($officerCount > 0) {
echo "<optgroup label='Officer" . ($officerCount > 1 ? 's' : '') ."'>$officerOptions</optgroup>";
}
if($votingCount > 0) {
echo "<optgroup label='Voting Position" . ($votingCount > 1 ? 's' : '') ."'>$votingOptions</optgroup>";
}
?>
</select>
</div>
<div class="form-group">
<label>Membership-Specific Title</label>
<input type="text" name="name" class="form-control" placeholder="Optional">
</div>
<div class="form-group">
<label>Start Date <?=$requiredIndicator?></label>
<input type="date" name="startDate" class="form-control" placeholder="YYYY-MM-DD" value="<?=date('Y-m-d')?>">
</div>
<div class="form-group">
<label>End Date</label>
<input type="date" name="endDate" class="form-control" placeholder="YYYY-MM-DD">
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="yearOnly" data-toggle="checkbox"> Year Only
</label>
</div>
<input type="hidden" name="transaction" value="create_membership">
<input type="hidden" name="sessionUniqueId" value="<?=$_GET['uniqueId']?>">
<input type="hidden" name="bodyUniqueId" value="<?=$_GET['bodyUniqueId']?>">
<button type="submit" class="btn btn-primary btn-sm btn-fill pull-right">Add Member</button>
<div class="clearfix"></div>
</form>
</div>
</div>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'subbodies') { ?>
<div class="card">
<div class="header">
<h4 class="title">Create New Sub-Body</h4>
</div>
<div class="content">
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<div class="form-group">
<label>Unique Identifier <?=$requiredIndicator?></label>
<div class="input-group">
<span class="input-group-addon" id="subbody-unique-id-prefix"><?=$session['fullUniqueId']?>/</span>
<input type="text" name="uniqueId" class="form-control" placeholder="uniqueId" aria-describedby="subbody-unique-id-prefix">
</div>
</div>
<div class="form-group">
<label>Sub-Body Name <?=$requiredIndicator?></label>
<input type="text" name="name" class="form-control" placeholder="Sub-Body Name">
</div>
<input type="hidden" name="transaction" value="create_subbody">
<input type="hidden" name="sessionUniqueId" value="<?=$_GET['uniqueId']?>">
<input type="hidden" name="bodyUniqueId" value="<?=$_GET['bodyUniqueId']?>">
<button type="submit" class="btn btn-primary btn-sm btn-fill pull-right">Create Sub-Body</button>
<div class="clearfix"></div>
</form>
</div>
</div>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'meetings') { ?>
<div class="card">
<div class="header">
<h4 class="title">Add Meeting</h4>
</div>
<div class="content">
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<div class="form-group">
<label>Meeting Date <?=$requiredIndicator?></label>
<input type="date" name="date" class="form-control">
</div>
<div class="form-group">
<label>Meeting Location <?=$requiredIndicator?></label>
<input type="text" name="location" class="form-control" placeholder="Location">
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="copyPreviousLocation" data-toggle="checkbox"> Copy Previous Meeting's Location
</label>
</div>
<input type="hidden" name="transaction" value="create_meeting">
<input type="hidden" name="sessionUniqueId" value="<?=$_GET['uniqueId']?>">
<input type="hidden" name="bodyUniqueId" value="<?=$_GET['bodyUniqueId']?>">
<button type="submit" class="btn btn-primary btn-sm btn-fill pull-right">Add Meeting</button>
<div class="clearfix"></div>
</form>
</div>
</div>
<?php } else if(isset($_GET['section']) && $_GET['section'] == 'projects') { ?>
<div class="card">
<div class="header">
<h4 class="title">Add Project</h4>
</div>
<div class="content">
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<div class="form-group">
<label for="projectName">Name <?=$requiredIndicator?></label>
<input type="text" name="name" id="projectName" class="form-control" placeholder="Name">
</div>
<div class="form-group">
<label for="projectDescription">Description <?=$requiredIndicator?></label>
<textarea name="description" id="projectDescription" class="form-control" placeholder="Description"></textarea>
</div>
<div class="form-group">
<label for="projectSubbodyUniqueId">Assigned Sub-Body</label>
<select class="form-control" name="subbodyUniqueId" id="projectSubbodyUniqueId">
<option selected disabled>Select a sub-body...</option>
<?php
$alreadyDisplayed = [];
foreach($subbodies as $sub) {
echo "<option value='$sub[uniqueId]'>" . $sub['name'] . "</option>";
}
?>
</select>
</div>
<div class="form-group">
<label for="projectContactPerson">Contact Person</label>
<select class="form-control" name="contactPersonRcsId" id="projectContactPerson">
<option selected disabled>Select a contact person...</option>
<?php
$alreadyDisplayed = [];
foreach($memberships as $m) {
if((!$session['active'] || $m['current']) && (!isset($alreadyDisplayed[$m['personRcsId']]) || !$alreadyDisplayed[$m['personRcsId']])) {
echo "<option value='$m[personRcsId]'>" . $m['person']['name'] . "</option>";
$alreadyDisplayed[$m['personRcsId']] = true;
}
}
?>
</select>
</div>
<input type="hidden" name="transaction" value="create_project">
<input type="hidden" name="sessionUniqueId" value="<?=$_GET['uniqueId']?>">
<input type="hidden" name="bodyUniqueId" value="<?=$_GET['bodyUniqueId']?>">
<button type="submit" class="btn btn-primary btn-sm btn-fill pull-right">Add Project</button>
<div class="clearfix"></div>
</form>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<?php require_once 'partials/footer.php' ?>
</div>
</div>
<?php require_once 'partials/scripts.php' ?>
<?=buildMessage($result, $_POST)?>
</body>
</html>