width = $width; // Height. $this->height = $height; // Grid Width. $this->gridWidth = $gridWidth; // Options. $this->values = $this->decoders($this->getOptionsWidget()); // Positions. $this->position = $this->getPositionWidget(); // Page. $this->page = basename(__FILE__); // ClassName. $class = new \ReflectionClass($this); $this->className = $class->getShortName(); // Title. $this->title = __('Clock'); // Name. if (empty($this->name) === true) { $this->name = 'clock'; } // This forces at least a first configuration. $this->configurationRequired = false; if (empty($this->values['clockType']) === true) { $this->configurationRequired = true; } $this->overflow_scrollbars = false; } /** * Decoders hack for retrocompability. * * @param array $decoder Values. * * @return array Returns the values with the correct key. */ public function decoders(array $decoder): array { $values = []; // Retrieve global - common inputs. $values = parent::decoders($decoder); if (isset($decoder['clock_type']) === true) { $values['clockType'] = $decoder['clock_type']; } if (isset($decoder['clockType']) === true) { $values['clockType'] = $decoder['clockType']; } return $values; } /** * Generates inputs for form (specific). * * @return array Of inputs. * * @throws Exception On error. */ public function getFormInputs(): array { $values = $this->values; // Retrieve global - common inputs. $inputs = parent::getFormInputs(); // Type clock. $fields = [ 'analogic' => __('Analogic'), 'digital' => __('Digital'), ]; $inputs[] = [ 'label' => __('Type'), 'arguments' => [ 'type' => 'select', 'fields' => $fields, 'name' => 'clockType', 'selected' => $values['clockType'], 'return' => true, ], ]; return $inputs; } /** * Get Post for widget. * * @return array */ public function getPost():array { // Retrieve global - common inputs. $values = parent::getPost(); $values['clockType'] = \get_parameter('clockType', 0); return $values; } /** * Draw widget. * * @return string; */ public function load() { global $config; $size = parent::getSize(); include_once $config['homedir'].'/include/graphs/functions_d3.php'; $id = \uniqid(); $output = '