Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("inc/rating_functions.php");
- include("inc/rating_total_functions.php"); ?>
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>HIGH Access - Search</title>
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
- <link rel="stylesheet" href="css/base.css" type="text/css" title="default"> <!-- default css -->
- <link rel="stylesheet" href="css/alternative.css" type="text/css" title="alternate"> <!-- alternative css -->
- <link rel="stylesheet" href="css/base2.css" type="text/css" title="third"> <!-- alternative css -->
- <script type="text/javascript" src="js/styleswitcher.js"></script> <!-- style switcher script -->
- <link rel="stylesheet" type="text/css" href="css/rating_style.css" media="all">
- <script type="text/javascript" src="js/jquery.js"></script>
- <script type="text/javascript" src="js/rating_update.js"></script>
- <script src="js/custom-form-elements.js" ></script> <!-- Required for custom form input -->
- <!--[if lt IE 9]>
- <link rel="stylesheet" type="text/css" href="css/ie8.css" media="all" />
- <![endif]-->
- <!--[if lt IE 7]>
- <style type="text/css">div, img { behavior: url(iepngfix.htc) }</style>
- <![endif]-->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
- <script>
- var search;
- function search(){
- if(input[name=search].val() != null)
- {
- search = "q="+input[name=search].val();
- }
- if(input[name=search_shop_experience].val() != null)
- {
- search += "search_shop_experience="+input[name=search_shop_experience].val();
- }
- if(input[name=search_shop_toilet_access].val() != null)
- {
- search += "search_shop_toilet_access="+input[name=search_shop_toilet_access].val();
- } }
- </script>
- </head>
- <!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
- <!--[if IE 7 ]> <body class="ie7"> <![endif]-->
- <!--[if IE 8 ]> <body class="ie8"> <![endif]-->
- <!--[if IE 9 ]> <body class="ie9"> <![endif]-->
- <!--[if (gt IE 9) ]> <body class="modern"> <![endif]-->
- <!--[!(IE)]><!--> <body class="notIE modern"> <!--<![endif]-->
- <!-- REMOVE onLoad="initialize()" to fix js error on line 62 -->
- <div class="styleswitch">
- <a href="#" onclick="setActiveStyleSheet('default'); return false;">Default</a> or
- <a href="#" onclick="setActiveStyleSheet('alternate'); return false;">Alternate</a> or
- <a href="#" onclick="setActiveStyleSheet('third'); return false;">Third</a>
- </div>
- <div class="container">
- <div class="header_wrapper">
- <header>
- <?php require_once('inc/header.php'); ?>
- <?php $search_total_rating_count = array(0,1,2,3,4,5);
- // put your default values here
- $defaults = array(
- 'search_shop_name' => '', 'search_shop_address' => '', 'search_shop_open' => '', 'search_shop_close' => '', 'search_open_now' => 'off',
- 'vapo' => '', 'snacks' => '', 'pool' => '', 'daccess' => '', 'tv' => '', 'games' => '', 'cat' => '', 'internet' => '', 'spacecake' => '', 'bud' => '',
- 'booze' => '', 'search_total_rating' => '0', 'search_shop_comfort' => '0', 'search_shop_service' => '0', 'search_shop_ambience' => '0', 'search_shop_friendliness' => '0', 'search_shop_spacious' => '0', 'search_shop_experience' => '0', 'search_shop_bud_quality' => '0', 'search_shop_bud_price' => '0', 'search_shop_drink_price' => '0', 'search_shop_space_cake' => '0', 'search_shop_accessibility' => '0', 'search_shop_toilet_access' => '0');
- // merge $_GET in default values
- $input = array_merge($defaults, $_GET); // or $_GET + $defaults
- // $search_shop_name = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($search_shop_name))));
- //$search_shop_name = mysql_real_escape_string($input['search_shop_name']);
- $vapo = $input['vapo'];
- $snacks = $input['snacks'];
- $pool = $input['pool'];
- $daccess = $input['daccess'];
- $tv = $input['tv'];
- $games = $input['games'];
- $cat = $input['cat'];
- $internet = $input['internet'];
- $spacecake = $input['spacecake'];
- $bud = $input['bud'];
- $booze = $input['booze'];
- $search_total_rating = mysql_real_escape_string($input['search_total_rating']);
- $search_shop_comfort = mysql_real_escape_string($input['search_shop_comfort']);
- $search_shop_service = mysql_real_escape_string($input['search_shop_service']);
- $search_shop_ambience = mysql_real_escape_string($input['search_shop_ambience']);
- $search_shop_friendliness = mysql_real_escape_string($input['search_shop_friendliness']);
- $search_shop_spacious = mysql_real_escape_string($input['search_shop_spacious']);
- $search_shop_experience = $input['search_shop_experience'];
- $search_shop_bud_quality = $input['search_shop_bud_quality'];
- $search_shop_bud_price = $input['search_shop_bud_price'];
- $search_shop_drink_price = $input['search_shop_drink_price'];
- $search_shop_space_cake = $input['search_shop_space_cake'];
- $search_shop_accessibility = $input['search_shop_accessibility'];
- $search_shop_toilet_access = $input['search_shop_toilet_access'];
- //$search_total_rating = isset($_GET['search_total_rating']) ? $_GET['search_total_rating'] : ""; ?>
- </header>
- </div>
- <section class="content">
- <h1>Search Coffeeshops</h1>
- <?php
- $sort_by = isset($_GET['s']) ? $_GET['s'] : false;
- date_default_timezone_set('Europe/Amsterdam');
- $nltime = date('H\:i');
- //$search_open_now = '07:00:00';
- $search_shop_name = mysql_real_escape_string($input['search_shop_name']); $search_shop_address = mysql_real_escape_string($input['search_shop_address']); $search_shop_open = mysql_real_escape_string($input['search_shop_open']);
- $search_open_now = mysql_real_escape_string($input['search_open_now']);
- $search_total_rating_min = $search_total_rating-1;
- $search_total_rating_max = $search_total_rating+1;
- print $search_total_rating_max;
- if($search_open_now == "on") {
- $result = mysql_query("SELECT coffeeshops.*, services.*, ratings.*, temp.total as final_total, CONCAT(shop_number, ' ', shop_location, ' ', shop_city, ' ', shop_province, ' ', shop_postcode) AS address FROM coffeeshops
- inner join services on coffeeshops.shop_id=services.shop_id inner join ratings on coffeeshops.shop_id=ratings.shop_id
- inner join (select SUM(comfort + service + ambience + friendliness + spacious + experience + bud_quality + bud_price + drink_price + space_cake + accessibility + toilet_access)/(12) / COUNT(shop_id) AS total, shop_id FROM ratings GROUP BY shop_id ) as temp on coffeeshops.shop_id=temp.shop_id
- HAVING temp.total >= '$search_total_rating'
- AND address LIKE '%$search_shop_address%' AND shop_name LIKE '%$search_shop_name%' AND services_vapo LIKE '%$vapo%' AND services_pool LIKE '%$pool%' AND services_snacks LIKE '%$snacks%' AND services_disabled LIKE '%$daccess%' AND services_tv LIKE '%$tv%' AND services_games LIKE '%$games%' AND services_cat LIKE '%$cat%' AND services_internet LIKE '%$internet%' AND services_spacecake LIKE '%$spacecake%' AND services_bud LIKE '%$bud%' AND services_booze LIKE '%$booze%'
- AND comfort >= '$search_shop_comfort' AND service >= '$search_shop_service' AND ambience >= '$search_shop_ambience' AND friendliness >= '$search_shop_friendliness' AND spacious >= '$search_shop_spacious'
- AND experience >= '$search_shop_experience' AND bud_quality >= '$search_shop_bud_quality' AND bud_price >= '$search_shop_bud_price' AND drink_price >= '$search_shop_drink_price'
- AND space_cake >= '$search_shop_space_cake' AND accessibility >= '$search_shop_accessibility' AND toilet_access >= '$search_shop_toilet_access'
- AND (shop_open < shop_close AND '".$nltime."' BETWEEN shop_open AND shop_close) OR (shop_open > shop_close AND ('".$nltime."' >= shop_open OR '".$nltime."' < shop_close))
- ORDER BY shop_name ASC");
- } else {
- $result = mysql_query("SELECT coffeeshops.*, services.*, final_total
- FROM coffeeshops inner join services on coffeeshops.shop_id=services.shop_id
- inner join (
- select avg(vote) AS final_total, shop_id FROM votes GROUP BY shop_id) as temp on coffeeshops.shop_id=temp.shop_id
- WHERE
- temp.final_total > ".$search_total_rating_min."
- AND
- temp.final_total < ".$search_total_rating_max."
- AND shop_name LIKE '%$search_shop_name%'
- AND services_vapo LIKE '%$vapo%' AND services_pool LIKE '%$pool%' AND services_snacks LIKE '%$snacks%'
- AND services_disabled LIKE '%$daccess%' AND services_tv LIKE '%$tv%' AND services_games LIKE '%$games%'
- AND services_cat LIKE '%$cat%' AND services_internet LIKE '%$internet%' AND services_spacecake LIKE '%$spacecake%'
- AND services_bud LIKE '%$bud%' AND services_booze LIKE '%$booze%'
- GROUP BY shop_name
- ORDER BY shop_name ASC");
- }
- //$sql = "SELECT distinct coffeeshops.*, services.*, ratings.*, temp.total as final_total,
- //CONCAT(shop_number, ' ', shop_location, ' ', shop_city, ' ', shop_province, ' ', shop_postcode) AS address FROM coffeeshops
- //inner join services on coffeeshops.shop_id=services.shop_id
- ////inner join ratings on coffeeshops.shop_id=ratings.shop_id
- //inner join
- //(select SUM(comfort + service + ambience + friendliness + spacious + experience + bud_quality + bud_price + drink_price + space_cake + accessibility + toilet_access)/(12) / COUNT(shop_id) AS total, shop_id FROM ratings GROUP BY shop_id ) as temp on coffeeshops.shop_id=temp.shop_id
- //HAVING temp.total >= '$search_total_rating'
- //////////////////////////////////// Adam's Pagination Logic ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- $nr = mysql_num_rows($result); // Get total of Num rows from the database query
- if (isset($_GET['pn'])) { // Get pn from URL vars if it is present
- $pn = preg_replace('#[^0-9]#i', '', $_GET['pn']); // filter everything but numbers for security(new)
- //$pn = ereg_replace("[^0-9]", "", $_GET['pn']); // filter everything but numbers for security(deprecated)
- } else { // If the pn URL variable is not present force it to be value of page number 1
- $pn = 1;
- }
- $paginationNumber = "";
- if(strlen($search_shop_name) > 0) {
- $paginationNumber .= '&search_shop_name=' . $search_shop_name;
- }
- if(strlen($search_shop_address) > 0) {
- $paginationNumber .= '&search_shop_address=' . $search_shop_address;
- }
- if($search_open_now == "on") {
- $paginationNumber .= '&search_open_now=' . $search_open_now;
- }
- if($search_total_rating > 0) {
- $paginationNumber .= '&search_total_rating=' . $search_total_rating;
- }
- if($vapo == "yes")
- {
- $paginationNumber .= '&vapo=' . $vapo;
- }
- if($pool == "yes") {
- $paginationNumber .= '&pool=' . $pool;
- }
- if($snacks == "yes") {
- $paginationNumber .= '&snacks=' . $snacks;
- }
- if($daccess == "yes") {
- $paginationNumber .= '&daccess=' . $daccess;
- }
- if($tv == "yes") {
- $paginationNumber .= '&tv=' . $tv;
- }
- if($games == "yes") {
- $paginationNumber .= '&games=' . $games;
- }
- if($cat == "yes") {
- $paginationNumber .= '&cat=' . $cat;
- }
- if($internet == "yes") {
- $paginationNumber .= '&internet=' . $internet;
- }
- if($spacecake == "yes") {
- $paginationNumber .= '&spacecake=' . $spacecake;
- }
- if($bud == "yes") {
- $paginationNumber .= '&bud=' . $bud;
- }
- if($booze == "yes") {
- $paginationNumber .= '&booze=' . $booze;
- }
- if($search_shop_comfort > 0) {
- $paginationNumber .= '&search_shop_comfort=' . $search_shop_comfort;
- }
- if($search_shop_service > 0) {
- $paginationNumber .= '&search_shop_service=' . $search_shop_service;
- }
- if($search_shop_ambience > 0) {
- $paginationNumber .= '&search_shop_ambience=' . $search_shop_ambience;
- }
- if($search_shop_friendliness > 0) {
- $paginationNumber .= '&search_shop_friendliness=' . $search_shop_friendliness;
- }
- if($search_shop_spacious > 0) {
- $paginationNumber .= '&search_shop_spacious=' . $search_shop_spacious;
- }
- if($search_shop_experience > 0) {
- $paginationNumber .= '&search_shop_experience=' . $search_shop_experience;
- }
- if($search_shop_bud_quality > 0) {
- $paginationNumber .= '&search_shop_bud_quality=' . $search_shop_bud_quality;
- }
- if($search_shop_bud_price > 0) {
- $paginationNumber .= '&search_shop_bud_price=' . $search_shop_bud_price;
- }
- if($search_shop_drink_price > 0) {
- $paginationNumber .= '&search_shop_drink_price=' . $search_shop_drink_price;
- }
- if($search_shop_space_cake > 0) {
- $paginationNumber .= '&search_shop_space_cake=' . $search_shop_space_cake;
- }
- if($search_shop_accessibility > 0) {
- $paginationNumber .= '&search_shop_accessibility=' . $search_shop_accessibility;
- }
- if($search_shop_toilet_access > 0) {
- $paginationNumber .= '&search_shop_toilet_access=' . $search_shop_toilet_access;
- }
- //This is where we set how many database items to show on each page
- $itemsPerPage = 10;
- // Get the value of the last page in the pagination result set
- $lastPage = ceil($nr / $itemsPerPage);
- // Be sure URL variable $pn(page number) is no lower than page 1 and no higher than $lastpage
- if ($pn < 1) { // If it is less than 1
- $pn = 1; // force if to be 1
- } else if ($pn > $lastPage) { // if it is greater than $lastpage
- $pn = $lastPage; // force it to be $lastpage's value
- }
- // This creates the numbers to click in between the next and back buttons
- $centerPages = ""; // Initialize this variable
- $sub1 = $pn - 1;
- $sub2 = $pn - 2;
- $add1 = $pn + 1;
- $add2 = $pn + 2;
- // Now we are going to run the same query as above but this time add $limit onto the end of the SQL syntax
- // $sql2 is what we will use to fuel our while loop statement below
- switch ($sort_by) {
- case 'shop_name':
- case 'shop_id':
- case 'final_total':
- break;
- default:
- $sort_by = 'shop_name';
- }
- // get the direction, or use the default
- $direction = isset($_GET['d']) ? $_GET['d'] : 'ASC';
- if ($direction != 'ASC' && $direction != 'DESC') {
- $direction = 'ASC'; }
- $paginationDisplay = ""; // Initialize the pagination output variable
- // This creates the numbers to click in between the next and back buttons
- if ($pn == 1) {
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber . '&submit">' . $add1 . '</a> ';
- } else if ($pn == $lastPage) {
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $sub1 . '</a> ';
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- } else if ($pn > 2 && $pn < ($lastPage - 1)) {
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub2 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $sub2 . '</a> ';
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $sub1 . '</a> ';
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $add1 . '</a> ';
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add2 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $add2 . '</a> ';
- } else if ($pn > 1 && $pn < $lastPage) {
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $sub1 . '</a> ';
- $centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
- $centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '&s=' . $sort_by . '&d='. $direction . $paginationNumber .'&submit">' . $add1 . '</a> ';
- }
- // This line sets the "LIMIT" range... the 2 values we place to choose a range of rows from database in our query
- $limit = 'LIMIT ' .($pn - 1) * $itemsPerPage .',' .$itemsPerPage;
- // Now we are going to run the same query as above but this time add $limit onto the end of the SQL syntax
- // This code runs only if the last page variable is not equal to 1, if it is only 1 page we require no paginated links to display
- if ($lastPage != "1"){
- // This shows the user what page they are on, and the total number of pages
- $paginationDisplay .= '<span class="pagesof">Page <strong>' . $pn . '</strong> of ' . $lastPage. '</span><img src="img/clearImage.gif" width="20" height="1" alt="Spacer" />';
- // If we are not on page 1 we can place the Back button
- if ($pn != 1) {
- $previous = $pn - 1;
- $paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '&s=' . $sort_by .'&d='. $direction;
- if(strlen($search_shop_name) > 0) {
- $paginationDisplay .= '&search_shop_name=' . $search_shop_name;
- }
- if(strlen($search_shop_address) > 0) {
- $paginationDisplay .= '&search_shop_address=' . $search_shop_address;
- }
- if($search_open_now == "on") {
- $paginationDisplay .= '&search_open_now=' . $search_open_now;
- }
- if($search_total_rating > 0) {
- $paginationDisplay .= '&search_total_rating=' . $search_total_rating;
- }
- if($vapo == "yes")
- {
- $paginationDisplay .= '&vapo=' . $vapo;
- }
- if($pool == "yes") {
- $paginationDisplay .= '&pool=' . $pool;
- }
- if($snacks == "yes") {
- $paginationDisplay .= '&snacks=' . $snacks;
- }
- if($daccess == "yes") {
- $paginationDisplay .= '&daccess=' . $daccess;
- }
- if($tv == "yes") {
- $paginationDisplay .= '&tv=' . $tv;
- }
- if($games == "yes") {
- $paginationDisplay .= '&games=' . $games;
- }
- if($cat == "yes") {
- $paginationDisplay .= '&cat=' . $cat;
- }
- if($internet == "yes") {
- $paginationDisplay .= '&internet=' . $internet;
- }
- if($spacecake == "yes") {
- $paginationDisplay .= '&spacecake=' . $spacecake;
- }
- if($bud == "yes") {
- $paginationDisplay .= '&bud=' . $bud;
- }
- if($booze == "yes") {
- $paginationDisplay .= '&booze=' . $booze;
- }
- if($search_shop_comfort > 0) {
- $paginationDisplay .= '&search_shop_comfort=' . $search_shop_comfort;
- }
- if($search_shop_service > 0) {
- $paginationDisplay .= '&search_shop_service=' . $search_shop_service;
- }
- if($search_shop_ambience > 0) {
- $paginationDisplay .= '&search_shop_ambience=' . $search_shop_ambience;
- }
- if($search_shop_friendliness > 0) {
- $paginationDisplay .= '&search_shop_friendliness=' . $search_shop_friendliness;
- }
- if($search_shop_spacious > 0) {
- $paginationDisplay .= '&search_shop_spacious=' . $search_shop_spacious;
- }
- if($search_shop_experience > 0) {
- $paginationDisplay .= '&search_shop_experience=' . $search_shop_experience;
- }
- if($search_shop_bud_quality > 0) {
- $paginationDisplay .= '&search_shop_bud_quality=' . $search_shop_bud_quality;
- }
- if($search_shop_bud_price > 0) {
- $paginationDisplay .= '&search_shop_bud_price=' . $search_shop_bud_price;
- }
- if($search_shop_drink_price > 0) {
- $paginationDisplay .= '&search_shop_drink_price=' . $search_shop_drink_price;
- }
- if($search_shop_space_cake > 0) {
- $paginationDisplay .= '&search_shop_space_cake=' . $search_shop_space_cake;
- }
- if($search_shop_accessibility > 0) {
- $paginationDisplay .= '&search_shop_accessibility=' . $search_shop_accessibility;
- }
- if($search_shop_toilet_access > 0) {
- $paginationDisplay .= '&search_shop_toilet_access=' . $search_shop_toilet_access;
- }
- $paginationDisplay .= '&submit"> Back</a> ';
- }
- // Lay in the clickable numbers display here between the Back and Next links
- $paginationDisplay .= '<span class="paginationNumbers">' . $centerPages . '</span>';
- // If we are not on the very last page we can place the Next button
- if ($pn != $lastPage) {
- $nextPage = $pn + 1;
- $paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $nextPage . '&s=' . $sort_by .'&d=' . $direction;
- if(strlen($search_shop_name) > 0) {
- $paginationDisplay .= '&search_shop_name=' . $search_shop_name;
- }
- if(strlen($search_shop_address) > 0) {
- $paginationDisplay .= '&search_shop_address=' . $search_shop_address;
- }
- if($search_open_now == "on") {
- $paginationDisplay .= '&search_open_now=' . $search_open_now;
- }
- if($search_total_rating > 0) {
- $paginationDisplay .= '&search_total_rating=' . $search_total_rating;
- }
- if($vapo == "yes")
- {
- $paginationDisplay .= '&vapo=' . $vapo;
- }
- if($pool == "yes") {
- $paginationDisplay .= '&pool=' . $pool;
- }
- if($snacks == "yes") {
- $paginationDisplay .= '&snacks=' . $snacks;
- }
- if($daccess == "yes") {
- $paginationDisplay .= '&daccess=' . $daccess;
- }
- if($tv == "yes") {
- $paginationDisplay .= '&tv=' . $tv;
- }
- if($games == "yes") {
- $paginationDisplay .= '&games=' . $games;
- }
- if($cat == "yes") {
- $paginationDisplay .= '&cat=' . $cat;
- }
- if($internet == "yes") {
- $paginationDisplay .= '&internet=' . $internet;
- }
- if($spacecake == "yes") {
- $paginationDisplay .= '&spacecake=' . $spacecake;
- }
- if($bud == "yes") {
- $paginationDisplay .= '&bud=' . $bud;
- }
- if($booze == "yes") {
- $paginationDisplay .= '&booze=' . $booze;
- }
- if($search_shop_comfort > 0) {
- $paginationDisplay .= '&search_shop_comfort=' . $search_shop_comfort;
- }
- if($search_shop_service > 0) {
- $paginationDisplay .= '&search_shop_service=' . $search_shop_service;
- }
- if($search_shop_ambience > 0) {
- $paginationDisplay .= '&search_shop_ambience=' . $search_shop_ambience;
- }
- if($search_shop_friendliness > 0) {
- $paginationDisplay .= '&search_shop_friendliness=' . $search_shop_friendliness;
- }
- if($search_shop_spacious > 0) {
- $paginationDisplay .= '&search_shop_spacious=' . $search_shop_spacious;
- }
- if($search_shop_experience > 0) {
- $paginationDisplay .= '&search_shop_experience=' . $search_shop_experience;
- }
- if($search_shop_bud_quality > 0) {
- $paginationDisplay .= '&search_shop_bud_quality=' . $search_shop_bud_quality;
- }
- if($search_shop_bud_price > 0) {
- $paginationDisplay .= '&search_shop_bud_price=' . $search_shop_bud_price;
- }
- if($search_shop_drink_price > 0) {
- $paginationDisplay .= '&search_shop_drink_price=' . $search_shop_drink_price;
- }
- if($search_shop_space_cake > 0) {
- $paginationDisplay .= '&search_shop_space_cake=' . $search_shop_space_cake;
- }
- if($search_shop_accessibility > 0) {
- $paginationDisplay .= '&search_shop_accessibility=' . $search_shop_accessibility;
- }
- if($search_shop_toilet_access > 0) {
- $paginationDisplay .= '&search_shop_toilet_access=' . $search_shop_toilet_access;
- }
- $paginationDisplay .= '&submit"> Next</a> ';
- }
- } // check for sort field
- // validate the sort field (avoid Bobby Tables!) and provide default
- // used in table heading to indicate sort direciton
- $sort_arrow = ($direction == 'ASC' ? '<img src="img/up_arrow.png" alt="Descend" />' : '<img src="img/down_arrow.png" alt="Ascend" />');
- // used to build urls to reverse the current sort direction
- $reverse_direction = ($direction == 'DESC' ? 'ASC' : 'DESC');
- // build the basis for the query
- if($search_open_now == "on") {
- $sql="SELECT coffeeshops.*, services.*, ratings.*, temp.total as final_total, CONCAT(shop_number, ' ', shop_location, ' ', shop_city, ' ', shop_province, ' ', shop_postcode) AS address FROM coffeeshops
- inner join services on coffeeshops.shop_id=services.shop_id inner join ratings on coffeeshops.shop_id=ratings.shop_id
- inner join (select SUM(comfort + service + ambience + friendliness + spacious + experience + bud_quality + bud_price + drink_price + space_cake + accessibility + toilet_access)/(12) / COUNT(shop_id) AS total, shop_id FROM ratings GROUP BY shop_id ) as temp on coffeeshops.shop_id=temp.shop_id
- WHERE (shop_open < shop_close AND '".$nltime."' BETWEEN shop_open AND shop_close) OR (shop_open > shop_close AND ('".$nltime."' >= shop_open OR '".$nltime."' < shop_close))
- HAVING temp.total >= '$search_total_rating'
- AND address LIKE '%$search_shop_address%' AND shop_name LIKE '%$search_shop_name%'
- AND services_vapo LIKE '%$vapo%' AND services_pool LIKE '%$pool%' AND services_snacks LIKE '%$snacks%' AND services_disabled LIKE '%$daccess%' AND services_tv LIKE '%$tv%' AND services_games LIKE '%$games%' AND services_cat LIKE '%$cat%' AND services_internet LIKE '%$internet%' AND services_spacecake LIKE '%$spacecake%' AND services_bud LIKE '%$bud%' AND services_booze LIKE '%$booze%'
- AND comfort >= '$search_shop_comfort' AND service >= '$search_shop_service' AND ambience >= '$search_shop_ambience' AND friendliness >= '$search_shop_friendliness' AND spacious >= '$search_shop_spacious' AND experience >= '$search_shop_experience' AND bud_quality >= '$search_shop_bud_quality' AND bud_price >= '$search_shop_bud_price' AND drink_price >= '$search_shop_drink_price' AND space_cake >= '$search_shop_space_cake' AND accessibility >= '$search_shop_accessibility' AND toilet_access >= '$search_shop_toilet_access' ORDER BY shop_name ASC";
- }
- else {
- $on_shopname = "AND shop_name LIKE '%$search_shop_name%'";
- $sql = "SELECT coffeeshops.*, services.*, final_total
- FROM coffeeshops inner join services on coffeeshops.shop_id=services.shop_id
- inner join (select avg(vote) AS final_total, shop_id FROM votes GROUP BY shop_id) as temp on coffeeshops.shop_id=temp.shop_id
- WHERE final_total >= '$search_total_rating'
- AND shop_name LIKE '%$search_shop_name%'
- AND services_vapo LIKE '%$vapo%' AND services_pool LIKE '%$pool%' AND services_snacks LIKE '%$snacks%'
- AND services_disabled LIKE '%$daccess%' AND services_tv LIKE '%$tv%' AND services_games LIKE '%$games%'
- AND services_cat LIKE '%$cat%' AND services_internet LIKE '%$internet%' AND services_spacecake LIKE '%$spacecake%'
- AND services_bud LIKE '%$bud%' AND services_booze LIKE '%$booze%'
- GROUP BY shop_name
- ORDER BY $sort_by $direction ,shop_name ASC $limit";
- //$sql = "SELECT distinct coffeeshops.*, services.*, ratings.*, temp.total as final_total,
- //CONCAT(shop_number, ' ', shop_location, ' ', shop_city, ' ', shop_province, ' ', shop_postcode) AS address FROM coffeeshops
- //inner join services on coffeeshops.shop_id=services.shop_id
- ////inner join ratings on coffeeshops.shop_id=ratings.shop_id
- //inner join
- //(select SUM(comfort + service + ambience + friendliness + spacious + experience + bud_quality + bud_price + drink_price + space_cake + accessibility + toilet_access)/(12) / COUNT(shop_id) AS total, shop_id FROM ratings GROUP BY shop_id ) as temp on coffeeshops.shop_id=temp.shop_id
- //HAVING temp.total >= '$search_total_rating'
- //AND address LIKE '%$search_shop_address%' AND shop_name LIKE '%$search_shop_name%'
- //AND toilet_access >= '$search_shop_toilet_access'
- //ORDER BY $sort_by $direction $limit";
- }
- // execute query, get results
- $res = mysql_query($sql);
- $results = array();
- if ($res) {
- while ($row = mysql_fetch_assoc($res)) {
- $results[] = $row;
- }
- //print_r($results);
- }
- // print $sql;
- $numrows = mysql_num_rows($result);
- if ($numrows == 0) {
- echo "<div id='legend_nodata'><span>No matches found, try again!</span></div>";
- // exit;
- }
- echo $numrows;
- ///////////////////////////////////// END Adam's Pagination Display Setup /////////////////////////////////////////////////////
- // Build the Output Section Here
- ?>
- <form id="search_form" action="<?php echo "search.php#legend_total_results"; ?>" method="GET">
- <fieldset class="search_basic">
- <legend>Search by Criteria</legend>
- <ol>
- <li>
- <label for="search_shop_name">Coffeeshop:</label>
- <input type="text" name="search_shop_name" id="search_shop_name" value="<?php echo htmlspecialchars($search_shop_name); ?>" />
- </li>
- <li>
- <label for="search_shop_address">Address:</label>
- <input type="text" name="search_shop_address" id="search_shop_address" value="<?php echo htmlspecialchars($search_shop_address); ?>" />
- </li>
- <li>
- <label for="search_total_rating">Total Rating:</label>
- <select name="search_total_rating" id="search_total_rating">
- <option value="0" <?php if($search_total_rating == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_total_rating == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_total_rating == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_total_rating == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_total_rating == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_total_rating == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_open_now">Open Now:</label>
- <input type="checkbox" name="search_open_now" class="styled" id="search_open_now" <?php if ($search_open_now == "on") { echo 'checked=\'yes\''; } ?> />
- </li>
- </ol>
- </fieldset>
- <fieldset class="search_services" >
- <legend>Search by Services</legend>
- <ol>
- <li>
- <label for="vapo">Vapo:</label>
- <input id="vapo" name="vapo" type="checkbox" class="styled" value="yes" <?php if($vapo == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li class="format_services">
- <label for="pool">Pool:</label>
- <input id="pool" name="pool" type="checkbox" class="styled" value="yes" <?php if($pool == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li class="format_services">
- <label for="snacks">Snacks:</label>
- <input id="snacks" name="snacks" type="checkbox" class="styled" value="yes" <?php if($snacks == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li>
- <label for="tv">Tv:</label>
- <input id="tv" name="tv" type="checkbox" class="styled" value="yes" <?php if($tv == 'yes') echo 'checked="checked"'; ?>>
- </li>
- <li class="format_services">
- <label for="games">Games:</label>
- <input id="games" name="games" type="checkbox" class="styled" value="yes" <?php if($games == 'yes') echo 'checked="checked"'; ?>>
- </li>
- <li class="format_services">
- <label for="internet">Internet:</label>
- <input id="internet" name="internet" type="checkbox" class="styled" value="yes" <?php if($internet == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li>
- <label for="spacecake">Space Cake:</label>
- <input id="spacecake" name="spacecake" type="checkbox" class="styled" value="yes" <?php if($spacecake == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li class="format_services">
- <label for="bud">Bud:</label>
- <input id="bud" name="bud" type="checkbox" class="styled" value="yes" <?php if($bud == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li class="format_services">
- <label for="cat">Cat:</label>
- <input id="cat" name="cat" type="checkbox" class="styled" value="yes" <?php if($cat == 'yes') echo 'checked="checked"'; ?> />
- </li>
- <li>
- <label for="daccess">Mobility access:</label>
- <input id="daccess" name="daccess" type="checkbox" class="styled" value="yes" <?php if($daccess == 'yes') echo 'checked="checked"'; ?> />
- </li>
- </ol>
- </fieldset>
- <fieldset class="search_ratings">
- <legend>Search by Ratings</legend>
- <ol>
- <li>
- <label for="search_shop_comfort">Comfort:</label>
- <select name="search_shop_comfort" id="search_shop_comfort">
- <option value="0" <?php if($search_shop_comfort == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_comfort == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_comfort == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_comfort == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_comfort == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_comfort == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_service">Service:</label>
- <select name="search_shop_service" id="search_shop_service">
- <option value="0" <?php if($search_shop_service == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_service == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_service == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_service == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_service == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_service == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_ambience">Ambience:</label>
- <select name="search_shop_ambience" id="search_shop_ambience">
- <option value="0" <?php if($search_shop_ambience == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_ambience == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_ambience == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_ambience == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_ambience == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_ambience == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_friendliness">Friendliness:</label>
- <select name="search_shop_friendliness" id="search_shop_friendliness">
- <option value="0" <?php if($search_shop_friendliness == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_friendliness == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_friendliness == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_friendliness == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_friendliness == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_friendliness == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_spacious">Spacious:</label>
- <select name="search_shop_spacious" id="search_shop_spacious">
- <option value="0" <?php if($search_shop_spacious == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_spacious == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_spacious == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_spacious == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_spacious == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_spacious == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_experience">Experience:</label>
- <select name="search_shop_experience" id="search_shop_experience">
- <option value="0" <?php if($search_shop_experience == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_experience == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_experience == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_experience == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_experience == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_experience == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_bud_quality">Bud quality:</label>
- <select name="search_shop_bud_quality" id="search_shop_bud_quality">
- <option value="0" <?php if($search_shop_bud_quality == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_bud_quality == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_bud_quality == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_bud_quality == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_bud_quality == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_bud_quality == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_bud_price">Bud price:</label>
- <select name="search_shop_bud_price" id="search_shop_bud_price">
- <option value="0" <?php if($search_shop_bud_price == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_bud_price == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_bud_price == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_bud_price == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_bud_price == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_bud_price == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_drink_price">Drink Price:</label>
- <select name="search_shop_drink_price" id="search_shop_drink_price">
- <option value="0" <?php if($search_shop_drink_price == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_drink_price == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_drink_price == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_drink_price == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_drink_price == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_drink_price == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_space_cake">Space cake:</label>
- <select name="search_shop_space_cake" id="search_shop_space_cake">
- <option value="0" <?php if($search_shop_space_cake == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_space_cake == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_space_cake == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_space_cake == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_space_cake == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_space_cake == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_accessibility">Accessibility:</label>
- <select name="search_shop_accessibility" id="search_shop_accessibility">
- <option value="0" <?php if($search_shop_accessibility == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_accessibility == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_accessibility == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_accessibility == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_accessibility == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_accessibility == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- <li>
- <label for="search_shop_toilet_access">Toilet access:</label>
- <select name="search_shop_toilet_access" id="search_shop_toilet_access">
- <option value="0" <?php if($search_shop_toilet_access == '0') echo 'selected="selected"'; ?>>0</option>
- <option value="1" <?php if($search_shop_toilet_access == '1') echo 'selected="selected"'; ?>>1</option>
- <option value="2" <?php if($search_shop_toilet_access == '2') echo 'selected="selected"'; ?>>2</option>
- <option value="3" <?php if($search_shop_toilet_access == '3') echo 'selected="selected"'; ?>>3</option>
- <option value="4" <?php if($search_shop_toilet_access == '4') echo 'selected="selected"'; ?>>4</option>
- <option value="5" <?php if($search_shop_toilet_access == '5') echo 'selected="selected"'; ?>>5</option>
- </select>
- </li>
- </ol>
- </fieldset>
- <fieldset id="search_buttons">
- <button id="submit" name="submit" type="submit">Search</button>
- <button id="reset" name="reset" type="reset" ONCLICK="window.location.href='search.php'">Reset</button>
- </fieldset>
- </form>
- <?php // print_r($_GET); //SHOW THE SEARCHED data
- if(isset($_GET['submit'])) {
- if($numrows > 0) { ?>
- <div id="legend_total_results"><span>Found <?php echo $nr; ?> Coffeeshops</span></div>
- <?php }
- //print_r($_SERVER); // Useful server details
- $paginationSort = "";
- ?>
- <?php $numrows = mysql_num_rows($result);
- if($numrows > 10) { ?>
- <div id="ribbon_search_wrapper">
- <div class="ribbon_wrapper_pg_top">
- <div class="ribbon-wrapper">
- <div class="ribbon-front">
- <?php echo $paginationDisplay;
- $paginationSort .= $_SERVER['PHP_SELF'] . '?s=final_total';
- if(strlen($search_shop_name) > 0) {
- $paginationSort .= '&search_shop_name=' . $search_shop_name;
- }
- if(strlen($search_shop_address) > 0) {
- $paginationSort .= '&search_shop_address=' . $search_shop_address;
- }
- if($search_open_now == "on") {
- $paginationSort .= '&search_open_now=' . $search_open_now;
- }
- if($search_total_rating > 0) {
- $paginationSort .= '&search_total_rating=' . $search_total_rating;
- }
- if($vapo == "yes")
- {
- $paginationSort .= '&vapo=' . $vapo;
- }
- if($pool == "yes") {
- $paginationSort .= '&pool=' . $pool;
- }
- if($snacks == "yes") {
- $paginationSort .= '&snacks=' . $snacks;
- }
- if($daccess == "yes") {
- $paginationSort .= '&daccess=' . $daccess;
- }
- if($tv == "yes") {
- $paginationSort .= '&tv=' . $tv;
- }
- if($games == "yes") {
- $paginationSort .= '&games=' . $games;
- }
- if($cat == "yes") {
- $paginationSort .= '&cat=' . $cat;
- }
- if($internet == "yes") {
- $paginationSort .= '&internet=' . $internet;
- }
- if($spacecake == "yes") {
- $paginationSort .= '&spacecake=' . $spacecake;
- }
- if($bud == "yes") {
- $paginationSort .= '&bud=' . $bud;
- }
- if($booze == "yes") {
- $paginationSort .= '&booze=' . $booze;
- }
- if($search_shop_comfort > 0) {
- $paginationSort .= '&search_shop_comfort=' . $search_shop_comfort;
- }
- if($search_shop_service > 0) {
- $paginationSort .= '&search_shop_service=' . $search_shop_service;
- }
- if($search_shop_ambience > 0) {
- $paginationSort .= '&search_shop_ambience=' . $search_shop_ambience;
- }
- if($search_shop_friendliness > 0) {
- $paginationSort .= '&search_shop_friendliness=' . $search_shop_friendliness;
- }
- if($search_shop_spacious > 0) {
- $paginationSort .= '&search_shop_spacious=' . $search_shop_spacious;
- }
- if($search_shop_experience > 0) {
- $paginationSort .= '&search_shop_experience=' . $search_shop_experience;
- }
- if($search_shop_bud_quality > 0) {
- $paginationSort .= '&search_shop_bud_quality=' . $search_shop_bud_quality;
- }
- if($search_shop_bud_price > 0) {
- $paginationSort .= '&search_shop_bud_price=' . $search_shop_bud_price;
- }
- if($search_shop_drink_price > 0) {
- $paginationSort .= '&search_shop_drink_price=' . $search_shop_drink_price;
- }
- if($search_shop_space_cake > 0) {
- $paginationSort .= '&search_shop_space_cake=' . $search_shop_space_cake;
- }
- if($search_shop_accessibility > 0) {
- $paginationSort .= '&search_shop_accessibility=' . $search_shop_accessibility;
- }
- if($search_shop_toilet_access > 0) {
- $paginationSort .= '&search_shop_toilet_access=' . $search_shop_toilet_access;
- }
- ?>
- <span class="sort_options"><a class="<?php echo $sort_by == 'shop_id' ? 'sortColumn' : ''; ?>" href="<?php echo $paginationSort . '&s=shop_name&d='.$reverse_direction.'&submit'; ?>">Title</a>
- <?php echo $sort_by == 'shop_name' ? $sort_arrow : ''; ?>
- <a class="<?php echo $sort_by == 'shop_id' ? 'sortColumn' : ''; ?>" href="<?php echo $paginationSort . '&d=' . $reverse_direction . '&submit';?>">Rating Total</a>
- <?php echo $sort_by == 'final_total' ? $sort_arrow : ''; ?></span>
- </div>
- <div class="ribbon-edge-topleft"></div>
- <div class="ribbon-edge-topright"></div>
- <div class="ribbon-edge-bottomleft"></div>
- <div class="ribbon-edge-bottomright"></div>
- <div class="ribbon-back-left"></div>
- <div class="ribbon-back-right"></div>
- </div>
- </div>
- </div>
- <?php }?>
- <?php foreach($results as $row) { ?>
- <div class="wrapper_coffeeshop">
- <div class="shop_top"><h1><?php echo "<a href='coffeeshop.php?shop_id=".$row["shop_id"]."'>". $row["shop_title"] ." ". $row["shop_name"]."</a>"; ?></h1></div>
- <section class="coffeeshop">
- <article class="shop_details">
- <?php if(file_exists("img/photos/".$row["shop_img"] . ".jpg")) {
- echo "<a href='coffeeshop.php?shop_id=" . $row["shop_id"]. "'>" . "<img class ='shopimg' src='img/shops/" . $row["shop_img"] . ".jpg' alt='".$row['shop_title'] ." ". $row['shop_name']."' /></a>";
- } else { $row["shop_img"] = "shop_placeholder";
- echo "<a href='coffeeshop.php?shop_id=" . $row["shop_id"]. "'>" . "<img class ='shopimg' src='img/placeholder/" . $row["shop_img"] . ".png' alt='".$row['shop_title'] ." ". $row['shop_name']."' /></a>";
- } // Checks if there is an image for that shop otherwise sets a placeholder ?>
- <address><?php echo $row["shop_number"] . ' ' . $row["shop_location"] . ', ' . $row["shop_district"] . ' ' . $row["shop_postcode"]; ?></address>
- <p><?php echo $row["shop_description"]; ?></p>
- <article class="openclose">
- <h2>Open - Close</h2>
- <?php $open = $row["shop_open"]; $shop_open = strtotime($open);
- $close = $row["shop_close"]; $shop_close = strtotime($close); ?>
- <time><?php echo date('H\:i', $shop_open); ?></time> - <time><?php echo date('H\:i', $shop_close); ?></time>
- </article>
- <article class="shoptotal">
- <?php $shop_id = $row['shop_id'];
- echo pullRatingTotal($shop_id,true,true,true); ?>
- </article>
- </article>
- <article class="services">
- <h1>Services</h1>
- <div class="services_img_wrapper">
- <?php echo "<img src='img/icons/vapo_" . $row["services_vapo"] . ".png' width='50' height='50' alt='Vaporizer' title='Vaporizer '/>";
- echo "<img src='img/icons/pool_" . $row["services_pool"] . ".png' width='50' height='50' alt='Pool Table' title='Pool Table' />";
- echo "<img src='img/icons/snacks_" . $row["services_snacks"] . ".png' width='50' height='50' alt='Snacks' title='Snacks' />";
- echo "<img src='img/icons/disabled_" . $row["services_disabled"] . ".png' width='50' height='50' alt='Wheelchair access' title='Wheelchair access'/>";
- echo "<img src='img/icons/cat_" . $row["services_cat"] . ".png' width='50' height='50' alt='Cat' title='Cat' />";
- echo "<img src='img/icons/tv_" . $row["services_tv"] . ".png' width='50' height='50' alt='Television' title='Television'/>";?>
- </div>
- </article>
- </section>
- <div class="shop_bottom"></div>
- </div>
- <?php // close while //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////// END QUERY THE MEMBER DATA & Build the Output Section //////////////////////////// ?>
- <?php }
- $numrows = mysql_num_rows($result);
- if($numrows > 10) { ?>
- <div id="ribbon_search_wrapper_bottom">
- <div class="ribbon_wrapper_pg_bot">
- <div class="ribbon-wrapper">
- <div class="ribbon-front">
- <?php echo $paginationDisplay; ?>
- <span class="sort_options"><a class="<?php echo $sort_by == 'shop_id' ? 'sortColumn' : ''; ?>" href="<?php echo $paginationSort . '&s=shop_name&d='.$reverse_direction.'&submit'; ?>">Title</a>
- <?php echo $sort_by == 'shop_name' ? $sort_arrow : ''; ?>
- <a class="<?php echo $sort_by == 'shop_id' ? 'sortColumn' : ''; ?>" href="<?php echo $paginationSort . '&d=' . $reverse_direction . '&submit';?>">Rating Total</a>
- <?php echo $sort_by == 'final_total' ? $sort_arrow : ''; ?></span>
- </div>
- <div class="ribbon-edge-topleft"></div>
- <div class="ribbon-edge-topright"></div>
- <div class="ribbon-edge-bottomleft"></div>
- <div class="ribbon-edge-bottomright"></div>
- <div class="ribbon-back-left"></div>
- <div class="ribbon-back-right"></div>
- </div>
- </div>
- <?php }
- }
- mysql_close($connect);
- $status = explode(' ', mysql_stat($connect));
- print_r($status);
- //print_r(mysql_ping()); connect is dead and gives an Error if mysql_close of connection
- ?>
- </section>
- <footer>
- <?php require_once('inc/footer.php'); ?>
- </footer>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement