mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
remove XXX_TYPE and switch to Plugin::registerClass()
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@108 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
fc2231adcf
commit
3b5913f295
14
hook.php
14
hook.php
@ -122,7 +122,7 @@ function plugin_example_addLeftJoin($type,$ref_table,$new_table,$linkfield){
|
||||
|
||||
function plugin_example_forceGroupBy($type){
|
||||
switch ($type){
|
||||
case PLUGIN_EXAMPLE_TYPE :
|
||||
case 'PluginExampleExample' :
|
||||
// Force add GROUP BY IN REQUEST
|
||||
return true;
|
||||
break;
|
||||
@ -224,7 +224,7 @@ function plugin_example_MassiveActions($type){
|
||||
break;
|
||||
|
||||
// Actions for types provided by the plugin
|
||||
case PLUGIN_EXAMPLE_TYPE :
|
||||
case 'PluginExampleExample' :
|
||||
return array(
|
||||
// GLPI core one
|
||||
"add_document"=>$LANG["document"][16],
|
||||
@ -247,7 +247,7 @@ function plugin_example_MassiveActionsDisplay($type,$action){
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PLUGIN_EXAMPLE_TYPE:
|
||||
case 'PluginExampleExample':
|
||||
switch ($action){
|
||||
// No case for add_document : use GLPI core one
|
||||
case "do_nothing":
|
||||
@ -280,7 +280,7 @@ function plugin_example_MassiveActionsProcess($data){
|
||||
}
|
||||
break;
|
||||
case 'do_nothing':
|
||||
if ($data['device_type']==PLUGIN_EXAMPLE_TYPE){
|
||||
if ($data['device_type']=='PluginExampleExample'){
|
||||
$ci =new CommonItem();
|
||||
addMessageAfterRedirect("Right it is the type I want...");
|
||||
addMessageAfterRedirect("But... I say I will do nothing for :");
|
||||
@ -673,7 +673,7 @@ function plugin_example_cron_info($name) {
|
||||
|
||||
// Do special actions for dynamic report
|
||||
function plugin_example_dynamicReport($parm){
|
||||
if ($parm["item_type"]==PLUGIN_EXAMPLE_TYPE){
|
||||
if ($parm["item_type"]=='PluginExampleExample'){
|
||||
// Do all what you want for export depending on $parm
|
||||
echo "Personalized export for type ".$parm["display_type"];
|
||||
echo 'with additional datas : <br>';
|
||||
@ -690,7 +690,7 @@ function plugin_example_dynamicReport($parm){
|
||||
|
||||
// Add parameters to printPager in search system
|
||||
function plugin_example_addParamFordynamicReport($device_type){
|
||||
if ($device_type==PLUGIN_EXAMPLE_TYPE){
|
||||
if ($device_type=='PluginExampleExample'){
|
||||
// Return array data containing all params to add : may be single data or array data
|
||||
// Search config are available from session variable
|
||||
return array(
|
||||
@ -779,7 +779,7 @@ function plugin_example_uninstall(){
|
||||
|
||||
function plugin_example_AssignToTicket($types)
|
||||
{
|
||||
$types[PLUGIN_EXAMPLE_TYPE] = "Example";
|
||||
$types['PluginExampleExample'] = "Example";
|
||||
return $types;
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,13 @@ if ($_SESSION["glpiactiveprofile"]["interface"] == "central"){
|
||||
helpHeader("TITRE", $_SERVER['PHP_SELF']);
|
||||
}
|
||||
|
||||
checkTypeRight(PLUGIN_EXAMPLE_TYPE,"r");
|
||||
checkTypeRight('PluginExampleExample',"r");
|
||||
|
||||
manageGetValuesInSearch(PLUGIN_EXAMPLE_TYPE);
|
||||
manageGetValuesInSearch('PluginExampleExample');
|
||||
|
||||
searchForm(PLUGIN_EXAMPLE_TYPE,$_GET);
|
||||
searchForm('PluginExampleExample',$_GET);
|
||||
|
||||
showList(PLUGIN_EXAMPLE_TYPE,$_GET);
|
||||
showList('PluginExampleExample',$_GET);
|
||||
|
||||
commonFooter();
|
||||
?>
|
||||
|
@ -38,7 +38,7 @@ function plugin_init_example() {
|
||||
global $PLUGIN_HOOKS,$LANG,$CFG_GLPI;
|
||||
|
||||
// Params : plugin name - string type - ID - Array of attributes
|
||||
registerPluginType('example', 'PLUGIN_EXAMPLE_TYPE', 'PluginExampleExample', array(
|
||||
Plugin::registerClass('PluginExampleExample', array(
|
||||
'classname' => 'PluginExampleExample',
|
||||
'tablename' => 'glpi_plugin_example_example',
|
||||
'formpage' => 'front/example.form.php',
|
||||
@ -53,7 +53,7 @@ function plugin_init_example() {
|
||||
));
|
||||
|
||||
// Params : plugin name - string type - ID - Array of attributes
|
||||
registerPluginType('example', 'PLUGIN_EXAMPLEDROPDOWN_TYPE', 'PluginExampleDropdown', array(
|
||||
Plugin::registerClass('PluginExampleDropdown', array(
|
||||
'classname' => 'PluginExampleDropdown',
|
||||
'tablename' => 'glpi_plugin_example_dropdown',
|
||||
'typename' => 'Example Dropdown Type',
|
||||
@ -61,7 +61,7 @@ function plugin_init_example() {
|
||||
'searchpage' => 'front/dropdown.php'));
|
||||
|
||||
// Display a menu entry ?
|
||||
if (plugin_example_haveTypeRight(PLUGIN_EXAMPLE_TYPE,'r')) { // Right set in change_profile hook
|
||||
if (plugin_example_haveTypeRight('PluginExampleExample','r')) { // Right set in change_profile hook
|
||||
$PLUGIN_HOOKS['menu_entry']['example'] = true;
|
||||
|
||||
$PLUGIN_HOOKS['submenu_entry']['example']['options']['optionname']['title']="Search";
|
||||
@ -184,7 +184,7 @@ function plugin_example_haveTypeRight($type,$right){
|
||||
return false;
|
||||
}
|
||||
switch ($type){
|
||||
case PLUGIN_EXAMPLE_TYPE :
|
||||
case 'PluginExampleExample' :
|
||||
// Evaluate the right from data saved in session by change_profile hook
|
||||
return ($right=='r' || $_SESSION["glpi_plugin_example_profile"]=='w');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user