summaryrefslogtreecommitdiffstats
path: root/includes/admin/views
diff options
context:
space:
mode:
authorAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-08 21:18:38 +0200
committerAndreaChirulescu <andrea.chirulescu@gmail.com>2021-04-08 21:18:38 +0200
commitb6cdf32a16c06219628defb680ff3c4ffc7fc88c (patch)
tree5c0eec290a15d59e7882397fe07710ea76f89ada /includes/admin/views
parent95ec7617246120556a4f3dcb5178d9a158c31456 (diff)
downloadgigologadmin-b6cdf32a16c06219628defb680ff3c4ffc7fc88c.tar.gz
gigologadmin-b6cdf32a16c06219628defb680ff3c4ffc7fc88c.tar.bz2
gigologadmin-b6cdf32a16c06219628defb680ff3c4ffc7fc88c.zip
Added function getpublishstatus to check if concert is uploaded within the past 10 days
Diffstat (limited to 'includes/admin/views')
-rw-r--r--includes/admin/views/giglog_admin_page.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/includes/admin/views/giglog_admin_page.php b/includes/admin/views/giglog_admin_page.php
index 637820f..7970cf3 100644
--- a/includes/admin/views/giglog_admin_page.php
+++ b/includes/admin/views/giglog_admin_page.php
@@ -110,6 +110,24 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
return $select;
}
+
+ //function to calculate if the concert has been added in the past 10 days or before that and show a green NEW for the newest rows
+ static function getpublishstatus($concert_id)
+ {
+ 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");
+ }
+
+ if ($dd <= 10) return ('<span style="color:green">NEW</span>');
+ }
+
static function get_concerts()
{
@@ -172,7 +190,7 @@ if ( !class_exists( 'GiglogAdmin_AdminPage' ) ) {
//$content .= DATE_FORMAT($fdate,'%d.%b.%Y');
$content .= '<td>' .$newformat. '</td>';
- $content .= '<td></td>'; //.giglogadmin_getpublishstatus($row->id ).'</td>';
+ $content .= '<td>'.GiglogAdmin_AdminPage::getpublishstatus($row->id ).'</td>';
$content .= '<td>'.GiglogAdmin_AdminPage::returnuser('photo1', $row->id ).'</td>';
$content .= '<td>'.GiglogAdmin_AdminPage::returnuser('photo2', $row->id ).'</td>';
$content .= '<td>'.GiglogAdmin_AdminPage::returnuser('rev1', $row->id ).'</td>';