From b5622ca47e975370d22912ae1ee6d76d33447a27 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 7 Mar 2021 20:00:06 +0100 Subject: Implement upload of gig data files. --- giglogadmin.php | 4 ++- includes/admin/views/giglog_import_gigs.php | 42 ++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/giglogadmin.php b/giglogadmin.php index 0ebaa99..c9defd4 100644 --- a/giglogadmin.php +++ b/giglogadmin.php @@ -61,13 +61,15 @@ if ( !class_exists( 'GiglogAdmin_Plugin' ) ) { 'dashicons-tickets-alt', // Icon url 11); // Position, just below 'Media' - add_submenu_page( + $import_hook = add_submenu_page( "giglog", // parent slug "Import gigs", // page title "Import gigs", // menu title "upload_files", // required capability "giglog_import", // menu slug array( 'GiglogAdmin_ImportGigsPage', 'render_html' )); // callable + + add_action( 'load-' . $import_hook, array( 'GiglogAdmin_ImportGigsPage', 'submit_form' ) ); } /* diff --git a/includes/admin/views/giglog_import_gigs.php b/includes/admin/views/giglog_import_gigs.php index 953fa62..e04d0e6 100644 --- a/includes/admin/views/giglog_import_gigs.php +++ b/includes/admin/views/giglog_import_gigs.php @@ -19,7 +19,47 @@ if ( !class_exists( 'GiglogAdmin_ImportGigsPage' ) ) { class GiglogAdmin_ImportGigsPage { static function render_html() { - echo '

Let\'s import some gigs!

'; + ?> +
+

Import gigs

+

Import gig data from a tab separated data file.

+
+ + + + +
+
+ $fo, + 'rowid' => $r++, + 'rowcontent' => $newconcert + ); + + if ($wpdb->insert($table, $row) === false) { + $wpdb->bail(); + } + } } } } -- cgit v1.2.3