discourse-legacysite-perl/site/roadshow/top.php

104 lines
3.9 KiB
PHP
Raw Normal View History

2024-06-17 12:42:14 +00:00
<?PHP include("config.php");
require_once("class/rating/classes/include.all.php");
include("class/rating/int.to.words.php");
$results = mysql_query("SELECT COUNT(DISTINCT(gfr.rating_ip)) AS respondents, ROUND(AVG(gfr.rating_vote), 2) AS score, COUNT(gfr.rating_vote) AS votes, gf.openwater_id, gf.openwater_name, gf.openwater_address, gf.openwater_address_two, gf.openwater_city, gf.openwater_state, gf.openwater_zip, gf.openwater_phone, gf.openwater_fax, gf.openwater_email, gf.openwater_website, gf.openwater_certifications, gf.openwater_fitbikes FROM ".$prefix."OpenWaterRating AS gfr RIGHT JOIN ".$prefix."OpenWater AS gf ON gf.openwater_id = gfr.openwater_id_fk GROUP BY gfr.openwater_id_fk HAVING COUNT(gfr.rating_vote) > 10 ORDER BY score DESC, votes DESC LIMIT 10") OR die(mysql_error());
$none = FALSE;
if (mysql_num_rows($results) == 0) {
$none = TRUE;
}
// set the page title
$pagetitle = "Top Bike Fitters";
// set meta tags
$meta_keywords = "top ranked open water events";
$meta_description = "Top ranked open water events based on rankings submitted by the user.";
?>
<? include("include_common_head.php"); ?>
<? include("include_common_content.php"); ?>
<!-- Start outer -->
<div id="outer">
<!-- BODY -->
<div class="content">
<!-- LEFT COLUMN -->
<!-- End left column -->
<!-- Content col -->
<h1 class="content-title"><strong>Top Ranked Open Water Events</strong></h1>
<div class="indent">
<?
if($none == TRUE){
echo "No open water events have enough votes yet.";
}
?>
<table border="0" cellspacing="0" cellpadding="1" width="580">
<?
$x = 0;
while($row = mysql_fetch_array($results)){
$x++;
if($x % 2 == 0){ $bg = '#dddddd'; }else{ $bg = '#eeeeee'; }
?>
<tr bgcolor="<? echo "$bg"; ?>"><td><br><a class="sub-hdr" style="margin-left: 5px;" href="<? echo "individual.php?openwater_id=$row[openwater_id]"; ?>"><? echo $x.". ".$row[openwater_name]; ?></a><div style="padding-left: 5px;">(Avg. rating <? echo($row[score]); ?> based on <? echo(int_to_words($row[respondents])); if($row[respondents] == 1) { echo(" respondent"); } else { echo(" respondents"); } ?>)</div>
<div style="padding-left: 5px;"><?
$foo = $row[openwater_id];
$ratingData = Rating::OutputParentRating("$foo");
if (Error::HasErrors())
{
echo Error::ShowErrorMessages();
Error::ClearErrors();
}
else
{
echo $ratingData;
}
?></div>
<br />
</td></tr>
<tr bgcolor="<? echo "$bg"; ?>"><td>
<?
if (fist_equipped($row[openwater_id]) == "fist_equipped") { echo("<img src='http://www.slowtwitch.com/openwater/images/fist_equipped.gif' style='padding-top: 2px; padding-bottom: 5px;' class='indent'>");}
if (fist_equipped($row[openwater_id]) == "super_fist") { echo("<br /><img src='http://www.slowtwitch.com/openwater/images/super_fist.gif' style='padding-top: 2px; padding-bottom: 5px;' class='indent'>");}
?>
</td></tr>
<tr bgcolor="<? echo "$bg"; ?>"><td><strong class="indent">Address:</strong> <? echo ("$row[openwater_address]"); if($row[openwater_address_two]) { echo ("<br /><span class='indent'>$row[openwater_address_two]</span>"); } echo("<br /><span class='indent'>$row[openwater_city], $row[openwater_state] $row[openwater_zip]</span>"); ?></td></tr>
<tr bgcolor="<? echo "$bg"; ?>"><td><strong class="indent">
<?
echo "Phone: </strong>$row[openwater_phone]<br /><strong class='indent'>Fax/Alt Phone: </strong> $row[openwater_fax]";
?>
</td></tr>
<tr bgcolor="<? echo "$bg"; ?>"><td><div class="indent">
<strong>Email:</strong> <? echo "<a href='mailto:$row[openwater_email]'>$row[openwater_email]</a>"; ?><br />
<strong>Website:</strong> <? echo "<a href='$row[openwater_website]' target='_blank'>$row[openwater_website]</a>"; ?>
<br>
<a class="nav" href="<? echo "individual.php?openwater_id=$row[openwater_id]"; ?>">More information</a>
<br /><br /></div></td></tr>
<? } ?>
</table>
</div>
<!-- End content col -->
</div>
<!-- End BODY -->
</div>
<!-- End Outer -->
<? include("include_common_footer.php"); ?>