'exportPriContactName' => $this->checkFlag('exportPriContactName'),
'exportPriContactEmail' => $this->checkFlag('exportPriContactEmail'),
'exportUrl' => $this->checkFlag('exportUrl'),
- 'exportCategories' => $this->checkFlag('exportCategories')
+ 'exportCategories' => $this->checkFlag('exportCategories'),
+ 'exportClicks' => $this->checkFlag('exportClicks'),
+ 'exportViews' => $this->checkFlag('exportViews')
);
// Only return information records that are active
// If we have any entries
$memberCount = count($list);
if ($memberCount > 0) {
+
$haveMembers = true;
+
+ // If URL Clicks and/or Views are selected
+ if ($select['exportClicks'] || $select['exportViews']) {
+
+ foreach($list as $k=>$v) {
+
+ $thisMonth = date('Y-m-d', strtotime($_REQUEST['monthYear']));
+
+ if ($select['exportClicks']) {
+ $clicks = $this->wpdb->get_row("
+ SELECT COALESCE ((
+ SELECT clicks
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."clickthrough_stats
+ WHERE member = ".$v['id']."
+ AND stat_type = 3
+ AND stat_date = '$thisMonth'
+ ), 0) AS month
+ ", ARRAY_A);
+ $list[$k]['clicks'] = $clicks['month'];
+
+ }
+
+ if ($select['exportViews']) {
+ $views = $this->wpdb->get_row("
+ SELECT COALESCE ((
+ SELECT clicks
+ FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_detail_stats
+ WHERE member = ".$v['id']."
+ AND stat_type = 3
+ AND stat_date = '$thisMonth'
+ ), 0) AS month
+ ", ARRAY_A);
+
+ $list[$k]['views'] = $views['month'];
+
+ }
+ }
+ }
}
}
}
}
+ // Create current month/date string to pre-populate the Month/Year field for
+ $monthYear = date('F Y');
+
// Compile template data
$templateData = array(
+ 'monthYear' => $monthYear,
'enable_members' => $enable_members,
'haveMembers' => $haveMembers,
'members' => $list,
{if $select.exportOldId}<th align="left">Old ID</th>{/if}
{if $select.exportMember}<th align="left">{$terms.term_member_cap} Name</th>{/if}
{if $select.exportReferenceName}<th align="left">Active Profile</th>{/if}
+ {if $select.exportClicks}<th align="left">Clicks</th>{/if}
+ {if $select.exportViews}<th align="left">Views</th>{/if}
{if $select.exportAddr1}<th align="left">Address</th>{/if}
{if $select.exportAddr2}<th align="left">Addr Line #2</th>{/if}
{if $select.exportCity}<th align="left">City</th>{/if}
{if $select.exportOldId}<td>{$m.old_id}</td>{/if}
{if $select.exportMember}<td>{$m.member}</td>{/if}
{if $select.exportReferenceName}<td>{$m.reference_name}</td>{/if}
+ {if $select.exportClicks}<td>{$m.clicks}</td>{/if}
+ {if $select.exportViews}<td>{$m.views}</td>{/if}
{if $select.exportAddr1}<td>{$m.addr1}</td>{/if}
{if $select.exportAddr2}<td>{$m.addr2}</td>{/if}
{if $select.exportCity}<td>{$m.city}</td>{/if}
{if $select.exportOldId}"Old ID",{/if}
{if $select.exportMember}"{$terms.term_member_cap} Name",{/if}
{if $select.exportReferenceName}"Current Profile",{/if}
+{if $select.exportClicks}"Clicks",{/if}
+{if $select.exportViews}"Views",{/if}
{if $select.exportAddr1}"Address",{/if}
{if $select.exportAddr2}"Addr Line #2",{/if}
{if $select.exportCity}"City",{/if}
{if $select.exportOldId}"{$m.old_id}",{/if}
{if $select.exportMember}"{$m.member}",{/if}
{if $select.exportReferenceName}"{$m.reference_name}",{/if}
+{if $select.exportClicks}"{$m.clicks}",{/if}
+{if $select.exportViews}"{$m.views}",{/if}
{if $select.exportAddr1}"{$m.addr1}",{/if}
{if $select.exportAddr2}"{$m.addr2}",{/if}
{if $select.exportCity}"{$m.city}",{/if}
</table>
</td>
</tr>
+ <tr>
+ <th>Include Clicks & Views</th>
+ <td>
+ <table padding="3">
+ <tr>
+ <td>
+ Month: <input type="text" class="monthPicker" name="monthYear" value="{$monthYear}">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="checkbox" name="exportClicks"> URL Click Counts<br>
+ <input type="checkbox" name="exportViews"> Detail Page View Counts
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
<tr>
<th>Export to: </th>
<td>
<script type="text/javascript">
jQuery(document).ready(function($) {
-
- $("#exportMembersDialog").dialog({
+ $('.monthPicker').datepicker( {
+ changeMonth: true,
+ changeYear: true,
+ showButtonPanel: true,
+ dateFormat: 'MM yy',
+ onClose: function(dateText, inst) {
+ var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
+ var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
+ $(this).datepicker('setDate', new Date(year, month, 1));
+ },
+ beforeShow: function (input, inst) {
+ var $this = $(this),
+ // For the simplicity we suppose the dateFormat will be always without the day part, so we
+ // manually add it since the $.datepicker.parseDate will throw if the date string doesn't contain the day part
+ dateFormat = 'd ' + $this.datepicker('option', 'dateFormat'),
+ date;
+
+ try {
+ date = $.datepicker.parseDate(dateFormat, '1 ' + $this.val());
+ } catch (ex) {
+ return;
+ }
+
+ $this.datepicker('option', 'defaultDate', date);
+ $this.datepicker('setDate', date);
+
+ inst.dpDiv.addClass('datepicker-month-year');
+ }
+ });
+
+ $("#exportMembersDialog").dialog({
autoOpen: false,
- minWidth: 600,
+ minWidth: 700,
dialogClass: "glm-dialog-no-close"
});
$('#exportMembersButton').click( function() {