mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
implement new hook timeline_actions
This commit is contained in:
parent
511aba6951
commit
2621e6ceb9
@ -117,4 +117,28 @@ class PluginExampleItemForm {
|
||||
|
||||
echo $out;
|
||||
}
|
||||
|
||||
static public function timelineActions($params = []) {
|
||||
$rand = $params['rand'];
|
||||
$ticket = $params['item'];
|
||||
|
||||
if (get_class($ticket) !== "Ticket") {
|
||||
return false;
|
||||
}
|
||||
|
||||
$edit_panel = "viewitem".$ticket->fields['id'].$rand;
|
||||
$JS = <<<JAVASCRIPT
|
||||
$(function() {
|
||||
$(document).on('click', '#email_transfer_{$rand}', function(event) {
|
||||
$('#{$edit_panel}').html('email send');
|
||||
});
|
||||
});
|
||||
JAVASCRIPT;
|
||||
|
||||
echo "<li class='followup' id='email_transfer_$rand'>
|
||||
<i class='far fa-envelope'></i>".
|
||||
__("Send a notification").
|
||||
Html::scriptBlock($JS)."
|
||||
</li>";
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +204,11 @@ function plugin_init_example() {
|
||||
$PLUGIN_HOOKS['pre_item_form']['example'] = ['PluginExampleItemForm', 'preItemForm'];
|
||||
$PLUGIN_HOOKS['post_item_form']['example'] = ['PluginExampleItemForm', 'postItemForm'];
|
||||
|
||||
// Add new actions to timeline
|
||||
$PLUGIN_HOOKS['timeline_actions']['example'] = [
|
||||
'PluginExampleItemForm', 'timelineActions'
|
||||
];
|
||||
|
||||
// declare this plugin as an import plugin for Computer itemtype
|
||||
$PLUGIN_HOOKS['import_item']['example'] = ['Computer' => ['Plugin']];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user