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/admin/views/giglog_admin_page.php | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'includes/admin/views/giglog_admin_page.php') diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php index 0f8fe76..447dcb2 100644 --- a/includes/admin/views/giglog_admin_page.php +++ b/includes/admin/views/giglog_admin_page.php @@ -180,27 +180,21 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { /** * @return null|string */ - private function getpublishstatus(int $concert_id) + private function getpublishstatus(GiglogAdmin_Concert $concert) : string { - global $wpdb; - $date1 = new DateTime("now"); - $dsql = "select wpgcl_createddate from wpg_concertlogs where wpgcl_concertid=".$concert_id; - $results = $wpdb->get_results($dsql); - foreach ( $results AS $row ) { - //$x = strtotime($row -> filedate); - $x= date('Y-m-d H:i:s', strtotime($row -> wpgcl_createddate)); - $date2 = new DateTime($x, new DateTimeZone('Europe/London')); - $dd = $date2 -> diff($date1) ->format("%a"); + $now = new DateTime(); + $new_entry = $now->diff($concert->created())->days <= 10; + if ($new_entry) { + return 'NEW'; + } + else { + return ''; } - - if ($dd <= 10) return ('NEW'); } private function get_concerts(): string { - global $wpdb; - $content = ''; // $content .= ''; @@ -245,9 +239,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) { //$content .= DATE_FORMAT($fdate,'%d.%b.%Y'); $content .= ''; - $content .= ''; - - $roles = $concert->roles(); + $content .= ''; $content .= ''; $content .= ''; -- cgit v1.2.3
CITYIDBANDVENUEDATE
' . $newformat . '' . /* $concert->isnew() */ '' . '' . $this->getpublishstatus($concert) . '' . $this->assign_role_for_user_form('photo1', $concert) . '' . $this->assign_role_for_user_form('photo2', $concert) . '