=1){ $delunit_sql = ""; foreach($_SESSION['delunit'] as $key => $value){ $delunit_sql .= ' || delivery_'.$key." = 'checked'"; } // Take the list of 'dels' built up and knock the first four chars off the front ie ' || ' // This is used in the SQL $delunit_sql = "(".substr($delunit_sql,4).")"; }else{ $delunit_sql =""; } // $delunit_sql is the SQL // optin - This is the "trainers taking part in our promotions" tickbox if(isset($_SESSION['optin']) && $_SESSION['optin'] == "in"){ $optin_sql = "optin = 'in'"; $optin_checked = "checked"; }else{ $optin_sql = ""; $optin_checked = ""; } // $optin_sql is the SQL // $optin_checked is the current tickbox setting if(isset($_GET["debug"])) { echo '

[DEBUG] - Variables

'; echo '$range='.$range.'
'; echo '$zoom='.$zoom.'
'; echo '$page='.$page.'
'; echo '$search='.$search.'
'; echo '$delunit_sql='.$delunit_sql.'
'; echo '$optin_sql='.$optin_sql.'
'; echo '$optin_checked='.$optin_checked.'
'; echo '

'; } function refine() { global $optin_checked; echo '

To only view trainers taking part in our promotions, tick here:

To find specific NWUK programme delivery partners,
tick the appropriate box below:

  • NWUK Competence Card
  • Ultimate Nordic Circuits
  • Nordic Weight Loss
  • Young Explorers
  • Nordic Wellbeing
  • Ultimate Nordic Ski Fit
'; } ?>
search[]=$delunit_sql; if(!empty($optin_sql)) $ex_trainers->search[]=$optin_sql; // Get list of live trainers searching fullnames, firstnames and surnames where both lat and long are set to something. $ex_trainers->setupnamesearch($search); $totalcount=$ex_trainers->counttrainers(); // Work out the number of pages if(intval($totalcount/$results_per_page)!=($totalcount/$results_per_page)) $page_count=intval($totalcount/$results_per_page)+1; else $page_count=intval($totalcount/$results_per_page); // Check that the page number in the url is now not greater than number in results - we may have filtered some out if($page>$page_count) $page=$page_count; // echo '

GET THE SMALL SUB SET OF TRAINERS

'; $ex_trainers->start=0; // removed pagination to show all results on map // if($page>1) // $ex_trainers->start=($page-1)*$results_per_page; // $ex_trainers->limit=$results_per_page; $ex_trainers->listsql=$ex_trainers->setupsqlqueries($ex_trainers->listfields); $ex_trainers->getitemlist(); // echo '

GOT = '.count($ex_trainers->objects).' END GET TRAINERS

'; break; case "place": case "postcode": if(isset($_GET["debug"])) echo '

Googlemap search='.$search.' :: $range='.$range.'

'; $googlemap=new googlemaplookup($search,$range); if(empty($googlemap->err)) { $othertrainers=''; $ex_trainer_postcodeslist=new ex_trainer_postcodeslist(); $othertrainers= $ex_trainer_postcodeslist->setupplacesearch($googlemap->latlong_sql); //echo '

'.$othertrainers.'

'; //print_r($ex_trainer_postcodeslist); $ex_trainers=new ex_trainerslist(); if(!empty($delunit_sql)) $ex_trainers->search[]=$delunit_sql; if(!empty($optin_sql)) $ex_trainers->search[]=$optin_sql; $ex_trainers->setupplacesearch($googlemap->latlong_sql,$othertrainers); //print_r($ex_trainers); $showdebug=0; $totalcount=$ex_trainers->counttrainers(); $showdebug=0; //echo '

TOTCOUNT'.$totalcount.'

'; // Work out the number of pages if(intval($totalcount/$results_per_page)!=($totalcount/$results_per_page)) $page_count=intval($totalcount/$results_per_page)+1; else $page_count=intval($totalcount/$results_per_page); // Check that the page number in the url is now not greater than number in results - we may have filtered some out if($page>$page_count) $page=$page_count; $ex_trainers->start=0; // removed pagination to show all results on map // if($page>1) // $ex_trainers->start=($page-1)*$results_per_page; // $ex_trainers->limit=$results_per_page; $ex_trainers->listsql=$ex_trainers->setupsqlqueries($ex_trainers->listfields); $showdebug=0; $ex_trainers->getitemlist(); $showdebug=0; } // additional pins //$extra_where = "WHERE (1=1 AND 3963.191 * ACOS((SIN(PI() * ".$lat." / 180) * SIN(PI() * latitude / 180)) + (COS(PI() * ".$lat." /180) * cos(PI() * latitude / 180) * COS(PI()* longitude / 180 - PI() * ".$lon." / 180)) ) <= ".$_GET['range'].") and latitude !=''"; break; } if(isset($_GET["debug"])) echo '

NEW CODE

'; // Used globally when drawing trainer search result $ex_trainercats2list=new ex_trainercats2list(); $ex_trainercats2list->getitemlist(); $trainer_count=count($ex_trainers->objects); if($trainer_count) { echo '

Found '.$totalcount.' results, viewing page '.$page.' of '.$page_count.'

'; } if(isset($_GET["debug"])) echo '

Draw Trainers onto map

'; // Get pins and creds $count=0; $map_center=""; foreach($ex_trainers->objects as $trainer) { if($map_center == ""){ $map_center = $trainer->latitude.','.$trainer->longitude; } $ex_trainer_postcodes=new ex_trainer_postcodeslist($trainer->id); $ex_trainer_postcodes->getitemlist(); $ex_trainers->objects[$count]->postcodes_list=$ex_trainer_postcodes; $ex_trainer_credslist=new ex_trainer_credslist($trainer->id); $ex_trainer_credslist->getitemlist(); $ex_trainers->objects[$count]->ex_trainer_creds=$ex_trainer_credslist; $count++; } // Work out what results to show on this page $start = 0; if($page>1) { $start = $results_per_page * ($page-1); } $end = $start + ($results_per_page-1); if($page==$page_count) { $shown = ($page * $results_per_page) - $results_per_page; $end = (($totalcount - $shown) + $shown) - 1; } // Draw the results (not pins) if(is_array($ex_trainers->objects) && count($ex_trainers->objects)) { for($i=$start; $i<=$end; $i++) { $ex_trainers->objects[$i]->draw(); } } if(isset($_GET["debug"])) echo '$map_center='.$map_center; if($totalcount) $ex_trainers->dolinks($search,$range,$search_method,$page,$results_per_page,$page_count); else { if($googlemap->err == "PCODE_ERR"){ echo '

Sorry, we couldn\'t find any trainers matching your search - are you sure that is a valid postcode. Try a different search keyword such as a trainer or place name or simply move the map to your location.

If you would like more information about Nordic Walking please Contact Us or visit our Facebook page.

'; }else{ echo '

Sorry, we couldn\'t find any trainers matching your search, try a different search keyword such as a trainer or place name.

If you would like free information about Nordic Walking please Contact Us or visit our Facebook page.

'; } //echo ''; } if(isset($_GET['debug'])) echo '

NO SEARCH

'; $nosearch=1; } // No search carried out - 'Find a class' landing page else { echo ''; $zoom=6; $count = 0; $ex_trainers=new ex_trainerslist(); $ex_trainers->getitemlist(); foreach($ex_trainers->objects as $trainer) { if($map_center == ""){ $map_center = $trainer->latitude.','.$trainer->longitude; } $ex_trainer_postcodes=new ex_trainer_postcodeslist($trainer->id); $ex_trainer_postcodes->getitemlist(); // REMOVED BY GB REPLACED WITH LINE BLEOW $trainer->postcodes_list=$ex_trainer_postcodes; $ex_trainers->objects[$count]->postcodes_list=$ex_trainer_postcodes; $count++; //print_r($trainer->postcodes_list); } $map_center = '54.559322587438636, -4.1748046875'; // Just get all the trainers out the database } ?>
Nordic Walking would like to point out that although we are happy to help you find an Instructor in your area, at no point is a contract formed between NWUK and the public or the trainer. Our code of conduct is designed to ensure Instructors deliver Nordic Walking according to their qualifications only and we advise all members of the public to check the status of any insurance and clarification of any additional qualifications - competent Instructors will be delighted to provide these!
NORDIC WALKING IN THE FORESTS in Partnership with Forestry England
Exodus Travel