From 44adeb777c50e3af14cc61612eee02b54f0d6448 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Wed, 28 Sep 2016 14:41:21 -0400 Subject: [PATCH] Featured members styles and markup --- models/admin/pages/shortcode.php | 1 + models/front/members/detail.php | 6 +- models/front/members/featured.php | 144 ++++++++++++++++++++++++++++++ setup/shortcodes.php | 9 ++ setup/validActions.php | 3 +- views/front/members/featured.html | 16 ++++ 6 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 models/front/members/featured.php create mode 100644 views/front/members/featured.html diff --git a/models/admin/pages/shortcode.php b/models/admin/pages/shortcode.php index 563bdd80..8826e833 100644 --- a/models/admin/pages/shortcode.php +++ b/models/admin/pages/shortcode.php @@ -144,6 +144,7 @@ class GlmMembersAdmin_pages_shortcode $listAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-members-list']['attributes']; $detailAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-detail']['attributes']; + $featuredAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-featured']['attributes']; $glmcat = new GlmDataCategories( $this->wpdb, $this->config ); $categories = $glmcat->getListSortedParentChild(); diff --git a/models/front/members/detail.php b/models/front/members/detail.php index a1624dda..7ed85d19 100644 --- a/models/front/members/detail.php +++ b/models/front/members/detail.php @@ -315,10 +315,10 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo } else { $memberData['video_embed'] = "Could not find video"; } - - + + } - + $expanded = false; if (isset($_GET['expanded'])) { $expanded = htmlspecialchars($_GET['expanded']); diff --git a/models/front/members/featured.php b/models/front/members/featured.php new file mode 100644 index 00000000..13ab21aa --- /dev/null +++ b/models/front/members/featured.php @@ -0,0 +1,144 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + + +// Load Members data abstract +require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'; + +/* + * This class performs the work for the default action of the "Members" menu + * option, which is to display the members dashboard. + * + */ +class GlmMembersFront_members_featured extends GlmDataMemberInfo +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /* + * Constructor + * + * This contructor sets up this model. At this time that only includes + * storing away the WordPress data object. + * + * @return object Class object + * + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + // Run constructor for members data class + parent::__construct(false, false); + + } + + /* + * Perform Model Action + * + * This method does the work for this model and returns any resulting data + * + * @return array Status and data array + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'menuItemRedirect' + * + * If not false, provides a menu item the controller should + * execute after this one. Normally if this is used, there would also be a + * modelRedirect value supplied as well. + * + * 'modelRedirect' + * + * If not false, provides an action the controller should execute after + * this one. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + */ + public function modelAction ($actionData = false) + { + $settings = array(); + + /* + * Check for which view file to use, else default to list + */ + $view = "featured"; + $sql = " + SELECT id + FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "members + WHERE featured + + ;"; + $id = $this->wpdb->get_var($sql); + $memberData = $this->getActiveInfoForMember($id); + if (count($memberData) > 0) { + $success = true; + } + + // Compile template data + +// echo "
".print_r($memberData,true)."
"; + + $templateData = array( + 'view' => $view, + 'member' => $memberData, + ); + + // Return status, suggested view, and data to controller - also return any modified settings + return array( + 'status' => $success, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => "front/members/featured.html", + 'data' => $templateData, + 'settings' => $settings + ); + + } + + +} + +?> diff --git a/setup/shortcodes.php b/setup/shortcodes.php index d6da5fad..cc5b7b62 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -170,6 +170,15 @@ $glmMembersShortcodes = array( 'credit-cards' => 'detail_show_creditcards', 'amenities' => 'detail_show_amenities' ) + ), + 'glm-member-featured' => array( + 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, + 'menu' => 'members', + 'action' => 'featured', + 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', + 'attributes' => array ( + 'number' => 1 + ) ) ); diff --git a/setup/validActions.php b/setup/validActions.php index 1e412c7e..c43f105a 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -86,7 +86,8 @@ $glmMembersValidActions = array( 'frontActions' => array( 'members' => array( 'list' => 'glm-member-db', - 'detail' => 'glm-member-db' + 'detail' => 'glm-member-db', + 'featured' => 'glm-member-db' ), 'error' => array( 'index' => 'glm-member-db', diff --git a/views/front/members/featured.html b/views/front/members/featured.html new file mode 100644 index 00000000..47b94139 --- /dev/null +++ b/views/front/members/featured.html @@ -0,0 +1,16 @@ +{include file='front/members/header.html'} + +
Featured Business
+{if $member.logo} + +{/if} + +{include file='front/footer.html'} \ No newline at end of file -- 2.17.1