summaryrefslogtreecommitdiffstats
path: root/includes/concert.php
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2021-09-04 15:25:13 +0200
committerHarald Eilertsen <haraldei@anduin.net>2021-09-04 15:25:13 +0200
commit57c9ed78112fb33f8a552e9b76d4fedac14f08d9 (patch)
treea79c75eecc0264d4f301520d01b4ecd43cac5e1f /includes/concert.php
parent64f4141378ea6fb524df015abdef5393d8d589bb (diff)
downloadgigologadmin-57c9ed78112fb33f8a552e9b76d4fedac14f08d9.tar.gz
gigologadmin-57c9ed78112fb33f8a552e9b76d4fedac14f08d9.tar.bz2
gigologadmin-57c9ed78112fb33f8a552e9b76d4fedac14f08d9.zip
Mark recently added concerts as new again.
Diffstat (limited to 'includes/concert.php')
-rw-r--r--includes/concert.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/includes/concert.php b/includes/concert.php
index dce15f0..c0c13ee 100644
--- a/includes/concert.php
+++ b/includes/concert.php
@@ -20,6 +20,8 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
private ?string $eventlink;
private ?int $status;
private array $roles;
+ private ?DateTimeImmutable $created;
+ private ?DateTimeImmutable $updated;
public const STATUS_NONE = 0;
public const STATUS_ACCRED_REQ = 1;
@@ -43,6 +45,8 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
$this->eventlink = isset($attrs->wpgconcert_event) ? $attrs->wpgconcert_event : NULL;
$this->status = isset($attrs->wpgconcert_status) ? $attrs->wpgconcert_status : 0;
$this->roles = isset($attrs->wpgconcert_roles) ? json_decode($attrs->wpgconcert_roles, true) : [];
+ $this->created = isset($attrs->created) ? new DateTimeImmutable($attrs->created) : NULL;
+ $this->updated = isset($attrs->updated) ? new DateTimeImmutable($attrs->updated) : NULL;
if ( isset( $attrs->venue ) ) {
if (isset($attrs->wpgvenue_name) && isset($attrs->wpgvenue_city)) {
@@ -74,8 +78,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
{
global $wpdb;
- $query = 'SELECT wpg_concerts.*, wpg_venues.wpgvenue_name, wpg_venues.wpgvenue_city '
- . 'FROM wpg_concerts '
+ $query = 'SELECT * FROM wpg_concerts '
. 'LEFT JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id '
. 'WHERE ' . $wpdb->prepare('wpg_concerts.id = %d', $id);
@@ -197,8 +200,7 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
{
global $wpdb;
- $query = 'SELECT wpg_concerts.*, wpg_venues.wpgvenue_name, wpg_venues.wpgvenue_city '
- . 'FROM wpg_concerts '
+ $query = 'SELECT * FROM wpg_concerts '
. 'INNER JOIN wpg_venues ON wpg_concerts.venue = wpg_venues.id ';
$where = [];
@@ -304,6 +306,14 @@ if ( !class_exists('GiglogAdmin_Concert') ) {
{
$this->roles = array_filter($this->roles, fn($u) => $u != $username);
}
+
+ public function created() : DateTimeImmutable {
+ return $this->created;
+ }
+
+ public function updated() : DateTimeImmutable {
+ return $this->updated;
+ }
}
}
?>