From 2c9d41dda28dd1a4770213928401cc7be011f9c2 Mon Sep 17 00:00:00 2001 From: remicollet Date: Mon, 8 Aug 2011 09:16:59 +0000 Subject: [PATCH] standard tab added from plugin, "Proof Of Concept", to be discussed (see glpi r15253) git-svn-id: https://forge.glpi-project.org/svn/example/trunk@162 349b9182-4a13-0410-896f-e5e9767dd1b3 --- inc/example.class.php | 25 +++++++++++++++++++++++++ setup.php | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/inc/example.class.php b/inc/example.class.php index da686be..25b6334 100644 --- a/inc/example.class.php +++ b/inc/example.class.php @@ -137,6 +137,31 @@ class PluginExampleExample extends CommonDBTM { } + function getTabNameForItem(CommonGLPI $item) { + global $LANG; + + Toolbox::logDebug('getTabNameForItem', $item); + if ($item->getID()) { + switch ($item->getType()) { + case 'Phone' : + if ($_SESSION['glpishow_count_on_tabs']) { + return self::createTabEntry('Example', + countElementsInTable($this->getTable())); + } + return 'Example'; + } + } + return ''; + } + + + static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) { + + if ($item->getType()=='Phone') { + echo "Plugin Example on Phone"; + } + return true; + } } ?> diff --git a/setup.php b/setup.php index 5d17f59..460c053 100755 --- a/setup.php +++ b/setup.php @@ -47,7 +47,8 @@ function plugin_init_example() { Plugin::registerClass('PluginExampleDropdown'); Plugin::registerClass('PluginExampleExample', - array('notificationtemplates_types' => true)); + array('notificationtemplates_types' => true, + 'addtabon' => array('Phone'))); Plugin::registerClass('PluginExampleRuleTestCollection', array('rulecollections_types' => true));