diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-04-14 00:32:04 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-04-14 00:32:04 +0200 |
commit | 1467d177c950617c290cec2193c690da7fa6a4e9 (patch) | |
tree | f85292847a0a0b005bc54ef9faa78d75c50fd259 /includes/admin/views/giglog_admin_page.php | |
parent | e618cdb494702dee8a62221bbafe2da61faba308 (diff) | |
download | gigologadmin-1467d177c950617c290cec2193c690da7fa6a4e9.tar.gz gigologadmin-1467d177c950617c290cec2193c690da7fa6a4e9.tar.bz2 gigologadmin-1467d177c950617c290cec2193c690da7fa6a4e9.zip |
Some nitpicking in editforms.
Filter $_POST['edit'] into a boolean we can use to check wether we're
editing or not. Then use this rather than other implicit assumptions to
detect wether we're an edit form or a new concert form.
Diffstat (limited to 'includes/admin/views/giglog_admin_page.php')
-rw-r--r-- | includes/admin/views/giglog_admin_page.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 5749bab..5f43331 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -137,8 +137,9 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { static function editforms() { $cid = filter_input(INPUT_POST, "cid"); + $editing = filter_input(INPUT_POST, "edit") == "EDIT"; - if(isset($_POST['edit']) && $_POST['edit']=="EDIT" && !empty($cid)) //A bit overdoing with the checks if concert ID is empty both here and in find_cid. But based on that, things are NULL or not. Better ideas? + if ($editing && !empty($cid)) //A bit overdoing with the checks if concert ID is empty both here and in find_cid. But based on that, things are NULL or not. Better ideas? $c = GiglogAdmin_Concert::find_cid($cid); else $c = new GiglogAdmin_Concert(); @@ -150,10 +151,15 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { .'<label for="cdate">Date:</label><input type="date" id="cdate" name="cdate" value="'.$c->cdate().'"><br>' .'<label for="ticket">Tickets:</label><input type="text" id="ticket" name="ticket" value="'.$c->tickets().'"><br>' .'<label for="eventurl">Event link:</label><input type="text" id="eventurl" name="eventurl" value="'.$c->eventlink().'"><br>'; - if ($c->band()=='') //actions differ if we update or create a concert, hence two buttons needed - $content.='<p><input type="submit" name="newconcert" value="Create New Concert"></p>'; - else - $content.='<p><input type="submit" name="editconcert" value="Edit Concert"></p>'; + + // actions differ if we update or create a concert, hence two buttons needed + if ($editing) { + $content.='<p><input type="submit" name="editconcert" value="Edit Concert"></p>'; + } + else { + $content.='<p><input type="submit" name="newconcert" value="Create New Concert"></p>'; + } + $content.='</form>'; $content.='<form method="POST" action="" class="bandedit" ><br>' |