$data) { if ($key == 'type') { global $type; $type = $data; } if ($key == 'group') { global $group; $group = $data; } } } else { $host = $_SERVER['HTTP_HOST']; $page = "grants-awarded.php?type=o"; header("Location: http://$host/$page"); } //--> $search_type = ""; switch($type) { case 'c' : $search_type = 'County'; $area = $group; break; case 'o' : $search_type = 'Organization'; break; case 'f' : $search_type = 'Funding'; break; } function getHeader() { global $type; global $area; if ($type != 'c') { print "

Current Grants

"; } else { print "

Grants for ".$area."

"; } } function getNavigation() { global $type; global $search_type; if ($type == 'c') { } else if ($type == 'o') { print " "; print "

BY ".$search_type."

"; } else if ($type == 'f') { print " "; print "

BY ".$search_type."

"; } } function getSecondaryNavigation() { global $type; global $search_type; if ($type == 'c') { } else if ($type == 'o') { print "
"; print " "; print "
"; } else if ($type == 'f') { print "
"; print " "; print "
"; } } function getGrants() { $arr = array(); global $type; global $area; global $alpha; //get grants if ($type == 'c') { //retrieve grants for county $sql = "select o.org_id, o.org_name, o.org_addr1, o.org_addr2, o.org_city, o.org_state, left(o.org_zip, 5) as org_zip, o.org_budget, r.request_num, r.grant_type, r.program_area, r.grant_amount, r.project_title, r.project_description, r.project_startdate, r.project_enddate from requests r inner join organizations o on r.org_id = o.org_id where r.program_geographic_area = '".$area."' order by r.program_area, o.org_name asc"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $arr[] = array('org_name' => $row['org_name'], 'program_area' => $row['program_area'], 'grant_amount' => $row['grant_amount'], 'project_description' => $row['project_description'], 'project_startdate' => $row['project_startdate'], 'project_enddate' => $row['project_enddate']); } } else if ($type == 'o') { //retrieve grants for organization by alpha selection $sql = "select o.org_id, o.org_name, o.org_addr1, o.org_addr2, o.org_city, o.org_state, left(o.org_zip, 5) as org_zip, o.org_budget, r.request_num, r.grant_type, r.program_area, r.grant_amount, r.project_title, r.project_description, r.project_startdate, r.project_enddate from requests r inner join organizations o on r.org_id = o.org_id order by o.org_name asc"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $arr[] = array('org_name' => $row['org_name'], 'program_area' => $row['program_area'], 'grant_amount' => $row['grant_amount'], 'project_description' => $row['project_description'], 'project_startdate' => $row['project_startdate'], 'project_enddate' => $row['project_enddate']); } } else if ($type == 'f'){ //retrieve grants by funding $sql = "select o.org_id, o.org_name, o.org_addr1, o.org_addr2, o.org_city, o.org_state, left(o.org_zip, 5) as org_zip, o.org_budget, r.request_num, r.grant_type, r.program_area, r.grant_amount, r.project_title, r.project_description, r.project_startdate, r.project_enddate from requests r inner join organizations o on r.org_id = o.org_id order by r.program_area, o.org_name asc"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $arr[] = array('org_name' => $row['org_name'], 'program_area' => $row['program_area'], 'grant_amount' => $row['grant_amount'], 'project_description' => $row['project_description'], 'project_startdate' => $row['project_startdate'], 'project_enddate' => $row['project_enddate']); } } //print list of domains to begin search criteria selection if ($type != 'none') { print "
"; if (empty($arr)) { print "

No grants are available.

"; } else { if ($type == 'o') { $prev_org_name = ''; $prev_first_alpha_character = ''; foreach ($arr as $grant) { $org_name = $grant['org_name']; $program_area = $grant['program_area']; $grant_amount = $grant['grant_amount']; $start_date = $grant['project_startdate']; $end_date = $grant['project_enddate']; $project_description = $grant['project_description']; $project_date = substr($grant['project_startdate'], (strlen($grant['project_startdate']) - 4), strlen($grant['project_startdate'])); $first_alpha_character = strtolower(substr($org_name, 0, 1)); if ($first_alpha_character != $prev_first_alpha_character) { print ""; } if ($org_name != $prev_org_name) { print ""; print "

".strtoupper($org_name)."

"; } print "

".$program_area.", ".$grant_amount."

"; if (!empty($end_date)) print "End date: ".$end_date.""; if (!empty($start_date)) print "Start date: ".$start_date.""; print "

".$project_description."

"; $prev_org_name = $org_name; $prev_first_alpha_character = $first_alpha_character; } } else if ($type == 'f') { $prev_program_area = ''; $prev_org_name = ''; $a = 0; foreach ($arr as $grant) { $org_name = $grant['org_name']; $program_area = $grant['program_area']; $grant_amount = $grant['grant_amount']; $start_date = $grant['project_startdate']; $end_date = $grant['project_enddate']; $project_description = $grant['project_description']; $project_date = substr($grant['project_startdate'], (strlen($grant['project_startdate']) - 4), strlen($grant['project_startdate'])); $program_bookmark_pos = strpos($program_area, " "); $program_bookmark_len = $program_bookmark_pos; //$program_bookmark = strtolower(substr($program_area, 0, $program_bookmark_len)); $program_bookmark = strtolower(str_replace(" ", "", $program_area)); if ($program_area != $prev_program_area) { if ($a != 0) { print "

back to top

"; } else { print ""; } //print "

"; print ""; print "

".strtoupper($program_area).""; //print ""; } if ($org_name != $prev_org_name) { print "

".strtoupper($org_name)."

"; } print "

".$program_area.", ".$grant_amount."

"; if (!empty($end_date)) print "End date: ".$end_date.""; if (!empty($start_date)) print "Start date: ".$start_date.""; print "

".$project_description."

"; $prev_org_name = $org_name; $prev_program_area = $program_area; $a++; } } else if ($type == 'c') { $prev_program_area = ''; $prev_org_name = ''; $a = 0; foreach ($arr as $grant) { $org_name = $grant['org_name']; $program_area = $grant['program_area']; $grant_amount = $grant['grant_amount']; $start_date = $grant['project_startdate']; $end_date = $grant['project_enddate']; $project_description = $grant['project_description']; $project_date = substr($grant['project_startdate'], (strlen($grant['project_startdate']) - 4), strlen($grant['project_startdate'])); $program_bookmark_pos = strpos($program_area, " "); $program_bookmark_len = $program_bookmark_pos; $program_bookmark = strtolower(substr($program_area, 0, $program_bookmark_len)); if ($program_area != $prev_program_area) { if ($a != 0) { print "

back to top

"; } else { print ""; } print "

"; print ""; print strtoupper($program_area); print "

"; } if ($org_name != $prev_org_name) { print "

".strtoupper($org_name)."

"; } print "

".$program_area.", ".$grant_amount."

"; if (!empty($end_date)) print "End date: ".$end_date.""; if (!empty($start_date)) print "Start date: ".$start_date.""; print "

".$project_description."

"; $prev_org_name = $org_name; $prev_program_area = $program_area; $a++; } } } } } ?>