| 1 |
<?php |
| 2 |
if ( !defined( 'ABSPATH' ) ) exit; |
| 3 |
|
| 4 |
if ( !class_exists( 'ewdotpDashboard' ) ) { |
| 5 |
/** |
| 6 |
* Class to handle plugin dashboard |
| 7 |
* |
| 8 |
* @since 3.0.0 |
| 9 |
*/ |
| 10 |
class ewdotpDashboard { |
| 11 |
|
| 12 |
public $message; |
| 13 |
public $status = true; |
| 14 |
|
| 15 |
public function __construct() { |
| 16 |
add_action( 'admin_menu', array( $this, 'add_dashboard_to_menu' ), 99 ); |
| 17 |
} |
| 18 |
|
| 19 |
public function add_dashboard_to_menu() { |
| 20 |
global $ewd_otp_controller; |
| 21 |
global $submenu; |
| 22 |
|
| 23 |
add_submenu_page( |
| 24 |
'ewd-otp-orders', |
| 25 |
'Dashboard', |
| 26 |
'Dashboard', |
| 27 |
$ewd_otp_controller->settings->get_setting( 'access-role' ), |
| 28 |
'ewd-otp-dashboard', |
| 29 |
array($this, 'display_dashboard_screen') |
| 30 |
); |
| 31 |
|
| 32 |
// Create a new sub-menu in the order that we want |
| 33 |
$new_submenu = array(); |
| 34 |
$menu_item_count = 3; |
| 35 |
|
| 36 |
if ( ! isset( $submenu['ewd-otp-orders'] ) or ! is_array($submenu['ewd-otp-orders']) ) { return; } |
| 37 |
|
| 38 |
foreach ( $submenu['ewd-otp-orders'] as $key => $sub_item ) { |
| 39 |
|
| 40 |
if ( $sub_item[0] == 'Dashboard' ) { $new_submenu[0] = $sub_item; } |
| 41 |
elseif ( $sub_item[0] == 'Settings' ) { $new_submenu[ sizeof($submenu) ] = $sub_item; } |
| 42 |
else { |
| 43 |
|
| 44 |
if ( $sub_item[0] == 'Tracking' ) { $sub_item[0] = 'Orders'; } |
| 45 |
|
| 46 |
$new_submenu[$menu_item_count] = $sub_item; |
| 47 |
$menu_item_count++; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
ksort($new_submenu); |
| 52 |
|
| 53 |
$submenu['ewd-otp-orders'] = $new_submenu; |
| 54 |
} |
| 55 |
|
| 56 |
public function display_dashboard_screen() { |
| 57 |
global $ewd_otp_controller; |
| 58 |
|
| 59 |
$permission = $ewd_otp_controller->permissions->check_permission( 'premium' ); |
| 60 |
|
| 61 |
$args = array(); |
| 62 |
|
| 63 |
$orders = $ewd_otp_controller->order_manager->get_matching_orders( $args ); |
| 64 |
|
| 65 |
?> |
| 66 |
|
| 67 |
<div id="ewd-otp-dashboard-content-area"> |
| 68 |
|
| 69 |
<div id="ewd-otp-dashboard-content-left"> |
| 70 |
|
| 71 |
<?php if ( ! $permission or get_option("EWD_OTP_Trial_Happening") == "Yes" ) { |
| 72 |
$premium_info = '<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full">'; |
| 73 |
$premium_info .= '<div class="ewd-otp-dashboard-new-widget-box-top">'; |
| 74 |
$premium_info .= sprintf( __( '<a href="%s" target="_blank">Visit our website</a> to learn how to upgrade to premium.'), 'https://www.etoilewebdesign.com/premium-upgrade-instructions/' ); |
| 75 |
$premium_info .= '</div>'; |
| 76 |
$premium_info .= '</div>'; |
| 77 |
|
| 78 |
$premium_info = apply_filters( 'ewd_dashboard_top', $premium_info, 'OTP', 'https://www.etoilewebdesign.com/license-payment/?Selected=OTP&Quantity=1' ); |
| 79 |
|
| 80 |
echo wp_kses( |
| 81 |
$premium_info, |
| 82 |
apply_filters( 'ewd_dashboard_top_kses_allowed_tags', wp_kses_allowed_html( 'post' ) ) |
| 83 |
); |
| 84 |
} ?> |
| 85 |
|
| 86 |
<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full" id="ewd-otp-dashboard-support-widget-box"> |
| 87 |
<div class="ewd-otp-dashboard-new-widget-box-top"><?php _e('Get Support', 'order-tracking'); ?><span id="ewd-otp-dash-mobile-support-down-caret"> ▼</span><span id="ewd-otp-dash-mobile-support-up-caret"> ▲</span></div> |
| 88 |
<div class="ewd-otp-dashboard-new-widget-box-bottom"> |
| 89 |
<ul class="ewd-otp-dashboard-support-widgets"> |
| 90 |
<li> |
| 91 |
<a href="https://www.youtube.com/watch?v=rMULYuPjVXU&list=PLEndQUuhlvSqa6Txwj1-Ohw8Bj90CIRl0" target="_blank"> |
| 92 |
<img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-youtube.png', __FILE__ ); ?>"> |
| 93 |
<div class="ewd-otp-dashboard-support-widgets-text"><?php _e('YouTube Tutorials', 'order-tracking'); ?></div> |
| 94 |
</a> |
| 95 |
</li> |
| 96 |
<li> |
| 97 |
<a href="https://wordpress.org/plugins/order-tracking/#faq" target="_blank"> |
| 98 |
<img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-faqs.png', __FILE__ ); ?>"> |
| 99 |
<div class="ewd-otp-dashboard-support-widgets-text"><?php _e('Plugin FAQs', 'order-tracking'); ?></div> |
| 100 |
</a> |
| 101 |
</li> |
| 102 |
<li> |
| 103 |
<a href="https://www.etoilewebdesign.com/support-center/?Plugin=OTP&Type=FAQs" target="_blank"> |
| 104 |
<img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-documentation.png', __FILE__ ); ?>"> |
| 105 |
<div class="ewd-otp-dashboard-support-widgets-text"><?php _e('Documentation', 'order-tracking'); ?></div> |
| 106 |
</a> |
| 107 |
</li> |
| 108 |
<li> |
| 109 |
<a href="https://www.etoilewebdesign.com/support-center/" target="_blank"> |
| 110 |
<img src="<?php echo plugins_url( '../assets/img/ewd-support-icon-forum.png', __FILE__ ); ?>"> |
| 111 |
<div class="ewd-otp-dashboard-support-widgets-text"><?php _e('Get Support', 'order-tracking'); ?></div> |
| 112 |
</a> |
| 113 |
</li> |
| 114 |
</ul> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
|
| 118 |
<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full" id="ewd-otp-dashboard-optional-table"> |
| 119 |
<div class="ewd-otp-dashboard-new-widget-box-top"><?php _e('Orders', 'order-tracking'); ?><span id="ewd-otp-dash-optional-table-down-caret"> ▼</span><span id="ewd-otp-dash-optional-table-up-caret"> ▲</span></div> |
| 120 |
<div class="ewd-otp-dashboard-new-widget-box-bottom"> |
| 121 |
<table class='ewd-otp-overview-table wp-list-table widefat fixed striped posts'> |
| 122 |
<thead> |
| 123 |
<tr> |
| 124 |
<th><?php _e("Order Number", 'order-tracking'); ?></th> |
| 125 |
<th><?php _e("Name", 'order-tracking'); ?></th> |
| 126 |
<th><?php _e("Status", 'order-tracking'); ?></th> |
| 127 |
<th><?php _e("Updated", 'order-tracking'); ?></th> |
| 128 |
</tr> |
| 129 |
</thead> |
| 130 |
<tbody> |
| 131 |
<?php |
| 132 |
if ( empty( $orders ) ) {echo "<tr><td colspan='3'>" . __("No orders to display yet. Create an order for it to be displayed here.", 'order-tracking') . "</td></tr>";} |
| 133 |
else { |
| 134 |
foreach ( $orders as $order ) { ?> |
| 135 |
<tr> |
| 136 |
<td><?php echo '<a href="admin.php?page=ewd-otp-add-edit-order&order_id=' . $order->id . '" data-id="' . esc_attr( $order->id ) . '">' . $order->number . '</a>'; ?></td> |
| 137 |
<td><?php echo $order->name; ?></td> |
| 138 |
<td><?php echo $order->status; ?></td> |
| 139 |
<td><?php echo $order->status_updated_fmtd; ?></td> |
| 140 |
</tr> |
| 141 |
<?php } |
| 142 |
} |
| 143 |
?> |
| 144 |
</tbody> |
| 145 |
</table> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
|
| 149 |
<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full"> |
| 150 |
<div class="ewd-otp-dashboard-new-widget-box-top">What People Are Saying</div> |
| 151 |
<div class="ewd-otp-dashboard-new-widget-box-bottom"> |
| 152 |
<ul class="ewd-otp-dashboard-testimonials"> |
| 153 |
<?php $randomTestimonial = rand(0,2); |
| 154 |
if($randomTestimonial == 0){ ?> |
| 155 |
<li id="ewd-otp-dashboard-testimonial-one"> |
| 156 |
<img src="<?php echo plugins_url( '../assets/img/dash-asset-stars.png', __FILE__ ); ?>"> |
| 157 |
<div class="ewd-otp-dashboard-testimonial-title">"Great Plugin. Great Support!"</div> |
| 158 |
<div class="ewd-otp-dashboard-testimonial-author">- @pfernand</div> |
| 159 |
<div class="ewd-otp-dashboard-testimonial-text">The next best thing about finding a great plugin is finding a plugin with AWESOME support... <a href="https://wordpress.org/support/topic/great-plugin-great-support-644/" target="_blank">read more</a></div> |
| 160 |
</li> |
| 161 |
<?php } |
| 162 |
if($randomTestimonial == 1){ ?> |
| 163 |
<li id="ewd-otp-dashboard-testimonial-two"> |
| 164 |
<img src="<?php echo plugins_url( '../assets/img/dash-asset-stars.png', __FILE__ ); ?>"> |
| 165 |
<div class="ewd-otp-dashboard-testimonial-title">"Order tracking made easy"</div> |
| 166 |
<div class="ewd-otp-dashboard-testimonial-author">- @vietnamsales</div> |
| 167 |
<div class="ewd-otp-dashboard-testimonial-text">That’s a wonderful plugin. Did I mention that customer service was fast, friendly and useful? <a href="https://wordpress.org/support/topic/order-tracking-made-easy/" target="_blank">read more</a></div> |
| 168 |
</li> |
| 169 |
<?php } |
| 170 |
if($randomTestimonial == 2){ ?> |
| 171 |
<li id="ewd-otp-dashboard-testimonial-three"> |
| 172 |
<img src="<?php echo plugins_url( '../assets/img/dash-asset-stars.png', __FILE__ ); ?>"> |
| 173 |
<div class="ewd-otp-dashboard-testimonial-title">"Amazing plugin, Awesome Customer Support"</div> |
| 174 |
<div class="ewd-otp-dashboard-testimonial-author">- @diegoduarte</div> |
| 175 |
<div class="ewd-otp-dashboard-testimonial-text">The plugin is simple, but really amazing. It does everything is supposed to do. Five stars! <a href="https://wordpress.org/support/topic/amazing-plugin-awesome-customer-support/" target="_blank">read more</a></div> |
| 176 |
</li> |
| 177 |
<?php } ?> |
| 178 |
</ul> |
| 179 |
</div> |
| 180 |
</div> |
| 181 |
|
| 182 |
<?php if ( ! $permission or get_option("EWD_OTP_Trial_Happening") == "Yes" ) { ?> |
| 183 |
<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full" id="ewd-otp-dashboard-guarantee-widget-box"> |
| 184 |
<div class="ewd-otp-dashboard-new-widget-box-top"> |
| 185 |
<div class="ewd-otp-dashboard-guarantee"> |
| 186 |
<div class="ewd-otp-dashboard-guarantee-title">14-Day 100% Money-Back Guarantee</div> |
| 187 |
<div class="ewd-otp-dashboard-guarantee-text">If you're not 100% satisfied with the premium version of our plugin - no problem. You have 14 days to receive a FULL REFUND. We're certain you won't need it, though.</div> |
| 188 |
</div> |
| 189 |
</div> |
| 190 |
</div> |
| 191 |
<?php } ?> |
| 192 |
|
| 193 |
</div> <!-- left --> |
| 194 |
|
| 195 |
<div id="ewd-otp-dashboard-content-right"> |
| 196 |
|
| 197 |
<?php if ( ! $permission or get_option("EWD_OTP_Trial_Happening") == "Yes" ) { ?> |
| 198 |
<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full" id="ewd-otp-dashboard-get-premium-widget-box"> |
| 199 |
<div class="ewd-otp-dashboard-new-widget-box-top">Get Premium</div> |
| 200 |
|
| 201 |
<?php if ( get_option( "EWD_OTP_Trial_Happening" ) == "Yes" ) { do_action( 'ewd_trial_happening', 'OTP' ); } ?> |
| 202 |
|
| 203 |
<div class="ewd-otp-dashboard-new-widget-box-bottom"> |
| 204 |
<div class="ewd-otp-dashboard-get-premium-widget-features-title"<?php echo ( ( get_option("EWD_OTP_Trial_Happening") == "Yes" ) ? "style='padding-top: 20px;'" : ""); ?>>GET FULL ACCESS WITH OUR PREMIUM VERSION AND GET:</div> |
| 205 |
<ul class="ewd-otp-dashboard-get-premium-widget-features"> |
| 206 |
<li>Set Up Sales Reps & Customers</li> |
| 207 |
<li>Custom Fields</li> |
| 208 |
<li>WooCommerce Order Integration</li> |
| 209 |
<li>Advanced Display Options</li> |
| 210 |
<li>+ More</li> |
| 211 |
</ul> |
| 212 |
<a href="https://www.etoilewebdesign.com/license-payment/?Selected=OTP&Quantity=1&utm_source=otp_admin&utm_content=dashboard_sidebar" class="ewd-otp-dashboard-get-premium-widget-button" target="_blank">UPGRADE NOW</a> |
| 213 |
|
| 214 |
<?php if ( ! get_option("EWD_OTP_Trial_Happening") ) { |
| 215 |
$trial_info = sprintf( __( '<a href="%s" target="_blank">Visit our website</a> to learn how to get a free 7-day trial of the premium plugin.'), 'https://www.etoilewebdesign.com/premium-upgrade-instructions/' ); |
| 216 |
|
| 217 |
echo apply_filters( 'ewd_trial_button', $trial_info, 'OTP' ); |
| 218 |
} ?> |
| 219 |
</div> |
| 220 |
</div> |
| 221 |
<?php } ?> |
| 222 |
|
| 223 |
<div class="ewd-otp-dashboard-new-widget-box ewd-widget-box-full"> |
| 224 |
<div class="ewd-otp-dashboard-new-widget-box-top">Other Plugins by Etoile</div> |
| 225 |
<div class="ewd-otp-dashboard-new-widget-box-bottom"> |
| 226 |
<ul class="ewd-otp-dashboard-other-plugins"> |
| 227 |
<li> |
| 228 |
<a href="https://wordpress.org/plugins/ultimate-product-catalogue/" target="_blank"><img src="<?php echo plugins_url( '../assets/img/ewd-otp-icon.png', __FILE__ ); ?>"></a> |
| 229 |
<div class="ewd-otp-dashboard-other-plugins-text"> |
| 230 |
<div class="ewd-otp-dashboard-other-plugins-title">Product Catalog</div> |
| 231 |
<div class="ewd-otp-dashboard-other-plugins-blurb">Enables you to display your business's products in a clean and efficient manner.</div> |
| 232 |
</div> |
| 233 |
</li> |
| 234 |
<li> |
| 235 |
<a href="https://wordpress.org/plugins/ultimate-faqs/" target="_blank"><img src="<?php echo plugins_url( '../assets/img/ewd-ufaq-icon.png', __FILE__ ); ?>"></a> |
| 236 |
<div class="ewd-otp-dashboard-other-plugins-text"> |
| 237 |
<div class="ewd-otp-dashboard-other-plugins-title">Ultimate FAQs</div> |
| 238 |
<div class="ewd-otp-dashboard-other-plugins-blurb">An easy-to-use FAQ plugin that lets you create, order and publicize FAQs, with many styles and options!</div> |
| 239 |
</div> |
| 240 |
</li> |
| 241 |
</ul> |
| 242 |
</div> |
| 243 |
</div> |
| 244 |
|
| 245 |
</div> <!-- right --> |
| 246 |
|
| 247 |
</div> <!-- us-dashboard-content-area --> |
| 248 |
|
| 249 |
<?php if ( ! $permission or get_option("EWD_OTP_Trial_Happening") == "Yes" ) { ?> |
| 250 |
<div id="ewd-otp-dashboard-new-footer-one"> |
| 251 |
<div class="ewd-otp-dashboard-new-footer-one-inside"> |
| 252 |
<div class="ewd-otp-dashboard-new-footer-one-left"> |
| 253 |
<div class="ewd-otp-dashboard-new-footer-one-title">What's Included in Our Premium Version?</div> |
| 254 |
<ul class="ewd-otp-dashboard-new-footer-one-benefits"> |
| 255 |
<li>Create & Assign Orders to Sales Reps</li> |
| 256 |
<li>Create & Tie Orders to Customers</li> |
| 257 |
<li>Custom Fields</li> |
| 258 |
<li>WooCommerce Order Integration</li> |
| 259 |
<li>Advanced Display & Styling Options</li> |
| 260 |
<li>Front-End Customer Order Form</li> |
| 261 |
<li>Import/Export Orders</li> |
| 262 |
<li>Set Up Status Locations</li> |
| 263 |
<li>Email Support</li> |
| 264 |
</ul> |
| 265 |
</div> |
| 266 |
<div class="ewd-otp-dashboard-new-footer-one-buttons"> |
| 267 |
<a class="ewd-otp-dashboard-new-upgrade-button" href="https://www.etoilewebdesign.com/license-payment/?Selected=OTP&Quantity=1&utm_source=otp_admin&utm_content=dashboard_footer" target="_blank">UPGRADE NOW</a> |
| 268 |
</div> |
| 269 |
</div> |
| 270 |
</div> <!-- us-dashboard-new-footer-one --> |
| 271 |
<?php } ?> |
| 272 |
<div id="ewd-otp-dashboard-new-footer-two"> |
| 273 |
<div class="ewd-otp-dashboard-new-footer-two-inside"> |
| 274 |
<img src="<?php echo plugins_url( '../assets/img/ewd-logo-white.png', __FILE__ ); ?>" class="ewd-otp-dashboard-new-footer-two-icon"> |
| 275 |
<div class="ewd-otp-dashboard-new-footer-two-blurb"> |
| 276 |
At Etoile Web Design, we build reliable, easy-to-use WordPress plugins with a modern look. Rich in features, highly customizable and responsive, plugins by Etoile Web Design can be used as out-of-the-box solutions and can also be adapted to your specific requirements. |
| 277 |
</div> |
| 278 |
<ul class="ewd-otp-dashboard-new-footer-two-menu"> |
| 279 |
<li>SOCIAL</li> |
| 280 |
<li><a href="https://www.facebook.com/EtoileWebDesign/" target="_blank">Facebook</a></li> |
| 281 |
<li><a href="https://twitter.com/EtoileWebDesign" target="_blank">Twitter</a></li> |
| 282 |
<li><a href="https://www.etoilewebdesign.com/category/blog/" target="_blank">Blog</a></li> |
| 283 |
</ul> |
| 284 |
<ul class="ewd-otp-dashboard-new-footer-two-menu"> |
| 285 |
<li>SUPPORT</li> |
| 286 |
<li><a href="https://www.youtube.com/watch?v=rMULYuPjVXU&list=PLEndQUuhlvSqa6Txwj1-Ohw8Bj90CIRl0" target="_blank">YouTube Tutorials</a></li> |
| 287 |
<li><a href="https://www.etoilewebdesign.com/support-center/?Plugin=OTP&Type=FAQs" target="_blank">Documentation</a></li> |
| 288 |
<li><a href="https://www.etoilewebdesign.com/support-center/" target="_blank">Get Support</a></li> |
| 289 |
<li><a href="https://wordpress.org/plugins/order-tracking/#faq" target="_blank">FAQs</a></li> |
| 290 |
</ul> |
| 291 |
</div> |
| 292 |
</div> <!-- ewd-otp-dashboard-new-footer-two --> |
| 293 |
|
| 294 |
<?php } |
| 295 |
|
| 296 |
public function display_notice() { |
| 297 |
if ( $this->status ) { |
| 298 |
echo "<div class='updated'><p>" . $this->message . "</p></div>"; |
| 299 |
} |
| 300 |
else { |
| 301 |
echo "<div class='error'><p>" . $this->message . "</p></div>"; |
| 302 |
} |
| 303 |
} |
| 304 |
} |
| 305 |
} // endif |
| 306 |
|