summaryrefslogtreecommitdiffstats
path: root/modules/monitoring/library/Monitoring/Hook/ObjectDetailsTabHook.php
blob: 15fa9bb6009d97ec2286f2b87629fc6b10372e39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/* Icinga Web 2 | (c) 2016 Icinga Development Team | GPLv2+ */

namespace Icinga\Module\Monitoring\Hook;

use Icinga\Authentication\Auth;
use Icinga\Module\Monitoring\Object\MonitoredObject;
use Icinga\Web\Request;

/**
 * Base class for object host details custom tab hooks
 */
abstract class ObjectDetailsTabHook
{
    /**
     * Return the tab name - it must be unique
     *
     * @return  string
     */
    abstract public function getName();

    /**
     * Return the tab label
     *
     * @return  string
     */
    abstract public function getLabel();

    /**
     * Return the tab header
     *
     * @param MonitoredObject $monitoredObject The monitored object related to that page
     * @param Request $request
     * @return  string/bool The HTML string that compose the tab header,
     *          bool True if the default header should be shown, False to display nothing
     */
    public function getHeader(MonitoredObject $monitoredObject, Request $request)
    {
        return true;
    }

    /**
     * Return the tab content
     *
     * @param MonitoredObject $monitoredObject The monitored object related to that page
     * @param Request $request
     * @return  string The HTML string that compose the tab content
     */
    abstract public function getContent(MonitoredObject $monitoredObject, Request $request);

    /**
     * This method returns true if the tab is visible for the logged user, otherwise false
     *
     * @return  bool True if the tab is visible for the logged user, otherwise false
     */
    public function shouldBeShown(MonitoredObject $monitoredObject, Auth $auth)
    {
        return true;
    }
}