Interim commit for changes
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 21 Jan 2016 15:36:58 +0000 (10:36 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 21 Jan 2016 15:36:58 +0000 (10:36 -0500)
models/front/hooked/detail.php [new file with mode: 0644]
setup/adminHooks.php [new file with mode: 0644]
setup/frontHooks.php
setup/hooksHelp.html [new file with mode: 0644]

diff --git a/models/front/hooked/detail.php b/models/front/hooked/detail.php
new file mode 100644 (file)
index 0000000..015d966
--- /dev/null
@@ -0,0 +1,116 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Front Package detail for Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load packages data abstract
+require_once(GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH.'/data/dataPackages.php');
+
+/*
+ * This class performs the work for displaying members packages.
+ */
+class GlmMembersFront_packaging_detailHook extends GlmDataPackages
+{
+
+    /**
+     * 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);
+
+    }
+
+    public function getPackageDetail($id)
+    {
+
+        return ('123 we be here');
+
+        /*
+         * Merge data returned from the model with the selected view
+         */
+/*
+        // Load Smarty Template support
+        $smarty = new smartyTemplateSupport();
+
+        // Update the Smarty view path based on plugin/add-on that's providing the action
+        $smarty->template->setTemplateDir($viewPath);
+
+        // 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 );
+        $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
+        $smarty->templateAssign ( 'glmPluginMediaURL', GLM_MEMBERS_PLUGIN_MEDIA_URL );
+        $smarty->templateAssign ( 'ref_type_numb', $this->config['ref_type_numb']);
+        $smarty->templateAssign ( 'thisYear', date ( 'Y' ) );
+        $smarty->templateAssign ( 'settings', $this->config['settings']);
+        $smarty->templateAssign ( 'terms', $this->config['terms']);
+        $smarty->templateAssign('thisAction', $action);
+
+        // Add data from model to Smarty template
+        if (is_array($results['data']) && count($results['data']) > 0) {
+            foreach ($results['data'] as $k => $d) {
+                $smarty->templateAssign($k, $d);
+            }
+        }
+
+        // If view debug has been requested
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+
+            glmMembersFront::addNotice("<b>Template File:</b> $view", 'Process');
+
+            $x = $smarty->template->getTemplateVars();
+            $templateVars = '<pre>' . print_r($x, 1) . '</pre>';
+            glmMembersFront::addNotice($templateVars, 'DataBlock', 'Template Parameters');
+        }
+
+        // Generate output from model data and view
+        $out = $smarty->template->fetch($view);
+*/
+
+
+    }
+
+}
+
+?>
\ No newline at end of file
diff --git a/setup/adminHooks.php b/setup/adminHooks.php
new file mode 100644 (file)
index 0000000..6860589
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Misc Admin Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  adminHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Misc Hooks and Filters here. If this file exists, it will be included
+ * by the add-on main plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ *  add_filter( 'filter_title', function( $parameter ) {
+ *     // Function code
+ *  });
+ *
+ *  Also note that parameters will be in the context of the main admin controller constructor.
+  */
+
+
+// Add content to member detail page
+add_filter('glm-member-db-admin-management-hoooksHelp', function($content) {
+
+        // Read in this plugin/addon hook help file
+        $fname = GLM_MEMBERS_PACKAGING_PLUGIN_PATH.'/setup/hooksHelp.html';
+        if (is_file($fname)) {
+            $hooksHelp = file_get_contents($fname);
+            if ($hooksHelp != false) {
+                $content .= $hooksHelp;
+            }
+        }
+        return $content;
+    },
+    10,
+    2
+);
+
+?>
\ No newline at end of file
index 895147b..6a61ce9 100644 (file)
@@ -23,7 +23,7 @@
  *     // Function code
  *  });
  *
- *  Also note that parameters will be in the context of the main front controller constructor.
+ *  *** Also note that parameters will be in the context of the main front controller constructor. ***
  */
 
 // Setup rewrite for package detail pages
@@ -48,4 +48,16 @@ add_filter('init', function() {
     }
 });
 
+// Add content to member detail page - Get it from the existing package detail shortcode
+if (isset($this->config['addOns']['glm-member-db'])) {
+    add_filter('glm-member-db-front-members-detail-descriptionBottom', function($content, $id) {
+            $packageData = do_shortcode('[glm-members-packaging-detail id="'.$id.'"]');
+            $content .= $packageData;
+            return $content;
+        },
+        10,
+        2
+    );
+}
+
 ?>
\ No newline at end of file
diff --git a/setup/hooksHelp.html b/setup/hooksHelp.html
new file mode 100644 (file)
index 0000000..52438d1
--- /dev/null
@@ -0,0 +1,55 @@
+<!-- Hooks Help from glm-member-db-packaging Add-On -->
+
+        <tr><th colspan="3" class="glm-notice"><p>Packaging Add-On</p></th></tr>
+        
+        <tr><th colspan="3">User Permission Hooks</td></tr>
+        
+        <tr>
+            <th>glm_members_permit_admin_members_packages_tab</th>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Hook to test if the logged in user is permitted to see multi-member packaging tab.
+            </td>
+        </tr>
+        <tr>
+            <th>glm_members_permit_admin_members_packaging_add_package</th>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Hook to test if the logged in user is permitted to add a new multi-member package.
+            </td>
+        </tr>
+        <tr>
+            <th>glm_members_permit_admin_members_packaging_edit_package</th>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Hook to test if the logged in user is permitted to edit a multi-member package.
+            </td>
+        </tr>
+        <tr>
+            <th>glm_members_permit_admin_members_packages_tab</th>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Hook to test if the logged in user is permitted to see the member packaging tab.
+            </td>
+        </tr>
+        <tr>
+            <th>glm_members_permit_admin_member_packaging_add_package</th>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Hook to test if the logged in user is permitted to add a new Member package.
+            </td>
+        </tr>
+        <tr>
+            <th>glm_members_permit_admin_member_packaging_edit_package</th>
+            <td>Filter</td>
+            <td></td>
+            <td>
+                Hook to test if the logged in user is permitted to edit a member package.
+            </td>
+        </tr>
+