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:41:58

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

Añadir plugin al menú desplegable "Herramientas"

Estoy aprendiendo a desarrollar plugins de GLPI siguiendo este tutorial: https://www.neteye-blog.com/2016/12/how … pi-plugin/

El tutorial explica cómo añadirlo a la pestaña "Ordenador", pero yo quiero añadirlo al menú "Herramientas". No me funciona ninguna de las dos cosas.

Cómo hago para añadir el plugin al menú?

Este es el código que tengo hasta el momento:

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