--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Front Package List
+ *
+ * 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 GlmMembersAdmin_ajax_packagesListJson 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;
+ $packages = []; // Used if sorting by package
+ $where = false;
+ $whereParts = array();
+ $noMemberWithPackage = true;
+
+ // Build $whereParts
+ $whereParts[] = "CURDATE() BETWEEN T.start_date AND T.end_date AND T.status = 10";
+
+ // Setup $where
+ $where = implode( ' AND ', $whereParts );
+ $orderBy = 'position ASC';
+
+ $list = $this->getPackageList( $where, $orderBy, $noMemberWithPackage );
+
+ $packageIndex = 0;
+ foreach ( $list as $package ) {
+ $packages[$packageIndex] = $package;
+ $packageIndex++;
+ }
+
+ header( 'Content-Type: application/json' );
+ echo json_encode( $packages );
+
+ }
+
+
+}