1<?php
2/* Icinga Web 2 | (c) 2013 Icinga Development Team | GPLv2+ */
3
4namespace Icinga\Module\Monitoring\DataView;
5
6/**
7 * Host and service comments view
8 */
9class Comment extends DataView
10{
11    /**
12     * {@inheritdoc}
13     */
14    public function getColumns()
15    {
16        return array(
17            'comment_author_name',
18            'comment_data',
19            'comment_expiration',
20            'comment_internal_id',
21            'comment_is_persistent',
22            'comment_name',
23            'comment_timestamp',
24            'comment_type',
25            'host_display_name',
26            'host_name',
27            'object_type',
28            'service_description',
29            'service_display_name',
30            'service_host_name'
31        );
32    }
33
34    /**
35     * {@inheritdoc}
36     */
37    public function getStaticFilterColumns()
38    {
39        return array(
40            'comment_author',
41            'host', 'host_alias',
42            'hostgroup', 'hostgroup_alias', 'hostgroup_name',
43            'instance_name',
44            'service',
45            'servicegroup', 'servicegroup_alias', 'servicegroup_name'
46        );
47    }
48
49    /**
50     * {@inheritdoc}
51     */
52    public function getSearchColumns()
53    {
54        return array('host_display_name', 'service_display_name');
55    }
56
57    /**
58     * {@inheritdoc}
59     */
60    public function getSortRules()
61    {
62        return array(
63            'comment_timestamp' => array(
64                'order' => self::SORT_DESC
65            ),
66            'host_display_name' => array(
67                'columns' => array(
68                    'host_display_name',
69                    'service_display_name'
70                ),
71                'order' => self::SORT_ASC
72            ),
73            'service_display_name' => array(
74                'columns' => array(
75                    'service_display_name',
76                    'host_display_name'
77                ),
78                'order' => self::SORT_ASC
79            )
80        );
81    }
82}
83