widgetName = JText::translate('VBO_W_AITOOLS_TITLE'); $this->widgetDescr = JText::translate('VBO_W_AITOOLS_DESCR'); $this->widgetId = basename(__FILE__, '.php'); $this->widgetIcon = ''; $this->widgetStyleName = 'violet'; } /** * @inheritDoc */ public function getPriority() { // give this widget a higher priority return 15; } /** * @inheritDoc */ public function preflight() { // can be used only if VCM is installed and the account has the AI channel return class_exists('VikChannelManager') && defined('VikChannelManagerConfig::AI') && VikChannelManager::getChannel(VikChannelManagerConfig::AI); } /** * @inheritDoc */ public function preload() { $options = [ 'version' => defined('VIKCHANNELMANAGER_SOFTWARE_VERSION') ? VIKCHANNELMANAGER_SOFTWARE_VERSION : VIKBOOKING_SOFTWARE_VERSION, ]; // manually load required dependencies JHtml::fetch('script', VCM_ADMIN_URI . 'layouts/ai/assistant/aitools.js', $options); JHtml::fetch('stylesheet', VCM_ADMIN_URI . 'layouts/ai/assistant/aitools.css', $options); JHtml::fetch('script', VCM_ADMIN_URI . 'assets/js/katex/katex.min.js', $options); JHtml::fetch('script', VCM_ADMIN_URI . 'assets/js/katex/auto-render.min.js', $options); JHtml::fetch('stylesheet', VCM_ADMIN_URI . 'assets/js/katex/katex.min.css', $options); // language definitions JText::script('VBO_AI_ASSISTANT_DISCLAIMER'); JText::script('VBO_AI_ASSISTANT_DISCOVER_HINT'); JText::script('VBO_AI_ASSISTANT_DISCOVER_TITLE'); } /** * @inheritDoc */ public function render(VBOMultitaskData $data = null) { $auto_focus = false; $prompt = null; // if we are rendering the widget on a modal, register a script to prevent the latter // from dismissing whenever the ESC key is pressed if ($data && $data->isModalRendering()) { $auto_focus = true; $prompt = (array) $this->getOption('prompt', null); ?> false, // auto-focus textarea 'auto_focus' => $auto_focus, // default prompt 'prompt' => $prompt, ], null, [ 'client' => 'administrator', 'component' => 'com_vikchannelmanager', ] ); } }