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 = __('Welcome message to %s', get_product_name()); // Name. if (empty($this->name) === true) { $this->name = 'example'; } $this->configurationRequired = false; $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); 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(); return $inputs; } /** * Get Post for widget. * * @return array */ public function getPost():array { // Retrieve global - common inputs. $values = parent::getPost(); $values['agentId'] = \get_parameter('agentId', 0); return $values; } /** * Draw widget. * * @return string; */ public function load() { $output = ''; $size = parent::getSize(); if (isset($this->values['message']) === true) { $output .= \io_safe_output( str_replace(' ', '
', $this->values['message']) ); return $output; } $style = 'height:'.$size['height'].'px; width:'.$size['width'].'px;'; $style .= 'text-align: left;'; $output .= '
'; $output .= '

'; $output .= __('Welcome to %s', \get_product_name()); $output .= '

'; $output .= '
'; $output .= '
'; $output .= __('This is an example of a dashboard widget. A widget may contain elements'); $output .= __('To add more elements, click on "Add widgets" on the top of this page.'); $output .= __('To delete this message, click on the delete button on top right corner of this element.'); $output .= __('To do so, just click on the title and drag and drop it to the desired place.'); $output .= __('To delete this message, click on the delete button on top right corner of this element.'); $output .= __('Thanks for using %s.', \get_product_name()); $output .= '
'; $output .= "
"; $output .= \html_print_image( \ui_get_logo_to_center_networkmap(), true, ['style' => 'margin-top:-27px;width:75%;'] ); $output .= '
'; $output .= '
'; $output .= '
'; return $output; } /** * Get description. * * @return string. */ public static function getDescription() { return __('Welcome message to %s', get_product_name()); } /** * Get Name. * * @return string. */ public static function getName() { return 'example'; } /** * Get size Modal Configuration. * * @return array */ public function getSizeModalConfiguration(): array { $size = [ 'width' => 500, 'height' => 220, ]; return $size; } }