diff options
author | AndreaChirulescu <andrea.chirulescu@gmail.com> | 2021-04-13 19:23:59 +0200 |
---|---|---|
committer | AndreaChirulescu <andrea.chirulescu@gmail.com> | 2021-04-13 19:23:59 +0200 |
commit | 0c437c746a8f964bf59ae9808a2b990d144bc39e (patch) | |
tree | f3fb6fd929ccfe834880c8430a939d105cc9109c /includes/public/shortcodes/giglog_bands.php | |
parent | 512511df29423fc943b566bc20d997cd20ee9e03 (diff) | |
download | gigologadmin-0c437c746a8f964bf59ae9808a2b990d144bc39e.tar.gz gigologadmin-0c437c746a8f964bf59ae9808a2b990d144bc39e.tar.bz2 gigologadmin-0c437c746a8f964bf59ae9808a2b990d144bc39e.zip |
Fixes of LF and extra spaces done by ATOM
Diffstat (limited to 'includes/public/shortcodes/giglog_bands.php')
-rw-r--r-- | includes/public/shortcodes/giglog_bands.php | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/includes/public/shortcodes/giglog_bands.php b/includes/public/shortcodes/giglog_bands.php index 76187ab..b299644 100644 --- a/includes/public/shortcodes/giglog_bands.php +++ b/includes/public/shortcodes/giglog_bands.php @@ -1,114 +1,114 @@ -<?php
-/*
- * code used for giglogadmin for the open page where everyone sees the list of
- * concerts. First function displays filters by city, venue and the second one
- * builds the table with concerts
- */
-
-function giglogadmin_getfilters()
-{
- global $wpdb;
-
- //echo (var_dump($_POST["selectvenue"]));
-
- $results = $wpdb->get_results('select distinct wpgvenue_city from wpg_venues');
- $select = '<form method="POST" action=""><select name="selectcity">';
- $select .= '<option value="ALL" ';
- if (isset($_POST["selectcity"]) && $_POST["selectcity"] == "ALL") {
- $select .= ' selected = "selected"';
- }
- $select .= '> All cities</option>';
- foreach ($results AS $row) {
- $select .= '<option value="' . $row->wpgvenue_city . '"';
- if (isset($_POST["selectcity"]) && $_POST["selectcity"] == $row->wpgvenue_city) {
- $select .= ' selected = "selected"';
- }
- $select .= ' >' . $row->wpgvenue_city . '</option>';
- }
-
- if (isset($_POST["selectcity"]) && $_POST["selectcity"] != "ALL") {
- $select .= '</select>';
- //second drop down for venue
-
- $vquery = "select id, wpgvenue_name from wpg_venues";
- $vquery .= " where wpgvenue_city='" . $_POST["selectcity"] . "'";
- $resultsv = $wpdb->get_results($vquery);
- $select .= '<select name="selectvenue">';
- $select .= '<option value="0" ';
- if (isset($_POST["selectvenue"]) && $_POST["selectvenue"] == "0") {
- $select .= ' selected = "selected"';
- }
- $select .= '> All venues</option>';
-
- foreach ($resultsv AS $rowv) {
- $select .= '<option value="' . $rowv->id . '"';
- if (isset($_POST["selectvenue"]) && $_POST["selectvenue"] == $rowv->id) {
- $select .= ' selected = "selected"';
- }
- $select .= ' >' . $rowv->wpgvenue_name . '</option>';
- }
- //end IF that checks if city was selected
- }
- $select .= '</select><input type="submit" value="Filter"></form>';
- return $select;
-}
-
-
-function giglogadmin_getconcerts()
-{
- global $wpdb;
- // Shortcodes RETURN content, so store in a variable to return
- $content = '<table class="concertstb">';
- // $content .= '</tr><th>CITY</th><th>ID</th><th>BAND</th><th>VENUE</th><th>DATE</th><th>TICKETS</th><th>EVENT</th></tr>';
- $content .= '<tr class="concertshrow"><th>CITY</th><th>BAND</th><th>VENUE</th><th>DATE</th><th>TICKETS</th><th>EVENT</th></tr>';
- // Use the submitted "city" if any. Otherwise, use the default/static value.
- $cty = filter_input(INPUT_POST, 'selectcity');
- $cty = $cty ? $cty : 'ALL';
-
- $venue = filter_input(INPUT_POST, 'selectvenue');
- //echo($_POST['selectvenue']);
- $venue = $venue ? $venue : '0';
-
-
- $query = "SELECT wpgc.id, wpgb.wpgband_name as band ,wpgv.wpgvenue_name as venue ,wpgc.wpgconcert_date, wpgc.wpgconcert_tickets, wpgc.wpgconcert_event, wpgv.wpgvenue_city, wpgv.wpgvenue_webpage
- FROM wpg_concerts wpgc, wpg_bands wpgb, wpg_venues wpgv
-where wpgc.band=wpgb.id
-and wpgc.venue = wpgv.id
-and wpgconcert_date >= CURDATE()";
- $query .= ($cty == "ALL") ? "" : " and wpgv.wpgvenue_city='" . $cty . "'";
- $query .= ($venue == "0") ? "" : " and wpgv.id='" . $venue . "'";
- $query .= " order by wpgv.wpgvenue_city, wpgconcert_date, wpgc.id";
- //echo($query);
- $results = $wpdb->get_results($query);
-
-
- $lastType = '';
- foreach ($results AS $row) {
- $content .= '<tr class="concertsrow">';
-
- if ($lastType != '' && $lastType != $row->wpgvenue_city) {
- $content .= '<td class="concertstd">' . $row->wpgvenue_city . '</td></tr><tr>';
- }
-
- if ($lastType == '') {
- $content .= '<td>' . $row->wpgvenue_city . '</td></tr><tr>';
- }
- // Modify these to match the database structure
- // $content .= '<td>' . $row->id. '</td>';
- $content .= '<td></td>';
- $content .= '<td>' . $row->band . '</td>';
- $content .= '<td>' . $row->venue . '</td>';
- $fdate = strtotime($row->wpgconcert_date);
- $newformat = date('d.M.Y', $fdate);
-
- //$content .= DATE_FORMAT($fdate,'%d.%b.%Y');
- $content .= '<td>' . $newformat . '</td>';
- $content .= '<td><a href="' . $row->wpgconcert_tickets . '" target="_blank">Tickets</a></td>';
- $content .= '<td><a href="' . $row->wpgconcert_event . '" target="_blank">Event link</a></td>';
- $content .= '</tr>';
- $lastType = $row->wpgvenue_city;
- }
- $content .= '</table>';
- // return the table
- return $content;
-}
+<?php +/* + * code used for giglogadmin for the open page where everyone sees the list of + * concerts. First function displays filters by city, venue and the second one + * builds the table with concerts + */ + +function giglogadmin_getfilters() +{ + global $wpdb; + + //echo (var_dump($_POST["selectvenue"])); + + $results = $wpdb->get_results('select distinct wpgvenue_city from wpg_venues'); + $select = '<form method="POST" action=""><select name="selectcity">'; + $select .= '<option value="ALL" '; + if (isset($_POST["selectcity"]) && $_POST["selectcity"] == "ALL") { + $select .= ' selected = "selected"'; + } + $select .= '> All cities</option>'; + foreach ($results AS $row) { + $select .= '<option value="' . $row->wpgvenue_city . '"'; + if (isset($_POST["selectcity"]) && $_POST["selectcity"] == $row->wpgvenue_city) { + $select .= ' selected = "selected"'; + } + $select .= ' >' . $row->wpgvenue_city . '</option>'; + } + + if (isset($_POST["selectcity"]) && $_POST["selectcity"] != "ALL") { + $select .= '</select>'; + //second drop down for venue + + $vquery = "select id, wpgvenue_name from wpg_venues"; + $vquery .= " where wpgvenue_city='" . $_POST["selectcity"] . "'"; + $resultsv = $wpdb->get_results($vquery); + $select .= '<select name="selectvenue">'; + $select .= '<option value="0" '; + if (isset($_POST["selectvenue"]) && $_POST["selectvenue"] == "0") { + $select .= ' selected = "selected"'; + } + $select .= '> All venues</option>'; + + foreach ($resultsv AS $rowv) { + $select .= '<option value="' . $rowv->id . '"'; + if (isset($_POST["selectvenue"]) && $_POST["selectvenue"] == $rowv->id) { + $select .= ' selected = "selected"'; + } + $select .= ' >' . $rowv->wpgvenue_name . '</option>'; + } + //end IF that checks if city was selected + } + $select .= '</select><input type="submit" value="Filter"></form>'; + return $select; +} + + +function giglogadmin_getconcerts() +{ + global $wpdb; + // Shortcodes RETURN content, so store in a variable to return + $content = '<table class="concertstb">'; + // $content .= '</tr><th>CITY</th><th>ID</th><th>BAND</th><th>VENUE</th><th>DATE</th><th>TICKETS</th><th>EVENT</th></tr>'; + $content .= '<tr class="concertshrow"><th>CITY</th><th>BAND</th><th>VENUE</th><th>DATE</th><th>TICKETS</th><th>EVENT</th></tr>'; + // Use the submitted "city" if any. Otherwise, use the default/static value. + $cty = filter_input(INPUT_POST, 'selectcity'); + $cty = $cty ? $cty : 'ALL'; + + $venue = filter_input(INPUT_POST, 'selectvenue'); + //echo($_POST['selectvenue']); + $venue = $venue ? $venue : '0'; + + + $query = "SELECT wpgc.id, wpgb.wpgband_name as band ,wpgv.wpgvenue_name as venue ,wpgc.wpgconcert_date, wpgc.wpgconcert_tickets, wpgc.wpgconcert_event, wpgv.wpgvenue_city, wpgv.wpgvenue_webpage + FROM wpg_concerts wpgc, wpg_bands wpgb, wpg_venues wpgv +where wpgc.band=wpgb.id +and wpgc.venue = wpgv.id +and wpgconcert_date >= CURDATE()"; + $query .= ($cty == "ALL") ? "" : " and wpgv.wpgvenue_city='" . $cty . "'"; + $query .= ($venue == "0") ? "" : " and wpgv.id='" . $venue . "'"; + $query .= " order by wpgv.wpgvenue_city, wpgconcert_date, wpgc.id"; + //echo($query); + $results = $wpdb->get_results($query); + + + $lastType = ''; + foreach ($results AS $row) { + $content .= '<tr class="concertsrow">'; + + if ($lastType != '' && $lastType != $row->wpgvenue_city) { + $content .= '<td class="concertstd">' . $row->wpgvenue_city . '</td></tr><tr>'; + } + + if ($lastType == '') { + $content .= '<td>' . $row->wpgvenue_city . '</td></tr><tr>'; + } + // Modify these to match the database structure + // $content .= '<td>' . $row->id. '</td>'; + $content .= '<td></td>'; + $content .= '<td>' . $row->band . '</td>'; + $content .= '<td>' . $row->venue . '</td>'; + $fdate = strtotime($row->wpgconcert_date); + $newformat = date('d.M.Y', $fdate); + + //$content .= DATE_FORMAT($fdate,'%d.%b.%Y'); + $content .= '<td>' . $newformat . '</td>'; + $content .= '<td><a href="' . $row->wpgconcert_tickets . '" target="_blank">Tickets</a></td>'; + $content .= '<td><a href="' . $row->wpgconcert_event . '" target="_blank">Event link</a></td>'; + $content .= '</tr>'; + $lastType = $row->wpgvenue_city; + } + $content .= '</table>'; + // return the table + return $content; +} |