summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2022-02-22 21:53:00 +0100
committerHarald Eilertsen <haraldei@anduin.net>2022-02-22 21:53:00 +0100
commit06d0591af5f2c9e0ce1c4269c55a503e9956759d (patch)
tree2cae4199d4903d0ca88c55da87a930560ae0f2e1
parentad2bcce71ed076eef5d52ee14dab3b7cea1c1dd8 (diff)
downloadgigologadmin-06d0591af5f2c9e0ce1c4269c55a503e9956759d.tar.gz
gigologadmin-06d0591af5f2c9e0ce1c4269c55a503e9956759d.tar.bz2
gigologadmin-06d0591af5f2c9e0ce1c4269c55a503e9956759d.zip
Some cleanup in render_concerts_table
-rw-r--r--includes/admin/views/_concerts_table.php56
1 files changed, 23 insertions, 33 deletions
diff --git a/includes/admin/views/_concerts_table.php b/includes/admin/views/_concerts_table.php
index 8ecd616..e9598e1 100644
--- a/includes/admin/views/_concerts_table.php
+++ b/includes/admin/views/_concerts_table.php
@@ -158,58 +158,48 @@ if (!class_exists("GiglogAdmin_ConcertsTable"))
private function render_concerts_table() : string
{
- //pagination. Change value as needed
-
$concerts = $this->get_concerts();
- $lastType = '';
+ $last_city = '';
$content = $this->render_concert_table_header();
- foreach ( $concerts AS $concert ) {
- $content .= '<tr class="assignitr">';
-
- if ($lastType != '' && $lastType != $concert->venue()->city()) {
- $content .= '<td>' . $concert->venue()->city() . '</td>';
- }
+ foreach ( $concerts as $concert ) {
+ $content .= '<tr class="assignitr"><td>';
- if ($lastType == '' ) {
- $content .= '<td>' . $concert->venue()->city() . '</td>';
+ if ($last_city != $concert->venue()->city()) {
+ $content .= $concert->venue()->city();
}
- if ($lastType != '' && $lastType == $concert->venue()->city()) {
- $content .= '<td></td>';
- }
+ $content .= '</td>';
- $fdate = strtotime($concert->cdate());
- $newformat = date('d.M.Y',$fdate);
- //$content .= DATE_FORMAT($fdate,'%d.%b.%Y');
- $content .= '<td>' . $newformat . '</td>';
- $content .= '<td>'. $concert->cname() . '</td>';
- $content .= '<td>' . $concert->venue()->name() . '</td>';
- if(!is_admin()){
- $content .= '<td><a target="_blank" href="'.$concert->eventlink() .'">Link</a></td>';
- $content .= '<td><a target="_blank" href="'.$concert->tickets() .'">Tickets</a></td>';
+ $content .=
+ "<td>" . date( 'd.M.Y', strtotime( $concert->cdate() ) ) . "</td>"
+ . "<td>{$concert->cname()}</td>"
+ . "<td>{$concert->venue()->name()}</td>";
- }
- else {
+ if( is_admin() ) {
$content .= '<td class="publishstatus">' . $this->mark_new_concert($concert) . '</td>';
- $content .= '<td class="assigneduser">' . $this->assign_role_for_user_form('photo1', $concert) . '</td>';
- $content .= '<td class="assigneduser">' . $this->assign_role_for_user_form('photo2', $concert) . '</td>';
- $content .= '<td class="assigneduser">' . $this->assign_role_for_user_form('rev1', $concert) . '</td>';
- $content .= '<td class="assigneduser">' . $this->assign_role_for_user_form('rev2', $concert) . '</td>';
+ foreach ( [ 'photo1', 'photo2', 'rev1', 'rev2' ] as $role ) {
+ $content .= '<td class="assigneduser">'
+ . $this->assign_role_for_user_form( $role, $concert )
+ . '</td>';
+ }
$content .= '<td>' . self::STATUS_LABELS[$concert->status()] . '</td>';
if (current_user_can('administrator')) {
- $content .= '<td class="adminbuttons">'
- . $this->adminactions($concert)
- . '</td>';
+ $content .= "<td class=\"adminbuttons\">{$this->adminactions( $concert )}</td>";
}
}
+ else {
+ $content .= "<td><a target=\"_blank\" href=\"{$concert->eventlink()}\">Link</a></td>";
+ $content .= "<td><a target=\"_blank\" href=\"{$concert->tickets()}\">Tickets</a></td>";
+ }
+
$content .= '</tr>';
- $lastType = $concert->venue()->city();
+ $last_city = $concert->venue()->city();
}
$content .= '</table>';