From 2d76b51934f7ec47cb1511b1651089e447e1dbce Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 21 Jun 2017 09:46:26 -0400 Subject: [PATCH] Adding photos import Adding tab for uploading the member photos. --- models/admin/import/index.php | 20 ++++++++++++++++++-- views/admin/import/files.html | 18 ++++++++++++++++++ views/admin/import/header.html | 4 +++- views/admin/import/photos.html | 23 +++++++++++++++++++++++ views/admin/import/processMembers.html | 12 ++++++++++-- 5 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 views/admin/import/files.html create mode 100644 views/admin/import/photos.html diff --git a/models/admin/import/index.php b/models/admin/import/index.php index 97e13603..560d5ac3 100644 --- a/models/admin/import/index.php +++ b/models/admin/import/index.php @@ -184,7 +184,7 @@ class GlmMembersAdmin_import_index { $view = 'index.html'; $failure = false; - $option = ''; + $option = 'default'; $clearData = false; if ( isset( $_REQUEST['numberProcessed'] ) ) { $this->numberProcessed = filter_var( $_REQUEST['numberProcessed'], FILTER_VALIDATE_INT ); @@ -234,7 +234,8 @@ class GlmMembersAdmin_import_index 'addr1', 'addr2', 'city', 'state', 'country', 'zip', 'mailing_addr1', 'mailing_addr2', 'mailing_city', 'mailing_state', 'mailing_zip', 'region', 'county', 'lat', 'lon', 'phone', 'toll_free', - 'url', 'reservation_url', 'email', 'logo', 'categories', 'amenities' ), + 'url', 'reservation_url', 'email', 'logo', 'categories', 'amenities' + ), 'type' => 'member', ), ); @@ -244,6 +245,10 @@ class GlmMembersAdmin_import_index $option = $_REQUEST['option']; } + if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { + $option2 = $_REQUEST['option2']; + } + $wpUploadDir = wp_get_upload_dir(); $uploadPath = $wpUploadDir['basedir'] . '/' . 'glm-member-import'; if ( !is_dir( $uploadPath ) ) { @@ -371,6 +376,16 @@ class GlmMembersAdmin_import_index $view = 'processMembers.html'; break; + case 'photos': + $view= 'photos.html'; + $fileData = '
$_FILES: ' . print_r( $_FILES, true ) . '
'; + break; + + case 'files': + $view = 'files.html'; + break; + + case 'default': default: $view = 'index.html'; // check upload dir to see if they have any files in yet @@ -386,6 +401,7 @@ class GlmMembersAdmin_import_index } $templateData = array( + 'option' => $option, 'errors' => $this->errors, 'numberProcessed' => $this->numberProcessed, 'totalMembers' => $this->totalMembers, diff --git a/views/admin/import/files.html b/views/admin/import/files.html new file mode 100644 index 00000000..821a318b --- /dev/null +++ b/views/admin/import/files.html @@ -0,0 +1,18 @@ +{include file='admin/import/header.html'} + +

Data Import: Files

+ + + + + + + + + + + +
Total Member{$totalMembers}
Processed Member{$numberProcessed}
+ + +{include file='admin/footer.html'} diff --git a/views/admin/import/header.html b/views/admin/import/header.html index 5d663c9f..69c87e14 100644 --- a/views/admin/import/header.html +++ b/views/admin/import/header.html @@ -3,7 +3,9 @@

{$glmPluginName} CSV Import

diff --git a/views/admin/import/photos.html b/views/admin/import/photos.html new file mode 100644 index 00000000..cbbb14ea --- /dev/null +++ b/views/admin/import/photos.html @@ -0,0 +1,23 @@ +{include file='admin/import/header.html'} + +

Data Import: Photos

+
+ + + + + + + + + +
Upload File
+ + +
+ + {if $fileData} + {$fileData} + {/if} + +{include file='admin/footer.html'} diff --git a/views/admin/import/processMembers.html b/views/admin/import/processMembers.html index 5ac631a3..63052c73 100644 --- a/views/admin/import/processMembers.html +++ b/views/admin/import/processMembers.html @@ -12,10 +12,10 @@ {$numberProcessed} {if !$completed} + {$newStart = 1 + $numberProcessed} - Process Next Count Members + Process Next Count Members {/if} @@ -28,4 +28,12 @@ + {if !$completed} + {$newStart = 1 + $numberProcessed} + + {/if} + {include file='admin/footer.html'} -- 2.17.1