/** * This function creates all the relevant pages for our plugin. * These pages appear in the Dashboard. * * @since 0.1 */ public function create_nelioab_admin_pages() { $nelioab_menu = 'nelioab-dashboard'; // Main menu // ---------------------------------------------------------------------- add_menu_page(__('Nelio A/B Testing', 'nelioab'), __('Nelio A/B Testing', 'nelioab'), 'manage_options', $nelioab_menu, null, null, NelioABSettings::get_menu_location() . '.000023510'); // Dashboard page // ---------------------------------------------------------------------- require_once NELIOAB_ADMIN_DIR . '/dashboard-page-controller.php'; add_submenu_page($nelioab_menu, __('Dashboard', 'nelioab'), __('Dashboard', 'nelioab'), 'manage_options', 'nelioab-dashboard', array('NelioABDashboardPageController', 'build')); // Experiments pages (depending on the action, we show one or another) // ---------------------------------------------------------------------- $the_action = NULL; if (isset($_GET['action'])) { $the_action = $_GET['action']; } switch ($the_action) { case 'edit': require_once NELIOAB_ADMIN_DIR . '/select-exp-edition-page-controller.php'; $page_to_build = array('NelioABSelectExpEditionPageController', 'build'); break; case 'progress': require_once NELIOAB_ADMIN_DIR . '/select-exp-progress-page-controller.php'; $page_to_build = array('NelioABSelectExpProgressPageController', 'build'); break; default: require_once NELIOAB_ADMIN_DIR . '/experiments-page-controller.php'; $page_to_build = array('NelioABExperimentsPageController', 'build'); break; } add_submenu_page($nelioab_menu, __('Experiments', 'nelioab'), __('Experiments', 'nelioab'), 'manage_options', 'nelioab-experiments', $page_to_build); // Creating Experiment; (depending on the type, we show one form or another) // ---------------------------------------------------------------------- require_once NELIOAB_ADMIN_DIR . '/select-exp-creation-page-controller.php'; add_action('admin_head', array($this, 'add_css_for_creation_page')); add_action('admin_head', array($this, 'add_css_for_themes')); $page_to_build = array('NelioABSelectExpCreationPageController', 'build'); add_submenu_page($nelioab_menu, __('Add Experiment', 'nelioab'), __('Add Experiment', 'nelioab'), 'manage_options', 'nelioab-add-experiment', $page_to_build); // Either Free Trial or My Account page // ---------------------------------------------------------------------- if (NelioABAccountSettings::is_using_free_trial()) { $label = __('Free Trial', 'nelioab'); } else { $label = __('My Account', 'nelioab'); } require_once NELIOAB_ADMIN_DIR . '/account-page-controller.php'; add_submenu_page($nelioab_menu, $label, $label, 'manage_options', 'nelioab-account', array('NelioABAccountPageController', 'build')); // Settings page // ---------------------------------------------------------------------- require_once NELIOAB_ADMIN_DIR . '/settings-page-controller.php'; add_submenu_page($nelioab_menu, __('Settings', 'nelioab'), __('Settings', 'nelioab'), 'manage_options', 'nelioab-settings', array('NelioABSettingsPageController', 'build')); // Help // ---------------------------------------------------------------------- add_submenu_page($nelioab_menu, __('Help', 'nelioab'), __('Help', 'nelioab'), 'manage_options', 'nelioab-help'); global $submenu; for ($i = 0; $i < count($submenu['nelioab-dashboard']); ++$i) { if ('nelioab-help' == $submenu['nelioab-dashboard'][$i][2]) { $submenu['nelioab-dashboard'][$i][2] = 'http://support.nelioabtesting.com/support/home'; break; } } // OTHER PAGES (not included in the menu) // CSS Editing // ---------------------------------------------------------------------- require_once NELIOAB_ADMIN_DIR . '/views/content/css-edit.php'; add_submenu_page(NULL, __('CSS Edit', 'nelioab'), __('CSS Edit', 'nelioab'), 'manage_options', 'nelioab-css-edit', array('NelioABCssEditPage', 'build')); }
public static function print_menu_location_field() { $field_name = 'menu_location'; printf('<select id="%1$s" name="nelioab_settings[%1$s]" %2$s>', $field_name, self::get_basic_details()); ?> <option value='<?php echo NelioABSettings::MENU_LOCATION_DASHBOARD; ?> '><?php _e('Top of the Dashboard', 'nelioab'); ?> </option> <option value='<?php echo NelioABSettings::MENU_LOCATION_APPEARANCE; ?> ' <?php if (NelioABSettings::get_menu_location() == NelioABSettings::MENU_LOCATION_APPEARANCE) { echo ' selected="selected"'; } ?> ><?php _e('Above Appearance', 'nelioab'); ?> </option> <option value='<?php echo NelioABSettings::MENU_LOCATION_TOOLS; ?> ' <?php if (NelioABSettings::get_menu_location() == NelioABSettings::MENU_LOCATION_TOOLS) { echo ' selected="selected"'; } ?> ><?php _e('Below Tools', 'nelioab'); ?> </option> <option value='<?php echo NelioABSettings::MENU_LOCATION_LAST_BLOCK; ?> ' <?php if (NelioABSettings::get_menu_location() == NelioABSettings::MENU_LOCATION_LAST_BLOCK) { echo ' selected="selected"'; } ?> ><?php _e('First Option in Last Block', 'nelioab'); ?> </option> <option value='<?php echo NelioABSettings::MENU_LOCATION_END; ?> ' <?php if (NelioABSettings::get_menu_location() == NelioABSettings::MENU_LOCATION_END) { echo ' selected="selected"'; } ?> ><?php _e('Latest Option', 'nelioab'); ?> </option> </select> <div class="the-descr" style="display:none;"><span class="description"><?php _e('Set the location of «Nelio A/B Testing» in the left pane of the Dashboard.', 'nelioab'); ?> </span></div><?php }