mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
[example] clean mesage after redirect
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@47 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
d45c7fa3aa
commit
4af5ffffad
46
setup.php
46
setup.php
@ -325,18 +325,18 @@ function plugin_example_MassiveActionsDisplay($type,$action){
|
|||||||
// How to process specific actions ?
|
// How to process specific actions ?
|
||||||
function plugin_example_MassiveActionsProcess($data){
|
function plugin_example_MassiveActionsProcess($data){
|
||||||
global $LANG;
|
global $LANG;
|
||||||
if (!isset($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"]="";
|
|
||||||
|
|
||||||
switch ($data['action']){
|
switch ($data['action']){
|
||||||
case 'plugin_example_DoIt':
|
case 'plugin_example_DoIt':
|
||||||
if ($data['device_type']==COMPUTER_TYPE){
|
if ($data['device_type']==COMPUTER_TYPE){
|
||||||
$ci =new CommonItem();
|
$ci =new CommonItem();
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].= "Right it is the type I want...<br>";
|
addMessageAfterRedirect("Right it is the type I want...");
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].= "But... I say I will do nothing for :<br>";
|
addMessageAfterRedirect("But... I say I will do nothing for :");
|
||||||
foreach ($data['item'] as $key => $val){
|
foreach ($data['item'] as $key => $val){
|
||||||
if ($val==1) {
|
if ($val==1) {
|
||||||
if ($ci->getFromDB($data["device_type"],$key)){
|
if ($ci->getFromDB($data["device_type"],$key)){
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].= "- ".$ci->getField("name")."<br>";
|
addMessageAfterRedirect("- ".$ci->getField("name"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -345,12 +345,12 @@ function plugin_example_MassiveActionsProcess($data){
|
|||||||
case 'do_nothing':
|
case 'do_nothing':
|
||||||
if ($data['device_type']==PLUGIN_EXAMPLE_TYPE){
|
if ($data['device_type']==PLUGIN_EXAMPLE_TYPE){
|
||||||
$ci =new CommonItem();
|
$ci =new CommonItem();
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].= "Right it is the type I want...<br>";
|
addMessageAfterRedirect("Right it is the type I want...");
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].= "But... I say I will do nothing for :<br>";
|
addMessageAfterRedirect("But... I say I will do nothing for :");
|
||||||
foreach ($data['item'] as $key => $val){
|
foreach ($data['item'] as $key => $val){
|
||||||
if ($val==1) {
|
if ($val==1) {
|
||||||
if ($ci->getFromDB($data["device_type"],$key)){
|
if ($ci->getFromDB($data["device_type"],$key)){
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].= "- ".$ci->getField("name")."<br>";
|
addMessageAfterRedirect("- ".$ci->getField("name"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,8 +397,7 @@ function plugin_pre_item_update_example($input){
|
|||||||
switch ($input["_item_type_"]){
|
switch ($input["_item_type_"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Pre Update Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Pre Update Computer Hook";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $input;
|
return $input;
|
||||||
@ -411,8 +410,7 @@ function plugin_item_update_example($parm){
|
|||||||
if (isset($parm["type"]))
|
if (isset($parm["type"]))
|
||||||
switch ($parm["type"]){
|
switch ($parm["type"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Update Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Update Computer Hook";
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -425,8 +423,7 @@ function plugin_pre_item_add_example($input){
|
|||||||
switch ($input["_item_type_"]){
|
switch ($input["_item_type_"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Pre Add Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Pre Add Computer Hook";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $input;
|
return $input;
|
||||||
@ -438,8 +435,7 @@ function plugin_item_add_example($parm){
|
|||||||
if (isset($parm["type"]))
|
if (isset($parm["type"]))
|
||||||
switch ($parm["type"]){
|
switch ($parm["type"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Add Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Add Computer Hook";
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -452,8 +448,7 @@ function plugin_pre_item_delete_example($input){
|
|||||||
switch ($input["_item_type_"]){
|
switch ($input["_item_type_"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Pre Delete Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Pre Delete Computer Hook";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $input;
|
return $input;
|
||||||
@ -464,8 +459,7 @@ function plugin_item_delete_example($parm){
|
|||||||
if (isset($parm["type"]))
|
if (isset($parm["type"]))
|
||||||
switch ($parm["type"]){
|
switch ($parm["type"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Delete Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Delete Computer Hook";
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -478,8 +472,7 @@ function plugin_pre_item_purge_example($input){
|
|||||||
switch ($input["_item_type_"]){
|
switch ($input["_item_type_"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Pre Purge Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Pre Purge Computer Hook";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $input;
|
return $input;
|
||||||
@ -490,8 +483,7 @@ function plugin_item_purge_example($parm){
|
|||||||
if (isset($parm["type"]))
|
if (isset($parm["type"]))
|
||||||
switch ($parm["type"]){
|
switch ($parm["type"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Purge Computer Hook",true);
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Purge Computer Hook";
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -504,8 +496,7 @@ function plugin_pre_item_restore_example($input){
|
|||||||
switch ($input["_item_type_"]){
|
switch ($input["_item_type_"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
// Manipulate data if needed
|
// Manipulate data if needed
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Pre Restore Computer Hook");
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Pre Restore Computer Hook";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $input;
|
return $input;
|
||||||
@ -516,8 +507,7 @@ function plugin_item_restore_example($parm){
|
|||||||
if (isset($parm["type"]))
|
if (isset($parm["type"]))
|
||||||
switch ($parm["type"]){
|
switch ($parm["type"]){
|
||||||
case COMPUTER_TYPE :
|
case COMPUTER_TYPE :
|
||||||
if (!empty($_SESSION["MESSAGE_AFTER_REDIRECT"])) $_SESSION["MESSAGE_AFTER_REDIRECT"].="<br>";
|
addMessageAfterRedirect("Restore Computer Hook");
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Restore Computer Hook";
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -527,7 +517,7 @@ function plugin_item_restore_example($parm){
|
|||||||
// Hook done on restore item case
|
// Hook done on restore item case
|
||||||
function plugin_item_transfer_example($parm){
|
function plugin_item_transfer_example($parm){
|
||||||
|
|
||||||
$_SESSION["MESSAGE_AFTER_REDIRECT"].="Transfer Computer Hook ".$parm['type']." ".$parm['ID']." -> ".$parm['newID'];
|
addMessageAfterRedirect("Transfer Computer Hook ".$parm['type']." ".$parm['ID']." -> ".$parm['newID']);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user