From 57c9ed78112fb33f8a552e9b76d4fedac14f08d9 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 4 Sep 2021 15:25:13 +0200 Subject: Mark recently added concerts as new again. --- includes/concert.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'includes/concert.php') 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; + } } } ?> -- cgit v1.2.3