← All changes
|
modules/logs/widgets/widget-log-recent-events-widget.php
+29
-9
5.2
→
6.2.2
View file →
| @@ -10,9 +10,17 @@ | ||
| 10 | 10 | |
| 11 | 11 | namespace MainWP\Dashboard\Module\Log; |
| 12 | 12 | |
| 13 | 13 | use MainWP\Dashboard\MainWP_Utility; |
| 14 | +use MainWP\Dashboard\MainWP_UI; | |
| 15 | +use MainWP\Dashboard\MainWP_DB; | |
| 14 | 16 | |
| 17 | +// Exit if accessed directly. | |
| 18 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 19 | + exit; | |
| 20 | +} | |
| 21 | + | |
| 22 | + | |
| 15 | 23 | /** |
| 16 | 24 | * Class Log_Recent_Events_Widget |
| 17 | 25 | * |
| 18 | 26 | * Displays the Logs info. |
| @@ -26,8 +34,15 @@ | ||
| 26 | 34 | */ |
| 27 | 35 | protected static $instance = null; |
| 28 | 36 | |
| 29 | 37 | /** |
| 38 | + * Private static variable to hold the table type value. | |
| 39 | + * | |
| 40 | + * @var mixed Default null | |
| 41 | + */ | |
| 42 | + private $table_id_prefix = 'widget-insight'; | |
| 43 | + | |
| 44 | + /** | |
| 30 | 45 | * Return the single instance of the class. |
| 31 | 46 | * |
| 32 | 47 | * @return mixed $instance The single instance of the class. |
| 33 | 48 | */ |
| @@ -60,18 +75,19 @@ | ||
| 60 | 75 | /** |
| 61 | 76 | * Render client overview Info. |
| 62 | 77 | */ |
| 63 | 78 | public function render_recent_events() { |
| 64 | - $manager = Log_Manager::instance(); | |
| 65 | - $list_table = new Log_Events_List_Table( $manager ); | |
| 79 | + $manager = Log_Manager::instance(); | |
| 80 | + $list_table = new Log_Events_List_Table( $manager, $this->table_id_prefix ); | |
| 81 | + $sites_count = MainWP_DB::instance()->get_websites_count(); | |
| 66 | 82 | ?> |
| 67 | 83 | <div class="mainwp-widget-header"> |
| 68 | - <h3 class="ui header handle-drag"> | |
| 69 | - <?php esc_html_e( 'Recent Activity Log', 'mainwp' ); ?> | |
| 84 | + <h2 class="ui header handle-drag"> | |
| 85 | + <?php esc_html_e( 'Recent Activity', 'mainwp' ); ?> | |
| 70 | 86 | <div class="sub header"> |
| 71 | 87 | <?php esc_html_e( 'Chronological log of the latest activities performed on the system.', 'mainwp' ); ?> |
| 72 | 88 | </div> |
| 73 | - </h3> | |
| 89 | + </h2> | |
| 74 | 90 | </div> |
| 75 | 91 | |
| 76 | 92 | <div class="mainwp-scrolly-overflow"> |
| 77 | 93 | <?php |
| @@ -83,13 +99,17 @@ | ||
| 83 | 99 | * @since 4.6 |
| 84 | 100 | */ |
| 85 | 101 | do_action( 'mainwp_logs_widget_top', 'recent_events' ); |
| 86 | 102 | ?> |
| 87 | - <div id="mainwp-message-zone" style="display:none;" class="ui message"></div> | |
| 88 | - <?php | |
| 89 | - wp_nonce_field( 'mainwp-admin-nonce' ); | |
| 103 | + <div id="mainwp-message-zone" style="display:none;" class="ui message"></div> | |
| 104 | + <?php | |
| 105 | + MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); | |
| 106 | + if ( 0 < intval( $sites_count ) ) { | |
| 90 | 107 | $list_table->display(); |
| 91 | - ?> | |
| 108 | + } else { | |
| 109 | + MainWP_UI::render_empty_element_placeholder( __( 'No Avtivity Data Yet', 'mainwp' ), '<a href="admin.php?page=managesites&do=new">' . __( 'Start connecting your sites now', 'mainwp' ) . '</a>', '<em data-emoji=":bar_chart:" class="medium"></em>' ); | |
| 110 | + } | |
| 111 | + ?> | |
| 92 | 112 | <?php |
| 93 | 113 | /** |
| 94 | 114 | * Action: mainwp_logs_widget_bottom |
| 95 | 115 | * |