<?PHP 

include("config.php");

if(!is_admin($user)){
  header('Location:'.$site_url.'/');
}

// Query to fetch non-validated races:
$results = mysql_query("SELECT coach_id, coach_name, coach_address, coach_address_two, coach_city, coach_state, coach_phone, coach_fax, coach_zip, coach_email, coach_website FROM ".$prefix."Coaches WHERE coach_valid=0 ORDER BY coach_name ASC");

// check to see if set is empty
$none = FALSE;
if (mysql_num_rows($results) == 0) { $none = TRUE; }

// set the page title
$pagetitle = "Admin: Coach Validation";

// set meta tags
$meta_keywords = "";
$meta_description = "";
?>

<? 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">
          <div class="sidebar-b">
            <? include("include_sidebar.php"); ?>
          </div>

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

              <div class="clearfix">
                <h1><strong>Unvalidated Coaches</strong></h1>
                <form method="post" action="validate_X.php"  enctype="multipart/form-data">
                    <?
                    if($none == TRUE){
                    echo "There are no coaches waiting to be validated.";
                    }
                    ?>
                    <div class="dtable">
                    <? while($row = mysql_fetch_array($results)){ ?>
                    <div class="drow"><div class="dcell"><a class="sub-hdr" style="margin-left: 5px;" href="<? echo "individual.php?coach_id=$row[coach_id]"; ?>"><? echo $row[coach_name]; ?></a></div></div>
                    <div class="drow"><div class="dcell">Address: <? echo ("$row[coach_address]"); if($row[coach_address_two]) { echo ("<br /><span class='indent'>$row[coach_address_two]</span>"); } echo("<br /><span class='indent'>$row[coach_city], $row[coach_state] $row[coach_zip]</span>"); ?></div></div>
                    <div class="drow">
                        <div class="dcell">
                            <? 
                            echo "Phone: </strong>$row[coach_phone]<br /><strong class='indent'>Fax/Alt Phone: </strong> $row[coach_fax]";
                            ?>
                        </div>
                    </div>
                    <div class="drow">
                        <div class="dcel">
                            <strong>Website:</strong> <? echo "<a href='$row[coach_website]' target='_blank'>$row[coach_website]</a>"; ?>
                            <br>
                            <a class="nav" href="<? echo "individual.php?coach_id=$row[coach_id]"; ?>">More information</a>
                            <br /><input type="checkbox" value="<? echo($row[coach_id]); ?>" name="validate[]"> Validate this coach. <input type="checkbox" value="<? echo($row[coach_id]); ?>" name="delete[]"> Delete this coach.
                        </div>
                    </div>
                    <? } ?>
                    </div>
                    <input type="submit" value="Validate Selected Coaches" class="btn">
                </form>
                
              </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>
