Jump to content

Developer Documentation

core/Dashboard

What it is

A Dashboard extension allows you to add a widget to the AdminCP dashboard, which the administrator can optionally enable or hide, and reposition on their AdminCP dashboard to the location they want the widget to display.

How to use

The class defines two methods that you must implement.

    /**
    * Can the current user view this dashboard item?
    *
    * @return    bool
    */
    public function canView()
    {
        return TRUE;
    }

The canView() method is called to determine if the currently logged in administrator has permission to view the widget. It is important to remember that administrator restrictions may mean that the admin cannot access your application or a specific area of your application, and you should check appropriate permissions here to ensure that data is not displayed to the administrator which they should not be able to see.

    /**
     * Return the block to show on the dashboard
     *
     * @return    string
     */
    public function getBlock()
    {
        return \IPS\Theme::i()->getTemplate( 'xxxxx' )->template();
    }

The getBlock() method returns the HTML to display. This should typically be an HTML template with the data that you pass to it. There is no standard HTML template to utilize as each dashboard block will have different needs and different output.


  Report Document


×
×
  • Create New...