From: Steve Sutton Date: Thu, 17 Nov 2016 21:53:54 +0000 (-0500) Subject: Setting up files for member contact coupon and the management section. X-Git-Tag: v1.0.0^2~24 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=7e14bc41c8224cc8755759d62da47a787ca826f3;p=WP-Plugins%2Fglm-member-db-coupons.git Setting up files for member contact coupon and the management section. Coping these from the events and switching the names to Coupon. --- diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php new file mode 100644 index 0000000..f23de95 --- /dev/null +++ b/classes/data/dataManagement.php @@ -0,0 +1,170 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataCoupons.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * GlmDataCoupon class + * + * PHP version 5 + * + * @category Data + * @package GLM Member DB + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataCouponsManagement extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Data Table Name + * + * @var $table + * @access public + */ + public $table; + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + /** + * MemberInfo DB object + * + * @var $MemberInfo + * @access public + */ + public $MemberInfo; + + /** + * Constructor + * + * @param object $d database connection + * @param array $config Configuration array + * @param bool $limitedEdit Flag to say indicate limited edit requested + * + * @return void + * @access public + */ + public function __construct($wpdb, $config, $limitedEdit = false) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Table Name + */ + $this->table = GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'settings'; + + /* + * Table Data Fields + */ + + $this->fields = array ( + + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Recipient Email + 'notify_to' => array( + 'field' => 'notify_to', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + // Sender Email + 'notify_from' => array( + 'field' => 'notify_from', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + // Email Notification + 'notify_message' => array( + 'field' => 'notify_message', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + + ); + + } + + /* + * Entry Post Processing Call-Back Method + * + * Perform post-processing for all result entries. + * + * In this case we're using it to append an array of category + * data to each member result and also sort by member name. + * + * @param array $r Array of field result data for a single entry + * @param string $a Action being performed (l, i, g, ...) + * + * @return object Class object + * + */ + public function entryPostProcessing($r, $a) + { + return $r; + } + +} diff --git a/models/admin/member/coupons.php b/models/admin/member/coupons.php new file mode 100644 index 0000000..0a7d49e --- /dev/null +++ b/models/admin/member/coupons.php @@ -0,0 +1,88 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + */ + +// Inform the coupons code that we're working from the member area +define('GLM_COUPONS_MEMBER_MENU', true); + +// Load the coupons index +require GLM_MEMBERS_COUPONS_PLUGIN_PATH."/models/admin/coupons/list.php"; + +// Extend the coupons index class +class GlmMembersAdmin_member_coupons extends GlmMembersAdmin_coupons_list +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Coupon ID + * + * @var $couponID + * @access public + */ + public $couponID = false; + + /* + * Constructor + * + * This contructor performs the work for this model. This model returns + * an array containing the following. + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Run constructor for the Coupons class + */ + parent::__construct($wpdb, $config); + + } + +} diff --git a/setup/adminMenus.php b/setup/adminMenus.php index b643093..7e6f0b3 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -65,3 +65,17 @@ add_submenu_page( 'glm-members-admin-menu-coupons-list', // Menu slug function() {$this->controller('coupons', 'list');} ); + +// If a contact is logged in (ownEntity isn't false), add Contact Profile menu item +if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser']['contactUser']) && $this->config['loggedInUser']['contactUser']) { + + add_submenu_page( + $mainMenuSlug, + 'Coupons', + 'Coupons', + 'glm_members_edit_my_entity', + 'glm-members-admin-menu-coupons-list', + function() {$this->controller('coupons');} + ); + +} diff --git a/views/admin/member/coupons.html b/views/admin/member/coupons.html new file mode 100644 index 0000000..173204b --- /dev/null +++ b/views/admin/member/coupons.html @@ -0,0 +1,25 @@ +{include file='admin/members/header.html'} + + +
+
+ + +

Coupons

+ + + + + + + + + + + + + +
Coupon TitleCategoryTimesDaysStart DateEnd Date