This repository has been archived by the owner on Aug 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathshowCase.php
136 lines (117 loc) · 4.67 KB
/
showCase.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
<?php
/*
* Copyright 2011-2015 Community Legal Services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// showCase.php
// Displays a single case's information
require_once("config.php");
require_once("Arrest.php");
require_once("ArrestSummary.php");
require_once("Person.php");
require_once("Attorney.php");
require_once("utils.php");
require_once("Case.php");
include('head.php');
include('header.php');
?>
<div class="main">
<div class="content-left"> </div>
<div class="content-center">
<?php
// if the user isn't logged in, then don't display this page. Tell them they need to log in.
if (!isLoggedIn())
include("displayNotLoggedIn.php");
else
{
$attorney = new Attorney($_SESSION["loginUserID"], $db);
if($GLOBALS['debug'])
$attorney->printAttorneyInfo();
// only certain users can see this page
if ($attorney->getProgramId() != 1)
print "You must have permission to view this page.";
else
{
// first, get basic info about the expungement
$query = "SELECT expungement.*, userinfo.*, arrest.*, defendant.firstName as dFirst, defendant.lastName as dLast from expungement LEFT JOIN userinfo on (expungement.userid = userinfo.userid) LEFT JOIN arrest on (expungement.arrestID = arrest.arrestID) LEFT JOIN defendant on (arrest.defendantID = defendant.defendantID) WHERE expungement.expungementID = {$_GET['id']}";
// if this is not an admin user, then you should only display this to a user
// who actually did the expungement.
if ($attorney->getUserLevel() != 1)
$query .= " AND expungement.userid = {$attorney->getUserID()}";
$result = $db->query($query);
if (!$result)
{
if ($GLOBALS['debug'])
die('Could not get the Expungement Information from the DB:' . $db->error);
else
die('Could not get the Expungement Information from the DB');
}
print <<<END
<table>
<th>Docket Number</th><th>Defendant Name</th><th>Attorney Name</th><th>Date Prepared</th><th>Charges Redacted</th><th>Type</th><th>Costs Owed</th><th>Bail Owed</th>
END;
while ($row = $result->fetch_assoc())
{
$redactionType = getRedactionType($row['isExpungement'],$row['isRedaction'],$row['isSummaryExpungement']);
print "<tr>";
print "<td><a href='showCase.php?id={$row['expungementID']}'>{$row['docketNumRelated']}</a></td>";
print "<td>{$row['dFirst']} {$row['dLast']} </td>";
print "<td>{$row['firstName']} {$row['lastName']} </td>";
print "<td>{$row['timestamp']}</td>";
print "<td>{$row['numRedactableCharges']}</td>";
print "<td>$redactionType</td>";
print "<td>$" . number_format($row['costsTotal'] - $row['bailTotal'],2) . "</td>";
print "<td>$" . number_format($row['bailTotalToal'],2) . "</td>";
print "</tr>";
}
print "</table>";
$result->close();
if (doesPDFExistForCaseId($_GET['id']))
print "<br /><a href='displayPDF.php?id={$_GET['id']}'>Show stored PDF docket sheet for this case</a><br />";
// now, query all of the charges associated with this expungement
$query = "SELECT expungement.*, arrest.*, defendant.*, charge.* from expungement LEFT JOIN arrest on (expungement.arrestID = arrest.arrestID) LEFT JOIN defendant on (arrest.defendantID = defendant.defendantID) LEFT JOIN charge on (arrest.arrestID = charge.arrestID) WHERE expungement.expungementID = {$_GET['id']}";
if ($attorney->getUserLevel() != 1)
$query .= " AND expungement.userid = {$attorney->getUserID()}";
$result = $db->query($query);
if (!$result)
{
if ($GLOBALS['debug'])
die('Could not get the Expungement Information from the DB:' . $db->error);
else
die('Could not get the Expungement Information from the DB');
}
print <<<END
<table>
<th>Charge Name</th><th>Charge Disposition</th><th>Code Section</th><th>Disp Date</th><th>Is Charge Expungeable?</th>
END;
while ($row = $result->fetch_assoc())
{
print "<tr>";
print "<td>{$row['chargeName']}</td>";
print "<td>{$row['disposition']}</td>";
print "<td>{$row['codeSection']}</td>";
print "<td>{$row['dispDate']}</td>";
print "<td>{$row['isExpungeableNow']}</td>";
print "</tr>";
}
$result->close();
}
}
?>
</div> <!-- content-center -->
<div class="content-right"><?php // include right column? ?></div>
</div>
<?php
include ('foot.php');
?>