Front end now working with [glm-member-list] and [glm-member-detail] short codes.
authorChuck Scott <cscott@gaslightmedia.com>
Sun, 15 Mar 2015 22:05:33 +0000 (18:05 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Sun, 15 Mar 2015 22:05:33 +0000 (18:05 -0400)
44 files changed:
classes/data/dataAccommodationTypes.php
classes/data/dataAmenities.php
classes/data/dataCategories.php
classes/data/dataCategoryMemberInfo.php
classes/data/dataCities.php
classes/data/dataMemberInfo.php
classes/data/dataMemberTypes.php
classes/data/dataMembers.php
classes/data/dataRegions.php
controllers/admin.php
controllers/front.php
css/admin.css
css/front.css
misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php
misc/smarty/templates_c/4c287ca0e4946b3d644e61950c851e98e8906d49.file.list.html.php
models/admin/configure/accommodationTypes.php
models/admin/configure/amenities.php
models/admin/configure/categories.php
models/admin/configure/cities.php
models/admin/configure/development.php
models/admin/configure/index.php
models/admin/configure/memberTypes.php
models/admin/configure/regions.php
models/admin/error/badAction.php
models/admin/error/index.php
models/admin/member/index.php
models/admin/member/memberInfo.php
models/admin/members/index.php
models/admin/members/list.php
models/admin/shortcodes/index.php [new file with mode: 0644]
models/front/error/badAction.php [new file with mode: 0644]
models/front/error/index.php [new file with mode: 0644]
models/front/members/detail.php [new file with mode: 0644]
models/front/members/list.php
views/admin/configure/categories.html
views/admin/member/index.html
views/admin/members/list.html
views/admin/shortcodes/header.html [new file with mode: 0644]
views/admin/shortcodes/index.html [new file with mode: 0644]
views/front/error/badAction.html
views/front/error/header.html
views/front/error/index.html
views/front/members/detail.html [new file with mode: 0644]
views/front/members/list.html

index 38fd379..9c6f81a 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataAccommodationTypes extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index f427729..4f2ba29 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataAmenities extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index 3455e71..83629fa 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataCategories extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index 5e64e7a..caceaed 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataCategoryMemberInfo extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index ac3679e..1c9381c 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataCities extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index e05a91c..5cd019d 100644 (file)
@@ -86,11 +86,16 @@ class GlmDataMemberInfo extends GlmDataAbstract {
        function __construct($wpdb, $config)
        {
 
-               // Save WordPress Database object
-               $this->wpdb = $wpdb;
+           // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-               // Save plugin configuration object
-               $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
                /*
                 * Table Name
@@ -308,6 +313,33 @@ class GlmDataMemberInfo extends GlmDataAbstract {
 
        }
 
+       /*
+        * Find the active member info record for a specific member ID
+        *
+        * @param integer $member ID of the member
+        *
+        * @return integer Member info record ID or false if not found
+        */
+       public function getActiveInfoForMember($member) {
+
+           $memberID = $member - 0;
+
+        $sql = "
+            SELECT id
+              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "member_info
+             WHERE member = $memberID
+               AND status = ".$this->config['status_numb']['Active']."
+           ;";
+        $memberInfo = $this->wpdb->get_row($sql, ARRAY_A);
+
+        if ($memberInfo) {
+            return $memberInfo['id'];
+        }
+
+        return false;
+
+       }
+
        /*
         * Entry Post Processing Call-Back Method
         *
@@ -325,8 +357,8 @@ class GlmDataMemberInfo extends GlmDataAbstract {
        public function entryPostProcessing($r, $a)
        {
 
-           // Only run these tests for 'l' (getList)
-           if ($a != 'l') {
+           // Only run these tests for 'l' (getList) or 'g' (getEntry)
+           if ($a != 'l' && $a != 'g') {
                return $r;
            }
 
index 224e0ea..def4de5 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataMemberTypes extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index 04d97db..39a5656 100644 (file)
@@ -86,11 +86,15 @@ class GlmDataMembers extends GlmDataAbstract {
        function __construct($wpdb, $config)
        {
 
-               // Save WordPress Database object
-               $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-               // Save plugin configuration object
-               $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+           }
 
                /*
                 * Table Name
index 92fc593..be26b2c 100644 (file)
@@ -88,11 +88,16 @@ class GlmDataRegions extends GlmDataAbstract
     function __construct ($wpdb, $config)
     {
 
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
+        // If this class is not being extended along with existing $wpdb and $config
+           if (!$this->wpdb) {
 
-        // Save plugin configuration object
-        $this->config = $config;
+           // Save WordPress Database object
+           $this->wpdb = $wpdb;
+
+           // Save plugin configuration object
+           $this->config = $config;
+
+           }
 
         /*
          * Table Name
index 68138ba..a0583ba 100644 (file)
@@ -51,6 +51,9 @@ $GLOBALS['glmMembersAdminValidActions'] = array(
                 'amenities',
                 'development'
         ),
+        'shortcodes' => array(
+                'index'
+        ),
         'error' => array(
                 'index',
                 'badAction'
@@ -305,6 +308,16 @@ class glmMembersAdmin extends GlmPluginSupport
                         $this,
                         'glmMembersAdminMenuConfigure'
                 ));
+
+        // Add a submenu for the "Shortcode Reference" section
+        add_submenu_page('glm-members-admin-menu-members',
+                'Shortcode Reference', 'Shortcodes',
+                'glm_members_shortcodes', 'glm-members-admin-menu-shortcodes',
+                array(
+                        $this,
+                        'glmMembersAdminMenuShortcodes'
+                ));
+
     }
 
     /*
@@ -343,6 +356,11 @@ class glmMembersAdmin extends GlmPluginSupport
         $this->controller('configure');
     }
 
+    public function glmMembersAdminMenuShortcodes ()
+    {
+        $this->controller('shortcodes');
+    }
+
     /**
      * Admin controller
      *
@@ -451,7 +469,7 @@ class glmMembersAdmin extends GlmPluginSupport
 
         // Loop till we have a final action
         $loopCheck = 0;
-        $redirectData = false;
+        $actionData = false;
         do {
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
@@ -533,7 +551,7 @@ class glmMembersAdmin extends GlmPluginSupport
 
                     // Instantiate the model and ask it to perform the work
                     $model = new $className($this->wpdb, $this->config);
-                    $results = $model->modelAction($redirectData);
+                    $results = $model->modelAction($actionData);
 
                     // Check if there's been a model redirect request
                     if ($results['modelRedirect']) {
@@ -548,7 +566,7 @@ class glmMembersAdmin extends GlmPluginSupport
 
                         // Check if there's data to pass to the new model
                         if (isset($results['data']) && count($results['data']) > 0) {
-                            $redirectData = $results['data'];
+                            $actionData = $results['data'];
                         }
 
                         $modelRedirect = true;
index 2d737cb..bffee32 100644 (file)
 $GLOBALS['glmMembersFrontValidActions'] = array(
 
         'members' => array(
-                'list'
+                'list',
+                'detail'
+        ),
+        'error' => array(
+                'index',
+                'badAction'
         )
+
 );
 
 // Load glmPluginSupport class
@@ -74,7 +80,13 @@ class glmMembersFront extends GlmPluginSupport
                         'glmMembersFrontScripts'
                 ));
 
-        add_shortcode('glm-members',
+        add_shortcode('glm-members-list',
+                array(
+                        $this,
+                        'controller'
+                ));
+
+        add_shortcode('glm-member-detail',
                 array(
                         $this,
                         'controller'
@@ -171,18 +183,41 @@ class glmMembersFront extends GlmPluginSupport
      * @return void
      * @access public
      */
-    public function controller ($atts, $content = null)
+    public function controller ($atts, $content = null, $shortcode)
     {
 
-        // Shortcode Attributes defaults
-        $request = shortcode_atts(
-            array(
-                'action' => 'index',
-                'option' => false
-            ),
-            $atts,
-            'glm-members'
-        );
+        // Set shortcode attribute defaults
+        switch ($shortcode) {
+
+            case 'glm-members-list':
+                $action = 'list';
+                $request = shortcode_atts(
+                    array(
+                        'map' => true,
+                        'category' => false,
+                        'alpha' => false,
+                        'search' => false,
+                        'amenities' => false,
+                        'detail-page' => false
+                    ),
+                    $atts,
+                    'glm-members'
+                );
+                break;
+
+            case 'glm-member-detail':
+                $action = 'detail';
+                $request = shortcode_atts(
+                    array(
+                        'map' => true,
+                        'id' => false
+                    ),
+                    $atts,
+                    'glm-members'
+                );
+                break;
+
+        }
 
         /*
          * Because WordPress insists on forcing the timezone to UTC
@@ -213,16 +248,6 @@ class glmMembersFront extends GlmPluginSupport
 
         // Default action is "index"
         $menuItem = 'members';
-        $action = 'list';
-        $option = false;
-
-        // First check shortcode attributes
-        if  ($request['action']) {
-            $action = $request['action'];
-        }
-        if  ($request['option']) {
-            $action = $request['option'];
-        }
 
         // Get any requested "action" from a form submission - Overrides shortcode attributes
         if (isset($_REQUEST['glm_action']) && $_REQUEST['glm_action'] != '') {
@@ -234,7 +259,10 @@ class glmMembersFront extends GlmPluginSupport
 
         // Loop till we have a final action
         $loopCheck = 0;
-        $redirectData = false;
+        $actionData = array(
+            'request' => $request
+        );
+
         do {
 
             if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
@@ -245,7 +273,6 @@ class glmMembersFront extends GlmPluginSupport
 
             // Verify that we have the requested menu item in the valid actions
             if (! isset($GLOBALS['glmMembersFrontValidActions'][$menuItem])) {
-
                 $modelRedirect = true;
                 $menuItem = 'error';
                 $action = 'index';
@@ -270,7 +297,7 @@ class glmMembersFront extends GlmPluginSupport
             $className = 'GlmMembersFront_' . $menuItem . '_' . $action;
 
             // If model file doesn't exist - we have an error
-            if (! file_exists($modelName)) {
+            if (!file_exists($modelName)) {
 
                 $modelRedirect = true;
                 $menuItem = 'error';
@@ -285,7 +312,6 @@ class glmMembersFront extends GlmPluginSupport
 
                 // check for an invalid model class name
                 if (! class_exists($className)) {
-
                     $modelRedirect = true;
                     $menuItem = 'error';
                     $action = 'index';
@@ -298,7 +324,7 @@ class glmMembersFront extends GlmPluginSupport
 
                     // Instantiate the model and ask it to perform the work
                     $model = new $className($this->wpdb, $this->config);
-                    $results = $model->modelAction($redirectData);
+                    $results = $model->modelAction($actionData);
 
                     // Check if there's been a model redirect request
                     if ($results['modelRedirect']) {
@@ -314,7 +340,7 @@ class glmMembersFront extends GlmPluginSupport
                         // Check if there's data to pass to the new model
                         if (isset($results['data']) &&
                                  count($results['data']) > 0) {
-                            $redirectData = $results['data'];
+                            $actionData = $results['data'];
                         }
 
                         $modelRedirect = true;
@@ -339,9 +365,8 @@ class glmMembersFront extends GlmPluginSupport
 
             // This is just a sanity check on this loop to keep it from getting
             // out of control
-            if (++ $loopCheck > 10) {
-                die(
-                        '<h1>Serious failure looping on model load in "controllers/front.php".</h1>');
+            if (++$loopCheck > 10) {
+                die('<h1>Serious failure looping on model load in "controllers/front.php".</h1>');
             }
 
             if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && $modelRedirect) {
@@ -372,6 +397,7 @@ class glmMembersFront extends GlmPluginSupport
         $smarty = new smartyTemplateSupport();
 
         // Add standard parameters
+        $smarty->templateAssign ( 'errorMsg', $errorMsg);
         $smarty->templateAssign ( 'frontDebug', GLM_MEMBERS_PLUGIN_FRONT_DEBUG);
         $smarty->templateAssign ( 'baseURL', GLM_MEMBERS_PLUGIN_BASE_URL);
         $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_URL );
@@ -395,11 +421,6 @@ class glmMembersFront extends GlmPluginSupport
 
         $smarty->templateAssign('thisAction', $action);
 
-        // If there's an error message, add that also
-        if ($errorMsg != '') {
-            $smarty->templateAssign('errorMsg', $errorMsg);
-        }
-
         // If view debug has been requested
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
 
index fda3410..f2938f4 100644 (file)
@@ -32,6 +32,9 @@
     text-align: center;
     margin: 2em;
 }
+.glm-clear {
+    clear: both;
+}
 
 .glm-button {
     margin-left: 4px !important;
index 9f9f4ab..a57a51d 100644 (file)
@@ -27,7 +27,7 @@
 .glm-member-list-info {
     clear: both;
 }
-.glm-member-list-categories {
+.glm-member-list-items {
     margin-top: .5em;
 }
 
@@ -42,3 +42,8 @@
 .glm-map img {
     max-width: none !important;
 }
+.glm-map-member-name {
+    width: 100%;
+    font-weight: bold;
+    border-bottom: 2px #ccc solid;
+}
\ No newline at end of file
index e1e67c2..d9d4e4d 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-09 19:07:47
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-15 10:21:53
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html" */ ?>
 <?php /*%%SmartyHeaderCode:94073808254c05abfc4adf1-45287000%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '1be35689c5d30d774f40ebc45e387f5f95c45e90' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html',
-      1 => 1425940975,
+      1 => 1426429308,
       2 => 'file',
     ),
   ),
@@ -54,7 +54,6 @@ $_valid = $_smarty_tpl->decodeProperties(array (
         Add New Member
   <?php }?>
     </h2>
-
   
     <form action="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
 ?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
@@ -72,6 +71,8 @@ $_valid = $_smarty_tpl->decodeProperties(array (
       <?php }?>
         
         <table class="glm-admin-table">
+            <tr><th>ID</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['id'];?>
+</td></tr>
             <tr>
                 <th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['name']) {?>class="glm-required"<?php }?>>Member Name:</th>
                 <td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?>class="glm-form-bad-input"<?php }?>>
index 2bee983..92fce18 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-10 11:33:06
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-03-15 10:14:45
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/list.html" */ ?>
 <?php /*%%SmartyHeaderCode:33593880254c05ab8e362a8-88978550%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '4c287ca0e4946b3d644e61950c851e98e8906d49' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/list.html',
-      1 => 1426001563,
+      1 => 1426428835,
       2 => 'file',
     ),
   ),
@@ -48,8 +48,9 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     <table class="wp-list-table widefat fixed posts glm-admin-table"">
         <thead>
             <tr>
-                <th>Access</th>
+                <th>ID</th>
                 <th>Member Name</th>
+                <th>Access</th>
                 <th>Member Type</th>
                 <th>Date Created</th>
                 <th>Pending</th>
@@ -70,7 +71,7 @@ $_smarty_tpl->tpl_vars['m']->_loop = true;
             <tr class="alternate">
         <?php }?>
                 <td>
-                    <?php echo $_smarty_tpl->tpl_vars['m']->value['access']['name'];?>
+                    <?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
 
                 </td>
                 <td>
@@ -78,6 +79,10 @@ $_smarty_tpl->tpl_vars['m']->_loop = true;
 ?page=glm-members-admin-menu-member&glm_action=index&member=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
 "><?php echo $_smarty_tpl->tpl_vars['m']->value['name'];?>
 </a>
+                </td>
+                <td>
+                    <?php echo $_smarty_tpl->tpl_vars['m']->value['access']['name'];?>
+
                 </td>
                 <td>
                     <?php echo $_smarty_tpl->tpl_vars['m']->value['member_type']['name'];?>
index 2a5b437..0eb9ddf 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_configure_accommodationTypes extends GlmDataAccommodationT
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_configure_accommodationTypes extends GlmDataAccommodationT
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
index 090ff01..0d0cacf 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_configure_amenities extends GlmDataAmenities
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_configure_amenities extends GlmDataAmenities
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
index fe22426..e582815 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_configure_categories extends GlmDataCategories
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_configure_categories extends GlmDataCategories
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
index 3d17b65..d721708 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_configure_cities extends GlmDataCities
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_configure_cities extends GlmDataCities
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
index 6f51831..9f9b242 100644 (file)
@@ -90,7 +90,7 @@ class GlmMembersAdmin_configure_development
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         // Get current database version
index 99139bc..3d23663 100644 (file)
@@ -90,7 +90,7 @@ class GlmMembersAdmin_configure_index
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         // Determine if current user can add, edit, delete member data
index 338c952..524fa46 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_configure_memberTypes extends GlmDataMemberTypes
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_configure_memberTypes extends GlmDataMemberTypes
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
index a29e6e2..f2f6fbe 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_configure_regions extends GlmDataRegions
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_configure_regions extends GlmDataRegions
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
index 2868efa..6d2e593 100644 (file)
@@ -99,7 +99,7 @@ class glmMembersAdmin_error_badAction
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         // No work to perform here so just return status
index 38ca2cf..20456e3 100644 (file)
@@ -65,7 +65,7 @@ class GlmMembersAdmin_error_index
 
     }
 
-    public function modelAction($redirectData = false) {
+    public function modelAction($actionData = false) {
 
         // Return status, any suggested view, and any data to controller
         return array(
index 2179547..b7ed4c0 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $success = true;
@@ -114,9 +114,9 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
         $haveMemberTypes = ($memberTypesStats > 0);
 
         // Check if a redirecting model supplied the member ID
-        if (isset($redirectData['memberID'])) {
+        if (isset($actionData['memberID'])) {
 
-            $memberID = $redirectData['memberID'];
+            $memberID = $actionData['memberID'];
 
         // Otherwise check if one was supplied by the user or passed from somewhere else
         } elseif (isset($_REQUEST['id'])) {
index b78846c..76f2d00 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
         // Add scrips and css
         add_action('glm_members_memberInfo_enqueue_scripts',
@@ -129,7 +129,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
         // Set some default values
         $success = true;
@@ -152,13 +152,13 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
         }
 
         // Check for redirection - Should be from creating a new member
-        if ($redirectData) {
+        if ($actionData) {
 
-            if (!isset($redirectData['member'])) {
-                $memberID = $redirectData['member']-0;
+            if (!isset($actionData['member'])) {
+                $memberID = $actionData['member']-0;
             }
 
-            $memberID = $redirectData['member']-0;
+            $memberID = $actionData['member']-0;
             $option = 'create';
 
         // Otherwise it should be a user submission
index af8b219..807302e 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
         $success = true;
 
index da0c6fe..01acdcf 100644 (file)
@@ -57,8 +57,13 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         // Save plugin configuration object
         $this->config = $config;
 
-        // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        /*
+         * Run constructor for members data class to setup table and fields array
+         *
+         * Since this class is extending GlmDataMembers, it does not need to pass
+         * $wpdb and $config to it in the constructor.
+         */
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +101,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
         $where = '';
         $filterPending = false;
diff --git a/models/admin/shortcodes/index.php b/models/admin/shortcodes/index.php
new file mode 100644 (file)
index 0000000..86154a6
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Shortcodes Reference
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called when the "Shortcodes" menu is selected
+ *
+ */
+class GlmMembersAdmin_shortcodes_index
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * '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.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+    }
+
+    public function modelAction($actionData = false) {
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/shortcodes/index.html',
+                'data' => false
+        );
+
+    }
+}
+
+?>
\ No newline at end of file
diff --git a/models/front/error/badAction.php b/models/front/error/badAction.php
new file mode 100644 (file)
index 0000000..00a9545
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front-End Bad Action Error Model
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  front.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called if a bad action has been requested.
+ *
+ */
+class glmMembersFront_error_badAction
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * '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.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+    }
+
+    /*
+     * 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)
+    {
+
+        // No work to perform here so just return status
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'menuItemRedirect' => false,
+                'modelRedirect' => false,
+                'view' => 'front/error/badAction.html',
+                'data' => false
+        );
+    }
+}
+
+?>
\ No newline at end of file
diff --git a/models/front/error/index.php b/models/front/error/index.php
new file mode 100644 (file)
index 0000000..8562859
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front-End Generic Error Model
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  front.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called if there is a generic/unknown error
+ *
+ */
+class GlmMembersFront_error_index
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * '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.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+    }
+
+    public function modelAction($actionData = false) {
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'front/error/index.html',
+                'data' => false
+        );
+
+    }
+}
+
+?>
\ No newline at end of file
diff --git a/models/front/members/detail.php b/models/front/members/detail.php
new file mode 100644 (file)
index 0000000..2a3b561
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Front Member Detail
+ *
+ * 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_detail 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)
+    {
+
+        $where = '';
+        $haveMember = false;
+
+        // If member ID submitted in the URL
+        if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
+
+            $id = ($_REQUEST['id'] - 0);
+
+        // Otherwise if ID from the short-code
+        } elseif (isset($actionData['request']) && isset($actionData['request']['id'])) {
+
+            $id = ($actionData['request']['id'] - 0);
+
+        }
+
+        // Check that ID is a positive value
+        if ($id <= 0) {
+
+            return array(
+                    'status' => true,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'front/error/index.html',
+                    'data' => false
+            );
+
+        }
+
+        // Find the active member info record
+        $memberInfoID = $this->getActiveInfoForMember($id);
+
+        /*
+         *  Get data on the specified member
+         */
+        $memberData = $this->getEntry($memberInfoID);
+
+
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+            glmMembersFront::addNotice($memberData, 'DataBlock', 'Member Data');
+        }
+
+        // If we have member data
+        $success = true;
+        $haveMember = false;
+        if ($memberData !== false) {
+
+            $success = true;
+            $haveMember = true;
+
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveMember' => $haveMember,
+            'member' => $memberData,
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'front/members/detail.html',
+            'data' => $templateData
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
index 4ee3ddf..3ae629d 100644 (file)
@@ -58,7 +58,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         $this->config = $config;
 
         // Run constructor for members data class
-        parent::__construct($this->wpdb, $this->config);
+        parent::__construct(false, false);
 
     }
 
@@ -96,7 +96,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
      * produce output.
      *
      */
-    public function modelAction ($redirectData = false)
+    public function modelAction ($actionData = false)
     {
 
         $where = '';
@@ -105,6 +105,8 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
         $filterName = false;
         $haveFilter = false;
 
+        // Apply any specified category filter
+
         $where .= " T.status = ".$this->config['status_numb']['Active'];
 
         /*
index 83325d0..c816db0 100644 (file)
     <table class="wp-list-table widefat fixed posts glm-admin-table"">
         <thead>
             <tr>
+                <th>ID</th>
                 <th>Category</th>
                 <th>Description</th>
                 <th>Short Description</th>
         {else}
             <tr class="alternate">
         {/if}
+                <td>{$t.id}</td>
                 <td>
                     <span{if $t.parent.value} class="glm-indent"{/if}>
                         <a class="editCategory" data-categoryID="{$t.id}" data-categoryParent="{$t.parent.value}">{$t.name}</a>
index 67ad247..afe52b9 100644 (file)
@@ -13,7 +13,6 @@
         Add New Member
   {/if}
     </h2>
-
   
     <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
         <input type="hidden" name="glm_action" value="index">
@@ -27,6 +26,7 @@
       {/if}
         
         <table class="glm-admin-table">
+            <tr><th>ID</th><td>{$member.fieldData.id}</td></tr>
             <tr>
                 <th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
                 <td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
index 5781ad2..18b953b 100644 (file)
@@ -12,8 +12,9 @@
     <table class="wp-list-table widefat fixed posts glm-admin-table"">
         <thead>
             <tr>
-                <th>Access</th>
+                <th>ID</th>
                 <th>Member Name</th>
+                <th>Access</th>
                 <th>Member Type</th>
                 <th>Date Created</th>
                 <th>Pending</th>
             <tr class="alternate">
         {/if}
                 <td>
-                    {$m.access.name}
+                    {$m.id}
                 </td>
                 <td>
                     <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$m.id}">{$m.name}</a>
                 </td>
+                <td>
+                    {$m.access.name}
+                </td>
                 <td>
                     {$m.member_type.name}
                 </td>
diff --git a/views/admin/shortcodes/header.html b/views/admin/shortcodes/header.html
new file mode 100644 (file)
index 0000000..f9fdb91
--- /dev/null
@@ -0,0 +1,5 @@
+<div class="wrap">
+       
+    <h2>{$glmPluginName}</h2>
+    
+  
\ No newline at end of file
diff --git a/views/admin/shortcodes/index.html b/views/admin/shortcodes/index.html
new file mode 100644 (file)
index 0000000..93dfb92
--- /dev/null
@@ -0,0 +1,63 @@
+{include file='admin/shortcodes/header.html'}    
+    
+    <h2>Shortcodes Reference</h2>
+    
+    <p>
+        Listed below are the shortcodes that may be used in this Web site to display
+        member lists, member detail information, maps of members, and other related
+        information. Simply paste these codes into a the text content editor for a page 
+        in this Web site. You may also include other text along with the shortcode. 
+        Some shortcodes allow for additional "attributes" you can use to more specifically
+        direct what will be displayed on the page.  
+    </p><p>
+        When using a Shortcode in a page, be sure to include the "[" and "]" characters.
+        The attributes show below each Shortcode in the table below may be included in the
+        Shortcode to modify behavior of the Shortcode. One or more of these attributes may be
+        inserted into the shortcode. When including multiple attributes in a Shortcode,
+        be sure to leave a space between the attributes. An example is shown below.   
+    </p>
+    <p><pre>[glm-members action="list" category="Accommodations"]</pre></p>
+    
+    <table class="glm-admin-table">
+        <tr><th>Shortcode</th><th>Attribute</th><th>Attribute Value</th><th>Description</th></tr>
+        <tr>
+            <th colspan="3">[glm-member-list]</th>
+            <td>
+                Displays a list of members and a map with markers for each member. Optionally, 
+                the attributes below may used to modify the display of this page.
+            </td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <th colspan="2">
+                category="{ category ID(s) }"
+            </th>
+            <td>
+                The "category" attribute is used display only members in a specific category or 
+                ctegories. To select multiple categories, separate the categories with a ",". 
+                Categories are specified by ID number. The ID for each category is 
+                shown in the Member Categories list. 
+            </td>
+        </tr>
+        <tr>
+            <th colspan="3">[glm-member-detail]</th>
+            <td>
+                Displays details for a speicif member along with a map showing their location. The 
+                "id" attribute below is required to specify which member to display. 
+            </td>
+        </tr>
+         <tr>
+            <td>&nbsp;</td>
+            <th colspan="2">
+                id="{ member ID }"
+            </th>
+            <td>
+                This is a required attribute for [glm-member-detail] that specifies the ID of
+                the desired member. The ID for a member is displayed both in the left column
+                of the member list and at the top of the Member Dashboard. Only one ID may
+                be specified.
+            </td>
+        </tr>
+    </table>
+    
+{include file='admin/footer.html'}
index 7165a07..a19e0f9 100644 (file)
@@ -2,10 +2,8 @@
     
     <h2>Sorry, we've had an error.</h2>
     
-    <p><b>Error: </b>: An invalid action has been specified.</p>
+    <p><b>Error: </b>: An invalid action or Shortcode attribute has been specified.</p>
     
-    {if $errorMsg}<p>{$errorMsg}</p>{/if}
-
     <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
       
 {include file='front/footer.html'}
index f9fdb91..2b17b0e 100644 (file)
@@ -1,5 +1,4 @@
 <div class="wrap">
        
-    <h2>{$glmPluginName}</h2>
     
   
\ No newline at end of file
index ece4c86..16f771f 100644 (file)
@@ -4,6 +4,8 @@
     
         <h3>Sorry, we've had some type of fatal error.</h3>
         
+     {if $errorMsg}<p>{$errorMsg}</p>{/if}
+        
         <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
           
     </center>
diff --git a/views/front/members/detail.html b/views/front/members/detail.html
new file mode 100644 (file)
index 0000000..ae63293
--- /dev/null
@@ -0,0 +1,105 @@
+{include file='front/members/header.html'}
+
+{if $haveMember}
+
+        <script src="http://maps.googleapis.com/maps/api/js?sensor=true&key={$googleMapsBrowserApiKey}"></script>
+
+        <div id="locationMap" class="glm-map">(map loads here)</div>     
+                    
+    
+    <h3>Member Detail</h3>
+    
+        <div class="glm-member-list-container">
+            <div class="glm-member-list-image"><img src="{$glmPluginMediaURL}/images/small/{$member.logo}"></div>
+            <div class="glm-member-list-nameAddress">
+                <h2><a href="{$thisURL}?glm_action=detail&id={$member.id}">{$member.member}</a></h2>
+                <p>
+                    {if $member.addr1}{$member.addr1}<br>{/if}
+                    {if $member.addr2}{$member.addr2}<br>{/if}
+                    {if $member.city.name}{$member.city.name}{if $member.state.name}, {/if}{/if}{if $member.state.name}{$member.state.name}{/if}{if $member.zip} {$member.zip}{/if} 
+                    {if $member.country.name}<br>{$member.country.name}{/if}
+                    {if $member.region.value}<p><b>Region:</b> {$member.region.name}</p>{/if}
+                </p>                
+            </div>
+            <div class="glm-member-list-info">
+        {if $member.descr}
+                <p>{$member.descr}</p>
+        {else if $member.short_descr}
+                <p>{$member.short_descr}</p>
+        {/if}
+                {if $member.phone}<b>Phone:</b> {$member.phone}<br>{/if}
+                {if $member.toll_free}<b>Toll Free:</b> {$member.toll_free}<br>{/if}
+                {if $member.url}<b>Web site:</b> <a href="{$member.url}">{$member.url}</a><br>{/if}
+        {if $member.categories}
+                <div class="glm-member-list-items">           
+                    <b>Member Categories</b>
+                    <ul>
+            {foreach $member.categories as $c}
+                        <li>
+                            {if $c.parent_name}{$c.parent_name}: {/if}{$c.name}
+                        </li>
+            {/foreach}
+                    </ul>
+                </div>
+        {/if}
+        {if $member.cc_type}
+                <div class="glm-member-list-items">           
+                    <b>Credit Cards Accepted:</b>
+                    <ul>
+            {foreach $member.cc_type.names as $c}
+                        <li>{$c}</li>
+            {/foreach}
+                    </ul>        
+                </div>
+        {/if}
+            </div>
+        </div>
+
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+
+            /*
+             * Google Maps
+             *  API reference: https://developers.google.com/maps/documentation/javascript/reference
+             */
+             
+            function initMap() {
+                
+                // Set default - Need to make this configurable
+                var location = new google.maps.LatLng({$member.lat}, {$member.lon});
+                var map = new google.maps.Map(document.getElementById('locationMap'), {
+                       zoom: 14,
+                       center: location,
+                    disableDefaultUI: false,   
+                    mapTypeId: google.maps.MapTypeId.MAP,  
+                });  
+    
+                // Create a marker for this member
+                var marker = new google.maps.Marker({  
+                    map: map,  
+                    position: new google.maps.LatLng({$member.lat}, {$member.lon}),
+                    draggable: false,
+                    animation: google.maps.Animation.DROP,  
+                    title: '{$member.member}',
+                    descr: ' \
+                        <div class="glm-map-member-name">{$member.member}</div> \
+                        {if $member.short_descr}{$member.short_descr}<br>{/if} \
+                        <a href="{$member.url}" target="memberWebSite">{$member.url}</a><br> \
+                        </p>',
+                    memberID: {$member.id}
+                });
+                
+            }
+            
+            // Load map
+            google.maps.event.addDomListener(window, 'load', initMap); 
+           
+        });
+    </script>
+  
+{else}
+        <p>For some reason the specified member was not found. Please try again.</p>
+{/if}
+
+
+{include file='front/footer.html'}
index 085f367..420075c 100644 (file)
         <div class="glm-member-list-container">
             <div class="glm-member-list-image"><img src="{$glmPluginMediaURL}/images/small/{$m.logo}"></div>
             <div class="glm-member-list-nameAddress">
-                <h2><a href=""{$thisURL}?action=detail&member={$m.id}">{$m.member}</a></h2>
+                <h2><a href="{$thisURL}?glm_action=detail&id={$m.member_pointer}">{$m.member}</a></h2>
                 <p>
                     {if $m.addr1}{$m.addr1}<br>{/if}
                     {if $m.addr2}{$m.addr2}<br>{/if}
                     {if $m.city.name}{$m.city.name}{if $m.state.name}, {/if}{/if}{if $m.state.name}{$m.state.name}{/if}{if $m.zip} {$m.zip}{/if} 
                     {if $m.country.name}<br>{$m.country.name}{/if}
-                    {if $m.region.value}<p>Region: {$m.region.name}</p>{/if}
+                    {if $m.region.value}<p><b>Region:</b> {$m.region.name}</p>{/if}
                 </p>                
             </div>
             <div class="glm-member-list-info">
         {else if $m.short_descr}
                 <p>{$m.short_descr}</p>
         {/if}
-                {if $m.phone}Phone: {$m.phone}<br>{/if}
-                {if $m.toll_free}Toll Free: {$m.toll_free}<br>{/if}
-                {if $m.url}Web site: <a href="{$m.url}">{$m.url}</a><br>{/if}
+                {if $m.phone}<b>Phone:</b> {$m.phone}<br>{/if}
+                {if $m.toll_free}<b>Toll Free:</b> {$m.toll_free}<br>{/if}
+                {if $m.url}<b>Web site:</b> <a href="{$m.url}">{$m.url}</a><br>{/if}
         {if $m.categories}
-                <div class="glm-member-list-categories">           
-                    Member Categories
+                <div class="glm-member-list-items">           
+                    <b>Member Categories</b>
                     <ul>
             {foreach $m.categories as $c}
                         <li>
             {/foreach}
                     </ul>
                 </div>
+        {/if}
+        {if $m.cc_type}
+                <div class="glm-member-list-items">           
+                    <b>Credit Cards Accepted:</b>
+                    <ul>
+            {foreach $m.cc_type.names as $c}
+                        <li>{$c}</li>
+            {/foreach}
+                    </ul>        
+                </div>
         {/if}
             </div>
         </div>
 {else}
         <div>(no members listed)</div>
 {/if}
-                {if $m.toll_free}<p>{$m.toll_free}</p>{/if}
 
     <script type="text/javascript">
         jQuery(document).ready(function($) {
 
             /*
              * Google Maps
-             *  API reference: https://develope                {if $m.toll_free}<p>{$m.toll_free}</p>{/if}
-rs.google.com/maps/documentation/javascript/reference
+             *  API reference: https://developers.google.com/maps/documentation/javascript/reference
              */
             
             // Set default - Need to make this configurable
@@ -66,15 +74,13 @@ rs.google.com/maps/documentation/javascript/reference
             var startLon = -84;
             var location = new google.maps.LatLng(startLat, startLon);
             var map = new google.maps.Map(document.getElementById('locationMap'), {  
-                maxZoom: 12,  
+//                maxZoom: 12,  
                 disableDefaultUI: false,   
                 mapTypeId: google.maps.MapTypeId.MAP,  
             });  
             var geocoder = new google.maps.Geocoder();
             var bounds = new google.maps.LatLngBounds();
-            var infowindow = new google.maps.InfoWindow({
-               maxWidth: 300
-            });            
+            var infowindow = new google.maps.InfoWindow();            
 
     {if $haveMembers}
         {foreach $members as $m}
@@ -87,10 +93,10 @@ rs.google.com/maps/documentation/javascript/reference
                 animation: google.maps.Animation.DROP,  
                 title: '{$m.member}',
                 descr: ' \
-                    <b>{$m.member}</b><hr> \
-                    <p>{$m.short_descr}<br> \
+                    <div class="glm-map-member-name">{$m.member}</div> \
+                    {if $m.short_descr}{$m.short_descr}<br>{/if} \
                     <a href="{$m.url}" target="memberWebSite">{$m.url}</a><br> \
-                    <a href="{$thisURL}?action=detail&member={$m.id}">More Info</a> \
+                    <a href="{$thisURL}?glm_action=detail&id={$m.member_pointer}"><br>More Info</a> \
                     </p>',
                 memberID: {$m.id}
             });