From 07f631f8b3c1a613687470629e051175077dc348 Mon Sep 17 00:00:00 2001 From: moyooo Date: Tue, 19 Feb 2013 11:48:41 +0000 Subject: [PATCH] [0.85] update for new menu management git-svn-id: https://forge.glpi-project.org/svn/example/trunk@214 349b9182-4a13-0410-896f-e5e9767dd1b3 --- front/example.php | 2 +- inc/example.class.php | 23 +++++++++++++++++++++++ setup.php | 22 +++++++++++++--------- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/front/example.php b/front/example.php index 461590b..0b9f8fa 100755 --- a/front/example.php +++ b/front/example.php @@ -35,7 +35,7 @@ include ('../../../inc/includes.php'); if ($_SESSION["glpiactiveprofile"]["interface"] == "central") { - Html::header("TITRE", $_SERVER['PHP_SELF'],"plugins","example","optionname"); + Html::header("TITRE", $_SERVER['PHP_SELF'],"plugins","pluginexampleexample",""); } else { Html::helpHeader("TITRE", $_SERVER['PHP_SELF']); } diff --git a/inc/example.class.php b/inc/example.class.php index 6bf7d09..51c974b 100644 --- a/inc/example.class.php +++ b/inc/example.class.php @@ -61,6 +61,29 @@ class PluginExampleExample extends CommonDBTM { } + /** + * @see CommonGLPI::getMenuName() + **/ + static function getMenuName() { + return __('Example plugin'); + } + + /** + * @see CommonGLPI::getAdditionalMenuLinks() + **/ + static function getAdditionalMenuLinks() { + global $CFG_GLPI; + $links = array(); + + $links['config'] = '/plugins/example/index.php'; + $links["".__s("] = '/plugins/example/index.php'; + $links[__s('Test link', 'example')] = '/plugins/example/index.php'; + + return $links; + } + + + function getSearchOptions() { $tab = array(); diff --git a/setup.php b/setup.php index 81c0667..0f86e58 100755 --- a/setup.php +++ b/setup.php @@ -58,15 +58,19 @@ function plugin_init_example() { // Display a menu entry ? if (isset($_SESSION["glpi_plugin_example_profile"])) { // Right set in change_profile hook - $PLUGIN_HOOKS['menu_entry']['example'] = 'front/example.php'; - - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['title'] = "Search"; - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['page'] = '/plugins/example/front/example.php'; - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['search'] = '/plugins/example/front/example.php'; - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['add'] = '/plugins/example/front/example.form.php'; - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['config'] = '/plugins/example/index.php'; - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']["".__s("] = '/plugins/example/index.php'; - $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links'][__s('Test link', 'example')] = '/plugins/example/index.php'; + $PLUGIN_HOOKS['menu_toadd']['example'] = array('plugins' => 'PluginExampleExample', + 'utils' => 'PluginExampleExample'); + + // Old menu style +// $PLUGIN_HOOKS['menu_entry']['example'] = 'front/example.php'; +// +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['title'] = "Search"; +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['page'] = '/plugins/example/front/example.php'; +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['search'] = '/plugins/example/front/example.php'; +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['add'] = '/plugins/example/front/example.form.php'; +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']['config'] = '/plugins/example/index.php'; +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links']["".__s("] = '/plugins/example/index.php'; +// $PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['links'][__s('Test link', 'example')] = '/plugins/example/index.php'; $PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true; }