dolibarr 18.0.6
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 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
21
34function show_skin($fuser, $edit = 0)
35{
36 global $conf, $langs, $db;
37 global $bc;
38
39 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
40
41 $formother = new FormOther($db);
42
43 $dirskins = array('/includes/ckeditor/ckeditor/skins');
44 if (!empty($conf->modules_parts['theme'])) { // Using this feature slow down application
45 foreach ($conf->modules_parts['theme'] as $reldir) {
46 $dirskins = array_merge($dirskins, (array) ($reldir.'theme'));
47 }
48 }
49 $dirskins = array_unique($dirskins);
50 // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
51
52 $selected_theme = getDolGlobalString('FCKEDITOR_SKIN', 'moono-lisa');
53
54 $colspan = 2;
55
56 $thumbsbyrow = 6;
57 print '<table class="noborder centpercent">';
58
59 $var = false;
60
61 // Title
62 print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';
63 print '<th class="right">';
64 print '</th></tr>';
65
66 print '<tr class="oddeven">';
67 print '<td>'.$langs->trans("ThemeDir").'</td>';
68 print '<td>';
69 foreach ($dirskins as $dirskin) {
70 echo '"'.$dirskin.'" ';
71 }
72 print '</td>';
73 print '</tr>';
74
75 //
76 print '<tr class="oddeven"><td colspan="'.$colspan.'">';
77
78 print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
79
80 $i = 0;
81 foreach ($dirskins as $dir) {
82 //print $dirroot.$dir;exit;
83 $dirskin = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
84 $urltheme = dol_buildpath($dir, 1);
85
86 if (is_dir($dirskin)) {
87 $handle = opendir($dirskin);
88 if (is_resource($handle)) {
89 while (($subdir = readdir($handle)) !== false) {
90 if (is_dir($dirskin."/".$subdir) && substr($subdir, 0, 1) <> '.'
91 && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
92 // Disable not stable themes (dir ends with _exp or _dev)
93 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && preg_match('/_dev$/i', $subdir)) {
94 continue;
95 }
96 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && preg_match('/_exp$/i', $subdir)) {
97 continue;
98 }
99
100 print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
101 if ($subdir == $selected_theme) {
102 print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="fckeditor_skin" value="'.$subdir.'"> <b>'.$subdir.'</b>';
103 } else {
104 print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="fckeditor_skin" value="'.$subdir.'"> '.$subdir;
105 }
106 print '</div>';
107
108 $i++;
109 }
110 }
111 }
112 }
113 }
114
115 print '</div></td></tr></table>';
116
117 print '</td></tr>';
118
119 print '</table>';
120}
Classe permettant la generation de composants html autre Only common components are here.
show_skin($fuser, $edit=0)
Show list of ckeditor's themes.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.