dolibarr 24.0.0-beta
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2026 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2026 Nick Fragoulis
4 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
5 * Copyright (C) 2026 Anthony Damhet <a.damhet@progiseize.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * or see https://www.gnu.org/
20 */
21
28// Load Dolibarr environment
29require '../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/ai/lib/ai.lib.php';
39// Security check
40if (!isModEnabled('ai') || !getDolGlobalString('AI_ASSISTANT_ENABLED')) {
41 accessforbidden('Module or feature not allowed');
42}
43// Per-user gate: the Assistant page is now governed by the standard
44// 'ai/assistant/use' right (granted by default to new users), so admins
45// can revoke access per user/group via the standard permission UI.
46if (!$user->hasRight('ai', 'assistant', 'use')) {
48}
49
50global $langs;
51$langs->loadLangs(array("main", "other", "dict"));
52
53$page_name = $langs->trans("AIAssistant");
54// 'ai-fullpage' body class: lets the chat fill the whole content area (no .fiche
55// padding, full height) so the assistant looks like a full-page app, see ai_assistant.css.
56llxHeader('', $page_name, '', '', 0, 0, '', '', '', 'ai-fullpage');
57?>
58
59<!-- CSS & JS INCLUDES -->
60<link rel="stylesheet" href="<?php echo dol_buildpath('/ai/css/ai_assistant.css', 1); ?>">
61
62<script type="module" src="<?php echo dol_buildpath('/ai/js/ai_assistant.js', 1).'?v='.urlencode((string) (@filemtime(DOL_DOCUMENT_ROOT.'/ai/js/ai_assistant.js') ?: DOL_VERSION)); ?>"></script>
63
64<?php
65// Chat markup (shared with the topbar popover fragment, see ai/assistant/popover.php).
66// The data-ai-autoinit attribute makes ai_assistant.js initialize it on load.
67print getAiChatAssistantHtml('page');
68
69llxFooter();
getAiChatAssistantHtml($mode='page')
Build the HTML of the AI Assistant chat interface.
Definition ai.lib.php:617
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition repair.php:130
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.