Featured members styles and markup
authorLaury GvR <laury@gaslightmedia.com>
Wed, 28 Sep 2016 18:41:21 +0000 (14:41 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 28 Sep 2016 18:41:21 +0000 (14:41 -0400)
models/admin/pages/shortcode.php
models/front/members/detail.php
models/front/members/featured.php [new file with mode: 0644]
setup/shortcodes.php
setup/validActions.php
views/front/members/featured.html [new file with mode: 0644]

index 563bdd8..8826e83 100644 (file)
@@ -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();
 
index a1624dd..7ed85d1 100644 (file)
@@ -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 (file)
index 0000000..13ab21a
--- /dev/null
@@ -0,0 +1,144 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front Featured Members
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @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 "<pre>".print_r($memberData,true)."</pre>";
+        
+        $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
+        );
+
+    }
+
+
+}
+
+?>
index d6da5fa..cc5b7b6 100644 (file)
@@ -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
+        )
     )
 );
 
index 1e412c7..c43f105 100644 (file)
@@ -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 (file)
index 0000000..47b9413
--- /dev/null
@@ -0,0 +1,16 @@
+{include file='front/members/header.html'}
+
+<h5>Featured Business</h5>
+{if $member.logo}
+    <div class="glm-featured-member-image-container">
+        <img class="glm-featured-member-image" src="{$glmPluginMediaUrl}/images/grid/{$member.logo}" alt="{$member.member_name}">
+    </div>
+{/if}
+<div class="glm-featured-member-text">
+    <h6 class="glm-featured-member-title">{$member.member_name}</h6>
+    <p class="glm-featured-member-excerpt">{$member.short_descr}</p>    
+    <a class="glm-featured-member-morelink" href="{$siteBaseUrl}{$settings.canonical_member_page}/{$member.member_slug}/">
+        find out more...
+    </a>
+</div>
+{include file='front/footer.html'}
\ No newline at end of file