'output' => ['itemid', 'hostid', $resolve_macros ? 'name_resolved' : 'name', 'history', 'trends', 'units',
<?php declare(strict_types = 0);
namespace Widgets\PieChart\Actions;
CControllerDashboardWidgetView,
use Widgets\PieChart\Includes\{
class WidgetView extends CControllerDashboardWidgetView {
private const LEGEND_AGGREGATION_ON = 1;
private const LEGEND_VALUE_ON = 1;
private const MERGE_SECTORS_ON = 1;
private const SHOW_TOTAL_ON = 1;
private const SHOW_UNITS_ON = 1;
private const VALUE_BOLD_ON = 1;
protected function init(): void {
$this->addValidationRules([
'has_custom_time_period' => 'in 1',
protected function doAction(): void {
'data_sets' => array_values($this->fields_values['ds']),
'data_source' => $this->fields_values['source'],
'time_from' => $this->fields_values['time_period']['from_ts'],
'time_to' => $this->fields_values['time_period']['to_ts']
'templateid' => $this->getInput('templateid', ''),
'override_hostid' => $this->fields_values['override_hostid']
? $this->fields_values['override_hostid'][0]
'merge' => $this->fields_values['merge'],
'percent' => $this->fields_values['merge'] == self::MERGE_SECTORS_ON
? $this->fields_values['merge_percent']
'color' => $this->fields_values['merge'] == self::MERGE_SECTORS_ON
? '#'.$this->fields_values['merge_color']
'total_show' => $this->fields_values['total_show'],
'decimal_places' => $this->fields_values['total_show'] == self::SHOW_TOTAL_ON
? $this->fields_values['decimal_places']
'units_show' => $this->fields_values['units_show'],
'units_value' => $this->fields_values['units_show'] == self::SHOW_UNITS_ON
? $this->fields_values['units']
'legend_aggregation_show' => $this->fields_values['legend_aggregation'] == self::LEGEND_AGGREGATION_ON
'name' => $this->getInput('name', $this->widget->getDefaultName()),
'info' => $this->makeWidgetInfo(),
'debug_mode' => $this->getDebugMode()