dolibarr 25.0.0-alpha
doleditor.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
5 * Copyright (C) 2026 Frédéric France <frederic.france@free.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
22
35function show_skin($fuser, $edit = 0)
36{
37 global $conf, $langs, $db;
38 global $bc;
39
40 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
41
42 $formother = new FormOther($db);
43
44 $dirskins = array('/public/includes/ckeditor/ckeditor/skins');
45 if (!empty($conf->modules_parts['theme'])) { // Using this feature slow down application
46 foreach ($conf->modules_parts['theme'] as $reldir) {
47 $dirskins = array_merge($dirskins, (array) ($reldir.'theme'));
48 }
49 }
50 $dirskins = array_unique($dirskins);
51 // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
52
53 $selected_theme = getDolGlobalString('FCKEDITOR_SKIN', 'moono-lisa');
54
55 $colspan = 2;
56
57
58 print '<table class="noborder centpercent">';
59
60 $var = 0;
61
62 // Title
63 print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';
64 print '<th class="right">';
65 print '</th></tr>';
66
67 print '<tr class="oddeven">';
68 print '<td>'.$langs->trans("ThemeDir").'</td>';
69 print '<td>';
70 foreach ($dirskins as $dirskin) {
71 echo '"'.$dirskin.'" ';
72 }
73 print '</td>';
74 print '</tr>';
75
76 //
77 print '<tr class="oddeven"><td colspan="'.$colspan.'">';
78
79 print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
80
81 $i = 0;
82 foreach ($dirskins as $dir) {
83 //print $dirroot.$dir;exit;
84 $dirskin = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
85 $urltheme = dol_buildpath($dir, 1);
86
87 if (is_dir($dirskin)) {
88 $handle = opendir($dirskin);
89 if (is_resource($handle)) {
90 while (($subdir = readdir($handle)) !== false) {
91 if (is_dir($dirskin."/".$subdir) && substr($subdir, 0, 1) != '.'
92 && substr($subdir, 0, 3) != 'CVS' && !preg_match('/common|phones/i', $subdir)) {
93 // Disable not stable themes (dir ends with _exp or _dev)
94 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && preg_match('/_dev$/i', $subdir)) {
95 continue;
96 }
97 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && preg_match('/_exp$/i', $subdir)) {
98 continue;
99 }
100
101 print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
102 if ($subdir == $selected_theme) {
103 print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="fckeditor_skin" value="'.$subdir.'"> <b>'.$subdir.'</b>';
104 } else {
105 print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="fckeditor_skin" value="'.$subdir.'"> '.$subdir;
106 }
107 print '</div>';
108
109 $i++;
110 }
111 }
112 }
113 }
114 }
115
116 print '</div></td></tr></table>';
117
118 print '</td></tr>';
119
120 print '</table>';
121}
Class to help generate other html components Only common components are here.
show_skin($fuser, $edit=0)
Show list of ckeditor's themes.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.