| @@ -10,9 +10,16 @@ | ||
| 10 | 10 | |
| 11 | 11 | namespace MainWP\Dashboard\Module\Log; |
| 12 | 12 | |
| 13 | 13 | use MainWP\Dashboard\MainWP_Utility; |
| 14 | +use MainWP\Dashboard\MainWP_UI; | |
| 14 | 15 | |
| 16 | +// Exit if accessed directly. | |
| 17 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 18 | + exit; | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 15 | 22 | /** |
| 16 | 23 | * Class Log_Sites_Widget |
| 17 | 24 | * |
| 18 | 25 | * Displays the Logs info. |
| @@ -64,9 +71,8 @@ | ||
| 64 | 71 | * |
| 65 | 72 | * @param array $args Args data. |
| 66 | 73 | */ |
| 67 | 74 | public function render_widget( $args ) { |
| 68 | - | |
| 69 | 75 | $data = is_array( $args ) && ! empty( $args[1][0] ) && is_array( $args[1][0] ) ? $args[1][0] : array(); |
| 70 | 76 | $stats_data = is_array( $data ) && ! empty( $data['stats_data']['site']['sites'] ) ? $data['stats_data']['site']['sites'] : array(); |
| 71 | 77 | if ( ! is_array( $stats_data ) ) { |
| 72 | 78 | $stats_data = array(); |
| @@ -78,43 +84,48 @@ | ||
| 78 | 84 | } |
| 79 | 85 | |
| 80 | 86 | ?> |
| 81 | 87 | <div class="mainwp-widget-header"> |
| 82 | - <h3 class="ui header handle-drag"> | |
| 88 | + <h2 class="ui header handle-drag"> | |
| 83 | 89 | <?php esc_html_e( 'Site Management Activity Metrics', 'mainwp' ); ?> |
| 84 | 90 | <div class="sub header"> |
| 85 | 91 | <?php esc_html_e( 'Summarizing site activities, alongside the total count for a complete overview.', 'mainwp' ); ?> |
| 86 | 92 | </div> |
| 87 | - </h3> | |
| 93 | + </h2> | |
| 88 | 94 | </div> |
| 89 | 95 | |
| 90 | - <div class="mainwp-widget-insights-card"> | |
| 91 | - <?php | |
| 92 | - /** | |
| 93 | - * Action: mainwp_logs_widget_top | |
| 94 | - * | |
| 95 | - * Fires at the top of the widget. | |
| 96 | - * | |
| 97 | - * @since 4.6 | |
| 98 | - */ | |
| 99 | - do_action( 'mainwp_logs_widget_top', 'core' ); | |
| 100 | - ?> | |
| 101 | - <div id="mainwp-message-zone" style="display:none;" class="ui message"></div> | |
| 102 | - <?php | |
| 103 | - wp_nonce_field( 'mainwp-admin-nonce' ); | |
| 96 | + <div class="mainwp-widget-insights-card mainwp-scrolly-overflow"> | |
| 97 | + <?php | |
| 98 | + /** | |
| 99 | + * Action: mainwp_logs_widget_top | |
| 100 | + * | |
| 101 | + * Fires at the top of the widget. | |
| 102 | + * | |
| 103 | + * @since 4.6 | |
| 104 | + */ | |
| 105 | + do_action( 'mainwp_logs_widget_top', 'core' ); | |
| 106 | + ?> | |
| 107 | + <div id="mainwp-message-zone" style="display:none;" class="ui message"></div> | |
| 108 | + <?php | |
| 109 | + MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); | |
| 110 | + | |
| 111 | + if ( ! empty( $data ) ) { | |
| 104 | 112 | $this->render_widget_content( $stats_data, $stats_prev_data ); |
| 105 | - ?> | |
| 106 | - <?php | |
| 107 | - /** | |
| 108 | - * Action: mainwp_logs_widget_bottom | |
| 109 | - * | |
| 110 | - * Fires at the bottom of the widget. | |
| 111 | - * | |
| 112 | - * @since 4.6 | |
| 113 | - */ | |
| 114 | - do_action( 'mainwp_logs_widget_bottom', 'core' ); | |
| 115 | - ?> | |
| 116 | - </div> | |
| 113 | + } else { | |
| 114 | + MainWP_UI::render_empty_element_placeholder( __( 'No activity recorded', 'mainwp' ), __( 'Data will appear here once actions are tracked.', 'mainwp' ), '<em data-emoji=":bar_chart:" class="medium"></em>' ); | |
| 115 | + } | |
| 116 | + ?> | |
| 117 | + <?php | |
| 118 | + /** | |
| 119 | + * Action: mainwp_logs_widget_bottom | |
| 120 | + * | |
| 121 | + * Fires at the bottom of the widget. | |
| 122 | + * | |
| 123 | + * @since 4.6 | |
| 124 | + */ | |
| 125 | + do_action( 'mainwp_logs_widget_bottom', 'core' ); | |
| 126 | + ?> | |
| 127 | + </div> | |
| 117 | 128 | <div class="mainwp-widget-footer ui four columns stackable grid"> |
| 118 | 129 | <div class="column"> |
| 119 | 130 | </div> |
| 120 | 131 | <div class="column"> |
| @@ -140,10 +151,10 @@ | ||
| 140 | 151 | 'total_events' => esc_html__( 'Total', 'mainwp' ), |
| 141 | 152 | ); |
| 142 | 153 | |
| 143 | 154 | ?> |
| 144 | - <div class="ui one column grid"> | |
| 145 | - <div class="left aligned middle aligned column"> | |
| 155 | + <div class="ui grid"> | |
| 156 | + <div class="sixteen wide column"> | |
| 146 | 157 | <div class="ui equal width grid"> |
| 147 | 158 | <?php |
| 148 | 159 | foreach ( $columns as $act => $title ) { |
| 149 | 160 | Log_Stats::render_stats_info( $data, $act, $title, $prev_data ); |
| @@ -150,10 +161,10 @@ | ||
| 150 | 161 | } |
| 151 | 162 | ?> |
| 152 | 163 | </div> |
| 153 | 164 | </div> |
| 154 | - <div class="left aligned middle aligned column"> | |
| 155 | - <div id="mainwp-module-log-chart-sites-management-wrapper" ></div> | |
| 165 | + <div class="sixteen wide column"> | |
| 166 | + <div id="mainwp-module-log-chart-sites-management-wrapper"></div> | |
| 156 | 167 | <script type="text/javascript"> |
| 157 | 168 | jQuery( document ).ready( function() { |
| 158 | 169 | let options = { |
| 159 | 170 | chart: { |