mage-eventpress/inc/welcome.php

117 lines
4.6 KiB
PHP
Raw Normal View History

2020-08-05 08:06:45 -04:00
<?php
if (!defined('ABSPATH')) {
die;
} // Cannot access pages directly.
2020-09-20 08:06:42 -04:00
add_action('admin_enqueue_scripts', 'mep_event_welcome_enqueue_scripts', 10, 1);
2020-08-05 08:06:45 -04:00
function mep_event_welcome_enqueue_scripts()
{
2020-09-20 08:15:42 -04:00
$current_screen = get_current_screen();
2021-12-06 05:53:55 -05:00
if ( ('mep_events_page_mep_event_welcome_page' == $current_screen->base) ) {
wp_enqueue_style('mep-welcome-style', plugin_dir_url(__DIR__) . 'inc/welcome/css/welcome.css', array());
}elseif(('mep_events_page_mep_event_import_page' == $current_screen->base)){
wp_enqueue_style('mep-welcome-style', plugin_dir_url(__DIR__) . 'inc/welcome/css/welcome.css', array());
}else{
2020-09-20 08:15:42 -04:00
return;
}
2021-12-06 05:53:55 -05:00
2020-08-05 08:06:45 -04:00
}
//Add admin page to the menu
add_action('admin_menu', 'mep_event_welcome_admin_menu');
function mep_event_welcome_admin_menu()
{
2022-04-05 03:42:16 -04:00
add_submenu_page('edit.php?post_type=mep_events', __('Welcome', 'mage-eventpress'), __('<span style="color:#10dd10">Welcome</span>', 'mage-eventpress'), 'manage_options', 'mep_event_welcome_page', 'mep_event_welcome_page');
2022-08-04 00:45:25 -04:00
add_submenu_page('edit.php?post_type=mep_events', __('Quick Setup', 'mage-eventpress'), __('<span style="color:#10dd10">Quick Setup</span>', 'mage-eventpress'), 'manage_options', 'mep_event_quick_setup_page', 'mep_event_quick_setup_page');
2022-04-05 03:42:16 -04:00
add_submenu_page('edit.php?post_type=mep_events', __('Dummy Import', 'mage-eventpress'), __('<span style="color:#10dd10">Dummy Import</span>', 'mage-eventpress'), 'manage_options', 'mep_event_import_page', 'mep_event_import_page');
2020-08-05 08:06:45 -04:00
}
2022-08-04 00:45:25 -04:00
function mep_event_quick_setup_page(){
require_once(dirname(__DIR__) . "/inc/quick_setup.php");
}
2020-08-05 08:06:45 -04:00
function mep_event_welcome_page()
{
?>
<!-- Create a header in the default WordPress 'wrap' container -->
2022-04-05 03:42:16 -04:00
<div class="wrap"></div><!-- /.wrap -->
<div class="mep_welcome_page_wrapper">
2020-08-05 08:06:45 -04:00
<?php
$active_tab = 'welcome';
if (isset($_GET['tab'])) {
2021-10-29 17:14:29 -04:00
$active_tab = mage_array_strip($_GET['tab']);
2020-08-05 08:06:45 -04:00
} // end if
?>
<h2 class="nav-tab-wrapper mage-event-welcome-tab">
2021-10-31 07:01:04 -04:00
<a href="edit.php?post_type=mep_events&page=mep_event_welcome_page&tab=welcome" class="nav-tab <?php echo esc_html($active_tab) == 'welcome' ? 'nav-tab-active' : ''; ?>">Welcome</a>
2022-04-05 03:42:16 -04:00
<a href="edit.php?post_type=mep_events&page=mep_event_import_page&tab=import" class="nav-tab <?php echo esc_html($active_tab) == 'import' ? 'nav-tab-active' : ''; ?>">Import</a>
<a href="edit.php?post_type=mep_events&page=mep_event_welcome_page&tab=kwb" class="nav-tab <?php echo esc_html($active_tab) == 'kwb' ? 'nav-tab-active' : ''; ?>">Support & Knowledgebase</a>
2020-08-05 08:06:45 -04:00
</h2>
<div class="tab-content">
<?php switch ($active_tab):
case 'welcome':
echo '<div class="mage-event-welcome">';
require_once(dirname(__DIR__) . "/inc/welcome/welcome.php");
echo '</div>';
break;
case 'kwb':
echo '<div class="mage-event-welcome">';
require_once(dirname(__DIR__) . "/inc/welcome/support.php");
echo '</div>';
break;
2022-04-05 03:42:16 -04:00
case 'import':
echo '<div class="mage-event-welcome">';
require_once(dirname(__DIR__) . "/inc/welcome/import.php");
echo '</div>';
break;
2020-08-05 08:06:45 -04:00
default:
echo '<div class="mage-event-welcome">';
require_once(dirname(__DIR__) . "/inc/welcome/welcome.php");
echo '</div>';
break;
endswitch; ?>
</div>
2022-04-05 03:42:16 -04:00
</div>
2020-08-05 08:06:45 -04:00
<?php
}
2021-12-06 05:53:55 -05:00
function mep_event_import_page(){
?>
2022-04-05 03:42:16 -04:00
<div class="wrap"></div><!-- /.wrap -->
<div class="mep_welcome_page_wrapper">
2021-12-06 05:53:55 -05:00
<?php
$active_tab = 'welcome';
if (isset($_GET['tab'])) {
$active_tab = mage_array_strip($_GET['tab']);
} // end if
?>
<h2 class="nav-tab-wrapper mage-event-welcome-tab">
<a href="edit.php?post_type=mep_events&page=mep_event_welcome_page&tab=welcome" class="nav-tab">Welcome</a>
2022-04-05 03:42:16 -04:00
<a href="edit.php?post_type=mep_events&page=mep_event_import_page&tab=import" class="nav-tab nav-tab-active">Import</a>
<a href="edit.php?post_type=mep_events&page=mep_event_welcome_page&tab=kwb" class="nav-tab">Support & Knowledgebase</a>
2021-12-06 05:53:55 -05:00
</h2>
<div class="tab-content">
<?php
2022-04-05 03:42:16 -04:00
echo '<div class="mage-event-welcome">';
require_once(dirname(__DIR__) . "/inc/welcome/import.php");
echo '</div>';
2021-12-06 05:53:55 -05:00
?>
</div>
2022-04-05 03:42:16 -04:00
</div>
2021-12-06 05:53:55 -05:00
<?php
}