<?PHP 

	if (!is_numeric($_GET[edit_id])) { header('Location:'.$site_url.'/?error=invalid_id'); }
	  
	include("config.php");
	
	// only admins can validate
	if(!is_admin($user)){
	    header('Location:'.$site_url.'/');
		exit();
	}
	
	// get the info for the edit based on ID
	// if the ID isn't valid, punt the user
	$edit_id_here = intval(mysql_escape_string($_GET[edit_id]));
	$results = mysql_query("SELECT * FROM ".$prefix."CoachesEdits WHERE edit_id = '".$edit_id_here."'");
	$row = mysql_fetch_array($results);
	if (!$row) { header('Location:'.$site_url.'/?error=no_entry'); }
	
	// set the page title
	$pagetitle = $row[coach_name];
	
	// set meta tags
	$meta_keywords = "triathlon, ".$row[coach_name].", ".$row[coach_state]." triathlon coach";
	$meta_description = "Considering getting fit by ".$row[coach_name]."? Here is all of the information about this coach.";
	
	include("include_common_head.php");

?>


<body class="listings">
  <? include($common_path . "/ads/ad_wallpaper.html"); ?>

  <div class="container">
    <? include($common_path . "/templates/include_header.php"); ?>
    <div class="main">
      <div class="contentwrapper clearfix">
        <? include("include_breadcrumb.php"); ?>

        <section class="section listings section-has-widgets section-static remove-sidebar">
          <div class="sidebar-b">
            <? include("include_sidebar.php"); ?>
          </div>

          <div class="content content-has-widgets">
            <div class="grid">

              <div class="clearfix">
              
<h2><!-- class="content-title"--><? echo stripslashes($row[coach_name]) ;
echo" "; ?></h2>
<? 

	// wiki control buttons
	include("wiki_buttons.php") 

?>

<div style="margin-top: 10px;">

<?
	$sqlWikiFetch = "SELECT user_username FROM ".$prefix."User WHERE user_id = ".mysql_escape_string($row[editor_user_id_fk])." LIMIT 1";
	
	$arrUser = mysql_fetch_array(mysql_query($sqlWikiFetch));
	
	$strEditor = $arrUser[user_username];
 ?>
<strong>Editor:</strong> <? echo "<a href=\"http://forum.slowtwitch.com/gforum.cgi?username=".$strEditor.";\" target=\"_blank\">".$strEditor."</a>"; ?>
<br />

<strong>Edit Date:</strong> <? echo date("F j, Y", $row[edit_timestamp]); ?>
<br />

<strong>Street Address: </strong><? echo stripslashes(htmlspecialchars($row[coach_address])); ?>
<br />
<strong>Street Address Two: </strong><? echo stripslashes(htmlspecialchars($row[coach_address_two])); ?>
<br />
<strong>City: </strong><? echo stripslashes(htmlspecialchars($row[coach_city])); ?>
<br />
<strong>State: </strong><? echo stripslashes(htmlspecialchars($row[coach_state])); ?>
<br />
<strong>Zip/Postal Code: </strong><? echo stripslashes(htmlspecialchars($row[coach_zip])); ?>
<br />
<strong>Phone: </strong><? echo stripslashes(htmlspecialchars($row[coach_phone])); ?>
<br />
<strong>Fax/Alt Phone: </strong><? echo stripslashes(htmlspecialchars($row[coach_fax])); ?>
<br />
<strong>E-mail: </strong><a href="mailto:<? echo $row[coach_email]; ?>"><? echo stripslashes(htmlspecialchars($row[coach_email])); ?></a>
<br />
<strong>Website: </strong><a href="<? echo $row[coach_website]; ?>" target="_blank"><? echo $row[coach_website]; ?></a>

<br />
<br />

<div class="indentlarge">
<? 
for ($i = 0; $i < 39; $i++) echo("*"); 
echo (" INFO ");
for ($i = 0; $i < 39; $i++) echo("*"); 
?>
</div>

<br />
<strong>Education: </strong><?

$row[coach_degrees] = ltrim(rtrim($row[coach_degrees], ", "), ", ");

$sql = ("SELECT * FROM gforum_CoachesDegrees WHERE coach_degree_id IN ($row[coach_degrees]) ORDER BY coach_degree_name ASC");

//echo $sql;

$fetch = mysql_query($sql) or die(mysql_error());

$degree_list = "";
while ($list = mysql_fetch_array($fetch)) {
    $degree_list  = $degree_list."$list[coach_degree_name], ";
}
$degree_list = rtrim($degree_list, ', ');

if ($degree_list) {echo $degree_list;} else {echo "None";}

?>

<br />
<strong>Certifications: </strong><?

$row[coach_certifications] = ltrim(rtrim($row[coach_certifications], ", "), ", ");

$sql = ("SELECT * FROM gforum_CoachesCertifications WHERE coach_certification_id IN ($row[coach_certifications]) ORDER BY coach_certification_name ASC");

//echo $sql;

$fetch = mysql_query($sql) or die(mysql_error());

$certification_list = "";
while ($list = mysql_fetch_array($fetch)) {
    $certification_list  = $certification_list."$list[coach_certification_name], ";
}
$certification_list = rtrim($certification_list, ', ');

if ($certification_list) {echo $certification_list;} else {echo "None";}

?>

<br />
<strong>Services: </strong><?

$row[coach_services] = ltrim(rtrim($row[coach_services], ", "), ", ");

$sql = ("SELECT * FROM gforum_CoachesServices WHERE coach_service_id IN ($row[coach_services]) ORDER BY coach_service_name ASC");

//echo $sql;

$fetch = mysql_query($sql) or die(mysql_error());

$service_list = "";
while ($list = mysql_fetch_array($fetch)) {
    $service_list  = $service_list."$list[coach_service_name], ";
}
$service_list = rtrim($service_list, ', ');

if ($service_list) {echo $service_list;} else {echo "None";}

?>

<br /><br />
<div class="indentlarge">
<? 
for ($i = 0; $i < 80; $i++) echo("*"); 
?>
</div>

<br />
<strong>General Info: </strong><? echo stripslashes(stripslashes($row[coach_info])) ?>
<br /><br />
<strong>Rates &amp; Fees: </strong><? echo stripslashes(stripslashes($row[coach_cost])); ?>
<br /><br />
<strong>Training Camps Offered: </strong><? echo stripslashes(stripslashes($row[coach_camps])); ?>

<br />

</div>

              </div><!-- end col-2/3 -->
            </div><!-- end grid -->
          </div><!-- end content -->
        </section>


      </div><!-- end contentwrapper -->
    </div> <!-- end main -->

  <? include($common_path . "/templates/include_footer.php") ?>
  </div> <!-- container  -->
</body>
<? include($common_path . "/templates/include_global_js.php") ?>
</html>
