function display_rows_or_placeholder() { $message = call_user_func($this->_message_callback); if ($message !== false) { ?> <tr class="no-items"> <td class="colspanchange" colspan="<?php echo $this->get_column_count(); ?> "> <?php echo $message; ?> </td> </tr> <?php } else { parent::display_rows_or_placeholder(); } }
/** * Add notifications above the table to indicate which bookings are * being shown. * @since 1.3 */ public function display_rows_or_placeholder() { global $rtb_controller; $notifications = array(); $status = ''; if (!empty($_GET['status'])) { $status = $_GET['status']; if ($status == 'trash') { $notifications['status'] = __("You're viewing bookings that have been moved to the trash.", 'restaurant-reservations'); } elseif (!empty($rtb_controller->cpts->booking_statuses[$status])) { $notifications['status'] = sprintf(_x("You're viewing bookings that have been marked as %s.", 'Indicates which booking status is currently being filtered in the list of bookings.', 'restaurant-reservations'), $rtb_controller->cpts->booking_statuses[$_GET['status']]['label']); } } if (!empty($this->filter_start_date) || !empty($this->filter_end_date)) { $notifications['date'] = sprintf(_x('Only bookings from %s are being shown.', 'Notification of booking date range, eg - bookings from 2014-12-02-2014-12-05', 'restaurant-reservations'), $this->get_current_date_range()); } elseif (!empty($_GET['date_range']) && $_GET['date_range'] == 'today') { $notifications['date'] = __("Only today's bookings are being shown.", 'restaurant-reservations'); } elseif (empty($_GET['date_range'])) { $notifications['date'] = __('Only upcoming bookings are being shown.', 'restaurant-reservations'); } $notifications = apply_filters('rtb_admin_bookings_table_filter_notifications', $notifications); if (!empty($notifications)) { ?> <tr class="notice <?php echo esc_attr($status); ?> "> <td colspan="<?php echo count($this->get_columns()); ?> "> <?php echo join(' ', $notifications); ?> </td> </tr> <?php } parent::display_rows_or_placeholder(); }