From: Steve Sutton Date: Fri, 8 Jul 2016 21:01:06 +0000 (-0400) Subject: WIP for leads sub menu X-Git-Tag: v1.0.0^2~33 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=b27e8d6e8532c18d4a0585d26e728229583ba072;p=WP-Plugins%2Fglm-member-db-leads.git WIP for leads sub menu Working on the member leads data abstract classes for leads and lead_entry. building the page which will be the search for leads. testing getting the lead entries first to output into a table for the leads. --- diff --git a/classes/data/dataInterests.php b/classes/data/dataInterests.php index c107adf..640e37a 100644 --- a/classes/data/dataInterests.php +++ b/classes/data/dataInterests.php @@ -123,7 +123,6 @@ class GlmDataInterests extends GlmDataAbstract 'use' => 'a', ), - // Parent - for adding, deleting and editing, has selection Tables 'group_id' => array( 'field' => 'group_id', 'type' => 'pointer', diff --git a/classes/data/dataLeadEntry.php b/classes/data/dataLeadEntry.php new file mode 100644 index 0000000..428f2fa --- /dev/null +++ b/classes/data/dataLeadEntry.php @@ -0,0 +1,265 @@ + + * @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 + * @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; + } + +} diff --git a/classes/data/dataLeads.php b/classes/data/dataLeads.php index 82d4677..30ccda3 100644 --- a/classes/data/dataLeads.php +++ b/classes/data/dataLeads.php @@ -106,16 +106,22 @@ class GlmDataLeads extends GlmDataAbstract * Table Data Fields */ - $this->fields = array ( + $this->fields = array( - 'id' => array ( + 'id' => array( 'field' => 'id', 'type' => 'integer', 'view_only' => true, - 'use' => 'a' - ) - -/* MORE STUFF GOES HERE */ + 'use' => 'a', + ), + + 'email' => array( + 'field' => 'email', + 'type' => 'text', + 'required' => true, + 'unique' => true, + 'use' => 'a', + ), ); diff --git a/models/admin/leads/index.php b/models/admin/leads/index.php index 6a1739a..fb6847d 100644 --- a/models/admin/leads/index.php +++ b/models/admin/leads/index.php @@ -14,9 +14,11 @@ */ // 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 { /** @@ -82,8 +84,31 @@ class GlmMembersAdmin_leads_index extends GlmDataLeads 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 '
$grouped_interests: ' . print_r($grouped_interests, true) . '
'; // Compile template data $templateData = array( + 'leads' => $leads, ); // Return status, any suggested view, and any data to controller diff --git a/views/admin/leads/index.html b/views/admin/leads/index.html index 1309ea5..c2148df 100644 --- a/views/admin/leads/index.html +++ b/views/admin/leads/index.html @@ -1,6 +1,27 @@ {include file='admin/leads/header.html'} -

ADMIN LEADS VIEW STUFF GOES HERE

+
+
+
+
+
+ +
- -{include file='admin/footer.html'} \ No newline at end of file +{if $leads} + + + + + + + {foreach $leads as $lead} + + + + + + {/foreach} +
CompanyContactSubmitted
{$lead.org} {$lead.fname} {$lead.lname} {$lead.date_submitted}
+{/if} +{include file='admin/footer.html'}