Adding member travel leads section with their search form.
working on saving page with admin search.
}
.glm-travel-edit .tsLog {
- margin: 10px 0;
- border-top: 1px dotted #369;
- border: 1px solid #eee;
- height: 1%;
- overflow: hidden;
+ margin: 10px 0;
+ border-top: 1px dotted #369;
+ border: 1px solid #eee;
+ height: 1%;
+ overflow: hidden;
}
.glm-travel-edit .tsLog h2 {
- font-family: Georgia, arial, sans-serif;
- font-size: 16px;
- padding: 5px 10px;
- background: #eee;
- font-weight: normal;
- margin: 0 0 1em 0 ;
+ font-family: Georgia, arial, sans-serif;
+ font-size: 16px;
+ padding: 5px 10px;
+ background: #eee;
+ font-weight: normal;
+ margin: 0 0 1em 0 ;
}
.glm-travel-edit .tsLog p {
- margin: 0 10px;
+ margin: 0 10px;
}
.glm-travel-edit .tlDelete {
- display: block;
- float: right;
- width: 16px;
- height: 16px;
- background: url(../assets/cancel.png) no-repeat;
- text-indent: -9000px;
- margin: 10px;
+ display: block;
+ float: right;
+ width: 16px;
+ height: 16px;
+ background: url(../assets/cancel.png) no-repeat;
+ text-indent: -9000px;
+ margin: 10px;
}
#addLog textarea {
text-indent: -1000px;
width: 198px;
height: 30px;
- float: right;
- background-image: url(../assets/tlSave.png);
- margin-right: 5px;
- margin-top: 5px;
+ float: right;
+ background-image: url(../assets/tlSave.png);
+ margin-right: 5px;
+ margin-top: 5px;
}
#change-1, #change-2 {
}
/* Travel Leads style framework */
#travel-admin .tlRounded {
- border-radius: 5px;
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- }
+ border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+ }
#travel-admin .tlShadow {
- -moz-box-shadow:inset 0 0 7px #fff,1px 1px 7px rgba(153, 153, 153, 0.2);
- -webkit-box-shadow:inset 0 0 7px #fff,1px 1px 7px rgba(153, 153, 153, 0.2);
- box-shadow:inset 0 0 7px #fff,1px 1px 7px rgba(153, 153, 153, 0.2);
- }
+ -moz-box-shadow:inset 0 0 7px #fff,1px 1px 7px rgba(153, 153, 153, 0.2);
+ -webkit-box-shadow:inset 0 0 7px #fff,1px 1px 7px rgba(153, 153, 153, 0.2);
+ box-shadow:inset 0 0 7px #fff,1px 1px 7px rgba(153, 153, 153, 0.2);
+ }
#travel-admin .tlBorder {
- border: 1px solid #999;
- }
+ border: 1px solid #999;
+ }
#travel-admin .tlTrans1 {
- background: #fff;
- background: rgba(255, 255, 255, .9);
- }
+ background: #fff;
+ background: rgba(255, 255, 255, .9);
+ }
#travel-wrapper {
- padding: 25px;
- width: 720px;
+ padding: 25px;
+ width: 720px;
min-height: 400px;
- background: rgba(255, 255, 255, .7);
- }
- /* main page fieldsets */
+ background: rgba(255, 255, 255, .7);
+ }
+ /* main page fieldsets */
#fieldsets {
- height: 1%;
- overflow: hidden;
- }
+ height: 1%;
+ overflow: hidden;
+ }
#travel-admin fieldset {
- display: block;
- float: left;
- margin-right: 20px;
- height: 9em;
+ display: block;
+ float: left;
+ margin-right: 20px;
+ height: 9em;
padding: 10px;
- }
+ }
#travel-admin fieldset:last-child {
- margin-right: 0;
- }
+ margin-right: 0;
+ }
#travel-admin fieldset p {
- font-weight: bold;
- font-family: Georgia, arial, sans-serif;
- font-size: 16px;
- font-size: 1.2rem;
- margin: 0.5em 0;
- }
+ font-weight: bold;
+ font-family: Georgia, arial, sans-serif;
+ font-size: 16px;
+ font-size: 1.2rem;
+ margin: 0.5em 0;
+ }
#findLeads div {
- margin: 0 0 10px 0;
- }
+ margin: 0 0 10px 0;
+ }
#findLeads label {
- width: 100px;
- display: block;
- float: left;
- line-height: 30px;
- }
+ width: 100px;
+ display: block;
+ float: left;
+ line-height: 30px;
+ }
#travel-admin fieldset form input {
- height: 28px;
- padding: 0;
- margin: 0;
- border-width: 1px;
- font-size: 14px;
- font-size: 1.0rem;
- display: block;
- width: 99%;
- }
+ height: 28px;
+ padding: 0;
+ margin: 0;
+ border-width: 1px;
+ font-size: 14px;
+ font-size: 1.0rem;
+ display: block;
+ width: 99%;
+ }
/* Buttons */
#travel-admin .button {
- width: 198px;
- height: 30px;
- text-indent: -9000px;
- display: block;
- cursor: pointer;
- margin-top: 10px;
- border-right: 1px solid #aaa;
- border-bottom: 1px solid #aaa;
- border-left: 1px solid #eee;
- border-top: 1px solid #eee;
- }
+ width: 198px;
+ height: 30px;
+ text-indent: -9000px;
+ display: block;
+ cursor: pointer;
+ margin-top: 10px;
+ border-right: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ border-left: 1px solid #eee;
+ border-top: 1px solid #eee;
+ }
#travel-admin .button:hover {
- border-right: 1px solid #888;
- border-bottom: 1px solid #888;
- border-left: 1px solid #ccc;
- border-top: 1px solid #ccc;
- }
+ border-right: 1px solid #888;
+ border-bottom: 1px solid #888;
+ border-left: 1px solid #ccc;
+ border-top: 1px solid #ccc;
+ }
/* Save Button */
#travel-admin .tlSave {
- float: right;
- background-image: url(../assets/tlSave.png);
- margin-right: 5px;
- margin-top: -5px;
- }
+ float: right;
+ background-image: url(../assets/tlSave.png);
+ margin-right: 5px;
+ margin-top: -5px;
+ }
#travel-admin fieldset form #leadCompanySearch {
- background-image: url(../assets/goCompany.png);
- }
+ background-image: url(../assets/goCompany.png);
+ }
#travel-admin fieldset form #leadContactSearch {
- background-image: url(../assets/goContact.png);
- }
+ background-image: url(../assets/goContact.png);
+ }
#travelToList {
- background-image: url(../assets/travelToList.png);
- }
+ background-image: url(../assets/travelToList.png);
+ }
#newLead {
- background-image: url(../assets/newLead.png);
- }
+ background-image: url(../assets/newLead.png);
+ }
/* Pagination */
#travel-admin .paging {
- display: block;
- }
+ display: block;
+ }
#travel-admin .paging,
#travel-admin .business-first-letter {
- clear: both;
- margin: 1em 0;
- padding: 1em 0 0 0;
- height: 1%;
- overflow: hidden;
- margin-left: 2px;
- }
+ clear: both;
+ margin: 1em 0;
+ padding: 1em 0 0 0;
+ height: 1%;
+ overflow: hidden;
+ margin-left: 2px;
+ }
#travel-admin .business-first-letter {
- margin-bottom: 1em;
- border-bottom: 1px dotted #369;
- padding-bottom: 1em;
- }
+ margin-bottom: 1em;
+ border-bottom: 1px dotted #369;
+ padding-bottom: 1em;
+ }
#travel-admin .paging b,
#travel-admin .business-first-letter a.curr {
- padding: 0.2em 0.4em;
- background: #eee;
- border: 1px solid #9AAFE5;
- margin-left: 0.2em;
- display: block;
- float: left;
- }
+ padding: 0.2em 0.4em;
+ background: #eee;
+ border: 1px solid #9AAFE5;
+ margin-left: 0.2em;
+ display: block;
+ float: left;
+ }
#travel-admin .paging a,
#travel-admin .business-first-letter a {
- margin-left: 0.2em;
- color: #036;
- padding: 0.2em 0.4em;
- border: 1px solid #9AAFE5;
- text-decoration: none;
- background: white;
- display: block;
- float: left;
- }
+ margin-left: 0.2em;
+ color: #036;
+ padding: 0.2em 0.4em;
+ border: 1px solid #9AAFE5;
+ text-decoration: none;
+ background: white;
+ display: block;
+ float: left;
+ }
#travel-admin .paging a:hover,
#travel-admin .business-first-letter a:hover {
- border: 1px solid #2e8d32;
- background: #eee;
- }
+ border: 1px solid #2e8d32;
+ background: #eee;
+ }
/* Table Grid */
#dataGrid {
- margin: 0.5em 0 1em 0;
- background: rgba(255, 255, 255, 0.0);
- }
+ margin: 0.5em 0 1em 0;
+ background: rgba(255, 255, 255, 0.0);
+ }
#dataGrid, #dataGrid tr, #dataGrid th, #dataGrid td {
- border: 1px solid #999;
- border-collapse: collapse;
- }
+ border: 1px solid #999;
+ border-collapse: collapse;
+ }
#dataGrid th, #dataGrid td {
- padding: 10px 20px;
- }
+ padding: 10px 20px;
+ }
#dataGrid th {
- background: #fff;
- }
+ background: #fff;
+ }
#dataGrid tr:nth-child(even) {
- background: rgba(231, 231, 231, .9);
- }
+ background: rgba(231, 231, 231, .9);
+ }
#dataGrid tr:nth-child(odd) {
- background: rgba(248, 248, 248, .9);;
- }
+ background: rgba(248, 248, 248, .9);;
+ }
#dataGrid tr:hover {
- background: #fff;
- cursor: pointer;
- }
+ background: #fff;
+ cursor: pointer;
+ }
+#dataGrid tr.nohand:hover{
+ cursor: initial !important;
+}
#dataGrid a {
- text-decoration: none;
- color: black;
- }
+ text-decoration: none;
+ color: black;
+ }
#dataGrid th a {
- text-decoration: underline;
- font-family: Georgia, arial, sans-serif;
- white-space: nowrap;
- }
+ text-decoration: underline;
+ font-family: Georgia, arial, sans-serif;
+ white-space: nowrap;
+ }
/* Breadcrumbs */
#breadcrumbs {
- background: white;
- color: #000;
- padding: 10px 15px;
- margin-bottom: 1em;
+ background: white;
+ color: #000;
+ padding: 10px 15px;
+ margin-bottom: 1em;
max-width: 700px;
- }
+ }
#breadcrumbs i {
- font-weight: bold;
- font-style: normal;
- }
+ font-weight: bold;
+ font-style: normal;
+ }
#lead-delete {
- float: right;
- margin-top: 10px;
- }
+ float: right;
+ margin-top: 10px;
+ }
#lead-delete a {
- margin: 5px;
- background: red;
- background: rgba(204, 0, 0, .4);
- padding: 5px;
- border: 1px solid #ccc;
- border-radius: 5px;
- color: white;
- text-shadow: 1px 1px 1px #888;
- text-decoration: none;
- }
+ margin: 5px;
+ background: red;
+ background: rgba(204, 0, 0, .4);
+ padding: 5px;
+ border: 1px solid #ccc;
+ border-radius: 5px;
+ color: white;
+ text-shadow: 1px 1px 1px #888;
+ text-decoration: none;
+ }
#lead-delete a:hover {
- background: red;
- background: rgba(204, 0, 0, 1.0);
+ background: red;
+ background: rgba(204, 0, 0, 1.0);
}
/* Overriding Form Framework */
div.webform td {
- font-size: 13px !important;
- font-size: 1.3rem !important;
- }
+ font-size: 13px !important;
+ font-size: 1.3rem !important;
+ }
div.webform table, div.webform td {
- border: 1px solid #aaa !important;
- }
+ border: 1px solid #aaa !important;
+ }
/* Overriding JqueryUI */
/* #travel-admin .ui-state-highlight { */
-/* margin-bottom: .5em; */
-/* padding: 15px; */
-/* } */
+/* margin-bottom: .5em; */
+/* padding: 15px; */
+/* } */
/* #travel-admin .ui-state-highlight p { */
-/* margin: 0; */
-/* } */
+/* margin: 0; */
+/* } */
/* #travel-admin .ui-icon { */
-/* float: left; */
-/* margin-right: .3em; */
-/* display: block; */
-/* } */
+/* float: left; */
+/* margin-right: .3em; */
+/* display: block; */
+/* } */
/* #tabs li a { */
-/* font-size: 13px; */
-/* font-size: 1.3rem; */
-/* } */
+/* font-size: 13px; */
+/* font-size: 1.3rem; */
+/* } */
#travel-admin .tsLog {
- margin: 10px 0;
- border-top: 1px dotted #369;
- border: 1px solid #eee;
- height: 1%;
- overflow: hidden;
- }
+ margin: 10px 0;
+ border-top: 1px dotted #369;
+ border: 1px solid #eee;
+ height: 1%;
+ overflow: hidden;
+ }
#travel-admin .tsLog h2 {
- font-family: Georgia, arial, sans-serif;
- font-size: 16px;
- font-size: 1.6rem;
- padding: 5px 10px;
- background: #eee;
- font-weight: normal;
- margin: 0 0 1em 0 ;
- }
+ font-family: Georgia, arial, sans-serif;
+ font-size: 16px;
+ font-size: 1.6rem;
+ padding: 5px 10px;
+ background: #eee;
+ font-weight: normal;
+ margin: 0 0 1em 0 ;
+ }
#travel-admin .tsLog p {
- margin: 0 10px;
- }
+ margin: 0 10px;
+ }
#travel-admin .tlDelete {
- display: block;
- float: right;
- width: 16px;
- height: 16px;
- background: url(../assets/cancel.png) no-repeat;
- text-indent: -9000px;
- margin: 10px;
- }
+ display: block;
+ float: right;
+ width: 16px;
+ height: 16px;
+ background: url(../assets/cancel.png) no-repeat;
+ text-indent: -9000px;
+ margin: 10px;
+ }
#travel-list {
max-width: 800px;
}
+
+/* Member travel leads */
+#file_export fieldset {
+ border-width: 2px;
+ border-style: groove;
+ border-color: grey;
+ position: relative;
+ width: 90%;
+}
+.clearfix:after {
+ content: "";
+ display: block;
+ clear: both;
+ height: 0;
+ line-height: 0;
+ visibility: hidden;
+}
+
+#file_export .field-container {
+ display: block;
+ position: relative;
+ float: left;
+ width: 48%;
+}
trigger_error( print_r( $_REQUEST, E_USER_NOTICE ) );
switch ( $option ) {
+ case 'update':
+ $lead_id = (isset($_REQUEST['id'])) ? filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT ) : false;
+ $note_id = (isset($_REQUEST['note_id'])) ? filter_var( $_REQUEST['note_id'], FILTER_VALIDATE_INT ) : false;
+ $note_entry = (isset($_REQUEST['note_entry'])) ? filter_var( $_REQUEST['note_entry'], FILTER_SANITIZE_STRING ) : false;
+ if ( $lead_id && $note_id && $note_entry ) {
+ $this->wpdb->update(
+ GLM_MEMBERS_TRAVEL_PLUGIN_DB_PREFIX . 'lead_notes',
+ array(
+ 'lead' => $lead_id,
+ 'updated' => date( 'Y-m-d H:i:s' ),
+ 'notes' => $note_entry
+ ),
+ array( 'id' => $note_id ),
+ array( '%d', '%s', '%s' ),
+ array( '%d' )
+ );
+ }
+ wp_redirect( admin_url() . 'admin.php?page=glm-members-admin-menu-glm-travel&glm_action=index&option=edit&id=' . $lead_id . '#ui-id-7' );
+ break;
case 'add':
$lead_id = filter_var( $_REQUEST['id'], FILTER_VALIDATE_INT );
if ( isset( $_REQUEST['new_log'] ) && $lead_id
}
}
+ // If we have a back request then go through the PHP_SESSION
+ // and extract them into the REQUEST array.
+ if ( isset( $_REQUEST['back'] ) && filter_var( $_REQUEST['back'], FILTER_VALIDATE_BOOLEAN ) ) {
+ if ( isset( $_SESSION['search'] ) && is_array( $_SESSION['search'] ) ) {
+ foreach ( $_SESSION['search'] as $varName => $sessValue ) {
+ $_REQUEST[$varName] = $sessValue;
+ }
+ $search = true;
+ }
+ }
+
if ( ( isset( $search ) && $search ) ) {
if ( isset( $search ) && $search ) {
$searching = true;
break;
default:
+ // Check for paging
+ if ( isset( $_REQUEST['pageSelect'] ) ) {
+ $_SESSION['search']['pageSelect'] = $_REQUEST['pageSelect'];
+ } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['pageSelect'] ) ) {
+ unset( $_SESSION['search']['pageSelect'] );
+ }
+ if ( isset( $_REQUEST['nextStart'] ) ) {
+ $_SESSION['search']['nextStart'] = $_REQUEST['nextStart'];
+ } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['nextStart'] ) ) {
+ unset( $_SESSION['search']['nextStart'] );
+ }
+ if ( isset( $_REQUEST['prevStart'] ) ) {
+ $_SESSION['search']['prevStart'] = $_REQUEST['prevStart'];
+ } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['prevStart'] ) ) {
+ unset( $_SESSION['search']['prevStart'] );
+ }
+
if ( ( isset( $search ) && $search ) || $searching ) {
- // echo '<pre>$where_parts: ' . print_r( $where_parts, true ) . '</pre>';
if ( isset( $where_parts ) && !empty( $where_parts ) ) {
$where .= ' AND ' . implode( ' AND ', $where_parts );
}
$order = "T.lname, T.fname";
}
- // Check if we're doing paging
- if (isset($_REQUEST['pageSelect'])) {
- // If request is for Next
- if ($_REQUEST['pageSelect'][0] == 'N') {
- $newStart = $_REQUEST['nextStart'] - 0;
-
- // Otherwise it must be Previous
- } else {
- $newStart = $_REQUEST['prevStart'] - 0;
- }
-
- if ($newStart > 0) {
- $start = $newStart;
- }
+ echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
+ echo '<pre>$order: ' . print_r( $order, true ) . '</pre>';
+ // Check if we're doing paging
+ if (isset($_REQUEST['pageSelect'])) {
+ // If request is for Next
+ if ($_REQUEST['pageSelect'][0] == 'N') {
+ $newStart = $_REQUEST['nextStart'] - 0;
+
+ // Otherwise it must be Previous
+ } else {
+ $newStart = $_REQUEST['prevStart'] - 0;
+ }
+
+ if ($newStart > 0) {
+ $start = $newStart;
}
+ }
+
// $entry = $this->getList( $where );
$orderBy = 'T.company ASC,T.lname ASC,T.fname ASC,T.updated DESC';
$entryResults = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
// Get paging results
+ $params = '';
$numbDisplayed = $entryResults['returned'];
$leadCount = $numbDisplayed;
$lastDisplayed = $entryResults['last'];
--- /dev/null
+<?php
+/**
+ * Gaslight Media Member Leads Database
+ * Leads search, list, edit page
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link http://dev.gaslightmedia.com/
+ */
+
+// Load Leads data abstract
+require_once GLM_MEMBERS_TRAVEL_PLUGIN_CLASS_PATH.'/data/dataLeads.php';
+require_once GLM_MEMBERS_TRAVEL_PLUGIN_CLASS_PATH . '/data/dataContacts.php';
+require_once GLM_MEMBERS_TRAVEL_PLUGIN_CLASS_PATH . '/data/dataNotes.php';
+
+class GlmMembersAdmin_travel_members extends GlmDataTravelLeads
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ public $entryId = 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 data class
+ *
+ * Note, the third parameter is a flag that indicates to the
+ * data class that it should flag a group of fields as 'view_only'.
+ */
+ parent::__construct(false, false, true);
+
+
+ }
+
+ public function modelAction($actionData = false)
+ {
+ $where = ' true ';
+ $option = false;
+ $user_can_edit_leads = false;
+ $wpUser = $this->config['loggedInUser']['wpUser'];
+ $search_id = false;
+ $numbDisplayed = false;
+ $lastDisplayed = false;
+ $paging = true;
+ $prevStart = false;
+ $nextStart = false;
+ $start = 1;
+ $limit = 20; // Set to the number of listings per page
+ $haveLeads = false;
+ $leadCount = 0;
+ $addingLead = false;
+ $searching = false;
+ $updating = false;
+ $updating_error = false;
+ $inserting = false;
+ $inserting_error = false;
+ $groups = false;
+ $sources = false;
+ $entry = false;
+ $hasSearch = false;
+ $tab = 0;
+ $params = false;
+
+ // Get any provided option
+ if ( isset( $_REQUEST['option'] ) ) {
+ $option = $_REQUEST['option'];
+ }
+
+ // Get entry ID if supplied
+ if (isset($_REQUEST['id'])) {
+
+ // Make sure it's numeric
+ $this->entryId = ( $_REQUEST['id'] - 0 );
+
+ if ( $this->entryId <= 0 ) {
+ $this->entryId = false;
+ }
+
+ }
+
+ // Check for a search being done.
+ if ( isset( $_REQUEST['search'] ) ) {
+ $search = filter_var( $_REQUEST['search'], FILTER_VALIDATE_BOOLEAN);
+ }
+ if ( isset( $_REQUEST['back'] ) ) {
+ $back = filter_var( $_REQUEST['back'], FILTER_VALIDATE_BOOLEAN);
+ if ( $back ) {
+ $searching = true;
+ }
+ }
+
+ // If we have a back request then go through the PHP_SESSION
+ // and extract them into the REQUEST array.
+ if ( isset( $_REQUEST['back'] ) && filter_var( $_REQUEST['back'], FILTER_VALIDATE_BOOLEAN ) ) {
+ if ( isset( $_SESSION['search'] ) && is_array( $_SESSION['search'] ) ) {
+ foreach ( $_SESSION['search'] as $varName => $sessValue ) {
+ $_REQUEST[$varName] = $sessValue;
+ }
+ $search = true;
+ }
+ }
+
+ $where_parts = array( 'T.status = 10' );
+
+ if ( ( isset( $search ) && $search ) ) {
+ if ( isset( $search ) && $search ) {
+ $searching = true;
+ }
+ // Filter the $_POST variables from the search form.
+ // Verify mm/dd/YYYY date format for the from and to dates.
+ $search_params = filter_var_array(
+ $_REQUEST,
+ array(
+ 'company' => FILTER_SANITIZE_STRING,
+ 'contact' => FILTER_SANITIZE_STRING,
+ )
+ );
+
+ // build the $where part
+ // echo '<pre>$search_params: ' . print_r( $search_params, true ) . '</pre>';
+ if ( $search_params['company'] ) {
+ $where_parts[] = "T.company like '%" . esc_sql( $search_params['company'] ) . "%'";
+ }
+ if ( $search_params['contact'] ) {
+ // Search for name.
+ // Could be in these formats:
+ // fname lname
+ // lname, fname
+ // lname fname
+ // lname
+ // fname
+ $name_parts = array();
+ $name_parts[] = "SOUNDEX(CONCAT_WS(' ', fname, lname)) = SOUNDEX( '" . esc_sql( $search_params['contact'] ) . "')";
+ $name_parts[] = "SOUNDEX(CONCAT_WS(' ', lname, fname)) = SOUNDEX( '" . esc_sql( $search_params['contact'] ) . "')";
+ $name_parts[] = "SOUNDEX(fname) = SOUNDEX( '" . esc_sql( $search_params['contact'] ) . "')";
+ $name_parts[] = "SOUNDEX(lname) = SOUNDEX( '" . esc_sql( $search_params['contact'] ) . "')";
+ $where_parts[] = implode( ' OR ', $name_parts );
+ }
+
+ }
+
+ // Initialize the interests array
+ $interests = array();
+
+ // Initialize the grouped_interests array
+ $grouped_interests = array();
+
+ switch ( $option ) {
+ default:
+ // Check for paging
+ if ( isset( $_REQUEST['pageSelect'] ) ) {
+ $_SESSION['search']['pageSelect'] = $_REQUEST['pageSelect'];
+ } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['pageSelect'] ) ) {
+ unset( $_SESSION['search']['pageSelect'] );
+ }
+ if ( isset( $_REQUEST['nextStart'] ) ) {
+ $_SESSION['search']['nextStart'] = $_REQUEST['nextStart'];
+ } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['nextStart'] ) ) {
+ unset( $_SESSION['search']['nextStart'] );
+ }
+ if ( isset( $_REQUEST['prevStart'] ) ) {
+ $_SESSION['search']['prevStart'] = $_REQUEST['prevStart'];
+ } else if ( isset( $_REQUEST['searched'] ) && !isset( $_REQUEST['prevStart'] ) ) {
+ unset( $_SESSION['search']['prevStart'] );
+ }
+
+ if ( isset( $where_parts ) && !empty( $where_parts ) ) {
+ $where .= ' AND ' . implode( ' AND ', $where_parts );
+ }
+ $order = "T.lname, T.fname";
+
+ // echo '<pre>$where_parts: ' . print_r( $where_parts, true ) . '</pre>';
+ // echo '<pre>$where: ' . print_r( $where, true ) . '</pre>';
+
+ // Check if we're doing paging
+ if (isset($_REQUEST['pageSelect'])) {
+ // If request is for Next
+ if ($_REQUEST['pageSelect'][0] == 'N') {
+ $newStart = $_REQUEST['nextStart'] - 0;
+
+ // Otherwise it must be Previous
+ } else {
+ $newStart = $_REQUEST['prevStart'] - 0;
+ }
+
+ if ($newStart > 0) {
+ $start = $newStart;
+ }
+ }
+
+ // $entry = $this->getList( $where );
+ $orderBy = 'T.company ASC,T.lname ASC,T.fname ASC,T.updated DESC';
+ $entryResults = $this->getList( $where, $orderBy, true, 'id', $start, $limit );
+
+ // Get paging results
+ $params = '';
+ $numbDisplayed = $entryResults['returned'];
+ $leadCount = $numbDisplayed;
+ $lastDisplayed = $entryResults['last'];
+ if ( $start == 1 ) {
+ $prevStart = false;
+ } else {
+ $prevStart = $start - $limit;
+ if ( $start < 1 ) {
+ $start = 1;
+ }
+ }
+ if ( $entryResults['returned'] == $limit ) {
+ $nextStart = $start + $limit;
+ }
+ $entry = $entryResults['list'];
+ if ( count( $entry ) > 0 ) {
+ $haveLeads = true;
+ }
+
+ $leadCount = count( $entry );
+
+ $view = 'members.html';
+
+ break;
+ }
+
+ // Enqueue the scripts for jqueryui
+ wp_enqueue_script( 'jquery-ui-tabs' );
+ wp_enqueue_style( 'jquery-ui-smoothness', 'https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.min.css' );
+
+ // Common things to place into the $templateData array
+ $templateData = array(
+ 'hasSearch' => $hasSearch,
+ 'params' => $params,
+ 'lead' => $entry,
+ 'haveLeads' => $haveLeads,
+ 'leadCount' => $leadCount,
+ 'numbDisplayed' => $numbDisplayed,
+ 'lastDisplayed' => $lastDisplayed,
+ 'prevStart' => $prevStart,
+ 'nextStart' => $nextStart,
+ 'prev' => ( isset( $_REQUEST['prevStart'] ) ? $_REQUEST['prevStart'] : ''),
+ 'next' => ( isset( $_REQUEST['nextStart'] ) ? $_REQUEST['nextStart'] : ''),
+ 'pageSelect' => ( isset( $_REQUEST['pageSelect'] ) ? $_REQUEST['pageSelect'] : ''),
+ 'start' => $start,
+ 'limit' => $limit,
+ 'paging' => $paging,
+ 'searching' => $searching,
+ 'updating' => $updating,
+ 'updating_error' => $updating_error,
+ 'inserting' => $inserting,
+ 'inserting_error' => $inserting_error,
+ );
+
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'admin/travel/' . $view,
+ 'data' => $templateData
+ );
+
+ }
+
+}
// if ( $memberCanAccessLeads ) {
add_submenu_page(
$mainMenuSlug,
- 'Leads',
- 'Leads',
+ 'Travel Leads',
+ 'Travel Leads',
'glm_members_edit_my_entity',
- 'glm-members-admin-menu-travel-index',
- function() {$this->controller('travel');}
+ 'glm-members-admin-menu-glm-travel',
+ function() {$this->controller('travel', 'members');}
);
// }
}
'referredBy' => GLM_MEMBERS_TRAVEL_PLUGIN_SLUG,
),
'travel' => array(
- 'index' => GLM_MEMBERS_TRAVEL_PLUGIN_SLUG,
- )
+ 'index' => GLM_MEMBERS_TRAVEL_PLUGIN_SLUG,
+ 'members' => GLM_MEMBERS_TRAVEL_PLUGIN_SLUG,
+ ),
),
'frontActions' => array(
)
{if $notes}
{foreach $notes as $n}
- <div class="tsLog">
+ <div id="show-log-{$n.id}" class="tsLog">
<h2>{$n.updated.datetime}</h2>
- <p>{$n.notes|nl2br}</p>
+ <p class="tsNote" data-id="{$n.id}">{$n.notes|nl2br}</p>
<a class="tlDelete" href="{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=travelNotes&option=delete&id={$lead_id}¬e_id={$n.id}" title="Delete this entry">Delete</a>
</div>
+ <form action="{$ajaxUrl}">
+ <input type="hidden" name="action" value="glm_members_admin_ajax" />
+ <input type="hidden" name="glm_action" value="travelNotes" />
+ <input type="hidden" name="id" value="{$lead_id}" />
+ <input type="hidden" name="note_id" value="{$n.id}" />
+ <input type="hidden" name="option" value="update" />
+ <div id="edit-log-{$n.id}" class="tsEditLog" style="display: none;">
+ <textarea class="edit-log" name="note_entry" cols="30" rows="5">{$n.notes}</textarea>
+ <input type="submit" class="button" value="Save" />
+ </div>
+ </form>
{/foreach}
{/if}
</div>
+
+<script>
+jQuery(function($){
+ $('.tsNote').click(function(){
+ var dataId = $(this).data('id');
+ // Show the edit form
+ $('#edit-log-' + dataId).show();
+ // Hide the tsLog output
+ $('#show-log-' + dataId).hide();
+
+ });
+});
+</script>
<div id="tabs" class="glm-travel-edit">
{if isset($lead.fieldData) && isset($lead.fieldData.id)}
- <div id="lead-delete" flexy:if="deleteUrl">
+ <div id="lead-delete">
<a
href="{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&id={$lead.fieldData.id}"
onClick="return confirm('This will delete this lead!\nAre You Sure?');">Delete {$lead.fieldData.fname} {$lead.fieldData.lname}</a>
<div id="breadcrumbs" class="tlShadow tlBorder tlRounded tlTrans1">
<a href="{$thisUrl}?page={$thisPage}&glm_action=index">Home</a>
>
+ <a href="{$thisUrl}?page={$thisPage}&glm_action=index&back=1">Search Results</a>
+ >
<i>{$lead.fieldData.fname} {$lead.fieldData.lname}</i>
</div>
{/if}
<br clear="all">
<p><b>Total found:</b> {$leadCount} </p>
{if $paging}
+ <input type="hidden" name="search" value="1">
+ {if isset($smarty.request.company)}<input type="hidden" name="company" value="{$smarty.request.company}">{/if}
+ {if isset($smarty.request.contact)}<input type="hidden" name="contact" value="{$smarty.request.contact}">{/if}
<input type="Submit" name="pageSelect" value="Previous {$limit} Leads" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
<input type="Submit" name="pageSelect" value="Next {$limit} Leads" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
{/if}
<tbody>
{foreach $lead as $e}
<tr class="{if $e@iteration is div by 2}even{else}odd{/if}">
- <td> <a class="company_link" href="{$thisUrl}?page={$thisPage}&glm_action=index&option=edit&id={$e.id}&{$params}">Edit</a></td>
+ <td> <a class="company_link" href="{$thisUrl}?page={$thisPage}&glm_action=index&option=edit&id={$e.id}">Edit</a></td>
<td> {$e.company} </td>
<td> {$e.fname} </td>
<td> {$e.lname} </td>
--- /dev/null
+<div id="travel-admin">
+ <form id="file_export" action="{$thisUrl}">
+ <input type="hidden" name="page" value="{$thisPage}" />
+ <input type="hidden" name="glm_action" value="members" />
+ <input type="hidden" name="search" value="1" />
+ <fieldset class="clearfix">
+ <legend>Search for Group Tour Leads</legend>
+ <div class="field-container">
+ <label>Company</label>
+ <input id="company" name="company"{if isset($smarty.request.company)} value="{$smarty.request.company}"{/if} />
+ </div>
+ <div class="field-container">
+ <label>Contact</label>
+ <input id="contact" name="contact"{if isset($smarty.request.contact)} value="{$smarty.request.contact}"{/if} />
+ </div>
+ <h3>Date Range</h3>
+ <div class="field-container">
+ <label>From</label>
+ <input class="datepicker" name="from_date" />
+ </div>
+ <div class="field-container">
+ <label>To</label>
+ <input class="datepicker" name="from_date" />
+ </div>
+ <h3>Locations</h3>
+ <div class="field-container">
+ states
+ <br />
+ <br />
+ <br />
+ <br />
+ <br />
+ </div>
+ <input type="submit" value="Search" />
+ <br />
+ </fieldset>
+ </form>
+</div>
+
+<script>
+jQuery(function($){
+ $('.datepicker').datepicker();
+});
+</script>
--- /dev/null
+{include file='admin/travel/header.html'}
+
+{include file='admin/travel/memberSearchForm.html'}
+
+{if $lead}
+ <form action="{$thisUrl}">
+ <input type="hidden" name="page" value="{$thisPage}" />
+ <input type="hidden" name="glm_action" value="members" />
+ <input type="hidden" name="prevStart" value="{$prevStart}">
+ <input type="hidden" name="nextStart" value="{$nextStart}">
+ <input type="hidden" name="limit" value="{$limit}">
+ <br clear="all">
+ <p><b>Total found:</b> {$leadCount} </p>
+ {if $paging}
+ <input type="hidden" name="search" value="1">
+ {if isset($smarty.request.company)}<input type="hidden" name="company" value="{$smarty.request.company}">{/if}
+ {if isset($smarty.request.contact)}<input type="hidden" name="contact" value="{$smarty.request.contact}">{/if}
+ <input type="Submit" name="pageSelect" value="Previous {$limit} Leads" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
+ <input type="Submit" name="pageSelect" value="Next {$limit} Leads" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
+ {/if}
+
+ <table id="dataGrid" class="dataGrid">
+ <thead>
+ <tr class="nohand">
+ <th> Company </th>
+ <th> First Name </th>
+ <th> Last Name </th>
+ <th> Updated </th>
+ </tr>
+ </thead>
+ <tbody>
+ {foreach $lead as $e}
+ <tr class="nohand {if $e@iteration is div by 2}even{else}odd{/if}">
+ <td> {$e.company} </td>
+ <td> {$e.fname} </td>
+ <td> {$e.lname} </td>
+ <td> {$e.updated.datetime} </td>
+ </tr>
+ {/foreach}
+ </tbody>
+ </table>
+
+ {if $paging}
+ <input type="Submit" name="pageSelect" value="Previous {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$prevStart} disabled{/if}>
+ <input type="Submit" name="pageSelect" value="Next {$limit} {$terms.term_member_plur_cap}" class="button button-secondary glm-button"{if !$nextStart} disabled{/if}>
+ {/if}
+ </form>
+{else}
+ No search results!
+{/if}
+
+{include file='admin/travel/footer.html'}
<input type="hidden" name="glm_action" value="index" />
<input type="hidden" name="search" value="1" />
<div>
- <input id="company" name="company">
+ <input id="company" name="company"{if isset($smarty.request.company)} value="{$smarty.request.company}"{/if}>
<input type="submit" value="Go" id="leadCompanySearch" class="button">
</div>
</form>
<input type="hidden" name="glm_action" value="index" />
<input type="hidden" name="search" value="1" />
<div>
- <input id="contact" name="contact">
+ <input id="contact" name="contact"{if isset($smarty.request.contact)} value="{$smarty.request.contact}"{/if}>
<input type="submit" value="Go" id="leadContactSearch" class="button">
</div>
</form>