} $announcement = new Announcement($id); if (!empty($_POST)) { log_time('Preparing to process feedback.'); $feedback = new Announcement_Feedback(); log_time('new Feedback'); $feedback->response(get_param('response')); log_time('response'); $feedback->comments(get_param('response_comments')); log_time('comments'); $feedback->user_id($user_id); log_time('user_id'); $feedback->announcement_id($id); log_time('announcement_id'); $feedback->record_response(); log_time('record_response'); redirect('/announcement_feedback_response.php?id=' . $id); } $html = new HTML(); $html->set_title('Announcement'); $html->use_style('announcement.css'); $html->generate_header_mobile(); ?> <ul data-role='listview' data-inset='false' data-theme='a' data-divider-theme='a'> <li> <img src="<?php echo $announcement->get_image_src(); ?> "/> <?php echo $announcement->description();
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/global.php'; log_time('at the beginning'); require_once DOC_ROOT . '/includes/classes/class.html.php'; require_once DOC_ROOT . '/includes/classes/class.user.php'; require_once DOC_ROOT . '/includes/classes/class.city.php'; $user_id = get_param('user_id'); if (!$user_id) { redirect('/login.php'); } $region_type = get_param('type'); $user_region = new UserRegion(); //$city = $user_region->get_region_for_user($user_id); $city = $user_region->get_city($user_id); $html = new HTML(); $html->set_title('City Home'); $html->generate_header_mobile(); ?> <ul data-role='listview' data-inset='false' data-theme='a' data-divider-theme='a'> <li> <?php echo $city->masthead_logo[$region_type]; ?> <?php echo $city->masthead[$region_type]; ?> <br/> </li> <li data-theme="e">General Information</li> <li data-theme="e">Announcements</li>
function compute($top, $bottom, $left, $right, $distance, $places, $tables, $tables_val) { ///////////////// function check_location($d, $lat, $lng, $places) { if (count($places) == 0) { return true; } $result3 = pg_query($GLOBALS['db_connection'], "select array_to_json(s.tagsarr) from nodes s where \n\t\t\t\t\t\tst_dwithin(ST_SetSRID(ST_Point(" . $lng . "," . $lat . "),4326)::geography,s.geom::geography," . $d . ")=true;"); //$places=array(); //array_push($places,array(array("amenity","school")),array(array("amenity","college"),array("amenity","university")),array(array("railway","station"))); $p = $places; while ($row3 = pg_fetch_row($result3)) { $r = json_decode($row3[0]); for ($i = 0, $t = 1; $i < count($r); $i++, $t = 1) { $s = $r[$i]; while ($a = current($p)) { foreach ($a as $b) { if ($s[0] == $b[0] && $s[1] == $b[1]) { $t = 0; break; } } if ($t == 0) { array_splice($p, key($p), 1); break; } next($p); } reset($p); } } if (count($p) == 0) { return true; } else { return false; } } /////////////////////// $selected = array(); ///////////////// $deg_lat = 1.0 / 110574.0 * $GLOBALS['sq_len']; function deg_lng($lat) { $tem = 1.0 / (111320.0 * cos($lat)) * $GLOBALS['sq_len']; return $tem; } ////////////////// log_time("before"); //////////////////////////////////////////////////////////////////// $str = "insert into points values "; $str1 = ""; for ($lat = $bottom; $lat <= $top; $lat = $lat + $deg_lat) { for ($lng = $left; $lng <= $right; $lng = $lng + deg_lng($lat)) { if (check_location($distance, $lat, $lng, $places)) { $str1 = $str1 . "(ST_SetSRID(ST_Point(" . $lng . "," . $lat . "),4326),array[" . $lat . "," . $lng . "]),"; } } } log_time("check"); //////////////////////////////////////////////////////////////////// if ($str1 == "") { return $selected; } $str = $str . $str1; $str[strlen($str) - 1] = ';'; $result_pts = pg_query($GLOBALS['db_connection'], $str); if ($tables != "") { $result5 = pg_query($GLOBALS['db_connection'], "delete from points where chk_intersects_dwith_geom(geom," . $GLOBALS['buff'] . ")=true;\n\t\t\t\t\tdelete from points where chk_layers(array[" . $tables . "],array[" . $tables_val . "],geom)=false;\n\t\t\t\t\tselect latlng[1],latlng[2] from points;"); } else { $result5 = pg_query($GLOBALS['db_connection'], "delete from points where chk_intersects_dwith_geom(geom," . $GLOBALS['buff'] . ")=true;\n\t\t\t\t\tselect latlng[1],latlng[2] from points;"); } log_time("database"); //////////////////////////////////////////////////////////////////// while ($row5 = pg_fetch_row($result5)) { $lat = floatval($row5[0]); $lng = floatval($row5[1]); array_push($selected, array("lat" => $lat, "lng" => $lng)); } return $selected; }
echo $feedback_support; ?> <br/> Oppose <?php echo $oppose; ?> <br/> Total <?php echo $total; ?> <br/> </li> <li><a href="/view_comments.php?id=<?php echo $id; ?> ">See comments on this issue</a></li> <li><a href="/tell_friends.php?id=<?php echo $id; ?> ">Let friends know</a></li> <li><a href="/alerts.php?type=l&id=<?php echo $id; ?> ">Stay on top of it</a></li> </ul> <?php log_time('generating footer'); $html->generate_footer_mobile(); die; log_time('footer done');
function compute($top, $bottom, $left, $right, $distance, $places, $tables, $tables_val) { ///////////////// function check_location($d, $lat, $lng, $places) { $result3 = pg_query($GLOBALS['db_connection'], "select array_to_json(s.tagsarr),st_asgeojson(s.geom)from nodes s where \n\t\t\t\t\t\tst_dwithin(ST_SetSRID(ST_Point(" . $lng . "," . $lat . "),4326)::geography,s.geom::geography," . $d . ")=true;"); //$places=array(); //array_push($places,array(array("amenity","school")),array(array("amenity","college"),array("amenity","university")),array(array("railway","station"))); $p = $places; while ($row3 = pg_fetch_row($result3)) { $r = json_decode($row3[0]); for ($i = 0, $t = 1; $i < count($r); $i++, $t = 1) { $s = $r[$i]; while ($a = current($p)) { foreach ($a as $b) { if ($s[0] == $b[0] && $s[1] == $b[1]) { $t = 0; break; } } if ($t == 0) { array_splice($p, key($p), 1); break; } next($p); } reset($p); } } if (count($p) == 0) { return true; } else { return false; } } /////////////////////// $selected = array(); ///////////////// $deg_lat = 1.0 / 110574.0 * $GLOBALS['sq_len']; function deg_lng($lat) { $tem = 1.0 / (111320.0 * cos($lat)) * $GLOBALS['sq_len']; return $tem; } ////////////////// for ($lat = $bottom; $lat <= $top; $lat = $lat + $deg_lat) { for ($lng = $left; $lng <= $right; $lng = $lng + deg_lng($lat)) { log_time("before database1"); //////////////////////////////////////////////////////////////////////////////////////////////// $result = pg_query($GLOBALS['db_connection'], 'select chk_intersects_dwith(' . $lat . ',' . $lng . ',' . $GLOBALS['buff'] . ');'); $bool = pg_fetch_row($result); if ($bool[0] == 'f') { $boolean = true; log_time("after database1"); //////////////////////////////////////////////////////////////////////////////////////////////// for ($x = 0; $x < count($tables); $x = $x + 1) { $result2 = pg_query($GLOBALS['db_connection'], "select st_dwithin(ST_SetSRID(ST_Point(" . $lng . "," . $lat . "),4326)::geography,geom::geography,0) from " . $tables[$x] . " where name=any(array[" . $tables_val[$x] . "]) and st_dwithin(ST_SetSRID(ST_Point(" . $lng . "," . $lat . "),4326)::geography,geom::geography,0)=true;"); $row2 = pg_fetch_row($result2); if ($row2[0] != 't') { $boolean = false; break; } } log_time("after database2"); //////////////////////////////////////////////////////////////////////////////////////////////// if ($boolean) { if (check_location($distance, $lat, $lng, $places)) { array_push($selected, array("lat" => $lat, "lng" => $lng)); } log_time("after check"); //////////////////////////////////////////////////////////////////////////////////////////////// } } } } return $selected; }