From 227281197ed5f4736fbba4df7bce975bcf3ca2e5 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Thu, 14 Nov 2013 00:47:34 +0000 Subject: Files for the basic search interface. --- style.css | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 style.css (limited to 'style.css') diff --git a/style.css b/style.css new file mode 100644 index 0000000..f1b0ab3 --- /dev/null +++ b/style.css @@ -0,0 +1,23 @@ +body { + font-size: x-small; +} + +td { + border: 1px solid #000000; + padding: 3px 7px 2px 7px; +} + +th { + font-size: 1.1em; + padding: 3px 7px 2px 7px; + text-align: left; + color: #ffffff; +} + +tr.tablehead { + background-color: #000000; +} + +tr.alt { + background-color: #eeeeee; +} -- cgit v1.2.3 From e4e405d6a6b48dd90d38255834d745f66acdc877 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Thu, 14 Nov 2013 21:16:26 +0000 Subject: Use x-small text only in the results tables, not on the body of any page. --- charges.php | 2 +- dockets.php | 2 +- index.php | 15 +++------------ search.php | 3 ++- style.css | 4 +++- 5 files changed, 10 insertions(+), 16 deletions(-) (limited to 'style.css') diff --git a/charges.php b/charges.php index ee9c9b2..55536ce 100644 --- a/charges.php +++ b/charges.php @@ -14,7 +14,7 @@ HTML; $dbh = new PDO('mysql:host=localhost;dbname=mdcc', 'mdcc', 'Mdcc.'); echo << + diff --git a/dockets.php b/dockets.php index f8416c2..6805a3a 100644 --- a/dockets.php +++ b/dockets.php @@ -15,7 +15,7 @@ HTML; $dbh = new PDO('mysql:host=localhost;dbname=mdcc', 'mdcc', 'Mdcc.'); echo << +
ID Case ID
diff --git a/index.php b/index.php index 2a3971e..dfdca68 100644 --- a/index.php +++ b/index.php @@ -1,19 +1,10 @@ - - - Miami-Dade Clerk of Courts Search - - + Miami-Dade Clerk of Courts: Search + @@ -131,7 +122,7 @@ for ( $year = date("Y"); $year >= 1990; $year-- ) { ?> (dd/mm/yyyy)
- + diff --git a/search.php b/search.php index 169e56e..30f4dd0 100644 --- a/search.php +++ b/search.php @@ -162,6 +162,7 @@ if ( $where_parts ) { } } else { echo "You must enter at least one search criteria."; + exit; } $sql = $select . $where; @@ -172,7 +173,7 @@ if ( $st->execute() ) { echo "

$row_count records found.

\n"; echo << +
ID Seq. No.
diff --git a/style.css b/style.css index f1b0ab3..89aea51 100644 --- a/style.css +++ b/style.css @@ -1,4 +1,4 @@ -body { +.results_table { font-size: x-small; } @@ -21,3 +21,5 @@ tr.tablehead { tr.alt { background-color: #eeeeee; } + +#case_num { width: 5em; } -- cgit v1.2.3 From eb5a42d35f99038bb3d242e519f002fd039e16a1 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Thu, 14 Nov 2013 22:38:05 +0000 Subject: Tried to make the search form look a teeny tiny bit better. --- index.php | 166 +++++++++++++++++++++++++++++++++++++++----------------------- style.css | 29 +++++++++++ 2 files changed, 134 insertions(+), 61 deletions(-) (limited to 'style.css') diff --git a/index.php b/index.php index dfdca68..8772970 100644 --- a/index.php +++ b/index.php @@ -7,124 +7,168 @@ - + -
- Year: - + = 1990; $year-- ) { - echo " "; + echo " "; } ?> - - Case #: - Defendant #: - + + +
+ + +
+ +
+ + -
- Name: -
- Charge: -
- Disposition: -
- Docket: -
- Given probation? -
- Still on probation? -
- Probation completed: - +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + % -
- Probation start: - % +
+ +
+ + - + - + (dd/mm/yyyy) -
- Probation end: - (dd/mm/yyyy) +
+ +
+ + - + - + (dd/mm/yyyy) -
- + (dd/mm/yyyy) +
+ +
+ +
+ + + + diff --git a/style.css b/style.css index 89aea51..0f8301c 100644 --- a/style.css +++ b/style.css @@ -1,3 +1,7 @@ +#case_search { + background-color: #cccccc; +} + .results_table { font-size: x-small; } @@ -23,3 +27,28 @@ tr.alt { } #case_num { width: 5em; } + +#search_cases div { + margin-bottom: 1ex; +} + +label { + display: inline-block; + width: 25ex; +} + +#content { + width: 50%; + margin: 2em auto; +} + +#search_form { + width: 60%; + margin: 0 auto; +} + +#form_submit { + text-align: center; + margin-top: 4em; +} + -- cgit v1.2.3 From 575f10e90a01e88522b273f95800acee979c0e7b Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Fri, 15 Nov 2013 16:32:53 +0000 Subject: A few more cosmetic changes. --- index.php | 197 +++++++++++++++++++++++++++++++------------------------------- style.css | 10 ++-- 2 files changed, 106 insertions(+), 101 deletions(-) (limited to 'style.css') diff --git a/index.php b/index.php index 8772970..712c1a0 100644 --- a/index.php +++ b/index.php @@ -1,8 +1,9 @@ - + + Miami-Dade Clerk of Courts: Search @@ -12,162 +13,164 @@

Miami-Dade Clerk of Courts case search

-
-
-
- - + = 1990; $year-- ) { - echo " "; + echo " \n"; } ?> - -
- -
- - -
- -
- - +
+ +
+ + +
+ +
+ + -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + % -
+ % +
-
- - + $day"; + echo " \n"; } ?> - - + - + (dd/mm/yyyy) -
+ (dd/mm/yyyy) +
-
- - + $day"; + echo " \n"; } ?> - - + - + (dd/mm/yyyy) -
+ (dd/mm/yyyy) + + +
+ +
-
- -
+ - + - - + diff --git a/style.css b/style.css index 0f8301c..39a0c3a 100644 --- a/style.css +++ b/style.css @@ -38,13 +38,12 @@ label { } #content { - width: 50%; - margin: 2em auto; + text-align: center; } #search_form { - width: 60%; - margin: 0 auto; + display: inline-block; + text-align: left; } #form_submit { @@ -52,3 +51,6 @@ label { margin-top: 4em; } +#search_cases #name, #charge, #disposition, #docket { + width: 40ex; +} -- cgit v1.2.3 From 3dcb75c2e3600797a5d8d001b2b3b5f921332bf5 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Fri, 15 Nov 2013 18:09:00 +0000 Subject: Added the ability to sort results on various columns. --- index.php | 2 +- search.php | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++--------- style.css | 5 ++++ 3 files changed, 73 insertions(+), 12 deletions(-) (limited to 'style.css') diff --git a/index.php b/index.php index 712c1a0..e7bebbc 100644 --- a/index.php +++ b/index.php @@ -16,7 +16,7 @@
-
+
- + - - + + - - + + - + - @@ -210,11 +265,12 @@ HTML; } $alt = $alt ? '' : 'alt'; echo " \n"; - foreach ( $row as $field => $value ) { + #foreach ( $row as $field => $value ) { + foreach ( $database_fields as $field ) { if ( 'name' == $field && $akas_rows ) { - echo " \n"; + echo " \n"; } else { - echo " \n"; + echo " \n"; } } echo " \n"; diff --git a/style.css b/style.css index 39a0c3a..d6cd0e6 100644 --- a/style.css +++ b/style.css @@ -6,6 +6,11 @@ font-size: x-small; } +.results_table th a { + text-decoration: none; + color: green; +} + td { border: 1px solid #000000; padding: 3px 7px 2px 7px; -- cgit v1.2.3 From 37df1348b217e827dc1b5c3dcf525cdf7e182b93 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Fri, 15 Nov 2013 18:16:24 +0000 Subject: Tweaked the styles a bit. --- search.php | 36 ++++++++++++++++++------------------ style.css | 11 ++++++++++- 2 files changed, 28 insertions(+), 19 deletions(-) (limited to 'style.css') diff --git a/search.php b/search.php index 93a3096..c883434 100644 --- a/search.php +++ b/search.php @@ -208,42 +208,42 @@ if ( $st->execute() ) {
ID State Case No.
ID + Court Case No. + A + D + State Case No. Name Date of BirthDate FiledDate Closed + Date Filed + A + D + + Date Closed + A + D + Warrant Type Hearing Date Hearing Time Hearing TypeProbation StartProbation End + Probation Start + A + D + + Probation End + A + D + Probation LengthIn Jail? + In Jail? + A + D + Released To Bond Amount Bond Status Bond Type Bond DateCourt Case No. Defense Attorney Charges Dockets
$value{$row[$field]}$value{$row[$field]}Charges
diff --git a/style.css b/style.css index d6cd0e6..127e110 100644 --- a/style.css +++ b/style.css @@ -8,9 +8,18 @@ .results_table th a { text-decoration: none; - color: green; } +.sort_asc { + color: #e6e600; + margin-right: 5px; +} + +.sort_desc { + color: #29a329; +} + + td { border: 1px solid #000000; padding: 3px 7px 2px 7px; -- cgit v1.2.3 From 338444de70a1723e68640307c6cbb2ae5e35e621 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 16 Nov 2013 23:09:22 +0000 Subject: Made a link back to the search page. --- search.php | 2 +- style.css | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'style.css') diff --git a/search.php b/search.php index c883434..f1d3147 100644 --- a/search.php +++ b/search.php @@ -202,7 +202,7 @@ $st = $dbh->prepare($sql); if ( $st->execute() ) { $row_count = $st->rowCount(); echo "

$row_count records found.

\n"; - echo "Search again"; + echo "Search again"; echo << diff --git a/style.css b/style.css index 127e110..18a46ce 100644 --- a/style.css +++ b/style.css @@ -18,6 +18,10 @@ .sort_desc { color: #29a329; } + +#search_again { + color: blue; +} td { -- cgit v1.2.3 From c3a757c92efdc695dac914a754838888a0486acb Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Thu, 21 Nov 2013 15:39:21 +0000 Subject: Added some basic pagination for search results. --- search.php | 38 +++++++++++++++++++++++++++++++++++--- style.css | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'style.css') diff --git a/search.php b/search.php index f1d3147..54383f8 100644 --- a/search.php +++ b/search.php @@ -2,6 +2,8 @@ error_reporting(E_ALL ^ E_NOTICE); +$results_per_page = '20'; + echo << @@ -198,12 +200,34 @@ if ( $_REQUEST['orderby'] && $_REQUEST['orderdir'] ) { $sql .= " ORDER BY court_case_no DESC"; } +echo "New Search"; + +# Get the total row count so we can display it to the user $st = $dbh->prepare($sql); if ( $st->execute() ) { $row_count = $st->rowCount(); - echo "

$row_count records found.

\n"; - echo "Search again"; + if ( $row_count <= $results_per_page ) { + echo "

{$row_count} records found.

"; + } elseif ( $_GET['page'] ) { + $viewing = ($_GET['page'] - 1) * $results_per_page + 1; + $upto = ($_GET['page'] - 1) * $results_per_page + $results_per_page; + echo "

Viewing {$viewing} to {$upto} of {$row_count} records found.

"; + } else { + echo "

Viewing 1 to {$results_per_page} of {$row_count} records found.

"; + } +} + +# Pagination +if ( $_GET['page'] ) { + $start_num = ($_GET['page'] - 1) * $results_per_page; + $sql .= " LIMIT $start_num, $results_per_page"; +} else { + $sql .= " LIMIT 0, $results_per_page"; +} + +$st = $dbh->prepare($sql); +if ( $st->execute() ) { echo <<
@@ -279,8 +303,16 @@ HTML; } } +echo "
- Court Case No. - A - D + Court Case No.
+ A + D
State Case No. Name Date of Birth - Date Filed - A - D + Date Filed
+ A + D
- Date Closed - A - D + Date Closed
+ A + D
Warrant Type Hearing Date Hearing Time Hearing Type - Probation Start - A - D + Probation Start
+ A + D
- Probation End - A - D + Probation End
+ A + D
Probation Length - In Jail? - A - D + In Jail?
+ A + D
Released To Bond Amount
"; + +if ( $_GET['page'] && $row_count > $results_per_page ) { + $next_page = $_GET['page'] + 1; + echo "
Next Page>>"; +} elseif ( $row_count > $results_per_page ) { + echo "
Next Page >>"; +} + echo << diff --git a/style.css b/style.css index 18a46ce..e06ff81 100644 --- a/style.css +++ b/style.css @@ -66,7 +66,7 @@ label { #form_submit { text-align: center; - margin-top: 4em; + margin-top: 2em; } #search_cases #name, #charge, #disposition, #docket { -- cgit v1.2.3 From 5e4dc233b4b126aed748fdf84a950883aff91507 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Mon, 25 Nov 2013 18:48:28 +0000 Subject: Give user ability to search for multiple years. --- index.php | 4 +- search.php | 126 +++++++++++++++++++++++++++++++++++++++---------------------- style.css | 2 + 3 files changed, 84 insertions(+), 48 deletions(-) (limited to 'style.css') diff --git a/index.php b/index.php index e7bebbc..df83125 100644 --- a/index.php +++ b/index.php @@ -18,8 +18,8 @@
- - '', + 'case_years' => '', 'case_num' => '', 'defendant' => '', 'name' => '', @@ -61,7 +61,9 @@ $request_params = array( 'prob_end_year' => '', ); foreach ( $request_params as $param => $value ) { - if ( isset($_REQUEST[$param]) ) { + if ( isset($_REQUEST[$param]) && is_array($_REQUEST[$param]) ) { + $$param = $_REQUEST[$param]; + } elseif ( isset($_REQUEST[$param]) ) { $$param = trim($_REQUEST[$param]); } } @@ -76,117 +78,149 @@ if ( $docket ) { $select .= "LEFT JOIN dockets ON cases.id = dockets.case_id "; } -$where_parts = array(); +// Two arrays for storing where clauses, one for clauses that need to be joined +// by AND and one for those needing to be joined by OR +$where_parts_and = array(); +$where_parts_or = array(); -if ( $case_year && $case_num && $defendant ) { - $case_year = substr($case_year, -2); - $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); - $where_parts[] = "cases.court_case_no = 'F-{$case_year}-{$case_num}-{$defendant}'"; -} elseif ( $case_year && $case_num ) { - $case_year = substr($case_year, -2); - $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); - $where_parts[] = "cases.court_case_no LIKE 'F-{$case_year}-{$case_num}%'"; -} elseif ( $case_year && $defendant ) { - $case_year = substr($case_year, -2); - $where_parts[] = "cases.court_case_no LIKE 'F-{$case_year}-%-{$defendant}'"; +if ( $case_years && $case_num && $defendant ) { + foreach ( $case_years as $case_year ) { + $case_year = substr($case_year, -2); + $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); + $where_parts_or[] = "cases.court_case_no = 'F-{$case_year}-{$case_num}-{$defendant}'"; + } +} elseif ( $case_years && $case_num ) { + foreach ( $case_years as $case_year ) { + $case_year = substr($case_year, -2); + $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); + $where_parts_or[] = "cases.court_case_no LIKE 'F-{$case_year}-{$case_num}%'"; + } +} elseif ( $case_years && $defendant ) { + foreach ( $case_years as $case_year ) { + $case_year = substr($case_year, -2); + $where_parts_or[] = "cases.court_case_no LIKE 'F-{$case_year}-%-{$defendant}'"; + } } elseif ( $case_num && $defendant ) { $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); - $where_parts[] = "cases.court_case_no LIKE 'F-%-{$case_num}-{$defendant}'"; -} elseif ( $case_year ) { - $case_year = substr($case_year, -2); - $where_parts[] = "cases.court_case_no LIKE 'F-{$case_year}-%'"; + $where_parts_and[] = "cases.court_case_no LIKE 'F-%-{$case_num}-{$defendant}'"; +} elseif ( $case_years ) { + foreach ( $case_years as $case_year ) { + $case_year = substr($case_year, -2); + $where_parts_or[] = "cases.court_case_no LIKE 'F-{$case_year}-%'"; + } } elseif ( $case_num ) { $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); - $where_parts[] = "cases.court_case_no LIKE 'F-%-{$case_num}%'"; + $where_parts_and[] = "cases.court_case_no LIKE 'F-%-{$case_num}%'"; } elseif ( $defendant ) { - $where_parts[] = "cases.court_case_no LIKE 'F-%-%-{$defendant}'"; + $where_parts_and[] = "cases.court_case_no LIKE 'F-%-%-{$defendant}'"; } if ( $name ) { $select .= " LEFT JOIN akas on cases.id = akas.case_id "; - $where_parts[] = "( cases.name LIKE '%{$name}%' OR akas.last_name LIKE '{$name}%' + $where_parts_and[] = "( cases.name LIKE '%{$name}%' OR akas.last_name LIKE '{$name}%' OR akas.first_name LIKE '{$name}%' )"; } if ( $charge ) { - $where_parts[] = "charges.charge LIKE '%${charge}%'"; + $where_parts_and[] = "charges.charge LIKE '%${charge}%'"; } if ( $disposition ) { - $where_parts[] = "charges.disposition LIKE '%{$disposition}%'"; + $where_parts_and[] = "charges.disposition LIKE '%{$disposition}%'"; } if ( $docket ) { - $where_parts[] = "dockets.docket LIKE '%{$docket}%'"; + $where_parts_and[] = "dockets.docket LIKE '%{$docket}%'"; } if ( $prob_given ) { - $where_parts[] = "cases.prob_start_date IS NOT NULL"; + $where_parts_and[] = "cases.prob_start_date IS NOT NULL"; } if ( $prob_still ) { $today = date('Y-m-d'); - $where_parts[] = "'$today' BETWEEN cases.prob_start_date AND cases.prob_end_date"; + $where_parts_and[] = "'$today' BETWEEN cases.prob_start_date AND cases.prob_end_date"; } if ( $prob_per_complete ) { - $where_parts[] = "( DATEDIFF(prob_end_date, prob_start_date) * .{$prob_per_complete} < + $where_parts_and[] = "( DATEDIFF(prob_end_date, prob_start_date) * .{$prob_per_complete} < DATEDIFF(CURDATE(), prob_start_date) AND CURDATE() < prob_end_date )"; } if ( $prob_start_year && $prob_start_month && $prob_start_day ) { - $where_parts[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}' + $where_parts_and[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}' AND MONTH(cases.prob_start_date) = '{$prob_start_month}' AND DAY(cases.prob_start_date) = '{$prob_start_day}'"; } elseif ( $prob_start_year && $prob_start_month ) { - $where_parts[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}' + $where_parts_and[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}' AND MONTH(cases.prob_start_date) = '{$prob_start_month}'"; } elseif ( $prob_start_year && $prob_start_day ) { - $where_parts[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}' + $where_parts_and[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}' AND DAY(cases.prob_start_date) = '{$prob_start_day}'"; } elseif ( $prob_start_month && $prob_start_day ) { - $where_parts[] = "MONTH(cases.prob_start_date) = '{$prob_start_month}' + $where_parts_and[] = "MONTH(cases.prob_start_date) = '{$prob_start_month}' AND DAY(cases.prob_start_date) = '{$prob_start_day}'"; } elseif ( $prob_start_year ) { - $where_parts[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}'"; + $where_parts_and[] = "YEAR(cases.prob_start_date) = '{$prob_start_year}'"; } elseif ( $prob_start_month ) { - $where_parts[] = "MONTH(cases.prob_start_date) = '{$prob_start_month}'"; + $where_parts_and[] = "MONTH(cases.prob_start_date) = '{$prob_start_month}'"; } elseif ( $prob_start_day ) { - $where_parts[] = "DAY(cases.prob_start_date) = '{$prob_start_day}'"; + $where_parts_and[] = "DAY(cases.prob_start_date) = '{$prob_start_day}'"; } if ( $prob_end_year && $prob_end_month && $prob_end_day ) { - $where_parts[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}' + $where_parts_and[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}' AND MONTH(cases.prob_end_date) = '{$prob_end_month}' AND DAY(cases.prob_end_date) = '{$prob_end_day}'"; } elseif ( $prob_end_year && $prob_end_month ) { - $where_parts[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}' + $where_parts_and[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}' AND MONTH(cases.prob_end_date) = '{$prob_end_month}'"; } elseif ( $prob_end_year && $prob_end_day ) { - $where_parts[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}' + $where_parts_and[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}' AND DAY(cases.prob_end_date) = '{$prob_end_day}'"; } elseif ( $prob_end_month && $prob_end_day ) { - $where_parts[] = "MONTH(cases.prob_end_date) = '{$prob_end_month}' + $where_parts_and[] = "MONTH(cases.prob_end_date) = '{$prob_end_month}' AND DAY(cases.prob_end_date) = '{$prob_end_day}'"; } elseif ( $prob_end_year ) { - $where_parts[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}'"; + $where_parts_and[] = "YEAR(cases.prob_end_date) = '{$prob_end_year}'"; } elseif ( $prob_end_month ) { - $where_parts[] = "MONTH(cases.prob_end_date) = '{$prob_end_month}'"; + $where_parts_and[] = "MONTH(cases.prob_end_date) = '{$prob_end_month}'"; } elseif ( $prob_end_day ) { - $where_parts[] = "DAY(cases.prob_end_date) = '{$prob_end_day}'"; + $where_parts_and[] = "DAY(cases.prob_end_date) = '{$prob_end_day}'"; } $where = ''; -if ( $where_parts ) { - foreach ( $where_parts as $part ) { + +if ( $where_parts_and ) { + foreach ( $where_parts_and as $and_part ) { if ( $where ) { - $where .= " AND $part"; + $where .= " AND $and_part"; } else { - $where = "WHERE $part"; + $where = "WHERE $and_part"; } } -} else { +} + +if ( $where_parts_or ) { + // The first element of the OR list should be appended to the existing + // where clause with an AND + if ( $where ) { + $where .= " AND " . array_shift($where_parts_or); + } + // If there are still any where_parts_or left, then join them with OR + if ( count($where_parts_or) ) { + foreach ( $where_parts_or as $or_part ) { + if ( $where ) { + $where .= " OR $or_part"; + } else { + $where = "WHERE $or_part"; + } + } + } +} + +if ( empty($where) ) { echo "You must enter at least one search criteria."; exit; } diff --git a/style.css b/style.css index e06ff81..c762e50 100644 --- a/style.css +++ b/style.css @@ -72,3 +72,5 @@ label { #search_cases #name, #charge, #disposition, #docket { width: 40ex; } + +label { vertical-align: top; } -- cgit v1.2.3 From 917f9f6602659fb5d0a859cb8035f808f7a0ecf5 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Tue, 26 Nov 2013 23:16:04 +0000 Subject: Added the ability for a user to export search results to a CSV file. --- export.php | 24 ++++++++++++++++++++++++ search.php | 7 +++++++ style.css | 8 ++++++++ 3 files changed, 39 insertions(+) create mode 100644 export.php (limited to 'style.css') diff --git a/export.php b/export.php new file mode 100644 index 0000000..2ceca89 --- /dev/null +++ b/export.php @@ -0,0 +1,24 @@ +prepare($sql); +if ( $st->execute() ) { + readfile($filename); +} else { + $errors = $st->errorInfo(); + print_r($errors); +} + +unlink($filename); + +?> diff --git a/search.php b/search.php index e8b5b31..c2409c5 100644 --- a/search.php +++ b/search.php @@ -279,6 +279,10 @@ echo "New Search"; $st = $dbh->prepare($sql); if ( $st->execute() ) { $row_count = $st->rowCount(); + if ( $row_count == '0' ) { + echo "

No records found.

"; + exit; + } if ( $row_count <= $results_per_page ) { echo "

{$row_count} records found.

"; } elseif ( $_GET['page'] ) { @@ -288,6 +292,9 @@ if ( $st->execute() ) { } else { echo "

Viewing 1 to {$results_per_page} of {$row_count} records found.

"; } + $url_sql = urlencode($sql); + // Give the user an export button + echo ""; } # Pagination diff --git a/style.css b/style.css index c762e50..5f2c712 100644 --- a/style.css +++ b/style.css @@ -74,3 +74,11 @@ label { } label { vertical-align: top; } + +#export { + margin-bottom: 1ex; +} + +#export a { + color: blue; +} -- cgit v1.2.3 From a670c3f81ff441271054336fa2c3eb25c08b6576 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 12 Apr 2014 12:25:27 +0000 Subject: Added the ability to search by a range of case numbers. --- index.php | 4 +++- search.php | 16 ++++++++++++++++ style.css | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) (limited to 'style.css') diff --git a/index.php b/index.php index 16cc010..b84f90c 100644 --- a/index.php +++ b/index.php @@ -32,7 +32,9 @@ for ( $year = date("Y"); $year >= 1990; $year-- ) {
- + + to +
diff --git a/search.php b/search.php index 6aadeef..936b6c0 100644 --- a/search.php +++ b/search.php @@ -49,6 +49,7 @@ $request_params = array( 'between' => '', 'case_years' => '', 'case_num' => '', + 'case_num_to' => '', 'defendant' => '', 'name' => '', 'charge' => '', @@ -95,6 +96,21 @@ if ( $case_id ) { $where_parts_and[] = "id = '$case_id'"; } +// There are a limited set of circumstances where using a range will work, as +// the MySQL between operator doesn't always work with wildcards. Unset case +// $case_years and $case_num and then populate $between, since we already have +// code to handle that. +if ( $case_num_to ) { + $case_year = substr($case_years[0], -2); + $case_num = str_pad($case_num, 6, '0', STR_PAD_LEFT); + $case_num_to = str_pad($case_num_to, 6, '0', STR_PAD_LEFT); + $range_start = "F-{$case_year}-{$case_num}"; + $range_end = "F-{$case_year}-{$case_num_to}"; + $between = "$range_start:$range_end"; + unset($case_years); + unset($case_num); +} + if ( $between ) { list($btwn_start, $btwn_end) = explode(':', $between); $where_parts_and[] = "court_case_no BETWEEN '$btwn_start' AND '$btwn_end'"; diff --git a/style.css b/style.css index 5f2c712..ee8dd7a 100644 --- a/style.css +++ b/style.css @@ -44,7 +44,7 @@ tr.alt { background-color: #eeeeee; } -#case_num { width: 5em; } +.case_num { width: 5em; } #search_cases div { margin-bottom: 1ex; -- cgit v1.2.3 From c1ea47789989b08e919645d8b8133cfea0ad97c9 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 12 Apr 2014 13:25:03 +0000 Subject: Added a small PHP script to show how many cases were pulled in on a given day a certain times. --- daily_run_report.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 3 +++ 2 files changed, 52 insertions(+) create mode 100644 daily_run_report.php (limited to 'style.css') diff --git a/daily_run_report.php b/daily_run_report.php new file mode 100644 index 0000000..8cab7e9 --- /dev/null +++ b/daily_run_report.php @@ -0,0 +1,49 @@ + + + + + Miami-Dade Clerk of Courts: Daily run report + + + + + +

MDCC daily run report

+HTML; + +$dbh = new PDO('mysql:host=localhost;dbname=mdcc', 'mdcc', 'Mdcc.'); + +for ( $i=0; $i<7; $i++ ) { + $this_day = date("Y-m-d", strtotime("-{$i} days")); + $pretty_day = date("l, F j, Y", strtotime("-{$i} days")); + $sql_first_run = "SELECT count(court_case_no) AS cnt FROM cases WHERE DATE(date_entered) = '{$this_day}' AND TIME(date_entered) < '22:00:00'"; + $sql_second_run = "SELECT count(court_case_no) AS cnt FROM cases WHERE DATE(date_entered) = '{$this_day}' AND TIME(date_entered) >= '22:00:00'"; + + $st_first_run = $dbh->prepare($sql_first_run); + if ( $st_first_run->execute() ) { + $first_run_count = $st_first_run->fetchColumn(); + } + $st_second_run = $dbh->prepare($sql_second_run); + if ( $st_second_run->execute() ) { + $second_run_count = $st_second_run->fetchColumn(); + } + + echo << +
$pretty_day:
+
Noon pull: {$first_run_count}
+
6PM pull: {$second_run_count}
+
+HTML; + +} + +echo << + +HTML; + +?> diff --git a/style.css b/style.css index ee8dd7a..323d302 100644 --- a/style.css +++ b/style.css @@ -82,3 +82,6 @@ label { vertical-align: top; } #export a { color: blue; } + +.pull { margin-bottom: 2em; } +.pull_count { margin-left: 1em; } -- cgit v1.2.3