--- /dev/null
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Leads
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package GLM Member-DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataLeads.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataLeads class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ * Exp $
+ */
+class GlmDataLeadEntry 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;
+
+ /**
+ * 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_LEADS_PLUGIN_DB_PREFIX . 'lead_entry';
+
+ /*
+ * Table Data Fields
+ */
+
+ $this->fields = array(
+
+ 'id' => array(
+ 'field' => 'id',
+ 'type' => 'integer',
+ 'view_only' => true,
+ 'use' => 'a',
+ ),
+
+ 'lead_id' => array(
+ 'field' => 'lead_id',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_LEADS_PLUGIN_DB_PREFIX . 'leads',
+ 'p_field' => 'email',
+ 'p_orderby' => 'email',
+ 'p_blank' => true,
+ 'force_list' => true,
+ 'required' => true,
+ 'use' => 'a'
+ ),
+
+ 'fname' => array(
+ 'field' => 'fname',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'lname' => array(
+ 'field' => 'lname',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'org' => array(
+ 'field' => 'org',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'addr1' => array(
+ 'field' => 'addr1',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'addr2' => array(
+ 'field' => 'addr2',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'city' => array(
+ 'field' => 'city',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'state' => array(
+ 'field' => 'state',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'zip' => array(
+ 'field' => 'zip',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'country' => array(
+ 'field' => 'country',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'phone' => array(
+ 'field' => 'phone',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'phone2' => array(
+ 'field' => 'phone2',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'fax' => array(
+ 'field' => 'fax',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'date_submitted' => array(
+ 'field' => 'date_submitted',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => false,
+ 'use' => 'a',
+ ),
+
+ 'user_trace_info' => array(
+ 'field' => 'user_trace_info',
+ 'type' => 'text',
+ 'required' => false,
+ 'unique' => 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;
+ }
+
+}
*/
// Load Leads data abstract
-require_once(GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataLeads.php');
+require_once(GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataLeadEntry.php');
+require_once GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataInterests.php';
+require_once GLM_MEMBERS_LEADS_PLUGIN_CLASS_PATH.'/data/dataInterestGroups.php';
-class GlmMembersAdmin_leads_index extends GlmDataLeads
+class GlmMembersAdmin_leads_index extends GlmDataLeadEntry
{
/**
public function modelAction($actionData = false)
{
+ if ( isset( $search ) && $search ) {
+ $leads = $this->getList();
+ } else {
+ $leads = '';
+ }
+ $leads = $this->getList();
+
+ $groupData = new GlmDataInterestGroups( $this->wpdb, $this->config );
+ $groups = $groupData->getList();
+
+ $grouped_interests = array();
+
+ if ( $groups ) {
+ foreach ( $groups as $group ) {
+ $intData = new GlmDataInterests( $this->wpdb, $this->config );
+ $grouped_interests[$group['title']] = $intData->getList(
+ "group_id = " . $group['id'],
+ 'title'
+ );
+ }
+ }
+ echo '<pre>$grouped_interests: ' . print_r($grouped_interests, true) . '</pre>';
// Compile template data
$templateData = array(
+ 'leads' => $leads,
);
// Return status, any suggested view, and any data to controller
{include file='admin/leads/header.html'}
-<H1>ADMIN LEADS VIEW STUFF GOES HERE</H1>
+<form>
+ <label>Company</label><br>
+ <input type="text" name="company"><br>
+ <label>Contact</label><br>
+ <input type="text" name="contact"><br>
+ <input type="submit" value="Search">
+</form>
-
-{include file='admin/footer.html'}
\ No newline at end of file
+{if $leads}
+ <table class="glm-admin-table">
+ <tr>
+ <th>Company</th>
+ <th>Contact</th>
+ <th>Submitted</th>
+ </tr>
+ {foreach $leads as $lead}
+ <tr>
+ <td> {$lead.org} </td>
+ <td> {$lead.fname} {$lead.lname} </td>
+ <td> {$lead.date_submitted} </td>
+ </tr>
+ {/foreach}
+ </table>
+{/if}
+{include file='admin/footer.html'}