From 333e38c6261e38b41ba26f7df24b5d90540f3634 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Mon, 14 Dec 2015 14:26:25 -0500 Subject: [PATCH] Initially complete packaging --- classes/data/dataPackages.php | 17 ++ defines.php | 3 - glm-member-db-packaging.php | 7 +- models/admin/member/packaging.php | 36 ++- models/admin/members/packaging.php | 2 +- models/front/packaging/detail.php | 146 ++++++++++++ models/front/packaging/list.php | 221 ++++++++++++++++++ setup/adminTabs.php | 57 ++--- setup/permissions.php | 48 ++++ setup/shortcodes.php | 170 ++++++++++++++ setup/validActions.php | 5 +- views/admin/member/packaging.html | 325 +++++++++++++------------- views/admin/members/packaging.html | 353 +++++++++++++++-------------- views/front/footer.html | 10 + views/front/packaging/detail.html | 34 +++ views/front/packaging/header.html | 3 + views/front/packaging/list.html | 39 ++++ 17 files changed, 1125 insertions(+), 351 deletions(-) create mode 100644 models/front/packaging/detail.php create mode 100644 models/front/packaging/list.php create mode 100644 setup/shortcodes.php create mode 100644 views/front/footer.html create mode 100644 views/front/packaging/detail.html create mode 100644 views/front/packaging/header.html create mode 100644 views/front/packaging/list.html diff --git a/classes/data/dataPackages.php b/classes/data/dataPackages.php index b57b355..963c73b 100644 --- a/classes/data/dataPackages.php +++ b/classes/data/dataPackages.php @@ -231,6 +231,23 @@ class GlmDataPackages extends GlmDataAbstract } + public function entryPostProcessing($r, $a) + { + + // Only run these tests for list, get, edit, and delete + if (in_array($a, array('l', 'g', 'e', 'd', 'u')) && $r['ref_type'] > 0 && $r['ref_dest'] > 0) { + + // Get entity table + $table = GLM_MEMBERS_PLUGIN_DB_PREFIX.$this->config['ref_type_table'][$r['ref_type']['value']]; + + $dest = $this->wpdb->get_row("SELECT name FROM $table WHERE id = ".$r['ref_dest'].";"); + $r['ref_dest_name'] = $dest->name; + + } + + return $r; + } + } ?> \ No newline at end of file diff --git a/defines.php b/defines.php index 02a2c76..07ad47a 100644 --- a/defines.php +++ b/defines.php @@ -42,7 +42,6 @@ define('GLM_MEMBERS_PACKAGING_PLUGIN_URL', plugin_dir_url(__FILE__)); define('GLM_MEMBERS_PACKAGING_PLUGIN_ADMIN_URL', admin_url('admin.php')); define('GLM_MEMBERS_PACKAGING_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG); define('GLM_MEMBERS_PACKAGING_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]); -define('GLM_MEMBERS_PACKAGING_PLUGIN_MEDIA_URL', $WPUploadDir['baseurl'].'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG); // Directories define('GLM_MEMBERS_PACKAGING_PLUGIN_PATH', dirname(__FILE__)); @@ -55,7 +54,5 @@ define('GLM_MEMBERS_PACKAGING_PLUGIN_CONFIG_PATH', GLM_MEMBERS_PACKAGING_PLUGIN_ $pluginsPath = str_replace(GLM_MEMBERS_PACKAGING_PLUGIN_SLUG, '', GLM_MEMBERS_PACKAGING_PLUGIN_PATH); define('GLM_MEMBERS_PACKAGING_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db'); define('GLM_MEMBERS_PACKAGING_PLUGIN_LIB_PATH', GLM_MEMBERS_PACKAGING_MAIN_PLUGIN_PATH.'/lib'); -define('GLM_MEMBERS_PACKAGING_PLUGIN_MEDIA_PATH', $WPUploadDir['basedir'].'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG); -define('GLM_MEMBERS_PACKAGING_PLUGIN_IMAGES_PATH', GLM_MEMBERS_PACKAGING_MAIN_PLUGIN_PATH.'/images'); ?> diff --git a/glm-member-db-packaging.php b/glm-member-db-packaging.php index 963d1e0..556874a 100644 --- a/glm-member-db-packaging.php +++ b/glm-member-db-packaging.php @@ -106,7 +106,8 @@ function glmMembersPluginMinVerRequired() { echo '

The '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than ' - .GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!

+ .GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!
+ '.GLM_MEMBERS_PACKAGING_MIN_VERSION_NOTE.'

The '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' plugin has been de-activated.

'; @@ -117,6 +118,7 @@ function glmMembersPluginMinVerRequired() { */ $glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion'); if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) { + define('GLM_MEMBERS_PACKAGING_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, Packaging Requires: ".GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION); add_action( 'admin_notices', 'glmMembersPluginMinVerRequired'); deactivate_plugins('/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG.'/'.GLM_MEMBERS_PACKAGING_PLUGIN_SLUG.'.php'); } @@ -125,6 +127,7 @@ if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_PACKAGING_PLUG * Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded. */ require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/validActions.php'); +require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/shortcodes.php'); require_once(GLM_MEMBERS_PACKAGING_PLUGIN_DB_SCRIPTS.'/dbVersions.php'); function glmMembersRegisterPackaging($addOns) { @@ -135,6 +138,8 @@ function glmMembersRegisterPackaging($addOns) { 'short_name' => GLM_MEMBERS_PACKAGING_PLUGIN_SHORT_NAME, 'slug' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG, 'actions' => $GLOBALS['glmMembersPackagingAddOnValidActions'], + 'shortcodes' => $GLOBALS['glmMembersPackagingShortcodes'], + 'shortcodesDescription' => $GLOBALS['glmMembersPackagingShortcodesDescription'], 'database' => array( 'dbPrefix' => GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX, 'dbCurrentVersion' => GLM_MEMBERS_PACKAGING_PLUGIN_DB_VERSION, diff --git a/models/admin/member/packaging.php b/models/admin/member/packaging.php index 8c4743a..39b03ce 100644 --- a/models/admin/member/packaging.php +++ b/models/admin/member/packaging.php @@ -13,7 +13,7 @@ * @link http://dev.gaslightmedia.com/ */ -// Load Member Types data abstract +// Load Packages data abstract require_once(GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH.'/data/dataPackages.php'); /** @@ -88,6 +88,9 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages $packageUpdated = false; $packageInfo = false; $packageError = false; + $haveMember = false; + $memberID = false; + $memberName = false; $option = false; $error = false; @@ -103,12 +106,35 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages $packageID = $_REQUEST['packageID'] - 0; } + /* + * Get the selected member information + */ + // Get the current Member ID $memberID = 0; if (isset($_REQUEST['member']) && ($_REQUEST['member']-0) > 0) { $memberID = $_REQUEST['member'] - 0; } + // If we have a member ID + if ($memberID > 0) { + + // Get Member data + require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php'); + $Members = new GlmDataMembers($this->wpdb, $this->config); + $memberInfo = $Members->getEntry($memberID); + $memberName = $memberInfo['name']; + + // Check for good member data + if (!$memberInfo || count($memberInfo) == 0) { + $memberID = 0; + } else { + $haveMember = true; + } + + } + + // If we don't have a member ID at this point, then it's a fatal error if ($memberID == 0) { // There should have been a member ID - So failure @@ -119,8 +145,13 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages 'view' => 'admin/error/index.html', 'data' => false ); + } + /* + * Process based on supplied option + */ + switch($option) { case 'add': @@ -156,6 +187,7 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages // Tell the template there were errors and let them try again $packageError = true; + $option = 'add'; } break; @@ -262,7 +294,9 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages 'packageID' => $packageID, 'packageInfo' => $packageInfo, 'packageError' => $packageError, + 'haveMember' => $haveMember, 'memberID' => $memberID, + 'memberName' => $memberName, 'option' => $option ); diff --git a/models/admin/members/packaging.php b/models/admin/members/packaging.php index 4809410..6f44177 100644 --- a/models/admin/members/packaging.php +++ b/models/admin/members/packaging.php @@ -13,7 +13,7 @@ * @link http://dev.gaslightmedia.com/ */ -// Load Member Types data abstract +// Load packages data abstract require_once(GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH.'/data/dataPackages.php'); /** diff --git a/models/front/packaging/detail.php b/models/front/packaging/detail.php new file mode 100644 index 0000000..2561d5b --- /dev/null +++ b/models/front/packaging/detail.php @@ -0,0 +1,146 @@ + + * @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_detail 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); + + } + + /* + * Perform Model Action + * + * This method does the work for this model and returns any resulting data + * + * @return array Status and data array + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'menuItemRedirect' + * + * If not false, provides a menu item the controller should + * execute after this one. Normally if this is used, there would also be a + * modelRedirect value supplied as well. + * + * 'modelRedirect' + * + * If not false, provides an action the controller should execute after + * this one. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + */ + public function modelAction ($actionData = false) + { + + $havePackage = false; + $packageID = false; + $package = false; + $settings = array(); + $status = false; + + // Get requested package - Check URL parameter first + if (isset($_REQUEST['packageID'])) { + $packageID = ($_REQUEST['packageID'] - 0); + } + + // If not supplied in URL, then check shortcode attribute + if (!$packageID) { + $packageID = $actionData['request']['id'] - 0; + } + + // If there's a package ID, then get the package data + if ($packageID > 0) { + $package = $this->getEntry($packageID); + if ($package) { + $havePackage = true; + $status = true; + } + } + + // Compile template data + $templateData = array( + 'havePackage' => $havePackage, + 'packageID' => $packageID, + 'package' => $package + ); + + // Return status, suggested view, and data to controller - also return any modified settings + return array( + 'status' => $status, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'front/packaging/detail.html', + 'data' => $templateData, + 'settings' => $settings + ); + + } + + +} + +?> \ No newline at end of file diff --git a/models/front/packaging/list.php b/models/front/packaging/list.php new file mode 100644 index 0000000..fd1de41 --- /dev/null +++ b/models/front/packaging/list.php @@ -0,0 +1,221 @@ + + * @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_list 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); + + } + + /* + * Perform Model Action + * + * This method does the work for this model and returns any resulting data + * + * @return array Status and data array + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'menuItemRedirect' + * + * If not false, provides a menu item the controller should + * execute after this one. Normally if this is used, there would also be a + * modelRedirect value supplied as well. + * + * 'modelRedirect' + * + * If not false, provides an action the controller should execute after + * this one. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + */ + public function modelAction ($actionData = false) + { + + $havePackages = false; + $settings = array(); + $status = false; + $where = 'true'; + $orderBy = ''; + $byMember = false; + + // Select by specified type + switch($actionData['request']['type']) { + + // Member Packages Only + case 'member': + + $where .= ' AND T.ref_dest > 0'; + break; + + // Multi-member Packages (CVB) Only + case 'multi-member': + + $where .= ' AND T.ref_dest = 0'; + break; + + // All package types + case 'all': + default: + + $type = 'all'; + break;; + + } + + // Check for specified member ID + $memberID = ($actionData['request']['member'] - 0); + if ($actionData['request']['member'] > 0) { + $where .= " AND T.ref_type = ".$this->config['ref_type_numb']['Member']." and T.ref_dest = $memberID"; + } + + // Check for specified output ordering + $order_type = $actionData['request']['order']; + switch($order_type) { + + case 'member': + // Need to do this here after getting data + + case 'title': + $orderBy = 'T.title'; + break; + + case 'start-date': + $orderBy = 'T.start_date'; + break; + + case 'end-date': + $orderBy = 'T.end_date'; + break; + + case 'exp-date': + $orderBy = 'T.expire_date'; + break; + + default: + $order_type = 'member'; // Sets type to 'member' to do after getting the list + break; + + } + + // Get the selected list of packages + $packages = $this->getList($where, $orderBy); + if ($packages && count($packages) > 0) { + $havePackages = true; + $status = true; + } + + // Check for specified output ordering by member name + function packageMemberCmp($a, $b) { + if ($a['ref_dest_name'] == $b['ref_dest_name']) { + return 0; + } + return ($a['ref_dest_name'] < $b['ref_dest_name']) ? -1 : 1; + } + if ($actionData['request']['order'] == 'member') { + + // Sort by member name + reset($packages); + uasort($packages, 'packageMemberCmp'); + + // Mark first entry for each member + reset($packages); + $memb = ''; + while (list($key, $val) = each($packages)) { + $packages[$key]['firstForMember'] = false; + if ($memb != $val['ref_dest_name']) { + $packages[$key]['firstForMember'] = true; + $memb = $val['ref_dest_name']; + } + } + + $byMember = true; + } + + // Compile template data + $templateData = array( + 'havePackages' => $havePackages, + 'packages' => $packages, + 'byMember' => $byMember + ); + + // Return status, suggested view, and data to controller - also return any modified settings + return array( + 'status' => $status, + 'menuItemRedirect' => false, + 'modelRedirect' => false, + 'view' => 'front/packaging/list.html', + 'data' => $templateData, + 'settings' => $settings + ); + + } + + +} + +?> \ No newline at end of file diff --git a/setup/adminTabs.php b/setup/adminTabs.php index b0f6c3d..d0bb894 100644 --- a/setup/adminTabs.php +++ b/setup/adminTabs.php @@ -33,33 +33,36 @@ * */ -add_filter('glm-member-db-add-tab-for-members', - function($addOnTabs) { - $newTabs = array( - array( - 'text' => 'Packaging', - 'menu' => 'members', - 'action' => 'packaging' - ) - ); - $addOnTabs = array_merge($addOnTabs, $newTabs); - return $addOnTabs; - } -); - -add_filter('glm-member-db-add-tab-for-member', - function($addOnTabs) { - $newTabs = array( - array( - 'text' => 'Packaging', - 'menu' => 'member', - 'action' => 'packaging' - ) - ); - $addOnTabs = array_merge($addOnTabs, $newTabs); - return $addOnTabs; - } -); +if (apply_filters('glm_members_permit_admin_members_packages_tab', true)) { + add_filter('glm-member-db-add-tab-for-members', + function($addOnTabs) { + $newTabs = array( + array( + 'text' => 'Packaging', + 'menu' => 'members', + 'action' => 'packaging' + ) + ); + $addOnTabs = array_merge($addOnTabs, $newTabs); + return $addOnTabs; + } + ); +} +if (apply_filters('glm_members_permit_admin_members_packages_tab', true)) { + add_filter('glm-member-db-add-tab-for-member', + function($addOnTabs) { + $newTabs = array( + array( + 'text' => 'Packaging', + 'menu' => 'member', + 'action' => 'packaging' + ) + ); + $addOnTabs = array_merge($addOnTabs, $newTabs); + return $addOnTabs; + } + ); +} ?> \ No newline at end of file diff --git a/setup/permissions.php b/setup/permissions.php index 048444d..d037bfa 100644 --- a/setup/permissions.php +++ b/setup/permissions.php @@ -41,4 +41,52 @@ * Of course any of these may test more than one capability if that's desired. */ +// glm-member-db, view/members/index.html, Display Multi-Member (CVB) Packages tab +add_filter('glm_members_permit_admin_members_packages_tab', + function($permit) { + if (!$permit) { return false; } + return current_user_can('glm_members_view_any_member'); + } +); + +// glm-member-db, view/members/packaging.html, Add a Multi-Member (CVB) Package +add_filter('glm_members_permit_admin_members_packaging_add_package', + function($permit) { + if (!$permit) { return false; } + return current_user_can('glm_members_edit_any_member'); + } +); + +// glm-member-db, view/member/packaging.html, Edit a Multi-Member (CVB) Package +add_filter('glm_members_permit_admin_members_packaging_edit_package', + function($permit) { + if (!$permit) { return false; } + return current_user_can('glm_members_view_any_member'); + } +); + +// glm-member-db, view/member/index.html, Display Member Packages tab +add_filter('glm_members_permit_admin_members_packages_tab', + function($permit) { + if (!$permit) { return false; } + return current_user_can('glm_members_view_any_member') || current_user_can('glm_members_view_my_member'); + } +); + +// glm-member-db, view/member/packaging.html, View a Member Package +add_filter('glm_members_permit_admin_member_packaging_add_package', + function($permit) { + if (!$permit) { return false; } + return current_user_can('glm_members_edit_any_member') || current_user_can('glm_members_edit_my_member'); + } +); + +// glm-member-db, view/member/contacts.html, Edit a Member Package +add_filter('glm_members_permit_admin_member_packaging_edit_package', + function($permit) { + if (!$permit) { return false; } + return current_user_can('glm_members_edit_any_member') || current_user_can('glm_members_edit_my_member'); + } +); + ?> \ No newline at end of file diff --git a/setup/shortcodes.php b/setup/shortcodes.php new file mode 100644 index 0000000..4d7ae5b --- /dev/null +++ b/setup/shortcodes.php @@ -0,0 +1,170 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release shortcodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * Array of short-code + * + * This array lists all of the short-codes available from the main + * member plugin and all add-ons that provide short-code features. + * + * This array is merged with the data from any registered add-ons + * providing short-code features. The plugin providing the short-code + * is designated in the 'plugin' elemeent. + * + * A shortcode is unique to a particular plugin. To provide additional + * data and features to a short-code, an add-on should use filters + * provided by the short-code to insert data into the template array, + * to insert additional format into the template, or to insert + * text directly into the completed template output. + * + * The "attributes" array is a list of available attributes for this + * shortcode and their default values. If a database table is provided, + * then the value for each attribute is a table column where we get + * the default value. If no table is provided, then the value for + * each attribute is the actual default value for that attribute. + * In the case that the data is taken from the database table, the + * "id" for the table entry where the data is stored is assumed to + * be 1. + * + * Note that if the value for a particular attribute is false, then + * it is not read from the database even if the table is specified + * but might be supplied at run-time as an attribute in the short-code. + * All attributes that might be specified in the shortcode must be + * listed in the 'attributes' array below. If an attribute is not + * specified here, it can't be read from the short-code. + * + * The following is an explanation of this array. + * + * array( + * '{shortcode-slug} => array( + * 'plugin' => '{plugin (add-on) slug}', // Identifies which plugin is providing the short-code + * 'menu' => '{menu name}', // Menu name in this context is simply where to find the action + * 'action' => '{shortcode action name}, // Action used to execute this shortcode + * 'table' => '{table prefix}{table name}', // Database table where default attribute values are stored + * 'attributes' => array( // An array of all shortcode attributes (options) + * '{attr name}' => '{field name}', // Available attribute names and the database field names with the default value + * .... + * ), + * ... additional short-codes + * ) + * + */ + +$glmMembersPackagingShortcodes = array( + 'glm-members-packaging-list' => array( + 'plugin' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG, + 'menu' => 'packaging', + 'action' => 'list', + 'table' => false, + 'attributes' => array( + 'type' => 'all', // 'all', 'member', 'multi-member' + 'order' => 'member', // 'member', 'title', 'start-date', 'end-date', 'exp-date' + 'member' => false // ID of member for member specific list + ) + ), + 'glm-members-packaging-detail' => array( + 'plugin' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG, + 'menu' => 'packaging', + 'action' => 'detail', + 'table' => false, + 'attributes' => array( + 'id' => false + ) + ) +); + +$glmMembersPackagingShortcodesDescription = ' + + + [glm-members-packaging-list] +   + +

+ Displays a list of packages. Optionally, the attributes below may used to modify + the display of this page. +

+ + + +   + type="{list type}" + +

+ The "type" attribute is used to select the type of list you would like displayed. + Below is a list of available list types. +

+

+ + + + + +
List Types
allList all packages
memberMember packages only
multi-memberMulti-member (CVB) packages only
+

+ + + + +   + order="{ordering method}" + +

+ The "order" attribute is used to specify how the list will be ordered (sorted). + Below is a list of available order types. +

+

+ + + + + + + + +
Ordering Types
specifiedOrder specified in the packages
memberBy member name
titleBy package title
start-dateBy package start date
end-dateBy package end date
expire-dateBy package expire date
+

+ + + +   + member="{member ID}" + +

+ The "member" attribute is used to specify a member ID. When included, the list + will only include packages for the member with that ID. +

+ + + + [glm-members-packaging-detail] +   + +

+ Displays the detail of a specific package. +

+ + + +   + id="{package ID}" + +

+ The "id" attribute is used to select the package to be displayed. This is a + required attribute. +

+ + + +'; \ No newline at end of file diff --git a/setup/validActions.php b/setup/validActions.php index ba1e4d4..f427686 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -40,8 +40,11 @@ $glmMembersPackagingAddOnValidActions = array( ) ), 'frontActions' => array( + 'packaging' => array( + 'list' => 'glm-member-db-packaging', + 'detail' => 'glm-member-db-packaging' + ) ) ); - ?> \ No newline at end of file diff --git a/views/admin/member/packaging.html b/views/admin/member/packaging.html index 611230d..4e31cc7 100644 --- a/views/admin/member/packaging.html +++ b/views/admin/member/packaging.html @@ -1,167 +1,189 @@ {include file='admin/member/header.html'} - {if $packageUpdated}

Package Updated

{/if} - {if $packageError}

Error submitting package, see below...

{/if} - {if $option == 'edit' || $option == 'add'} - - {if $option == 'edit'} -

Edit Package

- {else} -

Add new Package

- {/if} + + {if apply_filters('glm_members_permit_admin_member_packaging_edit_package', true)} -
- - - - - {if $havePackage} - - + {if $packageUpdated}

Package Updated

{/if} + {if $packageError}

Error submitting package, see below...

{/if} + + {if $option == 'edit'} +

Edit Package

{else} - +

Add new Package

{/if} + + + + + + + + {if $havePackage} + + + {else} + + {/if} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Title: + + {if $packageInfo.fieldFail.title}

{$packageInfo.fieldFail.title}

{/if} +
Active: + +
Description: + {php} + wp_editor('{$packageInfo.fieldData.descr|escape:quotes}', 'glm_descr', array( + // 'media_buttons' => true, + // 'quicktags' => false, + // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. + 'textarea_name' => 'descr', + 'editor_height' => 200, // Height in px, overrides editor_rows + // 'textarea_rows' => 8 + )); + {/php} + {if $packageInfo.fieldFail.descr}

{$packageInfo.fieldFail.descr}

{/if} +
Short Description: + + {if $packageInfo.fieldFail.short_descr}

{$packageInfo.fieldFail.short_descr}

{/if} +
Image: + + {if $packageInfo.fieldData.image} + + + + + {/if} + +
+
+ +
+
+ Delete Image
+ {$packageInfo.fieldData.image}
+
New image:
+
+ {if $packageInfo.fieldFail.image}

{$packageInfo.fieldFail.image}

{/if} +
Start Date: + + {if $packageInfo.fieldFail.start_date}

{$packageInfo.fieldFail.start_date}

{/if} +
End Date: + + {if $packageInfo.fieldFail.end_date}

{$packageInfo.fieldFail.end_date}

{/if} +
Expire Date: + + {if $packageInfo.fieldFail.expire_date}

{$packageInfo.fieldFail.expire_date}

{/if} +
Pricing Description: + + {if $packageInfo.fieldFail.pricing}

{$packageInfo.fieldFail.pricing}

{/if} +
Display Order: + + {if $packageInfo.fieldFail.position}

{$packageInfo.fieldFail.position}

{/if} +
+ +
+ + {else} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + +
Active: - -
Title: - - {if $packageInfo.fieldFail.title}

{$packageInfo.fieldFail.title}

{/if} -
Description: - {php} - wp_editor('{$packageInfo.fieldData.descr|escape:quotes}', 'glm_descr', array( - // 'media_buttons' => true, - // 'quicktags' => false, - // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text. - 'textarea_name' => 'descr', - 'editor_height' => 200, // Height in px, overrides editor_rows - // 'textarea_rows' => 8 - )); - {/php} - {if $packageInfo.fieldFail.descr}

{$packageInfo.fieldFail.descr}

{/if} -
Short Description: - - {if $packageInfo.fieldFail.short_descr}

{$packageInfo.fieldFail.short_descr}

{/if} -
Logo: - - {if $packageInfo.fieldData.image} - - - - - {/if} - -
-
- -
-
- Delete Image
- {$packageInfo.fieldData.image}
-
New image:
- - {if $packageInfo.fieldFail.image}

{$packageInfo.fieldFail.image}

{/if} -
Start Date: - - {if $packageInfo.fieldFail.start_date}

{$packageInfo.fieldFail.start_date}

{/if} -
End Date: - - {if $packageInfo.fieldFail.end_date}

{$packageInfo.fieldFail.end_date}

{/if} -
Expire Date: - - {if $packageInfo.fieldFail.expire_date}

{$packageInfo.fieldFail.expire_date}

{/if} -
Pricing Description: - - {if $packageInfo.fieldFail.pricing}

{$packageInfo.fieldFail.pricing}

{/if} -
Display Order: - - {if $packageInfo.fieldFail.position}

{$packageInfo.fieldFail.position}

{/if} -
Title:{$packageInfo.fieldData.title}
Active:{$packageInfo.fieldData.active.name}
Description:{$packageInfo.fieldData.descr}
Short Description:{$packageInfo.fieldData.short_descr}
Image:
Start Date:{$packageInfo.fieldData.start_date.date}
End Date:{$packageInfo.fieldData.end_date.date}
Expiration Date:{$packageInfo.fieldData.expire_date.date}
Pricing Description:{$packageInfo.fieldData.pricing}
Display Order:{$packageInfo.fieldData.position}
- - -{else} - -
Add a Package
-

Multi-Member Packages

+ {/if} - - - - - - - - - - - {if $havePackages} - {foreach $packages as $p} - - - - - - - {/foreach} - {else} - +{else} + + {if apply_filters('glm_members_permit_admin_member_packaging_add_package', true)} +
Add a Package
{/if} - -
PackageStartEndExpire
- {$p.title} - - {$p.start_date.date} - - {$p.end_date.date} - - {$p.expire_date.date} -
(no packages listed)
- -{/if} + +

Multi-Member Packages

+ + + + + + + + + + + + {if $havePackages} + {foreach $packages as $p} + + + + + + + {/foreach} + {else} + + {/if} + +
PackageStartEndExpire
+ {$p.title} + + {$p.start_date.date} + + {$p.end_date.date} + + {$p.expire_date.date} +
(no packages listed)
+{/if} + {/if} + + \ No newline at end of file diff --git a/views/front/packaging/detail.html b/views/front/packaging/detail.html new file mode 100644 index 0000000..b2e9506 --- /dev/null +++ b/views/front/packaging/detail.html @@ -0,0 +1,34 @@ +{include file='front/packaging/header.html'} + +{if $havePackage} + +
+

{$package.title}

+ {if $package.ref_type.value} +

{$package.ref_type.name}: {$package.ref_dest_name}

+ {/if} + {if $package.image} +
+ +
+ {/if} +
+ + + + + +
Start Date:{$package.start_date.date}
End Date:{$package.end_date.date}
Expiration Date:{$package.expire_date.date}
Pricing:{$package.pricing}
+ {if $package.descr} +

Description: {$package.descr}

+ {else if $package.short_descr} +

Description: {$package.short_descr}

+ {/if} +
+
+ +{else} + (Sorry, no data on the specified package.) +{/if} + +{include file='front/footer.html'} diff --git a/views/front/packaging/header.html b/views/front/packaging/header.html new file mode 100644 index 0000000..4af7c4f --- /dev/null +++ b/views/front/packaging/header.html @@ -0,0 +1,3 @@ +
+
+ \ No newline at end of file diff --git a/views/front/packaging/list.html b/views/front/packaging/list.html new file mode 100644 index 0000000..1b7d851 --- /dev/null +++ b/views/front/packaging/list.html @@ -0,0 +1,39 @@ +{include file='front/packaging/header.html'} + +{foreach $packages as $p} +
+ {if $p.ref_type.value} + {if $byMember} + {if $p.firstForMember} +

{$p.ref_type.name}: {$p.ref_dest_name}

+ {/if} + {else} +

{$p.ref_type.name}: {$p.ref_dest_name}

+ {/if} + {/if} +

{$p.title}

+ {if $p.image} +
+ +
+ {/if} +
+ + + + + +
Start Date:{$p.start_date.date}
End Date:{$p.end_date.date}
Expiration Date:{$p.expire_date.date}
Pricing:{$p.pricing}
+ {if $p.descr} +

Description: {$p.descr}

+ {else if $p.short_descr} +

Description: {$p.short_descr}

+ {/if} +
+
+ + + +{/foreach} + +{include file='front/footer.html'} -- 2.17.1