From ed351bce699e5cc0b2b0cb11cfb607fb8cf7419f Mon Sep 17 00:00:00 2001 From: moyooo Date: Thu, 23 Dec 2010 09:11:14 +0000 Subject: [PATCH] Permit to use addDefaultXXX for plugins in search engine see #2547 git-svn-id: https://forge.glpi-project.org/svn/example/trunk@148 349b9182-4a13-0410-896f-e5e9767dd1b3 --- hook.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hook.php b/hook.php index afb4762..1214934 100644 --- a/hook.php +++ b/hook.php @@ -100,6 +100,43 @@ function plugin_example_giveItem($type,$ID,$data,$num) { return ""; } +function plugin_example_addDefaultJoin($type, $ref_table, &$already_link_tables) { + + // Example of default JOIN clause + // No need of the function if you do not have specific cases + switch ($type) { +// case "PluginExampleExample" : + case "MyType" : + return Search::addLeftJoin($type, $ref_table, $already_link_tables, + "newtable", "linkfield"); + } + return ""; +} + +function plugin_example_addDefaultSelect($type) { + + // Example of default SELECT item to be added + // No need of the function if you do not have specific cases + switch ($type) { +// case "PluginExampleExample" : + case "MyType" : + return "`mytable`.`myfield` = 'myvalue' AS MYNAME, "; + } + return ""; +} + +function plugin_example_addDefaultWhere($type) { + + // Example of default WHERE item to be added + // No need of the function if you do not have specific cases + switch ($type) { +// case "PluginExampleExample" : + case "MyType" : + return " `mytable`.`myfield` = 'myvalue' "; + } + return ""; +} + function plugin_example_addLeftJoin($type,$ref_table,$new_table,$linkfield) {