mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
Mise à jour
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@26 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
4758786c02
commit
e2b9e280e7
72
setup.php
72
setup.php
@ -122,17 +122,6 @@ function plugin_example_getSearchOption(){
|
|||||||
return $sopt;
|
return $sopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function plugin_example_addLeftJoin($type,$ref_table,$new_table,$linkfield){
|
|
||||||
switch ($new_table){
|
|
||||||
case "glpi_dropdown_plugin_example" :
|
|
||||||
// Standard LEFT JOIN for the example but use it for specific jointures
|
|
||||||
return " LEFT JOIN $new_table ON ($ref_table.$linkfield = $new_table.ID) ";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
function plugin_example_giveItem($type,$field,$data,$num,$linkfield=""){
|
function plugin_example_giveItem($type,$field,$data,$num,$linkfield=""){
|
||||||
global $CFG_GLPI, $INFOFORM_PAGES;
|
global $CFG_GLPI, $INFOFORM_PAGES;
|
||||||
|
|
||||||
@ -148,6 +137,19 @@ function plugin_example_giveItem($type,$field,$data,$num,$linkfield=""){
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function plugin_example_addLeftJoin($type,$ref_table,$new_table,$linkfield){
|
||||||
|
|
||||||
|
// Example of standard LEFT JOIN clause but use it ONLY for specific LEFT JOIN
|
||||||
|
// No need of the function if you do not have specific cases
|
||||||
|
switch ($new_table){
|
||||||
|
case "glpi_dropdown_plugin_example" :
|
||||||
|
return " LEFT JOIN $new_table ON ($ref_table.$linkfield = $new_table.ID) ";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function plugin_example_addWhere($link,$nott,$type,$ID,$val){
|
function plugin_example_addWhere($link,$nott,$type,$ID,$val){
|
||||||
global $SEARCH_OPTION;
|
global $SEARCH_OPTION;
|
||||||
|
|
||||||
@ -156,17 +158,17 @@ function plugin_example_addWhere($link,$nott,$type,$ID,$val){
|
|||||||
|
|
||||||
$SEARCH=makeTextSearch($val,$nott);
|
$SEARCH=makeTextSearch($val,$nott);
|
||||||
|
|
||||||
switch ($table.".".$field){
|
// Example of standard Where clause but use it ONLY for specific Where
|
||||||
case "glpi_plugin_example.name" :
|
// No need of the function if you do not have specific cases
|
||||||
// Standard Where clause for the example but use it for specific jointures
|
// switch ($table.".".$field){
|
||||||
$ADD="";
|
// case "glpi_plugin_example.name" :
|
||||||
if ($nott&&$val!="NULL") {
|
// $ADD="";
|
||||||
$ADD=" OR $table.$field IS NULL";
|
// if ($nott&&$val!="NULL") {
|
||||||
}
|
// $ADD=" OR $table.$field IS NULL";
|
||||||
|
// }
|
||||||
return $link." ($table.$field $SEARCH ".$ADD." ) ";
|
// return $link." ($table.$field $SEARCH ".$ADD." ) ";
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,12 +178,13 @@ function plugin_example_addSelect($type,$ID,$num){
|
|||||||
$table=$SEARCH_OPTION[$type][$ID]["table"];
|
$table=$SEARCH_OPTION[$type][$ID]["table"];
|
||||||
$field=$SEARCH_OPTION[$type][$ID]["field"];
|
$field=$SEARCH_OPTION[$type][$ID]["field"];
|
||||||
|
|
||||||
switch ($table.".".$field){
|
// Example of standard Select clause but use it ONLY for specific Select
|
||||||
case "glpi_plugin_example.name" :
|
// No need of the function if you do not have specific cases
|
||||||
// Standard Select clause for the example but use it for specific selection
|
// switch ($table.".".$field){
|
||||||
return $table.".".$field." AS ITEM_$num, ";
|
// case "glpi_plugin_example.name" :
|
||||||
break;
|
// return $table.".".$field." AS ITEM_$num, ";
|
||||||
}
|
// break;
|
||||||
|
// }
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,12 +194,13 @@ function plugin_example_addOrderBy($type,$ID,$order,$key=0){
|
|||||||
$table=$SEARCH_OPTION[$type][$ID]["table"];
|
$table=$SEARCH_OPTION[$type][$ID]["table"];
|
||||||
$field=$SEARCH_OPTION[$type][$ID]["field"];
|
$field=$SEARCH_OPTION[$type][$ID]["field"];
|
||||||
|
|
||||||
switch ($table.".".$field){
|
// Example of standard OrderBy clause but use it ONLY for specific order by
|
||||||
case "glpi_plugin_example.name" :
|
// No need of the function if you do not have specific cases
|
||||||
// Standard Order By clause for the example but use it for specific selection
|
// switch ($table.".".$field){
|
||||||
return " ORDER BY $table.$field $order ";
|
// case "glpi_plugin_example.name" :
|
||||||
break;
|
// return " ORDER BY $table.$field $order ";
|
||||||
}
|
// break;
|
||||||
|
// }
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user