Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Adding links to interfaces (plugin)

edited September 1 in Mods and Customizations
Hello. I want to create my own plugin without changing any kernel files. 
The plugin should add tabs to the navigation bar. 
Example of the plugin code in the file
I want to put reports.php in a folder with a plugin, not scp / - is it possible without changing kernel files?
How do I override the app.php link when I click on the 'apps' menu item?
How are things with API? Are there any qualitative changes to the API in the latest version of osTicket?
As far as I understand, now it's impossible to create your own plug-in 
without changing the kernel code.
Thank you.
(Sorry for the bad english).

Comments

  • P.S. I do not attach a file, I will put the code in the comments

    <!--plugin.php-->
    <?php

    return array(
        'id' =>             'nav', # notrans
        'version' =>        '1',
        'name' =>           /* trans */ 'Navigation plugin',
        'author' =>         '',
        'description' =>    /* trans */ 'Navigation',
        'url' =>            '',
        'plugin' =>         'config.php:NavigationPlugin'
    );

    ?>

    <!--config.php-->
    <?php
    class NavigationPlugin extends Plugin {

        function bootstrap() {
            $this->createStaffMenu ();
        }

        function createStaffMenu() {
            Application::registerStaffApp ( 'allReports', 'reports.php', array (
                iconclass => 'logs'
            ) );

        }

    }
    ?>
  • It is possible to make your own plugins right now, Grizly have been succesful in doing so: https://github.com/clonemeagain/

    I believe you would have to alter the menu item array in the bootstrap

    So you would probably need to override this function to change the StaffNav

  • I haven't added any menu items, was thinking about it though, I'll have a play with your code and see what I can do with it.
  • Thank you for such quick answers! Grizly, do you think it's possible to add menu items without changing the kernel code? How extensive is the osTicket API?
  • Actually, got it to work in a single file:

    /include/plugins/navtest/plugin.php

    <?php
    require_once INCLUDE_DIR . 'class.app.php';

    class NavigationPlugin extends Plugin
    {

        function bootstrap()
        {
            error_log("Bootstrappin the nav plugin.");
        }
    }
    Application::registerStaffApp('Reports App', '/reports/reports.php', array(
        iconclass => 'logs'
    ));

    return array(
        'id' => 'nav', // notrans
        'version' => '1',
        'name' =>           /* trans */ 'Navigation plugin',
        'author' => '',
        'description' =>    /* trans */ 'Navigation',
        'url' => '',
        'plugin' => ':NavigationPlugin'
    );
  • You get a new menu "Applications" with the item "Reports App" which is a link to /reports/reports.php
  • When clicking on the 'application' in the StafNav class, a link to app.php is defined. Is it possible to change this menu item in the plugin folder to not change the script code class.nav.php?
  • I don't know man, I've been trying for the last hour, and it's breaking my brain. Why is there no documentation for any of this? Basically, not without modifying core. The plugin application system is still pretty broken.
  • Grizly, thanks for the answer. I also came to the conclusion that nothing really works. And the lack of documentation just kills
Sign In or Register to comment.