diff --git a/hook.php b/hook.php index 603495a..7ae35d6 100644 --- a/hook.php +++ b/hook.php @@ -41,18 +41,6 @@ class pluginExample extends CommonDBTM { }; -// Define rights for the plugin types -function plugin_example_haveTypeRight($type,$right){ - switch ($type){ - case PLUGIN_EXAMPLE_TYPE : - // 1 - All rights for all users - // return true; - // 2 - Similarity right : same right of computer - return haveRight("computer",$right); - break; - } -} - // Define dropdown relations function plugin_example_getDatabaseRelations(){ // @@ -70,7 +58,7 @@ function plugin_example_getDropdown(){ // Define search option for types of the plugins function plugin_example_getSearchOption(){ - global $LANGEXAMPLE,$LANG; + global $LANG; $sopt=array(); // Part header @@ -79,7 +67,7 @@ function plugin_example_getSearchOption(){ $sopt[PLUGIN_EXAMPLE_TYPE][1]['table']='glpi_plugin_example'; $sopt[PLUGIN_EXAMPLE_TYPE][1]['field']='name'; $sopt[PLUGIN_EXAMPLE_TYPE][1]['linkfield']='name'; - $sopt[PLUGIN_EXAMPLE_TYPE][1]['name']=$LANGEXAMPLE["name"]; + $sopt[PLUGIN_EXAMPLE_TYPE][1]['name']=$LANG['plugin_example']["name"]; $sopt[PLUGIN_EXAMPLE_TYPE][2]['table']='glpi_dropdown_plugin_example'; $sopt[PLUGIN_EXAMPLE_TYPE][2]['field']='name'; @@ -547,12 +535,12 @@ function plugin_headings_actions_example($type){ // Example of an action heading function plugin_headings_example($type,$ID,$withtemplate=0){ - global $LANGEXAMPLE; + global $LANG; if (!$withtemplate){ echo "
"; switch ($type){ case "central": - echo "Plugin central action ".$LANGEXAMPLE["test"]; + echo "Plugin central action ".$LANG['plugin_example']["test"]; break; case "prefs": // Complete form display diff --git a/locales/en_GB.php b/locales/en_GB.php index 042baee..2863f3e 100644 --- a/locales/en_GB.php +++ b/locales/en_GB.php @@ -33,6 +33,6 @@ // Purpose of file: // ---------------------------------------------------------------------- -$LANGEXAMPLE["test"]="test english"; -$LANGEXAMPLE["name"]="Name"; +$LANG['plugin_example']["test"]="test english"; +$LANG['plugin_example']["name"]="Name"; ?> diff --git a/locales/fr_FR.php b/locales/fr_FR.php index 65039d5..e8809aa 100644 --- a/locales/fr_FR.php +++ b/locales/fr_FR.php @@ -34,6 +34,6 @@ // ---------------------------------------------------------------------- -$LANGEXAMPLE["test"]="test french"; -$LANGEXAMPLE["name"]="Nom"; +$LANG['plugin_example']["test"]="test french"; +$LANG['plugin_example']["name"]="Nom"; ?> diff --git a/setup.php b/setup.php index 82b5db8..c897ce1 100755 --- a/setup.php +++ b/setup.php @@ -34,13 +34,13 @@ // Init the hooks of the plugins -Needed function plugin_init_example() { - global $PLUGIN_HOOKS,$LANGEXAMPLE,$LANG,$CFG_GLPI; + global $PLUGIN_HOOKS,$LANG,$CFG_GLPI; // Display a menu entry ? $PLUGIN_HOOKS['menu_entry']['example'] = true; $PLUGIN_HOOKS['submenu_entry']['example']['add'] = 'example.form.php'; - $PLUGIN_HOOKS['submenu_entry']['example']["".$LANGEXAMPLE["test"].""] = 'index.php'; - $PLUGIN_HOOKS['submenu_entry']['example'][$LANGEXAMPLE["test"]] = 'index.php'; + $PLUGIN_HOOKS['submenu_entry']['example']["".$LANG["] = 'index.php'; + $PLUGIN_HOOKS['submenu_entry']['example'][$LANG['plugin_example']["test"]] = 'index.php'; $PLUGIN_HOOKS['submenu_entry']['example']['config'] = 'index.php'; $PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true; @@ -194,6 +194,17 @@ function plugin_example_check_config(){ return true; } +// Define rights for the plugin types +function plugin_example_haveTypeRight($type,$right){ + switch ($type){ + case PLUGIN_EXAMPLE_TYPE : + // 1 - All rights for all users + // return true; + // 2 - Similarity right : same right of computer + return haveRight("computer",$right); + break; + } +} ?>