From 68f5a861bbf858539d561b27419d79fd62f9d79c Mon Sep 17 00:00:00 2001 From: remicollet Date: Tue, 8 Dec 2009 18:43:34 +0000 Subject: [PATCH] first work on Search class git-svn-id: https://forge.glpi-project.org/svn/example/trunk@111 349b9182-4a13-0410-896f-e5e9767dd1b3 --- front/example.php | 6 +----- hook.php | 12 ++++++------ inc/example.class.php | 6 +++--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/front/example.php b/front/example.php index 5296eec..e11796b 100755 --- a/front/example.php +++ b/front/example.php @@ -46,11 +46,7 @@ if ($_SESSION["glpiactiveprofile"]["interface"] == "central"){ checkTypeRight('PluginExampleExample',"r"); -manageGetValuesInSearch('PluginExampleExample'); - -searchForm('PluginExampleExample',$_GET); - -showList('PluginExampleExample',$_GET); +Search::show('PluginExampleExample'); commonFooter(); ?> diff --git a/hook.php b/hook.php index 26c5a74..a230231 100644 --- a/hook.php +++ b/hook.php @@ -90,12 +90,12 @@ function plugin_example_getAddSearchOptions($itemtype){ function plugin_example_giveItem($type,$ID,$data,$num){ global $CFG_GLPI, $INFOFORM_PAGES; - $searchopt=&getSearchOptions($type); + $searchopt=&Search::getOptions($type); $table=$searchopt[$ID]["table"]; $field=$searchopt[$ID]["field"]; switch ($table.'.'.$field){ - case "glpi_plugin_example.name" : + case "glpi_plugin_example_example.name" : $out= ""; $out.= $data["ITEM_$num"]; if ($_SESSION["glpiis_ids_visible"]||empty($data["ITEM_$num"])) $out.= " (".$data["id"].")"; @@ -132,7 +132,7 @@ function plugin_example_forceGroupBy($type){ function plugin_example_addWhere($link,$nott,$type,$ID,$val){ - $searchopt=&getSearchOptions($type); + $searchopt=&Search::getOptions($type); $table=$searchopt[$ID]["table"]; $field=$searchopt[$ID]["field"]; @@ -155,7 +155,7 @@ function plugin_example_addWhere($link,$nott,$type,$ID,$val){ // This is not a real example because the use of Having condition in this case is not suitable function plugin_example_addHaving($link,$nott,$type,$ID,$val,$num){ - $searchopt=&getSearchOptions($type); + $searchopt=&Search::getOptions($type); $table=$searchopt[$ID]["table"]; $field=$searchopt[$ID]["field"]; @@ -180,7 +180,7 @@ function plugin_example_addHaving($link,$nott,$type,$ID,$val,$num){ function plugin_example_addSelect($type,$ID,$num){ - $searchopt=&getSearchOptions($type); + $searchopt=&Search::getOptions($type); $table=$searchopt[$ID]["table"]; $field=$searchopt[$ID]["field"]; @@ -196,7 +196,7 @@ function plugin_example_addSelect($type,$ID,$num){ function plugin_example_addOrderBy($type,$ID,$order,$key=0){ - $searchopt=&getSearchOptions($type); + $searchopt=&Search::getOptions($type); $table=$searchopt[$ID]["table"]; $field=$searchopt[$ID]["field"]; diff --git a/inc/example.class.php b/inc/example.class.php index e93df5c..76b8ad2 100644 --- a/inc/example.class.php +++ b/inc/example.class.php @@ -53,7 +53,7 @@ class PluginExampleExample extends CommonDBTM { $tab = array(); $tab['common']="Header Needed"; - $tab[1]['table']='glpi_plugin_example'; + $tab[1]['table']='glpi_plugin_example_example'; $tab[1]['field']='name'; $tab[1]['linkfield']='name'; $tab[1]['name']=$LANG['plugin_example']["name"]; @@ -63,13 +63,13 @@ class PluginExampleExample extends CommonDBTM { $tab[2]['linkfield']='plugin_example_dropdown_id'; $tab[2]['name']='Dropdown'; - $tab[3]['table']='glpi_plugin_example'; + $tab[3]['table']='glpi_plugin_example_example'; $tab[3]['field']='serial'; $tab[3]['linkfield']='serial'; $tab[3]['name']='Serial'; $tab[3]['usehaving']=true; - $tab[30]['table']='glpi_plugin_example'; + $tab[30]['table']='glpi_plugin_example_example'; $tab[30]['field']='id'; $tab[30]['linkfield']=''; $tab[30]['name']=$LANG["common"][2];