summaryrefslogtreecommitdiffstats
path: root/includes/admin
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/admin
parent64f4141378ea6fb524df015abdef5393d8d589bb (diff)
downloadgigologadmin-57c9ed78112fb33f8a552e9b76d4fedac14f08d9.tar.gz
gigologadmin-57c9ed78112fb33f8a552e9b76d4fedac14f08d9.tar.bz2
gigologadmin-57c9ed78112fb33f8a552e9b76d4fedac14f08d9.zip
Mark recently added concerts as new again.
Diffstat (limited to 'includes/admin')
-rw-r--r--includes/admin/views/giglog_admin_page.php26
1 files changed, 9 insertions, 17 deletions
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 '<span style="color:green">NEW</span>';
+ }
+ else {
+ return '';
}
-
- if ($dd <= 10) return ('<span style="color:green">NEW</span>');
}
private function get_concerts(): string
{
- global $wpdb;
-
$content = '<table class="assignit">';
// $content .= '</tr><th>CITY</th><th>ID</th><th>BAND</th><th>VENUE</th><th>DATE</th></tr>';
@@ -245,9 +239,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
//$content .= DATE_FORMAT($fdate,'%d.%b.%Y');
$content .= '<td>' . $newformat . '</td>';
- $content .= '<td>' . /* $concert->isnew() */ '' . '</td>';
-
- $roles = $concert->roles();
+ $content .= '<td>' . $this->getpublishstatus($concert) . '</td>';
$content .= '<td>' . $this->assign_role_for_user_form('photo1', $concert) . '</td>';
$content .= '<td>' . $this->assign_role_for_user_form('photo2', $concert) . '</td>';