From dc2dc419a2b0c79ee9aeacc5bf02897a0a0e9d7c Mon Sep 17 00:00:00 2001 From: remicollet Date: Tue, 14 Apr 2009 11:08:29 +0000 Subject: [PATCH] [examples] add to plugin_get_headings git-svn-id: https://forge.glpi-project.org/svn/example/trunk@72 349b9182-4a13-0410-896f-e5e9767dd1b3 --- hook.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/hook.php b/hook.php index 8e63e59..09c3798 100644 --- a/hook.php +++ b/hook.php @@ -516,17 +516,28 @@ function plugin_display_planning_example($parm){ } // Define headings added by the plugin -function plugin_get_headings_example($type,$withtemplate){ +function plugin_get_headings_example($type,$ID,$withtemplate){ switch ($type){ - case COMPUTER_TYPE : - // template case - if ($withtemplate) + case PROFILE_TYPE: + $prof = new Profile(); + if ($ID>0 && $prof->getFromDB($ID) && $prof->fields['interface']=='central') { + return array( + 1 => "Test PLugin", + ); + } else { return array(); - // Non template case - else + } + break; + case COMPUTER_TYPE : + // new object / template case + if ($withtemplate) { + return array(); + // Non template case / editing an existing object + } else { return array( 1 => "Test PLugin", ); + } break; case ENTERPRISE_TYPE : return array( @@ -553,6 +564,7 @@ function plugin_get_headings_example($type,$withtemplate){ function plugin_headings_actions_example($type){ switch ($type){ + case PROFILE_TYPE : case COMPUTER_TYPE : return array( 1 => "plugin_headings_example",