* PHP version 5.5
*
* @category glmWordPressPlugin
- * @package glmMembersDatabase
+ * @package glmBilling
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @release registratiosnSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @release billingSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
* @link http://dev.gaslightmedia.com/
*/
* @access public
*/
public $config;
- /**
- * Billing Request Cart
- *
- * $var $cart
- * @access public
- */
- public $cart = false;
/**
* 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
);
}
+ /**
+ * getAccountById
+ *
+ * Grab the account data using the account id.
+ *
+ * @param mixed $account
+ * @access public
+ * @return void
+ */
+ public function getAccountById( $account )
+ {
+ return $this->wpdb->get_row(
+ $this->wpdb->prepare(
+ "SELECT *
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE id = %d",
+ $account
+ ),
+ ARRAY_A
+ );
+ }
+
/**
* getTransactionsByAccount
*
--- /dev/null
+<?php
+/**
+ * Gaslight Media Associate
+ * Billings Plugin support class
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmBilling
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release notifications.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php';
+
+class GlmNotifications
+{
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+
+ /**
+ * Constructor
+ *
+ * @param object $d database connection
+ * @param array $config Configuration array
+ *
+ * @return void
+ * @access public
+ */
+ public function __construct($wpdb, $config)
+ {
+
+ // 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;
+
+ }
+
+ }
+
+ /**
+ * sendEmailNotification
+ *
+ * Send out the email notification based on type and the account.
+ *
+ * @param mixed $notification_type Id for notification type.
+ * @param mixed $account Id for the account.
+ *
+ * @access public
+ * @return void
+ */
+ public function sendEmailNotification( $notification_type, $account )
+ {
+ // Support Class
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+ // get the Account
+ $account = $BillingSupport->getAccountById( $account );
+ echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+
+ // get the Notification type
+ $notification_type = $this->getNotificationTypeById( $notification_type );
+ echo '<pre>$notification_type: ' . print_r( $notification_type, true ) . '</pre>';
+
+ }
+
+ /**
+ * getNotificationTypeById
+ *
+ * Grab the notification type based on the id.
+ *
+ * @param mixed $id Id of the notification_type
+ *
+ * @access public
+ * @return void
+ */
+ public function getNotificationTypeById( $id )
+ {
+ return $this->wpdb->get_row(
+ $this->wpdb->prepare(
+ "SELECT *
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "notification_types
+ WHERE id = %d",
+ $id
+ ),
+ ARRAY_A
+ );
+ }
+
+}
}
switch($_REQUEST['option']) {
+ case 'test':
+ echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/notifications.php';
+ $Notifications = new GlmNotifications( $this->wpdb, $this->config );
+ $notification_id = 5;
+ $account = 1;
+ $Notifications->sendEmailNotification( $notification_id, $account );
+ wp_die('Testing here');
+ break;
case 'add':
$notification = $this->newEntry();
$view = 'editNotificationType';