Continuing development. Now have preliminary organization of menu items and tabs.
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 14 Jan 2015 23:28:53 +0000 (18:28 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Wed, 14 Jan 2015 23:28:53 +0000 (18:28 -0500)
38 files changed:
classes/glmPluginSupport.php
controllers/admin.php
css/admin.css
index.php
lib/GlmDataAbstract/DataAbstract.php
lib/smartyTemplateSupport.php
misc/smarty/templates_c/06926788f51c1a5a54be2a368556f9c37e2780da.file.badAction.html.php
misc/smarty/templates_c/081a36d97cdf30d438a1e104c26a275acc180da0.file.index.html.php
misc/smarty/templates_c/15f83071407dddb0b3c23ae1a70b66cefbd681db.file.header.html.php
misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php [new file with mode: 0644]
misc/smarty/templates_c/25c8610e0e0bacafec3046a296066e9f8eceedae.file.member.html.php [new file with mode: 0644]
misc/smarty/templates_c/3ec5bcbe581d6335e06bc6c9474f73121a83d59b.file.header.html.php
misc/smarty/templates_c/47fb9b803e7138d215645f3c977b0b1dc2a9e718.file.index.html.php
misc/smarty/templates_c/50e78f1400d6db96c588c737669426ab57397d1d.file.footer.html.php
misc/smarty/templates_c/60cbe99d19bbec013cbca4d9344f2fd4a4152f52.file.index.html.php
misc/smarty/templates_c/c74bd17240f8892f8955e8bedbedd434341aeca9.file.header.html.php [new file with mode: 0644]
models/admin/error/index.php
models/admin/member/index.php [new file with mode: 0644]
models/admin/member/member.php [new file with mode: 0644]
models/admin/members/add.php [deleted file]
models/admin/members/delete.php [deleted file]
models/admin/members/display.php [deleted file]
models/admin/members/edit.php [deleted file]
models/admin/members/index.php
readme.txt
views/admin/configure/headder.html [deleted file]
views/admin/configure/header.html [new file with mode: 0644]
views/admin/configure/index.html
views/admin/error/badAction.html
views/admin/error/index.html
views/admin/footer.html
views/admin/member/header.html [new file with mode: 0644]
views/admin/member/index.html [new file with mode: 0644]
views/admin/member/member.html [new file with mode: 0644]
views/admin/members/edit.html [deleted file]
views/admin/members/headder.html [deleted file]
views/admin/members/header.html [new file with mode: 0644]
views/admin/members/index.html

index bd35635..b7f4dd6 100644 (file)
@@ -28,7 +28,7 @@ class GlmPluginSupport
      * @return void
      * @access public
      */
-    public function addNotice ($message, $title = false)
+    public static function addNotice ($message, $title = false)
     {
         $notices = get_option('glmMembersAdminNotices');
 
index d1628f6..5f3f4f0 100644 (file)
 $GLOBALS['glmMembersAdminValidActions'] = array(
 
         'members' => array(
-                'index',
-                'display',
-                'edit',
-                'add',
-                'delete'
+                'index', // member list
+                'reports',
+                'other'
         ),
+        'member' => array(
+                'index', // Member Dashboard
+                'member',
+                'locations',
+                'facilities',
+                'activities',
+                'accommodations'
+        )
+        ,
         'configure' => array(
                 'index',
                 'cities',
@@ -41,6 +48,7 @@ $GLOBALS['glmMembersAdminValidActions'] = array(
                 'regions'
         ),
         'error' => array(
+                'index',
                 'badAction'
         )
 );
@@ -176,10 +184,11 @@ class glmMembersAdmin extends GlmPluginSupport
         }
 
         // Add hooks to WordPress
-        add_action('admin_menu', array(
-                $this,
-                'configureMenus'
-        ));
+        add_action('admin_menu',
+                array(
+                        $this,
+                        'configureMenus'
+                ));
 
         // Add admin scripts and css
         add_action('admin_enqueue_scripts',
@@ -203,7 +212,8 @@ class glmMembersAdmin extends GlmPluginSupport
     {
         wp_enqueue_media();
         wp_register_script('glm-members-admin-js',
-                GLM_MEMBERS_PLUGIN_URL . 'js/admin.js', array(
+                GLM_MEMBERS_PLUGIN_URL . 'js/admin.js',
+                array(
                         'jquery'
                 ));
         wp_enqueue_script('glm-members-admin-js');
@@ -242,6 +252,13 @@ class glmMembersAdmin extends GlmPluginSupport
                         'glmMembersAdminMenuMembers'
                 ));
 
+        add_submenu_page('glm-members-admin-menu-members', 'Member Information',
+                'Member', 'glm_members_member', 'glm-members-admin-menu-member',
+                array(
+                        $this,
+                        'glmMembersAdminMenuMember'
+                ));
+
         add_submenu_page('glm-members-admin-menu-members',
                 'Configure Members Database', 'Configure',
                 'glm_members_configure', 'glm-members-admin-menu-configure',
@@ -271,6 +288,11 @@ class glmMembersAdmin extends GlmPluginSupport
     }
 
     // Add Sub Menu Items
+    public function glmMembersAdminMenuMember ()
+    {
+        $this->controller('member');
+    }
+
     public function glmMembersAdminMenuConfigure ()
     {
         $this->controller('configure');
@@ -328,6 +350,7 @@ class glmMembersAdmin extends GlmPluginSupport
      */
     public function controller ($menuItem)
     {
+        $errorMsg = '';
 
         /*
          * Determine model to execute
@@ -345,12 +368,30 @@ class glmMembersAdmin extends GlmPluginSupport
             }
         }
 
-        // Loop as long as there's a model redirect.
+        // Loop till we have a final action
+        $loopCheck = 0;
         do {
 
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                $this->addNotice("<b>Requested Action:</b> Menu item = $menuItem, Action = $action");
+            }
+
+            $modelRedirect = false;
+
+            // Verify that we have the requested menu item in the valid actions
+            if (!isset($GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
+
+                $modelRedirect = true;
+                $menuItem = 'error';
+                $action = 'index';
+                $errorMsg .= "<b>Model doesn't exist:</b> ".$modelName;
+
+            }
+
             // Verify Menu item and action using array at top of this file
-            if (! in_array($action,
-                    $GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
+            if (! isset($GLOBALS['glmMembersAdminValidActions'][$menuItem]) ||
+                     ! in_array($action,
+                            $GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
                 $menuItem = 'error';
                 $action = 'badAction';
             }
@@ -359,29 +400,77 @@ class glmMembersAdmin extends GlmPluginSupport
              * Execute the selected model
              */
 
-            // Build model and path and class names and load the model
+            // Build model and path and class names
             $modelName = GLM_MEMBERS_PLUGIN_DIR . '/models/admin/' . $menuItem .
                      '/' . $action . '.php';
             $className = 'GlmMembersAdmin_' . $menuItem . '_' . $action;
-            require_once ($modelName);
 
-            // Instantiate the model and ask it to perform the work
-            $model = new $className($this->wpdb, $this->config);
-            $results = $model->modelAction();
+            // If model file doesn't exist - we have an error
+            if (!file_exists($modelName)) {
 
-            // Check if there's been a model redirect request
-            $modelRedirect = false;
-            if ($results['modelRedirect']) {
+                $modelRedirect = true;
+                $menuItem = 'error';
+                $action = 'index';
+                $errorMsg .= "<b>Model doesn't exist:</b> ".$modelName;
 
-                // Set the new model action
-                $action = $results['modelRedirect'];
+            // Otherwise, load and run the model
+            } else {
 
-                // Check if there's also a menu item change
-                if ($results['menuItemRedirect']) {
-                    $menuItem = $results['menuItemRedirect'];
-                }
+                // Load the model file
+                require_once ($modelName);
 
-                $modelRedirect = true;
+                // check for an invalid model class name
+                if (!class_exists($className)) {
+
+                    $modelRedirect = true;
+                    $menuItem = 'error';
+                    $action = 'index';
+                    $errorMsg .= "<b>Model class doesn't exist:</b> ".$className;
+
+                } else {
+
+                    // Instantiate the model and ask it to perform the work
+                    $model = new $className($this->wpdb, $this->config);
+                    $results = $model->modelAction();
+
+                    // Check if there's been a model redirect request
+                    if ($results['modelRedirect']) {
+
+                        // Set the new model action
+                        $action = $results['modelRedirect'];
+
+                        // Check if there's also a menu item change
+                        if ($results['menuItemRedirect']) {
+                            $menuItem = $results['menuItemRedirect'];
+                        }
+
+                        $modelRedirect = true;
+                    }
+
+                    // Get the specified view file
+                    $view = false;
+                    if (isset($results['view'])) {
+                        $view = $results['view'];
+                    }
+
+                    // Check for invalid or missing view file
+                    if (!$view || !is_file(GLM_MEMBERS_PLUGIN_DIR . '/views/'.$view)) {
+                        $modelRedirect = true;
+                        $menuItem = 'error';
+                        $action = 'index';
+                        $errorMsg .= "<b>Bad or missing view file:</b> ".$view;
+                    }
+
+                } // model class exists
+            }
+
+            // 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/admin.php".</h1>');
+            }
+
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG && $modelRedirect) {
+                $this->addNotice('<b>Redirecting...</b>');
             }
 
             // Loop again if there's a model redirect
@@ -414,9 +503,19 @@ class glmMembersAdmin 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_ADMIN_DEBUG) {
 
+            glmMembersAdmin::addNotice("<b>Template Data</b><br> $view");
+
             $x = $smarty->template->getTemplateVars();
             $templateVars = '<pre>' . print_r($x, 1) . '</pre>';
             glmMembersAdmin::addNotice($templateVars, 'Template Parameters');
index 2876646..2175f67 100644 (file)
     background-color: #fff;
 } 
 
+/* Admin Tabs */
+.nav-tab {
+    font-size: 15px !important;
+    font-weight: bold;
+}
+.nav-tab-active {
+    font-size: 15px !important;
+    font-weight: bold;
+    text-decoration: none;
+    border: 2px #ccc solid;
+    border-bottom: 0px;
+    padding: 6px 10px 8px 10px;
+    background-color: #f8f8f8;
+}
+.disabled {
+    pointer-events: none;
+    cursor: default;
+    color: #ccc;
+}
+
 /* Admin Forms */
 .glm-form-bad-input {
     background: #FFaBa9;
index 6eddbac..3d6ded5 100644 (file)
--- a/index.php
+++ b/index.php
@@ -48,6 +48,7 @@
 
 // Debug Options
 define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG', true);
+define('GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE', false);
 
 // Plugin Versions
 define('GLM_MEMBERS_PLUGIN_VERSION', 0.1);
@@ -325,7 +326,7 @@ function glmMembersAdminNotices($windowed = false)
 }
 // Check if there's admin notices for output
 $notices = get_option('glmMembersAdminNotices');
-if (is_admin() && $notices) {
+if (is_admin() && $notices && !GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
     // Add action to output the notices
     add_action('admin_notices','glmMembersAdminNotices');
 }
index c975706..9412e28 100755 (executable)
@@ -2378,6 +2378,11 @@ abstract class GlmDataAbstract
     public function processOutputData($data, $op = 'l', $forEdit = false, $id = false, $idfield = 'id')
     {
 
+        if ($forEdit) {
+            $fieldRequired = array();
+            $fieldFail = array();
+        }
+
         // For each possible field
         reset($this->fields);
         while (list($k, $v) = each($this->fields )) {
@@ -2414,9 +2419,21 @@ abstract class GlmDataAbstract
                 $out = $this->{$type.'Output'}($v, $d, $forEdit, $id, $idfield, $op);
 
                 $data[$as] = $out;
+
+                if($forEdit) {
+                    $fieldRequired[$as] = (isset($v['required']) && $v['required']);
+                    $fieldFail[$as] = false;
+                }
             }
         }
 
+        if ($forEdit) {
+            return array(
+                'fieldData' => $data,
+                'fieldRequired' => $fieldRequired,
+                'fieldFail' => $fieldFail
+            );
+        }
         return $data;
     }
 
@@ -2523,6 +2540,10 @@ abstract class GlmDataAbstract
                   FROM $this->table
                  WHERE $where;";
 
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - getStats() query");
+        }
+
         $stats = $this->wpdb->get_results($sql, ARRAY_A);
 
         return $stats['count'];
@@ -2557,7 +2578,11 @@ abstract class GlmDataAbstract
             ";
         }
 
-//echo "<pre>$sql</pre>";
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - getList() query");
+        }
+
+        //echo "<pre>$sql</pre>";
         $list = $this->wpdb->get_results($sql, ARRAY_A);
 
         if (count($list) == 0)
@@ -2593,7 +2618,11 @@ abstract class GlmDataAbstract
                        $where
                 ;";
 
-        $detail = $this->wpdb->get_results($sql, ARRAY_A);
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - getEntry() query");
+        }
+
+        $detail = $this->wpdb->get_row($sql, ARRAY_A);
 
         // If nothing was found, simply return false
                if ($detail == false) {
@@ -2684,6 +2713,10 @@ abstract class GlmDataAbstract
                 $detail = $this->wpdb->get_row($sql, ARRAY_A);
                 $r['insertedID'] = $detail['currval'];
 
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+                    glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - insertEntry() query");
+                }
+
                 // Get the data again for output
                 $r['fieldData'] = $this->getEntry($r['insertedID']);
 
@@ -2709,7 +2742,11 @@ abstract class GlmDataAbstract
                 WHERE $idfield = $id
                 ;";
 
-        $detail = $this->wpdb->get_results($sql, ARRAY_A);
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - editEntry() query");
+        }
+
+        $detail = $this->wpdb->get_row($sql, ARRAY_A);
 
         // Process individual fields
         $detail = $this->processOutputData($detail, 'e', true, $id, $idfield);
@@ -2776,6 +2813,10 @@ abstract class GlmDataAbstract
                 WHERE $idField = $id;
             ";
 
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+                glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - updateEntry() query");
+            }
+
             // Now store the field data
             $this->wpdb->query($sql, ARRAY_A);
 
@@ -2829,6 +2870,10 @@ abstract class GlmDataAbstract
                      WHERE $idField = $id;
                 ";
 
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+                    glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - deleteEntry() query");
+                }
+
                 // Assume things will go fine
                 try {
                     $this->wpdb->query($sql, ARRAY_A);
index 36e6abd..a5dd0f5 100644 (file)
@@ -71,7 +71,6 @@ class smartyTemplateSupport {
            $this->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
                $this->templateAssign ( 'thisURL', $scriptURL );
                $this->templateAssign ( 'thisPage', $_REQUEST['page']);
-               $this->templateAssign ( 'thisAction', $action);
                $this->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
                $this->templateAssign ( 'thisYear', date ( 'Y' ) );
 
index d0c996f..186d759 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-12 20:28:09
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 22:12:00
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/badAction.html" */ ?>
 <?php /*%%SmartyHeaderCode:210264866954b42dd4bbc715-16113482%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '06926788f51c1a5a54be2a368556f9c37e2780da' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/badAction.html',
-      1 => 1421094485,
+      1 => 1421264558,
       2 => 'file',
     ),
   ),
@@ -17,6 +17,10 @@ $_valid = $_smarty_tpl->decodeProperties(array (
   ),
   'version' => 'Smarty-3.1.21-dev',
   'unifunc' => 'content_54b42dd4c09430_68496846',
+  'variables' => 
+  array (
+    'errorMsg' => 0,
+  ),
   'has_nocache_code' => false,
 ),false); /*/%%SmartyHeaderCode%%*/?>
 <?php if ($_valid && !is_callable('content_54b42dd4c09430_68496846')) {function content_54b42dd4c09430_68496846($_smarty_tpl) {?><div class="wrap">
@@ -24,6 +28,9 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     <h2>Sorry, we've had an error.</h2>
     
     <p><b>Error: </b>: An invalid action has been specified.</p>
+    
+    <?php if ($_smarty_tpl->tpl_vars['errorMsg']->value) {?><p><?php echo $_smarty_tpl->tpl_vars['errorMsg']->value;?>
+</p><?php }?>
 
     <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
       
index 0d4bc63..23b62f9 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-13 07:50:35
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 18:10:53
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html" */ ?>
 <?php /*%%SmartyHeaderCode:206413157254b42f2535e168-27938613%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '081a36d97cdf30d438a1e104c26a275acc180da0' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/index.html',
-      1 => 1421135080,
+      1 => 1421259050,
       2 => 'file',
     ),
   ),
@@ -22,6 +22,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     'haveMembers' => 0,
     'members' => 0,
     'i' => 0,
+    'thisURL' => 0,
     'm' => 0,
   ),
   'has_nocache_code' => false,
@@ -57,8 +58,12 @@ $_smarty_tpl->tpl_vars['m']->_loop = true;
         <?php } else { ?>
             <tr class="alternate">
         <?php }?>
-                <td><?php echo $_smarty_tpl->tpl_vars['m']->value['name'];?>
-</td>
+                <td>
+                    <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=glm-members-admin-menu-member&glm_action=index&member_id=<?php echo $_smarty_tpl->tpl_vars['m']->value['id'];?>
+"><?php echo $_smarty_tpl->tpl_vars['m']->value['name'];?>
+</a>
+                </td>
                 <td>
                     (nothing here yet)
                 </td>
index f2b50b4..a4c3b87 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-13 07:00:40
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 21:33:37
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/header.html" */ ?>
 <?php /*%%SmartyHeaderCode:81165772654b46f32298020-09293550%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '15f83071407dddb0b3c23ae1a70b66cefbd681db' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/members/header.html',
-      1 => 1421132420,
+      1 => 1421271213,
       2 => 'file',
     ),
   ),
@@ -26,17 +26,17 @@ $_valid = $_smarty_tpl->decodeProperties(array (
   'has_nocache_code' => false,
 ),false); /*/%%SmartyHeaderCode%%*/?>
 <?php if ($_valid && !is_callable('content_54b46f322c0910_93147809')) {function content_54b46f322c0910_93147809($_smarty_tpl) {?><div class="wrap">
-       
+    <h2>Your Members</h2>
     <h2 class="nav-tab-wrapper">
         <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
 ?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">List Members</a>
+&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">List of Members</a>
         <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
 ?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=add" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='add') {?>-active<?php }?>">Add New Member</a>
+&glm_action=reports" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='add') {?>-active<?php }?>">Reports</a>
         <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
 ?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glm_action=other" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='edit') {?>-active<?php }?>">Edit Member</a>
+&glm_action=other" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='edit') {?>-active<?php } else { ?> disabled<?php }?>">Or Something - perahps mailing stuff?</a>
     </h2>
     <div id="glm-admin-content-container">
     <?php }} ?>
diff --git a/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php b/misc/smarty/templates_c/1be35689c5d30d774f40ebc45e387f5f95c45e90.file.index.html.php
new file mode 100644 (file)
index 0000000..6986fb3
--- /dev/null
@@ -0,0 +1,39 @@
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 21:06:49
+         compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html" */ ?>
+<?php /*%%SmartyHeaderCode:163797333154b6ac77c986e8-14104892%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
+$_valid = $_smarty_tpl->decodeProperties(array (
+  'file_dependency' => 
+  array (
+    '1be35689c5d30d774f40ebc45e387f5f95c45e90' => 
+    array (
+      0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/index.html',
+      1 => 1421269603,
+      2 => 'file',
+    ),
+  ),
+  'nocache_hash' => '163797333154b6ac77c986e8-14104892',
+  'function' => 
+  array (
+  ),
+  'version' => 'Smarty-3.1.21-dev',
+  'unifunc' => 'content_54b6ac77cbe666_15018258',
+  'variables' => 
+  array (
+    'member' => 0,
+  ),
+  'has_nocache_code' => false,
+),false); /*/%%SmartyHeaderCode%%*/?>
+<?php if ($_valid && !is_callable('content_54b6ac77cbe666_15018258')) {function content_54b6ac77cbe666_15018258($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/member/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
+
+    <h2><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
+</h2>
+    <table>
+        <tr><th>Member Name:</th><td><?php echo $_smarty_tpl->tpl_vars['member']->value['name'];?>
+</tr>
+    
+    </table>
+    
+<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
+<?php }} ?>
diff --git a/misc/smarty/templates_c/25c8610e0e0bacafec3046a296066e9f8eceedae.file.member.html.php b/misc/smarty/templates_c/25c8610e0e0bacafec3046a296066e9f8eceedae.file.member.html.php
new file mode 100644 (file)
index 0000000..cff656f
--- /dev/null
@@ -0,0 +1,85 @@
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 21:52:27
+         compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/member.html" */ ?>
+<?php /*%%SmartyHeaderCode:172471491954b6e51b1368b6-20693769%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
+$_valid = $_smarty_tpl->decodeProperties(array (
+  'file_dependency' => 
+  array (
+    '25c8610e0e0bacafec3046a296066e9f8eceedae' => 
+    array (
+      0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/member.html',
+      1 => 1421272105,
+      2 => 'file',
+    ),
+  ),
+  'nocache_hash' => '172471491954b6e51b1368b6-20693769',
+  'function' => 
+  array (
+  ),
+  'variables' => 
+  array (
+    'haveMember' => 0,
+    'thisURL' => 0,
+    'thisPage' => 0,
+    'member' => 0,
+  ),
+  'has_nocache_code' => false,
+  'version' => 'Smarty-3.1.21-dev',
+  'unifunc' => 'content_54b6e51b158d19_68572085',
+),false); /*/%%SmartyHeaderCode%%*/?>
+<?php if ($_valid && !is_callable('content_54b6e51b158d19_68572085')) {function content_54b6e51b158d19_68572085($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/member/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
+    
+    <?php if ($_smarty_tpl->tpl_vars['haveMember']->value) {?>
+        <h2>Edit Member</h2>
+    <?php } else { ?>
+        <h2>Add New Member</h2>
+    <?php }?>
+
+    <form action="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="glm_action" value="add">
+        <input type="hidden" name="option" value="submit">
+        <table class="form-table">
+            <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 }?>>
+                    <input type="text" name="name" value="<?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['name'];?>
+" class="glm-form-text-input">
+                    <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['name'];?>
+</p><?php }?>
+                </td>
+            </tr>
+            <tr>
+                <th>Active:</th>
+                <td>
+                    <input type="checkbox" name="active" <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldData']['active']['value']) {?>checked="checked"<?php }?>">
+                    <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['name']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['name'];?>
+</p><?php }?>
+                </td>
+            </tr>
+            <tr>
+                <th>Member Type:</th>
+                <td>
+                    Need to add "enum" type to data abstract.
+                </td>
+            </tr>            
+            <tr>
+                <th <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldRequired']['descr']) {?>class="glm-required"<?php }?>>Description:</th>
+                <td <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['descr']) {?>class="glm-form-bad-input"<?php }?>>
+                    <textarea name="descr" class="glm-form-textarea"><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldData']['descr'];?>
+</textarea>
+                    <?php if ($_smarty_tpl->tpl_vars['member']->value['fieldFail']['descr']) {?><p><?php echo $_smarty_tpl->tpl_vars['member']->value['fieldFail']['descr'];?>
+</p><?php }?>
+                </td>
+            </tr>
+            
+            
+        </table>
+        <p><span class="glm-required">*</span> Required</p>
+        <input type="submit" name="Add new member">
+    </form>
+    
+<?php echo $_smarty_tpl->getSubTemplate ('admin/footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+
+<?php }} ?>
index 5fa8589..9f3f0f1 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-13 07:37:06
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 21:35:21
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/header.html" */ ?>
 <?php /*%%SmartyHeaderCode:148991197854b4cb224461f5-92408371%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '3ec5bcbe581d6335e06bc6c9474f73121a83d59b' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/header.html',
-      1 => 1421134183,
+      1 => 1421271318,
       2 => 'file',
     ),
   ),
@@ -15,8 +15,38 @@ $_valid = $_smarty_tpl->decodeProperties(array (
   'function' => 
   array (
   ),
-  'has_nocache_code' => false,
   'version' => 'Smarty-3.1.21-dev',
   'unifunc' => 'content_54b4cb22446989_15253660',
+  'variables' => 
+  array (
+    'glmPluginName' => 0,
+    'thisURL' => 0,
+    'thisPage' => 0,
+    'thisAction' => 0,
+  ),
+  'has_nocache_code' => false,
 ),false); /*/%%SmartyHeaderCode%%*/?>
-<?php if ($_valid && !is_callable('content_54b4cb22446989_15253660')) {function content_54b4cb22446989_15253660($_smarty_tpl) {?><?php }} ?>
+<?php if ($_valid && !is_callable('content_54b4cb22446989_15253660')) {function content_54b4cb22446989_15253660($_smarty_tpl) {?><div class="wrap">
+
+    <h2><?php echo $_smarty_tpl->tpl_vars['glmPluginName']->value;?>
+ Configuration</h2>
+       
+    <h2 class="nav-tab-wrapper">
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=index" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?>">General Options</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=cities" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='cities') {?>-active<?php }?>">Cities List</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=states" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='add') {?>-active<?php }?>">States List</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=countries" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='edit') {?>-active<?php }?>">Countries List</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=Regions" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='edit') {?>-active<?php }?>">Regions List</a>
+    </h2>
+    <div id="glm-admin-content-container">
+    <?php }} ?>
index 67982dd..1770b38 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-13 07:48:39
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 17:04:39
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/index.html" */ ?>
 <?php /*%%SmartyHeaderCode:113537149654b4ca1e9b41e6-15887083%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '47fb9b803e7138d215645f3c977b0b1dc2a9e718' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/configure/index.html',
-      1 => 1421135161,
+      1 => 1421255040,
       2 => 'file',
     ),
   ),
@@ -19,7 +19,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
   'unifunc' => 'content_54b4ca1e9c5b88_76832702',
   'has_nocache_code' => false,
 ),false); /*/%%SmartyHeaderCode%%*/?>
-<?php if ($_valid && !is_callable('content_54b4ca1e9c5b88_76832702')) {function content_54b4ca1e9c5b88_76832702($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/configure/headder.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
+<?php if ($_valid && !is_callable('content_54b4ca1e9c5b88_76832702')) {function content_54b4ca1e9c5b88_76832702($_smarty_tpl) {?><?php echo $_smarty_tpl->getSubTemplate ('admin/configure/header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
 
     
     <h2>General Configuration</h2>
index db81be3..542893a 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-13 07:37:06
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 20:47:26
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/footer.html" */ ?>
 <?php /*%%SmartyHeaderCode:146319615854b4cb224487c6-63517443%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '50e78f1400d6db96c588c737669426ab57397d1d' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/footer.html',
-      1 => 1421125086,
+      1 => 1421268442,
       2 => 'file',
     ),
   ),
@@ -15,6 +15,8 @@ $_valid = $_smarty_tpl->decodeProperties(array (
   'function' => 
   array (
   ),
+  'version' => 'Smarty-3.1.21-dev',
+  'unifunc' => 'content_54b4cb2244e1c6_97382029',
   'variables' => 
   array (
     'glmPluginName' => 0,
@@ -24,12 +26,10 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     'thisPage' => 0,
   ),
   'has_nocache_code' => false,
-  'version' => 'Smarty-3.1.21-dev',
-  'unifunc' => 'content_54b4cb2244e1c6_97382029',
 ),false); /*/%%SmartyHeaderCode%%*/?>
 <?php if ($_valid && !is_callable('content_54b4cb2244e1c6_97382029')) {function content_54b4cb2244e1c6_97382029($_smarty_tpl) {?>
     </div> <!-- / admin content area -->
-    <div class="glm-copywright">
+    <div class="glm-copyright">
         <?php echo $_smarty_tpl->tpl_vars['glmPluginName']->value;?>
 <br>
         Copyright &copy; 2014-<?php echo $_smarty_tpl->tpl_vars['thisYear']->value;?>
@@ -42,7 +42,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
 >
         window.open('<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
 ?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
-&glmDebugWindow=true','GLM_Plugin_Debug','width=800, height=900, left=50, top=50');
+&glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
     <?php echo '</script'; ?>
 >
   <?php }?>
index 05f3572..cf9e3a2 100644 (file)
@@ -1,4 +1,4 @@
-<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-12 20:29:18
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 19:42:46
          compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/index.html" */ ?>
 <?php /*%%SmartyHeaderCode:204984570454b42e9eaf47c6-75708563%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
 $_valid = $_smarty_tpl->decodeProperties(array (
@@ -7,7 +7,7 @@ $_valid = $_smarty_tpl->decodeProperties(array (
     '60cbe99d19bbec013cbca4d9344f2fd4a4152f52' => 
     array (
       0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/error/index.html',
-      1 => 1421094555,
+      1 => 1421264555,
       2 => 'file',
     ),
   ),
@@ -15,15 +15,24 @@ $_valid = $_smarty_tpl->decodeProperties(array (
   'function' => 
   array (
   ),
-  'has_nocache_code' => false,
   'version' => 'Smarty-3.1.21-dev',
   'unifunc' => 'content_54b42e9eafe502_03625329',
+  'variables' => 
+  array (
+    'errorMsg' => 0,
+  ),
+  'has_nocache_code' => false,
 ),false); /*/%%SmartyHeaderCode%%*/?>
 <?php if ($_valid && !is_callable('content_54b42e9eafe502_03625329')) {function content_54b42e9eafe502_03625329($_smarty_tpl) {?><div class="wrap">
     
     <h2>Sorry, we've had an error.</h2>
     
-    <p><b>Error: </b>: Unknown error.</p>
+    <?php if ($_smarty_tpl->tpl_vars['errorMsg']->value) {?>
+        <p><?php echo $_smarty_tpl->tpl_vars['errorMsg']->value;?>
+</p>
+    <?php } else { ?>
+        <p><b>Error: </b>: Unknown error.</p>
+    <?php }?>
 
     <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
       
diff --git a/misc/smarty/templates_c/c74bd17240f8892f8955e8bedbedd434341aeca9.file.header.html.php b/misc/smarty/templates_c/c74bd17240f8892f8955e8bedbedd434341aeca9.file.header.html.php
new file mode 100644 (file)
index 0000000..f0a7244
--- /dev/null
@@ -0,0 +1,62 @@
+<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-01-14 22:28:02
+         compiled from "/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/header.html" */ ?>
+<?php /*%%SmartyHeaderCode:8257956454b6ac77cc21f2-25755845%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
+$_valid = $_smarty_tpl->decodeProperties(array (
+  'file_dependency' => 
+  array (
+    'c74bd17240f8892f8955e8bedbedd434341aeca9' => 
+    array (
+      0 => '/var/www/server/wordpress/wp-content/plugins/glm-member-db/views/admin/member/header.html',
+      1 => 1421274467,
+      2 => 'file',
+    ),
+  ),
+  'nocache_hash' => '8257956454b6ac77cc21f2-25755845',
+  'function' => 
+  array (
+  ),
+  'version' => 'Smarty-3.1.21-dev',
+  'unifunc' => 'content_54b6ac77cd9375_10535024',
+  'variables' => 
+  array (
+    'thisURL' => 0,
+    'thisPage' => 0,
+    'memberID' => 0,
+    'thisAction' => 0,
+    'haveMember' => 0,
+  ),
+  'has_nocache_code' => false,
+),false); /*/%%SmartyHeaderCode%%*/?>
+<?php if ($_valid && !is_callable('content_54b6ac77cd9375_10535024')) {function content_54b6ac77cd9375_10535024($_smarty_tpl) {?><div class="wrap">
+       
+    <h2>Member Information</h2>
+    
+    <h2 class="nav-tab-wrapper">
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=index&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='index') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Dashboard</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=member&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='member'||!$_smarty_tpl->tpl_vars['haveMember']->value) {?>-active<?php }?>">Member</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=locations&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='locations') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Locations</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=facilities&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='facilities') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Facilities</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=attractions&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='attractions') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Attractions</a>
+        <a href="<?php echo $_smarty_tpl->tpl_vars['thisURL']->value;?>
+?page=<?php echo $_smarty_tpl->tpl_vars['thisPage']->value;?>
+&glm_action=contacts&member_id=<?php echo $_smarty_tpl->tpl_vars['memberID']->value;?>
+" class="nav-tab<?php if ($_smarty_tpl->tpl_vars['thisAction']->value=='contacts') {?>-active<?php }?> <?php if (!$_smarty_tpl->tpl_vars['haveMember']->value) {?>disabled<?php }?>">Contacts</a>
+    </h2>
+    <div id="glm-admin-content-container">
+    
+    <?php }} ?>
index d0339c6..eff0d57 100644 (file)
@@ -18,7 +18,7 @@
  * This model is called if there is a generic/unknown error
  *
  */
-class glmMembersAdminError
+class GlmMembersAdmin_error_index
 {
 
     /**
@@ -58,12 +58,18 @@ class glmMembersAdminError
     {
         // No work to perform here so just return status
 
+    }
+
+    public function modelAction() {
+
         // Return status, any suggested view, and any data to controller
         return array(
                 'status' => true,
-                'view' => false,
+                'modelRedirect' => false,
+                'view' => 'admin/error/index.html',
                 'data' => false
         );
+
     }
 }
 
diff --git a/models/admin/member/index.php b/models/admin/member/index.php
new file mode 100644 (file)
index 0000000..76c4f22
--- /dev/null
@@ -0,0 +1,168 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Member Management
+ *
+ * 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_DIR.'/data/dataMembers.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_member_index extends GlmDataMembers
+{
+
+    /**
+     * 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($this->wpdb, $this->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 ()
+    {
+
+        $success = true;
+        $haveMember = false;
+        $memberData = false;
+        $memberID = 0;
+
+        // Check if a member ID is supplied
+        if (isset($_REQUEST['member_id'])) {
+            // Make sure it's a number
+            $memberID = $_REQUEST['member_id']-0;
+        }
+
+        // If we don't have a member ID, assume this is to add a member and go do that
+        if ($memberID <= 0) {
+
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                glmMembersAdmin::addNotice('&nbsp;&nbsp;No member ID supplied.');
+            }
+
+            return array(
+                'status' => $success,
+                'menuItemRedirect' => false,
+                'modelRedirect' => 'member',
+                'view' => 'admin/member/member.html',
+                'data' => array(
+                    'haveMember' => false,
+                )
+            );
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+            glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID specified:</b> $memberID");
+        }
+
+        // Try to get existing member data
+        $memberData = $this->getEntry($memberID);
+
+        // Check that we have data for the specified member ID
+        if ($memberData !== false) {
+            $haveMember = true;
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($memberData,1)."</pre>", 'Member Data');
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveMember' => $haveMember,
+            'memberID' => $memberID,
+            'member' => $memberData,
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/member/index.html',
+            'data' => $templateData
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/member/member.php b/models/admin/member/member.php
new file mode 100644 (file)
index 0000000..04f33bc
--- /dev/null
@@ -0,0 +1,157 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Member Edit
+ *
+ * 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_DIR.'/data/dataMembers.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_member_member extends GlmDataMembers
+{
+
+    /**
+     * 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($this->wpdb, $this->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 ()
+    {
+
+        $success = true;
+        $haveMember = false;
+        $memberData = false;
+        $memberID = 0;
+
+        // Check if a member ID is supplied
+        if (isset($_REQUEST['member_id'])) {
+            // Make sure it's a number
+            $memberID = $_REQUEST['member_id']-0;
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+            glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID specified:</b> $memberID");
+        }
+
+        // If we have a member ID, try to get the member data
+        if ($memberID > 0) {
+            $memberData = $this->editEntry($memberID);
+        }
+
+        // If we have member data, say so
+        if ($memberData !== false) {
+            $haveMember = true;
+
+        // Otherwise, we're going setup to enter a new one
+        } else {
+
+            $memberData = $this->newEntry();
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($memberData,1)."</pre>", 'Member Data');
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveMember' => $haveMember,
+            'memberID' => $memberID,
+            'member' => $memberData
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/member/member.html',
+            'data' => $templateData
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/members/add.php b/models/admin/members/add.php
deleted file mode 100644 (file)
index 34b8a5e..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Prototype Management and Display
- * Admin Edit Prototype Model
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmPrototypeManagement
- * @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/
- */
-
-// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
-
-/*
- * This class performs the work neede to add a new member
- * option, which is to display the members dashboard.
- *
- */
-class GlmMembersAdmin_members_add extends GlmDataMembers
-{
-
-    /**
-     * 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($this->wpdb, $this->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 ()
-    {
-
-        // Assume we're just going to display an input form
-        $view = 'edit.html';
-
-        // Check if this is a submission
-        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
-                       $member = $this->insertEntry();
-
-                       // If the submission was successful - display the result
-                       if ($member && $member['status']) {
-                           $view = 'display.html';
-                       }
-
-        } else {
-                       // Get the setup data from the data abstract to edit a new member
-           $member = $this->newEntry();
-        }
-
-        // Get result status
-        $success = ($member && $member['status']);
-
-        // Determine if current user can add, edit, delete prototypes
-        $canEdit = current_user_can('glm_proto_edit');
-
-        // Return status, suggested view, and data to controller
-        return array(
-                       'status' => $success,
-                       'menuItemRedirect' => false,
-                       'modelRedirect' => false,
-                       'view' => 'admin/members/'.$view,
-                       'data' => array(
-                                               'newMember' => true,
-                               'member' => $member,
-                                       'canEdit' => $canEdit
-                       )
-        );
-
-    }
-
-}
-
-?>
\ No newline at end of file
diff --git a/models/admin/members/delete.php b/models/admin/members/delete.php
deleted file mode 100644 (file)
index 8a8414c..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Prototype Management and Display
- * Admin Delete Selected Prototype Model
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmPrototypeManagement
- * @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/
- */
-
-// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
-
-/*
- * This class performs the work needed to delete a member.
- */
-class GlmMembersAdmin_members_delete extends GlmDataMembers
-{
-
-    /**
-     * 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($this->wpdb, $this->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 ()
-    {
-
-        // Check if we recieved a prototype ID
-        $id = $_REQUEST['proto_id'] - 0;
-        if ($id > 0) {
-
-            // Delete the prototype data
-            $res = $this->wpdb->get_row(
-                    "
-                               DELETE
-                                 FROM ".$this->wpdb->posts."
-                                WHERE post_type = 'glm_proto'
-                                  AND id = $id
-                       ", ARRAY_A);
-        }
-
-        // Return status - in this case we always redirect to the prototypes
-        // index model (list)
-        return array(
-                'status' => true,
-                'menuItemRedirect' => 'prototypes',
-                'modelRedirect' => 'index',
-                'view' => false,
-                'data' => false
-        );
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/models/admin/members/display.php b/models/admin/members/display.php
deleted file mode 100644 (file)
index 22477c8..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Prototype Management and Display
- * Admin Display Selected Prototype Model
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmPrototypeManagement
- * @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/
- */
-
-// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
-
-/*
- * This class performs the work needed to display member data
- */
-class GlmMembersAdmin_members_display extends GlmDataMembers
-{
-
-    /**
-     * 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($this->wpdb, $this->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 ()
-    {
-
-        // Check if we recieved a prototype ID
-        $id = $_REQUEST['proto_id'] - 0;
-        if ($id > 0) {
-
-            // Get the prototype data
-            $res = $this->wpdb->get_row(
-                    "
-                               SELECT id,
-                                          DATE_FORMAT(post_date, '%Y-%m-%d') p_date,
-                                          post_title,
-                                          post_content
-                                 FROM ".$this->wpdb->posts."
-                                WHERE post_type = 'glm_proto'
-                                  AND id = $id
-                       ", ARRAY_A);
-
-            // If we have results
-            $success = false;
-            if ($res['post_content']) {
-
-                $success = true;
-
-                // Break out the prototype file data
-                $d = unserialize($res['post_content']);
-                $res['content'] = $d;
-            }
-        }
-
-        // Return status, any suggested view, and any data to controller
-        // If 'viewText' exists, it's parsed as smarty template source for output rather than the 'view' file.
-        return array(
-                'status' => $success,
-                'menuItemRedirect' => false,
-                'modelRedirect' => false,
-                'view' => 'admin/prototypes/display.html',
-                'viewText' => stripslashes($d['html']),
-                'data' => array(
-                        'content' => $res['content']
-                )
-        );
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/models/admin/members/edit.php b/models/admin/members/edit.php
deleted file mode 100644 (file)
index f48e935..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Prototype Management and Display
- * Admin Edit Prototype Model
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmPrototypeManagement
- * @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/
- */
-
-// Load Members data abstract
-require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMembers.php');
-
-/*
- * This class performs the work needed to add a new prototype.
- */
-class GlmMembersAdmin_members_edit extends GlmDataMembers
-{
-
-    /**
-     * 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($this->wpdb, $this->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 ()
-    {
-
-        // Check that we have a prototype ID
-        $id = 0;
-        if (isset($_REQUEST['proto_id'])) {
-            // Make sure it's an integer
-            $id = $_REQUEST['proto_id'] - 0;
-        }
-        if (! $id) {
-            echo "FAILURE";
-            exit();
-        }
-
-        // Get the current data for the selected prototype
-        // Get the prototype data
-        $res = $this->wpdb->get_row(
-                "
-                SELECT id,
-                DATE_FORMAT(post_date, '%Y-%m-%d') p_date,
-                post_title,
-                post_content
-                FROM ".$this->wpdb->posts."
-                WHERE post_type = 'glm_proto'
-                AND id = $id
-                ", ARRAY_A);
-
-        // If we have results
-        $success = false;
-        if ($res['post_content']) {
-
-            $success = true;
-
-            // Break out the prototype file data
-            $content = unserialize($res['post_content']);
-        }
-
-        // Setup input data array
-        $content = array(
-                'glm_proto_title' => $content['title'],
-                'glm_proto_title_error' => '',
-                'glm_proto_width' => $content['width'],
-                'glm_proto_width_error' => '',
-                'glm_proto_height' => $content['height'],
-                'glm_proto_height_error' => '',
-                'glm_proto_html' => stripslashes($content['html']),
-                'glm_proto_html_error' => '',
-                'glm_proto_background' => $content['background'],
-                'glm_proto_background_error' => '',
-                'glm_proto_prototype' => $content['prototype'],
-                'glm_proto_prototype_error' => '',
-                'glm_proto_image3' => $content['image3'],
-                'glm_proto_image3_error' => '',
-                'glm_proto_image4' => $content['image4'],
-                'glm_proto_image4_error' => '',
-                'glm_proto_image5' => $content['image5'],
-                'glm_proto_image5_error' => ''
-        );
-
-        /*
-         * If a protototype update is being submitted
-         */
-        $submitError = false;
-        $submitted = false;
-        if (isset($_REQUEST['glm_proto_title'])) {
-
-            // Clean up all input
-            $content['glm_proto_title'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_title']);
-            $content['glm_proto_width'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_width']);
-            $content['glm_proto_height'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_height']);
-            $content['glm_proto_html'] = stripslashes($_REQUEST['glm_proto_html']);
-            $content['glm_proto_background'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_background']);
-            $content['glm_proto_prototype'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_prototype']);
-            $content['glm_proto_image3'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_image3']);
-            $content['glm_proto_image4'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_image4']);
-            $content['glm_proto_image5'] = sanitize_text_field(
-                    $_REQUEST['glm_proto_image5']);
-
-            // Check title field
-            if ($content['glm_proto_title'] == '') {
-                $content['glm_proto_title_error'] = 'Required title not supplied';
-                $submitError = true;
-            }
-
-            // Check width field
-            if ($content['glm_proto_width'] == '') {
-                $content['glm_proto_width_error'] = 'Required width not supplied';
-                $submitError = true;
-            }
-
-            // Check height field
-            if ($content['glm_proto_height'] == '') {
-                $content['glm_proto_height_error'] = 'Required height not supplied';
-                $submitError = true;
-            }
-
-            // Check background image - Not required but must exist if provided
-            if ($content['glm_proto_background'] != '' && ! $this->glmProtoIsUploaded(
-                    $content['glm_proto_background'])) {
-                $content['glm_proto_background_error'] = 'Supplied background image does not exists';
-                $submitError = true;
-            }
-
-            // Check prototype image
-            if ($content['glm_proto_prototype'] == '') {
-                $content['glm_proto_prototype_error'] = 'Required prototype image not supplied ';
-                $submitError = true;
-            } else {
-                $exists = $this->glmProtoIsUploaded(
-                        $content['glm_proto_prototype']);
-                if (! $exists) {
-                    $content['glm_proto_prototype_error'] .= 'Supplied prototype image does not exists';
-                    $submitError = true;
-                }
-            }
-
-            // Check image #3 - Not required but must exist if provided
-            if ($content['glm_proto_image3'] != '' && ! $this->glmProtoIsUploaded(
-                    $content['glm_proto_image3'])) {
-                $content['glm_proto_image3_error'] = 'Supplied image #3 does not exists';
-                $submitError = true;
-            }
-
-            // Check image #4 - Not required but must exist if provided
-            if ($content['glm_proto_image4'] != '' && ! $this->glmProtoIsUploaded(
-                    $content['glm_proto_image4'])) {
-                $content['glm_proto_image4_error'] = 'Supplied image #4 does not exists';
-                $submitError = true;
-            }
-
-            // Check image #5 - Not required but must exist if provided
-            if ($content['glm_proto_image5'] != '' && ! $this->glmProtoIsUploaded(
-                    $content['glm_proto_image5'])) {
-                $content['glm_proto_image3_error'] = 'Supplied image #5 does not exists';
-                $submitError = true;
-            }
-
-
-            if (! $submitError) {
-
-                // Prepair data for storage
-                $date = date('Y-m-d', time());
-                $timezoneBackup = date_default_timezone_get();
-                date_default_timezone_set("GMT");
-                $gmtDate = date('Y-m-d', time());
-                date_default_timezone_set($timezoneBackup);
-
-                $contentSerialized = serialize(
-                        array(
-                                'title' => $content['glm_proto_title'],
-                                'width' => $content['glm_proto_width'],
-                                'height' => $content['glm_proto_height'],
-                                'html' => $content['glm_proto_html'],
-                                'background' => $content['glm_proto_background'],
-                                'prototype' => $content['glm_proto_prototype'],
-                                'image3' => $content['glm_proto_image3'],
-                                'image4' => $content['glm_proto_image4'],
-                                'image5' => $content['glm_proto_image5']
-                        ));
-
-                // Store into wp_posts table
-                $result = $this->wpdb->update($this->wpdb->posts,
-                        array(
-                                'post_date' => $date,
-                                'post_date_gmt' => $gmtDate,
-                                'post_content' => $contentSerialized,
-                                'post_title' => $content['glm_proto_title'],
-                                'post_type' => 'glm_proto'
-                        ),
-                        array(
-                                'id' => $id
-                        ));
-
-                // If there was a problem storing the prototype, pass that to
-                // the template
-                if (! $result) {
-                    $content['glm_proto_title_error'] = 'There was an unknown problem updating this prototype.';
-                }
-
-                $prototypeSubmitted = true;
-            }
-        }
-
-        // If submitted OK then display success page
-        $menuItemRedirect = false;
-        $modelRedirect = false;
-        if ($prototypeSubmitted) {
-
-            $view = 'admin/prototypes/updated.html';
-
-            // Prototype was not successfully submitted so redisplay the form.
-        } else {
-
-            // Select view
-            $view = 'admin/prototypes/edit.html';
-        }
-
-        // Return status, suggested view, and data to controller
-        return array(
-                'status' => true,
-                'menuItemRedirect' => false,
-                'modelRedirect' => false,
-                'view' => $view,
-                'data' => array(
-                        'content' => $content
-                )
-        );
-    }
-
-    /*
-     * Check if a file supposedly uploaded to WordPress exists
-     *
-     * This method accepts a URL to a WordPress file or image, strips the
-     * WordPress base file URL to get the remaining path and file name for
-     * the file, then adds the base path for WordPress files and checks to
-     * see if the file exists.
-     *
-     * @param string URL of uploaded WordPress file or image
-     *
-     * @return bool True if it exists, false if not
-     */
-    private function glmProtoIsUploaded ($url)
-    {
-
-        // Get current WordPress upload directory/url information
-        $paths = wp_upload_dir();
-        $base = $paths['baseurl'];
-        $path = $paths['basedir'];
-
-        // Strip base directory from supplied URL
-        $file = substr($url, strlen($base));
-
-        // If there's now no file name
-        if (trim($file) == '') {
-            return false;
-        }
-
-        // Check if file exists
-        $exists = file_exists($path . $file);
-
-        return $exists;
-    }
-}
-
-?>
\ No newline at end of file
index e1859d7..c7718f9 100644 (file)
@@ -102,6 +102,10 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
         // Get a current list of members
         $list = $this->getList();
 
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice("<pre>".print_r($list,1)."</pre>", 'Member Data');
+        }
+
         // If we have list entries - even if it's an empty list
         $success = true;
         $haveMembers = false;
index b7b6bd3..59c7268 100644 (file)
@@ -26,13 +26,43 @@ e.g.
 
 == Frequently Asked Questions ==
 
-= A question that someone might have =
+= Code for this plugin looks completely different from others. =
+OK, so I just couldn't understand why certain things were done a certain way in WordPress. One of those is
+the way Templates are built. It seems to me that including PHP programing in a template is counter-productive.
+The whole idea of a template is to completely separate programming (the data side) and interface (the template
+side). I've also found many plugins mix code and html all over the place. How people can deal with that is a
+mystery to me. I used to program Web applications like that and believe me it cost me plenty in support.
 
-An answer to that question.
+Because of all that I've decided to use Smarty Templates for this project. I've been so happy with Smarty 
+Templates, and my last large project used them to completely separate data and design. (I know, Smarty is 
+kind of like programming and underneath uses PHP, but logically it's all output design.)
 
-= What about foo bar? =
+This project also has a revised MVC approach that fits with how I see that working in WordPress. It's a 
+first pass at really using this particular MVC adaptation, so cut me some slack on this one.
+
+Lastly, I just didn't like the very limited database, form-data processing, and input sanitizing/filtering I 
+found in WordPress. To avoid confusing and sloppy code, I decided to migrate my abstract data class from
+my previous project to handle all of this. This makes the "models" here much simpler and makes maintenance
+and extention of this plugin much simpler. You'll see that under lib/GlmDataAbstract. (Note that that class
+is proprietary and requires licensing. You did purchase this plugin, right?) For info on what that class does,
+look at the "documentation.txt" file in that directory. I'm not taking time to even summarize it here since
+I could not do it justice in a paragraph or two.
+
+= How the heck does this plugin work? =
+For the admin side the typical flow is (highly summarized) ... 
+
+/index.php -> /controllers/admin.php -> /models/admin/{menu}/{action}.php -> /views/admin/{menu}/{action}.html
+
+Note that the models also bring in data descriptions in the /classes/data directory that are appropriately
+named for the data of interest. The data structure arrays in those files are what the abstract data class 
+uses to process input and output and interact with the database tables. 
+
+So, if you want to find out how some particular action works, look in that models directory. If you want 
+to see the template for a particular output, look in the that views directory. If you want to see what data
+is stored and managed and how it input and structured for output, look at the /classes/data directory.  
+
+Beyond all that, good luck. This is my view of the WordPress world. I'm afraid you'll have to live with that.
 
-Answer to foo bar dilemma.
 
 == Screenshots ==
 
diff --git a/views/admin/configure/headder.html b/views/admin/configure/headder.html
deleted file mode 100644 (file)
index bffc06b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<div class="wrap">
-       
-    <h2 class="nav-tab-wrapper">
-        <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==index}-active{/if}">Cities List</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=states" class="nav-tab{if $thisAction==add}-active{/if}">States List</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=countries" class="nav-tab{if $thisAction==edit}-active{/if}">Countries List</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=Regions" class="nav-tab{if $thisAction==edit}-active{/if}">Regions List</a>
-    </h2>
-    <div id="glm-admin-content-container">
-    
\ No newline at end of file
diff --git a/views/admin/configure/header.html b/views/admin/configure/header.html
new file mode 100644 (file)
index 0000000..6d9eff3
--- /dev/null
@@ -0,0 +1,13 @@
+<div class="wrap">
+
+    <h2>{$glmPluginName} Configuration</h2>
+       
+    <h2 class="nav-tab-wrapper">
+        <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">General Options</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities}-active{/if}">Cities List</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=states" class="nav-tab{if $thisAction==add}-active{/if}">States List</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=countries" class="nav-tab{if $thisAction==edit}-active{/if}">Countries List</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=Regions" class="nav-tab{if $thisAction==edit}-active{/if}">Regions List</a>
+    </h2>
+    <div id="glm-admin-content-container">
+    
\ No newline at end of file
index 9188654..6ac1fe5 100644 (file)
@@ -1,4 +1,4 @@
-{include file='admin/configure/headder.html'}
+{include file='admin/configure/header.html'}
     
     <h2>General Configuration</h2>
     
index 8640ade..4c84eed 100644 (file)
@@ -3,6 +3,8 @@
     <h2>Sorry, we've had an error.</h2>
     
     <p><b>Error: </b>: An invalid action 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>
       
index 5e26734..c8ede52 100644 (file)
@@ -2,7 +2,11 @@
     
     <h2>Sorry, we've had an error.</h2>
     
-    <p><b>Error: </b>: Unknown error.</p>
+    {if $errorMsg}
+        <p>{$errorMsg}</p>
+    {else}
+        <p><b>Error: </b>: Unknown error.</p>
+    {/if}
 
     <p>Please try again. If you still get the same error, contact Gaslight Media at 231-487-0692 for assistance.</p>
       
index bc845a2..1fc38bb 100644 (file)
@@ -1,6 +1,6 @@
 
     </div> <!-- / admin content area -->
-    <div class="glm-copywright">
+    <div class="glm-copyright">
         {$glmPluginName}<br>
         Copyright &copy; 2014-{$thisYear} Gaslight Media - All Rights Reserved<br>
         <a href="http://www.gaslightmedia.com">http://www.gaslightmedia.com</a>
@@ -8,7 +8,7 @@
     
   {if $adminDebug}
     <script>
-        window.open('{$thisURL}?page={$thisPage}&glmDebugWindow=true','GLM_Plugin_Debug','width=800, height=900, left=50, top=50');
+        window.open('{$thisURL}?page={$thisPage}&glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
     </script>
   {/if}
   
diff --git a/views/admin/member/header.html b/views/admin/member/header.html
new file mode 100644 (file)
index 0000000..73f17d9
--- /dev/null
@@ -0,0 +1,15 @@
+<div class="wrap">
+       
+    <h2>Member Information</h2>
+    
+    <h2 class="nav-tab-wrapper">
+        <a href="{$thisURL}?page={$thisPage}&glm_action=index&member_id={$memberID}" class="nav-tab{if $thisAction==index}-active{/if} {if !$haveMember}disabled{/if}">Dashboard</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=member&member_id={$memberID}" class="nav-tab{if $thisAction==member || !$haveMember}-active{/if}">Member</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=locations&member_id={$memberID}" class="nav-tab{if $thisAction==locations}-active{/if} {if !$haveMember}disabled{/if}">Locations</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=facilities&member_id={$memberID}" class="nav-tab{if $thisAction==facilities}-active{/if} {if !$haveMember}disabled{/if}">Facilities</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=attractions&member_id={$memberID}" class="nav-tab{if $thisAction==attractions}-active{/if} {if !$haveMember}disabled{/if}">Attractions</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=contacts&member_id={$memberID}" class="nav-tab{if $thisAction==contacts}-active{/if} {if !$haveMember}disabled{/if}">Contacts</a>
+    </h2>
+    <div id="glm-admin-content-container">
+    
+    
\ No newline at end of file
diff --git a/views/admin/member/index.html b/views/admin/member/index.html
new file mode 100644 (file)
index 0000000..f303118
--- /dev/null
@@ -0,0 +1,9 @@
+{include file='admin/member/header.html'}
+
+    <h2>{$member.name}</h2>
+    <table>
+        <tr><th>Member Name:</th><td>{$member.name}</tr>
+    
+    </table>
+    
+{include file='admin/footer.html'}
diff --git a/views/admin/member/member.html b/views/admin/member/member.html
new file mode 100644 (file)
index 0000000..06fa920
--- /dev/null
@@ -0,0 +1,47 @@
+{include file='admin/member/header.html'}
+    
+    {if $haveMember}
+        <h2>Edit Member</h2>
+    {else}
+        <h2>Add New Member</h2>
+    {/if}
+
+    <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="glm_action" value="add">
+        <input type="hidden" name="option" value="submit">
+        <table class="form-table">
+            <tr>
+                <th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
+                <td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
+                    <input type="text" name="name" value="{$member.fieldData.name}" class="glm-form-text-input">
+                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th>Active:</th>
+                <td>
+                    <input type="checkbox" name="active" {if $member.fieldData.active.value}checked="checked"{/if}">
+                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th>Member Type:</th>
+                <td>
+                    Need to add "enum" type to data abstract.
+                </td>
+            </tr>            
+            <tr>
+                <th {if $member.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
+                <td {if $member.fieldFail.descr}class="glm-form-bad-input"{/if}>
+                    <textarea name="descr" class="glm-form-textarea">{$member.fieldData.descr}</textarea>
+                    {if $member.fieldFail.descr}<p>{$member.fieldFail.descr}</p>{/if}
+                </td>
+            </tr>
+            
+            
+        </table>
+        <p><span class="glm-required">*</span> Required</p>
+        <input type="submit" name="Add new member">
+    </form>
+    
+{include file='admin/footer.html'}
diff --git a/views/admin/members/edit.html b/views/admin/members/edit.html
deleted file mode 100644 (file)
index 17d4bf7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-{include file='admin/members/header.html'}
-
-    
-    {if $newMember}
-        <h2>Add New Member</h2>
-    {else}
-        <h2>Edit Member</h2>
-    {/if}
-
-    <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
-        <input type="hidden" name="glm_action" value="add">
-        <input type="hidden" name="option" value="submit">
-        <table class="form-table">
-            <tr>
-                <th {if $member.fieldRequired.name}class="glm-required"{/if}>Member Name:</th>
-                <td {if $member.fieldFail.name}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="name" value="{$member.fieldData.name}" class="glm-form-text-input">
-                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th>Active:</th>
-                <td>
-                    <input type="checkbox" name="active" {if $member.fieldData.active.value}checked="checked"{/if}">
-                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th>Member Type:</th>
-                <td>
-                    Need to add "enum" type to data abstract.
-                </td>
-            </tr>            
-            <tr>
-                <th {if $member.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
-                <td {if $member.fieldFail.descr}class="glm-form-bad-input"{/if}>
-                    <textarea name="descr" class="glm-form-textarea">{$member.fieldData.descr}</textarea>
-                    {if $member.fieldFail.descr}<p>{$member.fieldFail.descr}</p>{/if}
-                </td>
-            </tr>
-            
-            
-        </table>
-        <p><span class="glm-required">*</span> Required</p>
-        <input type="submit" name="Add new member">
-    </form>
-    
-{include file='admin/footer.html'}
-
-
-
diff --git a/views/admin/members/headder.html b/views/admin/members/headder.html
deleted file mode 100644 (file)
index eef3066..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<div class="wrap">
-       
-    <h2 class="nav-tab-wrapper">
-        <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">List Members</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=add" class="nav-tab{if $thisAction==add}-active{/if}">Add New Member</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=other" class="nav-tab{if $thisAction==edit}-active{/if}">Edit Member</a>
-    </h2>
-    <div id="glm-admin-content-container">
-    
\ No newline at end of file
diff --git a/views/admin/members/header.html b/views/admin/members/header.html
new file mode 100644 (file)
index 0000000..eaaccdf
--- /dev/null
@@ -0,0 +1,9 @@
+<div class="wrap">
+    <h2>Your Members</h2>
+    <h2 class="nav-tab-wrapper">
+        <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">List of Members</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=reports" class="nav-tab{if $thisAction==add}-active{/if}">Reports</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=other" class="nav-tab{if $thisAction==edit}-active{else} disabled{/if}">Or Something - perahps mailing stuff?</a>
+    </h2>
+    <div id="glm-admin-content-container">
+    
\ No newline at end of file
index c380103..941e6f0 100644 (file)
@@ -24,7 +24,9 @@
         {else}
             <tr class="alternate">
         {/if}
-                <td>{$m.name}</td>
+                <td>
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member_id={$m.id}">{$m.name}</a>
+                </td>
                 <td>
                     (nothing here yet)
                 </td>