| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin Dashboard |
| 4 |
* |
| 5 |
* @author PropertyHive |
| 6 |
* @category Admin |
| 7 |
* @package PropertyHive/Admin |
| 8 |
* @version 1.0.0 |
| 9 |
*/ |
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; // Exit if accessed directly |
| 12 |
} |
| 13 |
if ( ! class_exists( 'PH_Admin_Dashboard' ) ) : |
| 14 |
|
| 15 |
/** |
| 16 |
* PH_Admin_Dashboard Class. |
| 17 |
*/ |
| 18 |
class PH_Admin_Dashboard { |
| 19 |
|
| 20 |
/** |
| 21 |
* Hook in tabs. |
| 22 |
*/ |
| 23 |
public function __construct() { |
| 24 |
// Only hook in admin parts if the user has admin access |
| 25 |
if ( current_user_can( 'manage_options' ) ) { |
| 26 |
add_action( 'wp_dashboard_setup', array( $this, 'init' ) ); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Init dashboard widgets. |
| 32 |
*/ |
| 33 |
public function init() { |
| 34 |
wp_add_dashboard_widget( 'propertyhive_dashboard_news', __( 'Property Hive News', 'propertyhive' ), array( $this, 'news_widget' ) ); |
| 35 |
|
| 36 |
if ( get_option('propertyhive_module_disabled_viewings', '') != 'yes' ) |
| 37 |
{ |
| 38 |
wp_add_dashboard_widget( 'propertyhive_dashboard_viewings_awaiting_applicant_feedback', __( 'Viewings Awaiting Applicant Feedback', 'propertyhive' ), array( $this, 'viewings_awaiting_applicant_feedback_widget' ) ); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
/* |
| 43 |
* Property Hive News Widget |
| 44 |
*/ |
| 45 |
public function news_widget() |
| 46 |
{ |
| 47 |
echo '<div id="ph_dashboard_news">Loading...</div>'; |
| 48 |
} |
| 49 |
|
| 50 |
/* |
| 51 |
* Property Hive Viewings Awaiting Applicant Feedback Widget |
| 52 |
*/ |
| 53 |
public function viewings_awaiting_applicant_feedback_widget() |
| 54 |
{ |
| 55 |
echo '<div id="ph_dashboard_viewings_awaiting_applicant_feedback">Loading...</div>'; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
endif; |
| 60 |
|
| 61 |
return new PH_Admin_Dashboard(); |