--- /dev/null
+<?php
+/**
+ * Gaslight Media Members Database
+ * Admin File Library Upload
+ *
+ * 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/
+ */
+
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataFileLibrary.php';
+
+/*
+ * This model is called when the "Shortcodes" menu is selected
+ *
+ */
+class GlmMembersAdmin_export_index
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+
+ /*
+ * 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 members data class
+ parent::__construct(false, false);
+
+ }
+
+ public function modelAction($actionData = false) {
+
+
+ // Compile template data
+ $templateData = array(
+
+ );
+
+ // Return status, any suggested view, and any data to controller
+ return array(
+ 'status' => true,
+ 'modelRedirect' => false,
+ 'view' => 'admin/export/index.html',
+ 'data' => $templateData
+ );
+
+ }
+}
'detailViewCounts' => $detailViewCounts,
'statusPending' => $this->config['status_numb']['Pending'],
'addons' => $addons,
+ 'baseUrl' => GLM_MEMBERS_PLUGIN_URL
);
// Return status, suggested view, and data to controller.
'content' => 'Add Member',
'url' => $memberIndexPage . "&glm_action=memberEdit&option=add",
'classes' => '',
+ 'data' => '',
+ 'styles' => ''
+
],
],
],
'table' => $membersTable,
'url' => $membersIndexPage . "&option=search",
],
+ [
+ 'id' => 'eventExportModal',
+ 'title' => 'Export Events',
+ 'order' => 99,
+ 'template' => 'entityAmount',
+ 'table' => $membersTable,
+ 'url' => $membersIndexPage . "&option=search",
+ ],
[
'id' => 'textSearch',
'order' => 2,
),
'import' => array(
'index' => 'glm-member-db'
+ ),
+ 'export' => array(
+ 'index' => 'glm-member-db'
)
+
),
'frontActions' => array(
'members' => array(
--- /dev/null
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="index" />
+ <input type="hidden" name="option" value="validate" />
+
+ <table class="glm-admin-table" border="0" cellspacing="5" cellpadding="10">
+ <tr>
+ <th>File Type</th>
+ <th>New File</th>
+ <th>Sample File</th>
+ <th>Current File</th>
+ <th>Updated</th>
+ </tr>
+ {$count = 0}
+ {foreach $fileData as $fileHeader => $file}
+ <tr{if $count%2 == 0} class="alternate"{/if}>
+ <td class="glm-import-td">
+ {$fileHeader}
+ </td>
+ <td class="glm-import-td">
+ <input type="file" name="{$file.field}">
+ </td>
+ <td class="glm-import-td">
+ <a href="{$sampleFileUrl}{$file.name}">Sample {$fileHeader} File</a>
+ </td>
+ <td class="glm-import-td">
+ {if $file.exists}
+ {$fileHeader} File
+ {/if}
+ </td>
+ <td class="glm-import-td">
+ {if $file.exists}
+ {$file.mtime|date_format:"%D %I:%M %p"}
+ {/if}
+ </td>
+ </tr>
+ {$count = $count + 1}
+ {/foreach}
+ <tr>
+ <td>Clear Data</td>
+ <td colspan="4">
+ <input type="hidden" name="clear_data" value="0">
+ <input type="checkbox" name="clear_data" value="1" checked>
+ </td>
+ </tr>
+ </table>
+ <input type="submit" value="Continue" class="button button-primary submit-import">
+ </form>
+
+{include file='admin/footer.html'}
{foreach $component.buttons as $buttonName => $buttonData}
<a class="btn btn-small waves-effect waves-light {$buttonName}-button {if $buttonData.classes}{$buttonData.classes}{/if}"
style="font-style: normal; {if $buttonData.styles}{$buttonData.styles}{/if}"
- href="{if $buttonData.url}{$buttonData.url}{else}#{/if}" {if $buttonData.data} data-export={$buttonData.data} {/if}>
- {if $buttonData.content}{$buttonData.content}{/if}
+ href="{if $buttonData.url}{$buttonData.url}{/if}{if $buttonData.data}export-modal{else}#{/if}" {if $buttonData.data} data-export={$buttonData.data} {/if}>
+ {if $buttonData.content}{$buttonData.content} {$buttonData.data}{/if}
</a>
{/foreach}
</div>
</div>
</div>
<script>
- jQuery(function($){
-
- var date = new Date();
- var toDate = '', fromDate = '';
- $('.fromDate').datepicker({
- format : 'mm/dd/yyyy',
- setDefaultDate : true,
- defaultDate : date,
- autoClose : true,
- onClose : function(){
- fromDate = '&fromDate=' + $(this)[0].el.value;
- }
- });
- $('.toDate').datepicker({
- format : 'mm/dd/yyyy',
- autoClose : true,
- onClose: function(){
- toDate = '&toDate=' + $(this)[0].el.value;
- }
- });
- $('.date-search-btn').on("click", function(){
- window.location = '{$component.resultUrl}' +fromDate + toDate;
+ jQuery(function($){
+ dateSearch({
+ resultUrl : '{$component.resultUrl}'
+ })
})
- });
-</script>
\ No newline at end of file
+ </script>
\ No newline at end of file
--- /dev/null
+
+
+{$add.result}
\ No newline at end of file
</div>
<script>
jQuery(function($){
- let searchResults = {};
- let imageUrl = `{$glmPluginMediaUrl}/images`
- let data = {
- action : 'glm_members_admin_ajax',
- glm_action : 'glmTextSearch',
+ textSearch({
table : '{$component.table}',
fields : '{$component.fields}',
- where : '{$component.where}'
- }
- $('input#{$addon.slug}-text').autoComplete({
- source: function( request, response ) {
- data.query = request;
- $.ajax({
- dataType: "json",
- type : 'POST',
- url: '{$ajaxUrl}',
- data: data,
- success: function(data) {
- console.log(data.searchData);
- if(data.searchData){
- let searchDropdown = [];
- for(let i = 0;i < data.searchData.length;i++){
- let searchTitle = Object.keys(data.searchData[i])[0];
- let image = (data.searchData[i][searchTitle].image) ? data.searchData[i][searchTitle].image : null;
- let memberID = data.searchData[i][searchTitle].memberID;
- let entityID = data.searchData[i][searchTitle].entityID;
- searchDropdown.push(searchTitle);
- {literal} searchResults[searchTitle] = {image: image, memberID: memberID, entityID: entityID}; {/literal}
- }
- {literal} response(searchDropdown); {/literal}
- }else{
- response(['No Results Found'])
- }
- }
- });
- },
- renderItem: function (item, search){
- search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
- var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
- return '<div class="autocomplete-suggestion" data-langname="'+item[0]+'" data-lang="'+item[1]+'" data-val="'+search+'">'+item.replace(re, "<b>$1</b>")+'</div>';
-
- },
- onSelect: function(e, term, item){
- let search = $(item).text();
- console.log(search)
- if(search !== "No Results Found"){
- window.location.replace('{$component.resultUrl}&{$component.entityID}='+searchResults[search].entityID);
- }
- },
- minLength: 1,
- });
- });
+ where : '{$component.where}',
+ searchUrl : '{$component.resultUrl}'
+ })
+ })
</script>
\ No newline at end of file
</div>
</div>
</div>
+
+<!-- Modal Structure -->
+<div id="export-modal" class="modal"></div>
+
<script>
+
+ // Init
jQuery(function($){
- M.AutoInit();
- $(".widget-export-btn").on("click", function(){
- console.log( $(this).data('export') );
- })
+ $('.collapsible').collapsible();
})
+
+ function textSearch(textSearchData){
+ // Text Search Component
+ jQuery(function($){
+ let searchResults = {};
+ let imageUrl = `{$glmPluginMediaUrl}/images`
+ let data = {
+ action : 'glm_members_admin_ajax',
+ glm_action : 'glmTextSearch',
+ table : textSearchData.table,
+ fields : textSearchData.fields,
+ where : textSearchData.where
+ }
+ $('input#{$addon.slug}-text').autoComplete({
+ source: function( request, response ) {
+ data.query = request;
+ $.ajax({
+ dataType: "json",
+ type : 'POST',
+ url: '{$ajaxUrl}',
+ data: data,
+ success: function(data) {
+ console.log(data.searchData);
+ if(data.searchData){
+ let searchDropdown = [];
+ for(let i = 0;i < data.searchData.length;i++){
+ let searchTitle = Object.keys(data.searchData[i])[0];
+ let image = (data.searchData[i][searchTitle].image) ? data.searchData[i][searchTitle].image : null;
+ let memberID = data.searchData[i][searchTitle].memberID;
+ let entityID = data.searchData[i][searchTitle].entityID;
+ searchDropdown.push(searchTitle);
+ {literal} searchResults[searchTitle] = {image: image, memberID: memberID, entityID: entityID}; {/literal}
+ }
+ {literal} response(searchDropdown); {/literal}
+ }else{
+ response(['No Results Found'])
+ }
+ }
+ });
+ },
+ renderItem: function (item, search){
+ search = search.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ var re = new RegExp("(" + search.split(' ').join('|') + ")", "gi");
+ return '<div class="autocomplete-suggestion" data-langname="'+item[0]+'" data-lang="'+item[1]+'" data-val="'+search+'">'+item.replace(re, "<b>$1</b>")+'</div>';
+
+ },
+ onSelect: function(e, term, item){
+ let search = $(item).text();
+ console.log(search)
+ if(search !== "No Results Found"){
+ // window.location.replace('{ $component.resultUrl}&{ $component.entityID}='+searchResults[search].entityID);
+ }
+ },
+ minLength: 1,
+ });
+ });
+ }
+
+ /*
+ * Date Search Widget
+ */
+ function dateSearch(dateSearchData){
+ jQuery(function($){
+
+ var date = new Date();
+ var toDate = '', fromDate = '';
+ $('.fromDate').datepicker({
+ format : 'mm/dd/yyyy',
+ setDefaultDate : true,
+ defaultDate : date,
+ autoClose : true,
+ onClose : function(){
+ fromDate = '&fromDate=' + $(this)[0].el.value;
+ }
+ });
+ $('.toDate').datepicker({
+ format : 'mm/dd/yyyy',
+ autoClose : true,
+ onClose: function(){
+ toDate = '&toDate=' + $(this)[0].el.value;
+ }
+ });
+ $('.date-search-btn').on("click", function(){
+ window.location = dateSearchData.resultUrl + fromDate + toDate;
+ })
+ });
+ }
</script>
{include file='admin/footer.html'}
\ No newline at end of file