Skip to content

Commit 0a02187

Browse files
author
Maxime CULEA
committed
explode into a single export/import page
1 parent 1ae6c84 commit 0a02187

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
// don't load directly
3+
if ( !defined('ABSPATH') )
4+
die('-1');
5+
?>
6+
<!-- Create a header in the default WordPress 'wrap' container -->
7+
<div class="wrap">
8+
<div id="icon-edit" class="icon32 icon32-posts-member"></div>
9+
<h2><?php echo MPT_Admin_Export::get_page_title(); ?></h2>
10+
11+
<h3><?php _e( 'Export CSV file', 'mpt' ); ?></h3>
12+
<form action="" method="post" id="export-diag">
13+
<p class="submit">
14+
<input type="submit" name="export_members" class="button-primary export" value="<?php esc_attr_e( 'Export', 'mpt' ); ?>" />
15+
16+
<?php wp_nonce_field( 'export-members' ); ?>
17+
<input type="hidden" name="mpt_action" value="mpt_export_action" />
18+
</p>
19+
</form>
20+
</div><!-- /.wrap -->
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
// don't load directly
3+
if ( !defined('ABSPATH') )
4+
die('-1');
5+
?>
6+
<!-- Create a header in the default WordPress 'wrap' container -->
7+
<div class="wrap">
8+
<div id="icon-edit" class="icon32 icon32-posts-member"></div>
9+
<h2><?php echo MPT_Admin_Import::get_page_title(); ?></h2>
10+
11+
<h3><?php _e( 'Import CSV file', 'mpt' ); ?></h3>
12+
<form action="" method="post" id="import-diag" enctype="multipart/form-data">
13+
<p><?php _e( 'Import members from a CSV file. The format for the CSV file is "email; lastname; firstname; username". The password is automaticaly generated when the user is created.', 'mpt' ); ?></p>
14+
<label for='csv-file'><?php _e( 'Select a CSV file.', 'mpt' ); ?></label>
15+
<input type="file" name="csv-file" />
16+
<p class="submit">
17+
<input type="submit" name="import_members" class="button-primary export" value="<?php esc_attr_e( 'Import', 'mpt' ); ?>" />
18+
19+
<?php wp_nonce_field( 'import-members' ); ?>
20+
<input type="hidden" name="mpt_action" value="mpt_import_action" />
21+
</p>
22+
23+
<div class="report">
24+
<?php if( $report != false ) : ?>
25+
<p><strong><?php echo sprintf( __( 'Last import : %s', 'mpt'), date('d/m/Y H\hi', $report['report_date']) ); ?></strong></p>
26+
<?php if( !empty($report['ignore_line']) ) : ?>
27+
<p><?php _e( 'CSV formating error :', 'mpt' ); ?></p>
28+
<?php foreach( $report['ignore_line'] as $line => $result ) : ?>
29+
<p class="import-<?php echo $result['status']; ?>"><?php echo sprintf(__( 'Line %s : "%s" %s (%s)', 'mpt'), $result['line'], $result['content'], $result['operation'], $result['status']); ?></p>
30+
<?php endforeach; ?>
31+
<?php endif; ?>
32+
<?php if( !empty($report['import_status']) ) : ?>
33+
<p><?php _e( 'Importing status :', 'mpt' ); ?></p>
34+
<?php foreach( $report['import_status'] as $line => $result ) : ?>
35+
<p class="import-<?php echo $result['status']; ?>"><?php echo sprintf(__( '%s) %s (%s) : %s', 'mpt'), $line+1, $result['member'], $result['operation'], $result['status']); ?></p>
36+
<?php endforeach; ?>
37+
<?php endif; ?>
38+
<?php else : ?>
39+
<p><strong><?php _e( 'No report data available.', 'mpt' ); ?></strong></p>
40+
<?php endif; ?>
41+
</div>
42+
</form>
43+
</div><!-- /.wrap -->

0 commit comments

Comments
 (0)