You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2021-04-06 12:38:58

arielmanra
Member
Registered: 2019-03-26
Posts: 39

Ajouter un plugin au menu déroulant "Outils"

J'apprends à développer des plugins GLPI en suivant ce tutoriel: https://www.neteye-blog.com/2016/12/how … pi-plugin/

Le tutoriel explique comment l'ajouter à l'onglet "Ordinateur", mais je souhaite l'ajouter au menu "Outils". Aucun de ces travaux ne fonctionne pour moi.

Comment ajouter le plugin au menu?

Voici le code que j'ai jusqu'à présent:

setup.php
<?php

define('XMLTEU_VERSION', '1.0.1');

function plugin_init_xmlteu() {
    global $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['csrf_compliant']['xmlteu'] = true;
    Plugin::registerClass('PluginXmlTeuXml', array('addtabon' => array('Computer')));
}

if (!defined("PLUGIN_XMLTEU_DIR")) {
    define("PLUGIN_XMLTEU_DIR", GLPI_ROOT . "/plugins/xmlteu");
}


function plugin_version_xmlteu() {
    return array(
        'name'           => "XML TEU",
        'version'        => '1.0.0',
        'author'         => 'Alejandro Cuesta && Andrés Rocher && Josep Garzó',
        'license'        => 'GPLv2+',
        'homepage'       => '',
        'minGlpiVersion' => '0.85'
    );
}

function plugin_xmlteu_check_config() {
    return true;
}

function plugin_xmlteu_check_prerequisites() {
    return true;
}


hook.php
<?php

function plugin_xmlteu_install() { return true; }

function plugin_xmlteu_uninstall() { return true; }


xmlteu.class.php
<?php

class PluginXmlTeuXml extends CommonGLPI
{
    function getTabNameForItem(CommonGLPI $item, $withtemplate=0)
    {
        return self::createTabEntry('XML TEU');
    }

    static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0)
    {
        ?>
        <h1>aaa</h1>
        <?php
        return true;
    }
}

Offline

Board footer

Powered by FluxBB