Source
xxxxxxxxxx
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* The base class of all dashboard widgets. Depending on widget needs, it can be instantiated directly or be extended.
*/
class CWidget extends CWidgetBase {
/**
* Check if widgets of this type implement communication with other widgets. The reference field represents the
* unique ID of the widget. Its name is "reference". The value is generated and regenerated automatically when
* copying widgets or dashboard pages.
*
* @returns {boolean}
*/
static hasReferenceField() {
return false;
}
/**
* Get field names by which widgets of this type refer and store connections to other widgets. These fields have a
* role of foreign keys, referring to the corresponding "reference" fields of target widgets. The widget is
* responsible for setting field values. The values are regenerated automatically when copying widgets or dashboard
* pages.
*
* @returns {string[]}
*/
static getForeignReferenceFields() {
return [];
}
/**
* Define initial state of the widget.
*
* Invoked on widget instantiation. No HTML or data manipulation must be done at this step.
*
* Possible widget state: WIDGET_STATE_INITIAL.
*/
onInitialize() {
}
/**
* Prepare widget for the first activation.
*
* An HTML structure can be created, but no data manipulation must be done at this step.
*