From 069a3c7abe5cd9bb926016d0a0b50601b3df06db Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 6 Jun 2013 16:36:21 +0000 Subject: [PATCH] update join sql part for no city --- Toolkit/Members/ProfilePage.php | 222 +-------------------- Toolkit/Members/templates/memberDetail.tpl | 199 +++++++++--------- 2 files changed, 96 insertions(+), 325 deletions(-) diff --git a/Toolkit/Members/ProfilePage.php b/Toolkit/Members/ProfilePage.php index 631fdc9..e8b9346 100644 --- a/Toolkit/Members/ProfilePage.php +++ b/Toolkit/Members/ProfilePage.php @@ -388,18 +388,8 @@ class Toolkit_Members_ProfilePage $this->setMemberInfo($page); $this->setMemberPhotos($page); - $this->setMemberAccommodations($page); $this->setMemberAmenities($page); - $this->setMemberCCards($page); - $this->setMemberSocialMedia($page); $this->setMemberFiles($page); - $this->setMemberPackages($page); - $this->setMemberGolf($page); - $this->setMemberRestaurant($page); - - $page->show_attributes = ( $page->has_accommodations - || $page->has_social_media - || is_array($page->ccards)); } // }}} @@ -441,72 +431,6 @@ class Toolkit_Members_ProfilePage } } - // }}} - // {{{ setMemberGolf() - - /** - * Get all the golf data for the the member profile being looked at - * - * @param object &$page The object you want to use with the flexy template - * - * @return void - * @access protected - */ - protected function setMemberGolf(&$page) - { - try { - $sql = " - SELECT column_name, data_type - FROM information_schema.columns - WHERE table_name = 'member_golf'"; - - $tableData = $this->dbh->query($sql)->fetchAll(); - - $sql = " - SELECT * - FROM member_golf - WHERE member_id = :mid"; - - $stmt = $this->dbh->prepare($sql); - $stmt->bindParam(':mid', $this->_mid, PDO::PARAM_INT); - $stmt->execute(); - - if ($row = $stmt->fetch()) { - $show = false; - foreach ($tableData as $td) { - switch ($td['data_type']) { - case 'radio' : - case 'boolean' : - $golf[$td['column_name']] = ($row[$td['column_name']] == 't') ? 'Yes': 'No'; - break; - - case 'integer' : - break; - - case 'text' : - default : - $golf[$td['column_name']] = $row[$td['column_name']]; - if (!empty($row[$td['column_name']])) { - $show = true; - } - break; - } - } - - $page->golf_info = $show; - $page->par = $golf['par']; - $page->yardage = $golf['yardage']; - $page->course_rating = $golf['course_rating']; - $page->slope_rating = $golf['slope_rating']; - $page->walking_course = $golf['walking_course']; - $page->holes18 = $golf['holes18']; - $page->holes9 = $golf['holes9']; - } - } catch (PDOException $e) { - return Toolkit_Common::handleError($e); - } - } - // }}} // {{{ setMemberId() @@ -548,7 +472,9 @@ class Toolkit_Members_ProfilePage ct.county_name, s.state_abb AS state_abbr FROM member m - JOIN city c USING (city_id), state s, county ct + LEFT OUTER JOIN city c ON (m.city_id = c.city_id) + LEFT OUTER JOIN state s ON (m.state_id = s.state_id), + county ct WHERE m.member_id = :mid AND m.state_id = s.state_id AND m.county = ct.county_id"; @@ -665,49 +591,6 @@ class Toolkit_Members_ProfilePage } } - // }}} - // {{{ setMemberPackages() - - /** - * Get all the file data for the the member profile being looked at - * - * @param object &$page The object you want to use with the flexy template - * - * @return void - * @access protected - */ - protected function setMemberPackages(&$page) - { - try { - $sql = " - SELECT title, description, image - FROM member_packages - WHERE member_id = :mid - AND NOT pending - AND CURRENT_DATE BETWEEN sdate AND edate - ORDER BY id"; - - $stmt = $this->dbh->prepare($sql); - $stmt->bindParam(':mid', $this->_mid, PDO::PARAM_INT); - $stmt->execute(); - - $count = 0; - while ($row = $stmt->fetch()) { - $page->packages[$count]['title'] = $row['title']; - if (!empty($row['image'])) { - $img = $page->image_path . $row['image']; - $page->packages[$count]['image'] = $img; - } - if (!empty($row['description'])) { - $page->packages[$count]['description'] = $row['description']; - } - ++$count; - } - } catch (PDOException $e) { - return Toolkit_Common::handleError($e); - } - } - // }}} // {{{ setMemberPhotos() @@ -749,105 +632,6 @@ class Toolkit_Members_ProfilePage } // }}} - // {{{ setMemberRestaurant() - - /** - * Get all the restaurant data for the the member profile being looked at - * - * @param object &$page The object you want to use with the flexy template - * - * @return void - * @access protected - */ - protected function setMemberRestaurant(&$page) - { - try { - $sql = " - SELECT column_name, data_type - FROM information_schema.columns - WHERE table_name = 'member_restaurants'"; - - $tableData = $this->dbh->query($sql)->fetchAll(); - - $sql = " - SELECT * - FROM member_restaurants - WHERE member_id = :mid"; - - $stmt = $this->dbh->prepare($sql); - $stmt->bindParam(':mid', $this->_mid, PDO::PARAM_INT); - $stmt->execute(); - - if ($row = $stmt->fetch()) { - $show = false; - foreach ($tableData as $td) { - switch ($td['data_type']) { - case 'radio' : - case 'boolean' : - $restaurant[$td['column_name']] - = ($row[$td['column_name']] == 't') ? 'Yes': 'No'; - if ($row[$td['column_name']] == 't') { - $show = true; - } - break; - - default : - $restaurant[$td['column_name']] = $row[$td['column_name']]; - break; - } - } - - $page->restaurant_info = $show; - $page->breakfast = $restaurant['breakfast']; - $page->brunch = $restaurant['brunch']; - $page->lunch = $restaurant['lunch']; - $page->dinner = $restaurant['dinner']; - $page->alcohol = $restaurant['alcohol']; - } - } catch (PDOException $e) { - return Toolkit_Common::handleError($e); - } - } - - // }}} - // {{{ setMemberSocialMedia() - - /** - * Gets all the members social media links - * - * @param object &$page The object you want to use with the flexy template - * - * @return mixed array if the member has any links otherwise false - * @access protected - */ - protected function setMemberSocialMedia(&$page) - { - try { - $sql = " - SELECT facebook, twitter, myspace, linkedin, blog, - youtube, pinterest - FROM member - WHERE member_id = :mid"; - - $stmt = $this->dbh->prepare($sql); - $stmt->bindParam(':mid', $this->_mid, PDO::PARAM_INT); - $stmt->execute(); - - $row = $stmt->fetch(PDO::FETCH_ASSOC); - $media = array_filter($row); - - if (!empty($media)) { - $page->has_social_media = true; - foreach ($media as $k => $v) { - $page->$k = $v; - } - } - } catch (PDOException $e) { - return Toolkit_Common::handleError($e); - } - } - - // }}} // {{{ _validMember() diff --git a/Toolkit/Members/templates/memberDetail.tpl b/Toolkit/Members/templates/memberDetail.tpl index 5f00acd..70d92ad 100644 --- a/Toolkit/Members/templates/memberDetail.tpl +++ b/Toolkit/Members/templates/memberDetail.tpl @@ -1,37 +1,35 @@ + flexy:prefix="glm_" + base_url="base_url" + trip_planner_id="trip_planner_id" + catid="catid" + >
-
-
- Member Logo Image -
-
- - {memberSince:h} +
+
+ Member Logo Image +
+
-
-

{member_name:h}

-
-
Street Address
-
{street:h}
-
- {city:h}, - - {state_abbr:h} - - {zip:h} -
+
+

{member_name:h}

+
+
Street Address
+
{street:h}
+
+ {city:h}, + + {state_abbr:h} + + {zip:h} +
{county_name:h} County
-
+
Distance: {distance:h}
TrailType: {trailtype:h}
@@ -40,88 +38,77 @@ catid="catid"
Difficulty: {difficulty:h}
{paypal:h}
-
-
Mailing Address
-
{mailing_address:h}
-
- {mailing_city:h}, - - {mailing_state_abbr:h} - - {mailing_zip:h} -
-
-
- Phone: - {phone:h} -
-
- Toll Free: - {toll_free:h} -
-
- Fax: - {fax:h} -
- - Website -
-
-
-

Get Driving Directions:

-
- - - -
-
-
-
-
+
+ Phone: + {phone:h} +
+
+ Toll Free: + {toll_free:h} +
+
+ Fax: + {fax:h} +
+ + Website +
+
+
+

Get Driving Directions:

+
+ + + +
+
+
+
+
-{if:addToLink} - - Add to Your Travel List - - -{else:} - - View Your Travel List - -{end:} + {if:addToLink} + + Add to Your Travel List + + + {else:} + + View Your Travel List + + {end:} -
{description:h}
-
-

Trail Guide:

{guide:h} -
-
-

Facilities:

{facilities:h} -
-
-

Directions:

{directions:h} -
-
-

Information:

{information:h} -
+
{description:h}
+
+

Trail Guide:

{guide:h} +
+
+

Facilities:

{facilities:h} +
+
+

Directions:

{directions:h} +
+
+

Information:

{information:h} +
-
-
    -
  • {v:h}
  • -
-
+
+
    +
  • {v:h}
  • +
+
-
-

Files Available for Download

- {v[name]:h} -
+
+

Files Available for Download

+ {v[name]:h} +
- + -
+ -- 2.17.1