mirror of
https://github.com/pluginsGLPI/example.git
synced 2025-05-04 18:08:42 +02:00
some work to work with 0.80 (cleandb)
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@91 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
parent
760c7de79b
commit
c3b74fddcc
131
hook.php
131
hook.php
@ -41,35 +41,35 @@ class pluginExample extends CommonDBTM {
|
||||
}
|
||||
};
|
||||
|
||||
// Hook called on profile change
|
||||
// Hook called on profile change
|
||||
// Good place to evaluate the user right on this plugin
|
||||
// And to save it in the session
|
||||
function plugin_change_profile_example() {
|
||||
|
||||
// For example : same right of computer
|
||||
if (haveRight('computer','w')) {
|
||||
$_SESSION["glpi_plugin_example_profile"]=array('example'=>'w');
|
||||
$_SESSION["glpi_plugin_example_profile"]=array('example'=>'w');
|
||||
|
||||
} else if (haveRight('computer','r')) {
|
||||
$_SESSION["glpi_plugin_example_profile"]=array('example'=>'r');
|
||||
$_SESSION["glpi_plugin_example_profile"]=array('example'=>'r');
|
||||
|
||||
} else {
|
||||
unset($_SESSION["glpi_plugin_example_profile"]);
|
||||
unset($_SESSION["glpi_plugin_example_profile"]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Define dropdown relations
|
||||
function plugin_example_getDatabaseRelations(){
|
||||
//
|
||||
return array("glpi_dropdown_plugin_example"=>array("glpi_plugin_example"=>"FK_dropdown"));
|
||||
//
|
||||
return array("glpi_plugin_example_dropdown"=>array("glpi_plugin_example"=>"plugin_example_dropdown_id"));
|
||||
}
|
||||
|
||||
|
||||
// Define Dropdown tables to be manage in GLPI :
|
||||
function plugin_example_getDropdown(){
|
||||
// Table => Name
|
||||
return array("glpi_dropdown_plugin_example"=>"Plugin Example Dropdown");
|
||||
return array("glpi_plugin_example_dropdown"=>"Plugin Example Dropdown");
|
||||
}
|
||||
|
||||
////// SEARCH FUNCTIONS ///////(){
|
||||
@ -87,9 +87,9 @@ function plugin_example_getSearchOption(){
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][1]['linkfield']='name';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][1]['name']=$LANG['plugin_example']["name"];
|
||||
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][2]['table']='glpi_dropdown_plugin_example';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][2]['table']='glpi_plugin_example_dropdown';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][2]['field']='name';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][2]['linkfield']='FK_dropdown';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][2]['linkfield']='plugin_example_dropdown_id';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][2]['name']='Dropdown';
|
||||
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][3]['table']='glpi_plugin_example';
|
||||
@ -97,12 +97,12 @@ function plugin_example_getSearchOption(){
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][3]['linkfield']='serial';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][3]['name']='Serial';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][3]['usehaving']=true;
|
||||
|
||||
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][30]['table']='glpi_plugin_example';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][30]['field']='ID';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][30]['field']='id';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][30]['linkfield']='';
|
||||
$sopt[PLUGIN_EXAMPLE_TYPE][30]['name']=$LANG["common"][2];
|
||||
|
||||
|
||||
return $sopt;
|
||||
}
|
||||
|
||||
@ -114,9 +114,9 @@ function plugin_example_giveItem($type,$ID,$data,$num){
|
||||
|
||||
switch ($table.'.'.$field){
|
||||
case "glpi_plugin_example.name" :
|
||||
$out= "<a href=\"".$CFG_GLPI["root_doc"]."/".$INFOFORM_PAGES[$type]."?ID=".$data['ID']."\">";
|
||||
$out= "<a href=\"".$CFG_GLPI["root_doc"]."/".$INFOFORM_PAGES[$type]."?ID=".$data['id']."\">";
|
||||
$out.= $data["ITEM_$num"];
|
||||
if ($CFG_GLPI["view_ID"]||empty($data["ITEM_$num"])) $out.= " (".$data["ID"].")";
|
||||
if ($_SESSION["glpiis_ids_visible"]||empty($data["ITEM_$num"])) $out.= " (".$data["id"].")";
|
||||
$out.= "</a>";
|
||||
return $out;
|
||||
break;
|
||||
@ -129,8 +129,8 @@ 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) ";
|
||||
case "glpi_plugin_example_dropdown" :
|
||||
return " LEFT JOIN $new_table ON ($ref_table.$linkfield = $new_table.id) ";
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
@ -153,14 +153,14 @@ function plugin_example_addWhere($link,$nott,$type,$ID,$val){
|
||||
|
||||
$table=$SEARCH_OPTION[$type][$ID]["table"];
|
||||
$field=$SEARCH_OPTION[$type][$ID]["field"];
|
||||
|
||||
|
||||
$SEARCH=makeTextSearch($val,$nott);
|
||||
|
||||
// Example of standard Where clause but use it ONLY for specific Where
|
||||
// No need of the function if you do not have specific cases
|
||||
// switch ($table.".".$field){
|
||||
// case "glpi_plugin_example.name" :
|
||||
// $ADD="";
|
||||
// $ADD="";
|
||||
// if ($nott&&$val!="NULL") {
|
||||
// $ADD=" OR $table.$field IS NULL";
|
||||
// }
|
||||
@ -176,18 +176,18 @@ function plugin_example_addHaving($link,$nott,$type,$ID,$val,$num){
|
||||
|
||||
$table=$SEARCH_OPTION[$type][$ID]["table"];
|
||||
$field=$SEARCH_OPTION[$type][$ID]["field"];
|
||||
|
||||
|
||||
$SEARCH=makeTextSearch($val,$nott);
|
||||
|
||||
// Example of standard Having clause but use it ONLY for specific Having
|
||||
// No need of the function if you do not have specific cases
|
||||
switch ($table.".".$field){
|
||||
case "glpi_plugin_example.serial" :
|
||||
$ADD="";
|
||||
$ADD="";
|
||||
if (($nott&&$val!="NULL")||$val=='^$') {
|
||||
$ADD=" OR ITEM_$num IS NULL";
|
||||
}
|
||||
|
||||
|
||||
return " $LINK ( ITEM_".$num.$SEARCH." $ADD ) ";
|
||||
break;
|
||||
}
|
||||
@ -230,7 +230,7 @@ function plugin_example_addOrderBy($type,$ID,$order,$key=0){
|
||||
//////////////////////////////
|
||||
////// SPECIFIC MODIF MASSIVE FUNCTIONS ///////
|
||||
|
||||
// Define actions :
|
||||
// Define actions :
|
||||
function plugin_example_MassiveActions($type){
|
||||
global $LANG;
|
||||
switch ($type){
|
||||
@ -331,7 +331,7 @@ function plugin_example_MassiveActionsFieldsDisplay($type,$table,$field,$linkfie
|
||||
} else {
|
||||
// Linked Fields
|
||||
switch ($table.".".$field){
|
||||
case "glpi_dropdown_plugin_example.name" :
|
||||
case "glpi_plugin_example_dropdown.name" :
|
||||
echo "Not really specific - Just for example ";
|
||||
dropdown($table,$linkfield,1,$_SESSION["glpiactive_entity"]);
|
||||
//dropdownUsers($linkfield,0,"own_ticket",0,1,$_SESSION["glpiactive_entity"]);
|
||||
@ -351,7 +351,7 @@ function plugin_pre_item_update_example($input){
|
||||
if (isset($input["_item_type_"]))
|
||||
switch ($input["_item_type_"]){
|
||||
case COMPUTER_TYPE :
|
||||
// Manipulate data if needed
|
||||
// Manipulate data if needed
|
||||
addMessageAfterRedirect("Pre Update Computer Hook",true);
|
||||
break;
|
||||
}
|
||||
@ -377,7 +377,7 @@ function plugin_pre_item_add_example($input){
|
||||
if (isset($input["_item_type_"]))
|
||||
switch ($input["_item_type_"]){
|
||||
case COMPUTER_TYPE :
|
||||
// Manipulate data if needed
|
||||
// Manipulate data if needed
|
||||
addMessageAfterRedirect("Pre Add Computer Hook",true);
|
||||
break;
|
||||
}
|
||||
@ -402,7 +402,7 @@ function plugin_pre_item_delete_example($input){
|
||||
if (isset($input["_item_type_"]))
|
||||
switch ($input["_item_type_"]){
|
||||
case COMPUTER_TYPE :
|
||||
// Manipulate data if needed
|
||||
// Manipulate data if needed
|
||||
addMessageAfterRedirect("Pre Delete Computer Hook",true);
|
||||
break;
|
||||
}
|
||||
@ -426,7 +426,7 @@ function plugin_pre_item_purge_example($input){
|
||||
if (isset($input["_item_type_"]))
|
||||
switch ($input["_item_type_"]){
|
||||
case COMPUTER_TYPE :
|
||||
// Manipulate data if needed
|
||||
// Manipulate data if needed
|
||||
addMessageAfterRedirect("Pre Purge Computer Hook",true);
|
||||
break;
|
||||
}
|
||||
@ -450,7 +450,7 @@ function plugin_pre_item_restore_example($input){
|
||||
if (isset($input["_item_type_"]))
|
||||
switch ($input["_item_type_"]){
|
||||
case COMPUTER_TYPE :
|
||||
// Manipulate data if needed
|
||||
// Manipulate data if needed
|
||||
addMessageAfterRedirect("Pre Restore Computer Hook");
|
||||
break;
|
||||
}
|
||||
@ -471,14 +471,14 @@ function plugin_item_restore_example($parm){
|
||||
|
||||
// Hook done on restore item case
|
||||
function plugin_item_transfer_example($parm){
|
||||
|
||||
addMessageAfterRedirect("Transfer Computer Hook ".$parm['type']." ".$parm['ID']." -> ".$parm['newID']);
|
||||
|
||||
|
||||
addMessageAfterRedirect("Transfer Computer Hook ".$parm['type']." ".$parm['id']." -> ".$parm['newID']);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parm contains begin, end and who
|
||||
// Create data to be displayed in the planning of $parm["who"] or $parm["who_group"] between $parm["begin"] and $parm["end"]
|
||||
// Create data to be displayed in the planning of $parm["who"] or $parm["who_group"] between $parm["begin"] and $parm["end"]
|
||||
|
||||
function plugin_planning_populate_example($parm){
|
||||
|
||||
@ -486,7 +486,7 @@ function plugin_planning_populate_example($parm){
|
||||
// Items need to have an unique index beginning by the begin date of the item to display
|
||||
// needed to be correcly displayed
|
||||
|
||||
|
||||
|
||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["plugin"]="example";
|
||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["begin"]=date("Y-m-d 17:00:00");
|
||||
$parm["items"][$parm["begin"]."$$$"."plugin_example1"]["end"]=date("Y-m-d 18:00:00");
|
||||
@ -527,7 +527,7 @@ function plugin_get_headings_example($type,$ID,$withtemplate){
|
||||
if ($ID>0 && $prof->getFromDB($ID) && $prof->fields['interface']=='central') {
|
||||
return array(
|
||||
1 => "Test PLugin",
|
||||
);
|
||||
);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
@ -537,7 +537,7 @@ function plugin_get_headings_example($type,$ID,$withtemplate){
|
||||
if ($withtemplate) {
|
||||
return array();
|
||||
// Non template case / editing an existing object
|
||||
} else {
|
||||
} else {
|
||||
return array(
|
||||
1 => "Test PLugin",
|
||||
);
|
||||
@ -549,7 +549,7 @@ function plugin_get_headings_example($type,$ID,$withtemplate){
|
||||
return array(
|
||||
1 => "Test PLugin",
|
||||
2 => "Test PLugin 2",
|
||||
);
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "central":
|
||||
@ -572,7 +572,7 @@ function plugin_get_headings_example($type,$ID,$withtemplate){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Define headings actions added by the plugin
|
||||
// Define headings actions added by the plugin
|
||||
function plugin_headings_actions_example($type){
|
||||
|
||||
switch ($type){
|
||||
@ -622,21 +622,21 @@ function plugin_headings_example($type,$ID,$withtemplate=0){
|
||||
break;
|
||||
case "prefs":
|
||||
// Complete form display
|
||||
|
||||
|
||||
$data=plugin_version_example();
|
||||
|
||||
|
||||
echo "<form action='Where to post form'>";
|
||||
echo "<table class='tab_cadre_fixe'>";
|
||||
echo "<tr><th colspan='3'>".$data['name'];
|
||||
echo " - ".$data['version'];
|
||||
echo "</th></tr>";
|
||||
|
||||
|
||||
echo "<tr class='tab_bg_1'><td>Name of the pref";
|
||||
echo "</td><td>Input to set the pref</td>";
|
||||
|
||||
|
||||
echo "<td><input class='submit' type='submit' name='submit' value='submit'></td>";
|
||||
echo "</tr>";
|
||||
|
||||
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
break;
|
||||
@ -655,7 +655,7 @@ function plugin_headings_example($type,$ID,$withtemplate=0){
|
||||
// Cron function : name= cron_plugin_PLUGINNAME
|
||||
function cron_plugin_example(){
|
||||
logInFile('example',"cron called\n");
|
||||
|
||||
|
||||
// >0 : done
|
||||
// <0 : to be run again (not finished)
|
||||
// 0 : nothing to do
|
||||
@ -666,7 +666,7 @@ function cron_plugin_example(){
|
||||
// Do special actions for dynamic report
|
||||
function plugin_example_dynamicReport($parm){
|
||||
if ($parm["item_type"]==PLUGIN_EXAMPLE_TYPE){
|
||||
// Do all what you want for export depending on $parm
|
||||
// Do all what you want for export depending on $parm
|
||||
echo "Personalized export for type ".$parm["display_type"];
|
||||
echo 'with additional datas : <br>';
|
||||
echo "Single data : add1 <br>";
|
||||
@ -696,41 +696,43 @@ function plugin_example_addParamFordynamicReport($device_type){
|
||||
// Install process for plugin : need to return true if succeeded
|
||||
function plugin_example_install(){
|
||||
global $DB;
|
||||
|
||||
|
||||
if (!TableExists("glpi_plugin_example")){
|
||||
$query="CREATE TABLE `glpi_plugin_example` (
|
||||
`ID` int(11) NOT NULL auto_increment,
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(255) collate utf8_unicode_ci default NULL,
|
||||
`serial` varchar(255) collate utf8_unicode_ci NOT NULL,
|
||||
`FK_dropdown` int(11) NOT NULL default '0',
|
||||
`deleted` smallint(6) NOT NULL default '0',
|
||||
`plugin_example_dropdown_id` int(11) NOT NULL default '0',
|
||||
`is_deleted` smallint(6) NOT NULL default '0',
|
||||
`is_template` smallint(6) NOT NULL default '0',
|
||||
`tplname` varchar(255) collate utf8_unicode_ci default NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
`template_name` varchar(255) collate utf8_unicode_ci default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
";
|
||||
$DB->query($query) or die("error creating glpi_plugin_example ". $DB->error());
|
||||
$query="INSERT INTO `glpi_plugin_example` (`ID`, `name`, `serial`, `FK_dropdown`, `deleted`, `is_template`, `tplname`) VALUES
|
||||
$query="INSERT INTO `glpi_plugin_example` (`id`, `name`, `serial`, `plugin_example_dropdown_id`,
|
||||
`is_deleted`, `is_template`, `template_name`) VALUES
|
||||
(1, 'example 1', 'serial 1', 1, 0, 0, NULL),
|
||||
(2, 'example 2', 'serial 2', 2, 0, 0, NULL),
|
||||
(3, 'example 3', 'serial 3', 1, 0, 0, NULL);";
|
||||
$DB->query($query) or die("error populate glpi_plugin_example ". $DB->error());
|
||||
|
||||
}
|
||||
if (!TableExists("glpi_dropdown_plugin_example")){
|
||||
if (!TableExists("glpi_plugin_example_dropdown")){
|
||||
|
||||
$query="CREATE TABLE `glpi_dropdown_plugin_example` (
|
||||
`ID` int(11) NOT NULL auto_increment,
|
||||
$query="CREATE TABLE `glpi_plugin_example_dropdown` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(255) collate utf8_unicode_ci default NULL,
|
||||
`comments` text collate utf8_unicode_ci,
|
||||
PRIMARY KEY (`ID`),
|
||||
`comment` text collate utf8_unicode_ci,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `name` (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
||||
|
||||
$DB->query($query) or die("error creating glpi_dropdown_plugin_example". $DB->error());
|
||||
$query="INSERT INTO `glpi_dropdown_plugin_example` (`ID`, `name`, `comments`) VALUES
|
||||
$DB->query($query) or die("error creating glpi_plugin_example_dropdown". $DB->error());
|
||||
$query="INSERT INTO `glpi_plugin_example_dropdown` (`id`, `name`, `comment`) VALUES
|
||||
(1, 'dp 1', 'comment 1'),
|
||||
(2, 'dp2', 'comment 2');";
|
||||
$DB->query($query) or die("error populate glpi_dropdown_plugin_example". $DB->error());
|
||||
$DB->query($query) or die("error populate glpi_plugin_example_dropdown". $DB->error());
|
||||
|
||||
}
|
||||
return true;
|
||||
@ -742,13 +744,18 @@ function plugin_example_uninstall(){
|
||||
|
||||
if (TableExists("glpi_plugin_example")){
|
||||
$query="DROP TABLE `glpi_plugin_example`;";
|
||||
$DB->query($query) or die("error creating glpi_plugin_example");
|
||||
$DB->query($query) or die("error deleting glpi_plugin_example");
|
||||
}
|
||||
if (TableExists("glpi_dropdown_plugin_example")){
|
||||
|
||||
$query="DROP TABLE `glpi_dropdown_plugin_example`;";
|
||||
$DB->query($query) or die("error creating glpi_dropdown_plugin_example");
|
||||
$DB->query($query) or die("error deleting glpi_dropdown_plugin_example");
|
||||
}
|
||||
if (TableExists("glpi_plugin_example_dropdown")){
|
||||
|
||||
$query="DROP TABLE `glpi_plugin_example_dropdown`;";
|
||||
$DB->query($query) or die("error deleting glpi_plugin_example_dropdown");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
36
setup.php
36
setup.php
@ -59,8 +59,8 @@ function plugin_init_example() {
|
||||
$PLUGIN_HOOKS['submenu_entry']['example']["<img src='".$CFG_GLPI["root_doc"]."/pics/menu_showall.png' title='".$LANG['plugin_example']["test"]."' alt='".$LANG['plugin_example']["test"]."'>"] = 'index.php';
|
||||
$PLUGIN_HOOKS['submenu_entry']['example'][$LANG['plugin_example']["test"]] = 'index.php';
|
||||
$PLUGIN_HOOKS['submenu_entry']['example']['config'] = 'index.php';
|
||||
|
||||
$PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true;
|
||||
|
||||
$PLUGIN_HOOKS["helpdesk_menu_entry"]['example'] = true;
|
||||
}
|
||||
|
||||
// Config page
|
||||
@ -74,7 +74,7 @@ function plugin_init_example() {
|
||||
$PLUGIN_HOOKS['change_profile']['example'] = 'plugin_change_profile_example';
|
||||
// Change entity
|
||||
//$PLUGIN_HOOKS['change_entity']['example'] = 'plugin_change_entity_example';
|
||||
|
||||
|
||||
|
||||
// Onglets management
|
||||
$PLUGIN_HOOKS['headings']['example'] = 'plugin_get_headings_example';
|
||||
@ -83,19 +83,19 @@ function plugin_init_example() {
|
||||
// Item action event // See define.php for defined ITEM_TYPE
|
||||
$PLUGIN_HOOKS['pre_item_update']['example'] = 'plugin_pre_item_update_example';
|
||||
$PLUGIN_HOOKS['item_update']['example'] = 'plugin_item_update_example';
|
||||
|
||||
|
||||
$PLUGIN_HOOKS['pre_item_add']['example'] = 'plugin_pre_item_add_example';
|
||||
$PLUGIN_HOOKS['item_add']['example'] = 'plugin_item_add_example';
|
||||
|
||||
|
||||
$PLUGIN_HOOKS['pre_item_delete']['example'] = 'plugin_pre_item_delete_example';
|
||||
$PLUGIN_HOOKS['item_delete']['example'] = 'plugin_item_delete_example';
|
||||
|
||||
|
||||
$PLUGIN_HOOKS['pre_item_purge']['example'] = 'plugin_pre_item_purge_example';
|
||||
$PLUGIN_HOOKS['item_purge']['example'] = 'plugin_item_purge_example';
|
||||
|
||||
|
||||
$PLUGIN_HOOKS['pre_item_restore']['example'] = 'plugin_pre_item_restore_example';
|
||||
$PLUGIN_HOOKS['item_restore']['example'] = 'plugin_item_restore_example';
|
||||
|
||||
|
||||
$PLUGIN_HOOKS['item_transfer']['example'] = 'plugin_item_transfer_example';
|
||||
|
||||
// Cron action
|
||||
@ -114,41 +114,41 @@ function plugin_init_example() {
|
||||
$PLUGIN_HOOKS['use_massive_action']['example']=1;
|
||||
|
||||
$PLUGIN_HOOKS['assign_to_ticket']['example']=1;
|
||||
|
||||
|
||||
// Add specific files to add to the header : javascript or css
|
||||
$PLUGIN_HOOKS['add_javascript']['example']="example.js";
|
||||
$PLUGIN_HOOKS['add_css']['example']="example.css";
|
||||
|
||||
// Retrieve others datas from LDAP
|
||||
//$PLUGIN_HOOKS['retrieve_more_data_from_ldap']['example']="plugin_retrieve_more_data_from_ldap_example";
|
||||
|
||||
|
||||
// Reports
|
||||
$PLUGIN_HOOKS['reports']['example'] = array('report.php'=>'New Report', 'report.php?other'=>'New Report 2',);
|
||||
|
||||
|
||||
// Stats
|
||||
$PLUGIN_HOOKS['stats']['example'] = array('stat.php'=>'New stat', 'stat.php?other'=>'New stats 2',);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get the name and the version of the plugin - Needed
|
||||
function plugin_version_example(){
|
||||
return array(
|
||||
return array(
|
||||
'name' => 'Plugin Example',
|
||||
'version' => '0.1.0',
|
||||
'version' => '0.2.0',
|
||||
'author' => 'Julien Dombre',
|
||||
'homepage'=> 'http://glpi-project.org',
|
||||
'minGlpiVersion' => '0.72',// For compatibility / no install in version < 0.72
|
||||
'minGlpiVersion' => '0.80',// For compatibility / no install in version < 0.72
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Optional : check prerequisites before install : may print errors or add to message after redirect
|
||||
function plugin_example_check_prerequisites(){
|
||||
if (GLPI_VERSION>=0.72){
|
||||
if (GLPI_VERSION>=0.80){
|
||||
return true;
|
||||
} else {
|
||||
echo "GLPI version not compatible need 0.72";
|
||||
echo "GLPI version not compatible need 0.80";
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ function plugin_example_check_config($verbose=false){
|
||||
|
||||
// Define rights for the plugin types
|
||||
function plugin_example_haveTypeRight($type,$right){
|
||||
|
||||
|
||||
if (!isset($_SESSION["glpi_plugin_example_profile"])) {
|
||||
// No right
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user