[example] maj 0.7

git-svn-id: https://forge.glpi-project.org/svn/example/trunk@8 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
tsmr 2006-12-08 11:23:52 +00:00
parent fda0ebe2d3
commit 4c0349872a
6 changed files with 26 additions and 79 deletions

View File

@ -1,53 +0,0 @@
<?php
/*
----------------------------------------------------------------------
GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2006 by the INDEPNET Development Team.
http://indepnet.net/ http://glpi-project.org
----------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
$Dir = str_replace('\\', '/', getcwd());
$Dir = explode('/', $Dir);
$NDir = count($Dir);
for($i=count($Dir); $i>0;$i--)
{
if(file_exists(implode('/', $Dir) . '/siteroot.php'))
{
$phproot = implode('/', $Dir);
$HTMLRel = str_repeat("../", $NDir - count($Dir));
$i = 0;
}
unset($Dir[$i]);
}
?>

View File

@ -36,12 +36,12 @@
//header("Location:../../central.php");
// Entry menu case
include ("_relpos.php");
include ($phproot."/glpi/includes.php");
define('GLPI_ROOT', '../..');
include (GLPI_ROOT . "/inc/includes.php");
checkauthentication("admin");
checkRight("config","w");
commonHeader("TITRE",$_SERVER["PHP_SELF"]);
commonHeader("TITRE",$_SERVER['PHP_SELF']);
echo "This is the plugin config page";

View File

@ -36,10 +36,10 @@
//header("Location:../../central.php");
// Entry menu case
include ("_relpos.php");
include ($phproot."/inc/includes.php");
define('GLPI_ROOT', '../..');
include (GLPI_ROOT . "/inc/includes.php");
commonHeader("TITRE",$_SERVER["PHP_SELF"]);
commonHeader("TITRE",$_SERVER['PHP_SELF']);
echo "This is the plugin index file";

View File

@ -33,5 +33,5 @@
// Purpose of file:
// ----------------------------------------------------------------------
$langexample["test"]="test english";
$LANGEXAMPLE["test"]="test english";
?>

View File

@ -34,5 +34,5 @@
// ----------------------------------------------------------------------
$langexample["test"]="test french";
$LANGEXAMPLE["test"]="test french";
?>

View File

@ -37,27 +37,27 @@
// Init the hooks of the plugins -Needed
function plugin_init_example() {
global $plugin_hooks;
global $PLUGIN_HOOKS;
// Display a menu entry ?
$plugin_hooks['menu_entry']['example'] = true;
$PLUGIN_HOOKS['menu_entry']['example'] = true;
// Setup/Update functions
$plugin_hooks['setup']['example'] = "plugin_setup_example";
$PLUGIN_HOOKS['setup']['example'] = "plugin_setup_example";
// Config function
$plugin_hooks['config']['example'] = 'plugin_config_example';
$PLUGIN_HOOKS['config']['example'] = 'plugin_config_example';
// Config page
$plugin_hooks['config_page']['example'] = 'config.php';
$PLUGIN_HOOKS['config_page']['example'] = 'config.php';
// Item action event // See config.php for defined ITEM_TYPE
$plugin_hooks['item_update']['example'] = 'plugin_item_update_example';
$plugin_hooks['item_add']['example'] = 'plugin_item_add_example';
$plugin_hooks['item_delete']['example'] = 'plugin_item_delete_example';
$plugin_hooks['item_purge']['example'] = 'plugin_item_purge_example';
$plugin_hooks['item_restore']['example'] = 'plugin_item_restore_example';
$PLUGIN_HOOKS['item_update']['example'] = 'plugin_item_update_example';
$PLUGIN_HOOKS['item_add']['example'] = 'plugin_item_add_example';
$PLUGIN_HOOKS['item_delete']['example'] = 'plugin_item_delete_example';
$PLUGIN_HOOKS['item_purge']['example'] = 'plugin_item_purge_example';
$PLUGIN_HOOKS['item_restore']['example'] = 'plugin_item_restore_example';
// Onglets management
$plugin_hooks['headings']['example'] = 'plugin_get_headings_example';
$plugin_hooks['headings_action']['example'] = 'plugin_headings_actions_example';
$PLUGIN_HOOKS['headings']['example'] = 'plugin_get_headings_example';
$PLUGIN_HOOKS['headings_action']['example'] = 'plugin_headings_actions_example';
// Display on central page
$plugin_hooks['central_action']['example'] = 'plugin_central_action_example';
$PLUGIN_HOOKS['central_action']['example'] = 'plugin_central_action_example';
}
@ -70,9 +70,9 @@ function plugin_version_example(){
// Get config of the plugin
function plugin_config_example(){
global $cfg_glpi_plugins;
global $CFG_GLPI_PLUGINS;
$cfg_glpi_plugins["example"]["test"]="test";
$CFG_GLPI_PLUGINS["example"]["test"]="test";
}
// Config form od the plugin
@ -209,10 +209,10 @@ function plugin_headings_example($type,$ID,$withtemplate=0){
// Hook to be launch on central
function plugin_central_action_example(){
global $langexample;
global $LANGEXAMPLE;
echo "<div align='center'>";
echo "Plugin central action ".$langexample["test"];
echo "Plugin central action ".$LANGEXAMPLE["test"];
echo "</div>";
}