mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-06-28 06:58:43 +02:00
CS + call functions
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@172 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
@ -36,23 +36,24 @@
|
||||
// Class of the defined type
|
||||
class PluginExampleExample extends CommonDBTM {
|
||||
|
||||
// From CommonDBTM
|
||||
public $table = 'glpi_plugin_example_examples';
|
||||
public $type = 'PluginExampleExample';
|
||||
|
||||
// Should return the localized name of the type
|
||||
static function getTypeName() {
|
||||
return 'Example Type';
|
||||
}
|
||||
|
||||
|
||||
function canCreate() {
|
||||
|
||||
if (isset($_SESSION["glpi_plugin_example_profile"])) {
|
||||
return ($_SESSION["glpi_plugin_example_profile"]['example'] == 'w');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function canView() {
|
||||
|
||||
if (isset($_SESSION["glpi_plugin_example_profile"])) {
|
||||
return ($_SESSION["glpi_plugin_example_profile"]['example'] == 'w'
|
||||
|| $_SESSION["glpi_plugin_example_profile"]['example'] == 'r');
|
||||
@ -60,6 +61,7 @@ class PluginExampleExample extends CommonDBTM {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function getSearchOptions() {
|
||||
global $LANG;
|
||||
|
||||
@ -87,6 +89,7 @@ class PluginExampleExample extends CommonDBTM {
|
||||
return $tab;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Give localized information about 1 task
|
||||
*
|
||||
@ -105,6 +108,7 @@ class PluginExampleExample extends CommonDBTM {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute 1 task manage by the plugin
|
||||
*
|
||||
@ -123,16 +127,17 @@ class PluginExampleExample extends CommonDBTM {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// Hook done on before add item case
|
||||
static function pre_item_add_example($item) {
|
||||
addMessageAfterRedirect("Pre Add Computer Hook",true);
|
||||
Session::addMessageAfterRedirect("Pre Add Computer Hook", true);
|
||||
}
|
||||
|
||||
|
||||
// Hook done on add item case
|
||||
static function item_add_example($item) {
|
||||
|
||||
addMessageAfterRedirect("Add Computer Hook, ID=".$item->getField('id'),true);
|
||||
Session::addMessageAfterRedirect("Add Computer Hook, ID=".$item->getField('id'), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user