$postedArrays = filter_var_array(
$_REQUEST,
array(
+ 'activityId' => FILTER_VALIDATE_INT,
+ 'parkId' => FILTER_VALIDATE_INT,
+ 'regionId' => FILTER_VALIDATE_INT,
+ 'countyId' => FILTER_VALIDATE_INT,
'activity' => array(
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_FORCE_ARRAY
)
)
);
- if (!empty($postedArrays['activity'])) {
+// var_dump($_POST);
+// var_dump($postedArrays);
+ if ( !empty($postedArrays['activity'])
+ && $postedArrays['activity'][0]
+ ) {
$params[] = "m.member_id IN (
SELECT member_id
FROM member_category
WHERE category_id IN ("
.implode(',', $postedArrays['activity'])."))";
}
- if ($postedArrays['park']) {
+ if ($postedArrays['activityId']) {
+ $params[] = "m.member_id IN (
+ SELECT member_id
+ FROM member_category
+ WHERE category_id = {$postedArrays['activityId']})";
+ }
+ if ($postedArrays['parkId']) {
+ $params[] = "m.member_id IN (
+ SELECT member_id
+ FROM member_category
+ WHERE category_id = {$postedArrays['parkId']})";
+ }
+ if ($postedArrays['regionId']) {
+ $params[] = "m.region = {$postedArrays['regionId']}";
+ }
+ if ($postedArrays['countyId']) {
+ $params[] = "m.county = {$postedArrays['countyId']}";
+ }
+ if ( !empty($postedArrays['park'])
+ && $postedArrays['park'][0]
+ ) {
$params[] = "m.member_id IN (
SELECT member_id
FROM member_category
$this->tripPlannerUrl = Toolkit_Template_Page::getSeoUrl(
$this->_pageGateway, MEMBER_SESSION_PAGE
);
+ $this->_setupTrailSearchForm();
// check if define for GOOGLE_SEARCH is set
if (defined("GOOGLE_SEARCH")
}
}
+ private function _setupTrailSearchForm()
+ {
+ $this->activitySearch = array();
+ $this->parkSearch = array();
+ $this->regionSearch = array();
+ $this->countySearch = array();
+ try {
+ $dbh = Toolkit_Database::getInstance();
+ $sql = "
+ SELECT category_id,name
+ FROM members.category
+ WHERE parent_id = 7
+ ORDER BY name";
+ $stmt = $dbh->query($sql);
+ while ($category = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $this->activitySearch[$category['category_id']]
+ = $category['name'];
+ }
+// var_dump($this->activitySearch);exit;
+ $sql = "
+ SELECT category_id,name
+ FROM members.category
+ WHERE parent_id = 8
+ ORDER BY name";
+ $stmt = $dbh->query($sql);
+ while ($park = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $this->parkSearch[$park['category_id']]
+ = $park['name'];
+ }
+ $sql = "
+ SELECT region_id,region_name
+ FROM members.region
+ ORDER BY region_name";
+ $stmt = $dbh->query($sql);
+ while ($region = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $this->regionSearch[$region['region_id']]
+ = $region['region_name'];
+ }
+ $sql = "
+ SELECT county_id,county_name
+ FROM members.county
+ ORDER BY county_name";
+ $stmt = $dbh->query($sql);
+ while ($county = $stmt->fetch(PDO::FETCH_ASSOC)) {
+ $this->countySearch[$county['coutny_id']]
+ = $county['county_name'];
+ }
+ } catch (PDOException $e) {
+ Toolkit_Common::handleError($e);
+ }
+ }
+
/**
* Returns page main navigation
*
/**
* Toolkit_Template_Page_BodyFactory
- *
+ *
* Description of Toolkit_Template_Page_BodyFactory
- *
+ *
* @category Toolkit
* @package Template/Page
* @author Jamie Kahgee <steve@gaslightmedia.com>
/**
* description of $_breadCrumbsFactory
- *
+ *
* @var string
* @access private
*/
private $_breadCrumbsFactory;
-
+
/**
* description of $_pageGateway
- *
+ *
* @var string
* @access private
*/
private $_pageGateway;
-
+
/**
* description of $_paragraphGateway
- *
+ *
* @var string
* @access private
*/
private $_paragraphGateway;
-
+
/**
* description of $_cache
- *
+ *
* @var string
* @access private
*/
private $_cache;
-
+
/**
* description of $_keywordReplacement
- *
+ *
* @var string
* @access private
*/
/**
* Class constructor
- *
+ *
* @param Toolkit_BreadCrumbsFactory $breadCrumbsFactory breadCrumbsFactory
* @param Toolkit_Toolbox_PageGatewayAbstract $pageGateway pageGateway
* @param Toolkit_Toolbox_ParagraphGatewayAbstract $paragraphGateway paragraphGateway
* @param Toolkit_Template_KeywordReplacement $keywordReplacement keywordReplacement
* @param Cache_Lite $cache cache
- *
+ *
* @access public
*/
public function __construct(
/**
* description of getPageBodyBuilder
- *
+ *
* @param string $id ID
- *
+ *
* @return \Toolkit_Members_SiteMapPage|\Toolkit_Template_Page_SiteMap
* |\Toolkit_Template_Page_Bad|\Toolkit_Template_Page_GoogleSearch
- * |\Toolkit_Template_Page_Member|\Toolkit_Template_Page_Toolbox
+ * |\Toolkit_Template_Page_Member|\Toolkit_Template_Page_Toolbox
* @access public
*/
public function getPageBodyBuilder($id)
&& !empty($_GET['query']));
$memberPage = ( defined('MEMBERS_DB')
&& MEMBERS_DB
- && $page['include_members']
- // && (
- // (isset($page['member_categories'])
- // && is_array($page['member_categories'])
- // && !empty($page['member_categories']))
- // ||
- // (isset($page['member_regions'])
- // && is_array($page['member_regions'])
- // && !empty($page['member_regions']))
- // )
- );
+ && $page['include_members']);
if ($forgotPassword) {
die('Toolkit_Template_Page_BodyFactory::getPageBodyBuilder');
$breadCrumbs = $breadCrumbsBuilder->toHtml($this->id);
$searchResults = $this->_getMemberSearchResults($this->id);
$searchForm = $this->_getMemberSearchForm($this->id);
- $posted = '<pre>'.print_r($_REQUEST, true).'</pre>';
return $breadCrumbs .
$searchForm .
-// $posted .
$searchResults;
} else {
$breadCrumbs = $breadCrumbsBuilder->toHtml($this->id);
'name' => 'memberDbHdr',
'display' => $pluralMem,
);
- $e[] = array(
- 'type' => 'advcheckbox',
- 'req' => false,
- 'name' => 'include_members',
- 'display' => "Members",
- 'opts' => "Include Members On Page",
- 'val' => array(0, 1)
- );
- $e[] = array(
- 'type' => 'html',
- 'req' => false,
- 'name' => '<tr>
- <td class="labelcell"></td>
- <td class="fieldcell">
- To include all members, turn this feature on and
- don\'t select categories or regions below.<br>
- To restrict to specific categories, select desired
- categories under Category Filter.<br>
- To restrict to specific regions, select desired
- regions under Region Filter.
- </td>
- </tr>'
- );
- // Note that we call to populate this select list at the
- // bottom of this function after the element is made
- // so we load attributes (classes) into each option as needed.
- $e[] = array(
- 'type' => 'select',
- 'req' => false,
- 'name' => 'member_categories',
- 'display' => 'Category Filter<br>(none = all)',
- 'opts' => array(),
- 'att' => array(
- 'multiple' => 'multiple',
- 'size' => 7,
- 'title' => '-- Select to Add --',
- 'id' => 'MemberCategories'
- )
- );
- if ($hasRegions) {
- $e[] = array(
- 'type' => 'select',
- 'req' => false,
- 'name' => 'member_regions',
- 'display' => 'Region Filter<br>(none = all)',
- 'opts' => array(),
- 'att' => array(
- 'multiple' => 'multiple',
- 'size' => 7,
- 'title' => '-- Select to Add --',
- 'id' => 'MemberRegions'
- )
- );
+ $pageId = filter_var($_REQUEST['id'], FILTER_VALIDATE_INT);
+ if ($pageId == MEMBERS_TRAIL_PAGE) {
+ $e[] = array(
+ 'type' => 'advcheckbox',
+ 'req' => false,
+ 'name' => 'include_members',
+ 'display' => "Members",
+ 'opts' => "Include Members On Page",
+ 'val' => array(0, 1)
+ );
+ $e[] = array(
+ 'type' => 'html',
+ 'req' => false,
+ 'name' => '<tr>
+ <td class="labelcell"></td>
+ <td class="fieldcell">
+ To include all members, turn this feature on and
+ don\'t select categories or regions below.<br>
+ To restrict to specific categories, select desired
+ categories under Category Filter.<br>
+ To restrict to specific regions, select desired
+ regions under Region Filter.
+ </td>
+ </tr>'
+ );
+ $e[] = array(
+ 'type' => 'advcheckbox',
+ 'req' => false,
+ 'name' => 'include_member_map',
+ 'display' => "Google Map",
+ 'opts' => "Include Map On Page",
+ 'val' => array(0, 1)
+ );
+ $e[] = array(
+ 'type' => 'hidden',
+ 'req' => false,
+ 'name' => 'search_form',
+ 'display' => "Search Box",
+ 'opts' => 1,//'Include Search Box',
+ 'val' => 1//array(0, 1)
+ );
+ } else {
+ $e[] = array(
+ 'type' => 'advcheckbox',
+ 'req' => false,
+ 'name' => 'include_members',
+ 'display' => "Members",
+ 'opts' => "Include Members On Page",
+ 'val' => array(0, 1)
+ );
+ $e[] = array(
+ 'type' => 'html',
+ 'req' => false,
+ 'name' => '<tr>
+ <td class="labelcell"></td>
+ <td class="fieldcell">
+ To include all members, turn this feature on and
+ don\'t select categories or regions below.<br>
+ To restrict to specific categories, select desired
+ categories under Category Filter.<br>
+ To restrict to specific regions, select desired
+ regions under Region Filter.
+ </td>
+ </tr>'
+ );
+ // Note that we call to populate this select list at the
+ // bottom of this function after the element is made
+ // so we load attributes (classes) into each option as needed.
+ $e[] = array(
+ 'type' => 'select',
+ 'req' => false,
+ 'name' => 'member_categories',
+ 'display' => 'Category Filter<br>(none = all)',
+ 'opts' => array(),
+ 'att' => array(
+ 'multiple' => 'multiple',
+ 'size' => 7,
+ 'title' => '-- Select to Add --',
+ 'id' => 'MemberCategories'
+ )
+ );
+ if ($hasRegions) {
+ $e[] = array(
+ 'type' => 'select',
+ 'req' => false,
+ 'name' => 'member_regions',
+ 'display' => 'Region Filter<br>(none = all)',
+ 'opts' => array(),
+ 'att' => array(
+ 'multiple' => 'multiple',
+ 'size' => 7,
+ 'title' => '-- Select to Add --',
+ 'id' => 'MemberRegions'
+ )
+ );
+ }
+ $e[] = array(
+ 'type' => 'advcheckbox',
+ 'req' => false,
+ 'name' => 'include_member_map',
+ 'display' => "Google Map",
+ 'opts' => "Include Map On Page",
+ 'val' => array(0, 1)
+ );
+ $e[] = array(
+ 'type' => 'advcheckbox',
+ 'req' => false,
+ 'name' => 'search_form',
+ 'display' => "Search Box",
+ 'opts' => 'Include Search Box',
+ 'val' => array(0, 1)
+ );
}
- $e[] = array(
- 'type' => 'advcheckbox',
- 'req' => false,
- 'name' => 'include_member_map',
- 'display' => "Google Map",
- 'opts' => "Include Map On Page",
- 'val' => array(0, 1)
- );
- $e[] = array(
- 'type' => 'advcheckbox',
- 'req' => false,
- 'name' => 'search_form',
- 'display' => "Search Box",
- 'opts' => 'Include Search Box',
- 'val' => array(0, 1)
- );
}
if (!is_null($cpnRoot)) {
*/
public function loadMemberCategories(PDO $dbh)
{
+ $pageId = filter_var($_REQUEST['id'], FILTER_VALIDATE_INT);
+ if ($pageId == MEMBERS_TRAIL_PAGE) {
+ return;
+ }
try {
// Get a tree list of categories in linear order with
// category keys in the values and their level in the tree
*/
public function loadMemberRegions(PDO $dbh)
{
+ $pageId = filter_var($_REQUEST['id'], FILTER_VALIDATE_INT);
+ if ($pageId == MEMBERS_TRAIL_PAGE) {
+ return;
+ }
try {
// Get all the data about each category
$sql = "
<div id="trail_count">166</div>
<p>Trails Reviewed</p>
</div>
- <form id="findTrail" name="findATrail" method="post" action="">
- <select name="activity" id="activity">
- <option>Activity</option>
- <option>Short Trails (0.5 to 3 miles)</option>
- <option>Day Hikes (3 to 6 miles)</option>
- <option>Interpretive Trails and Nature Walks</option>
- <option>Backpacking</option>
- <option>Birding Trails</option>
- <option>Cross-Country Ski Trails</option>
+ <form
+ id="findTrail"
+ name="findATrail"
+ method="get"
+ action="{baseURL:h}find-trails-3/"
+ flexy:ignore="yes">
+ <select
+ name="activityId"
+ id="activity"
+ flexy:if="activitySearch">
+ <option value="">Activity</option>
+ <?php foreach($t->activitySearch as $id => $label) {
+ echo '<option
+ value="'.$id.'"'.(($_REQUEST['activityId'] == $id)?' selected':'').'>
+ '.$label.'</option>';
+ }?>
</select>
- <select name="park" id="park">
- <option>Park</option>
- <option>County Parks</option>
- <option>State Parks and Recreation Areas</option>
- <option>State Forest Pathways</option>
- <option>National Parks</option>
- <option>Huron-Clinton Metroparks</option>
+ <select
+ name="parkId"
+ id="park"
+ flexy:if="parkSearch">
+ <option value="">Park</option>
+ <?php foreach($t->parkSearch as $id => $label) {
+ echo '<option
+ value="'.$id.'"'.(($_REQUEST['parkId'] == $id)?' selected':'').'>
+ '.$label.'</option>';
+ }?>
</select>
- <select name="region" id="region">
- <option>Region</option>
- <option>Gaylord Area</option>
- <option>Petoskey Area</option>
- <option>Southwest Michigan</option>
+ <select
+ name="regionId"
+ id="region"
+ flexy:if="regionSearch">
+ <option value="">Region</option>
+ <?php foreach($t->regionSearch as $id => $label) {
+ echo '<option
+ value="'.$id.'"'.(($_REQUEST['regionId'] == $id)?' selected':'').'>
+ '.$label.'</option>';
+ }?>
</select>
- <select name="county" id="county">
- <option>County</option>
- <option>Cheboygan</option>
- <option>Emmet</option>
- <option>Mackinaw</option>
+ <select
+ name="countyId"
+ id="county"
+ flexy:if="countySearch">
+ <option value="">County</option>
+ <?php foreach($t->countySearch as $id => $label) {
+ echo '<option
+ value="'.$id.'"'.(($_REQUEST['countyId'] == $id)?' selected':'').'>
+ '.$label.'</option>';
+ }?>
</select>
<input type="submit" name="submit" value="submit">
</form>