summaryrefslogtreecommitdiffstats
path: root/includes/admin/views
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-09-17 16:59:01 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-09-17 16:59:01 +0200
commit8a189196899989fd611a710bbbfc6bbbf31b73cc (patch)
tree1ebe0044634119e87092c019cf53fac83b3b4a2d /includes/admin/views
parent34e48ad804ef613d83f184cf33a938cbfd7400b9 (diff)
downloadgigologadmin-8a189196899989fd611a710bbbfc6bbbf31b73cc.tar.gz
gigologadmin-8a189196899989fd611a710bbbfc6bbbf31b73cc.tar.bz2
gigologadmin-8a189196899989fd611a710bbbfc6bbbf31b73cc.zip
Move New Venue form to a separate partial.
Diffstat (limited to 'includes/admin/views')
-rw-r--r--includes/admin/views/_edit_concert_form.php9
-rw-r--r--includes/admin/views/_new_venue_form.php34
-rw-r--r--includes/admin/views/giglog_admin_page.php11
3 files changed, 45 insertions, 9 deletions
diff --git a/includes/admin/views/_edit_concert_form.php b/includes/admin/views/_edit_concert_form.php
index 61f2bf4..7b0164e 100644
--- a/includes/admin/views/_edit_concert_form.php
+++ b/includes/admin/views/_edit_concert_form.php
@@ -45,7 +45,7 @@ if (!class_exists("GiglogAdmin_EditConcertForm"))
else
$c = new GiglogAdmin_Concert((object)[]);
- $content='<div><h3>Form to create/edit concerts and venues</h3><br></div><div class="editform"><div class="concertform">';
+ $content='<div class="concertform">';
$content.='<form method="POST" action="" class="concert" >'
.'<div class="concertitems"><strong>CONCERT DETAILS</strong><br><br><fieldset>'
. wp_nonce_field( plugin_basename( __FILE__ ), 'giglog_edit_concert_nonce' )
@@ -71,12 +71,7 @@ if (!class_exists("GiglogAdmin_EditConcertForm"))
.'<label for="rev2">Text2:</label>'.$this->user_dropdown_for_role($c,'rev2').'<br>';
$content.='<fieldset></div></form></div>';
- $content.='<div class="venueform"><form method="POST" action="" class="venue" ><strong>VENUE DETAILS</strong><br><br>'
- .'<fieldset><label for="venue">Venue Name:</label><input type="text" id="venuename" name="venuename"><br>'
- .'<label for="eventurl">Venue City:</label><input type="text" id="venuecity" name="venuecity"><br>'
- .'<p><input type="submit" name="newvenue" value="Create New Venue"></p>'
- .'<fieldset></form></div>';
- $content.='</div>';
+
return $content;
}
}
diff --git a/includes/admin/views/_new_venue_form.php b/includes/admin/views/_new_venue_form.php
new file mode 100644
index 0000000..d17f5e0
--- /dev/null
+++ b/includes/admin/views/_new_venue_form.php
@@ -0,0 +1,34 @@
+<?php
+// SPDX-FileCopyrightText: 2021 Andrea Chirulescu <andrea.chirulescu@gmail.com>
+// SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+if ( !class_exists( "GiglogAdmin_NewVenueForm" ) )
+{
+ class GiglogAdmin_NewVenueForm
+ {
+ public function render() : string
+ {
+ return
+ '<div class="venueform">'
+ . '<p><strong>VENUE DETAILS</strong></p>'
+ . '<form method="POST" action="" class="venue">'
+ . ' <fieldset>'
+ . ' <div class="field venue_name_field">'
+ . ' <label for="venue">Venue Name:</label>'
+ . ' <input type="text" id="venuename" name="venuename">'
+ . ' </div>'
+ . ' <div class="field venue_city_field">'
+ . ' <label for="venuecity">Venue City:</label>'
+ . ' <input type="text" id="venuecity" name="venuecity">'
+ . ' </div>'
+ . ' <div class="actions">'
+ . ' <input type="submit" name="newvenue" value="Create New Venue">'
+ . ' </div>'
+ . ' <fieldset>'
+ . '</form>'
+ . '</div>';
+ }
+ }
+}
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index fa853fb..b7f6247 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -9,6 +9,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
require_once __DIR__ . '/../../venue.php';
require_once __DIR__ . '/_concerts_table.php';
require_once __DIR__ . '/_edit_concert_form.php';
+ require_once __DIR__ . '/_new_venue_form.php';
class GiglogAdmin_AdminPage
{
@@ -52,8 +53,14 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
</div>
<?php
if (current_user_can('administrator')) {
- $form = new GiglogAdmin_EditConcertForm();
- echo $form->render();
+ $edit_form = new GiglogAdmin_EditConcertForm();
+ $venue_form = new GiglogAdmin_NewVenueForm(); ?>
+ <div>
+ <h3>Form to create/edit concerts and venues</h3>
+ </div>
+ <div class="editform">
+ <?php echo $edit_form->render() . $venue_form->render(); ?>
+ </div><?php
}
}