dolibarr  16.0.5
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 
34 function 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 = '';
53  if (empty($conf->global->FCKEDITOR_SKIN)) {
54  $selected_theme = 'moono-lisa';
55  } else {
56  $selected_theme = $conf->global->FCKEDITOR_SKIN;
57  }
58 
59  $colspan = 2;
60 
61  $thumbsbyrow = 6;
62  print '<table class="noborder centpercent">';
63 
64  $var = false;
65 
66  // Title
67  print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';
68  print '<th class="right">';
69  print '</th></tr>';
70 
71  print '<tr class="oddeven">';
72  print '<td>'.$langs->trans("ThemeDir").'</td>';
73  print '<td>';
74  foreach ($dirskins as $dirskin) {
75  echo '"'.$dirskin.'" ';
76  }
77  print '</td>';
78  print '</tr>';
79 
80  //
81  print '<tr class="oddeven"><td colspan="'.$colspan.'">';
82 
83  print '<table class="nobordernopadding" width="100%"><tr><td><div class="center">';
84 
85  $i = 0;
86  foreach ($dirskins as $dir) {
87  //print $dirroot.$dir;exit;
88  $dirskin = dol_buildpath($dir, 0); // This include loop on $conf->file->dol_document_root
89  $urltheme = dol_buildpath($dir, 1);
90 
91  if (is_dir($dirskin)) {
92  $handle = opendir($dirskin);
93  if (is_resource($handle)) {
94  while (($subdir = readdir($handle)) !== false) {
95  if (is_dir($dirskin."/".$subdir) && substr($subdir, 0, 1) <> '.'
96  && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
97  // Disable not stable themes (dir ends with _exp or _dev)
98  if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) {
99  continue;
100  }
101  if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) {
102  continue;
103  }
104 
105  print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
106  if ($subdir == $selected_theme) {
107  print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="fckeditor_skin" value="'.$subdir.'"> <b>'.$subdir.'</b>';
108  } else {
109  print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="fckeditor_skin" value="'.$subdir.'"> '.$subdir;
110  }
111  print '</div>';
112 
113  $i++;
114  }
115  }
116  }
117  }
118  }
119 
120  print '</div></td></tr></table>';
121 
122  print '</td></tr>';
123 
124  print '</table>';
125 }
show_skin
show_skin($fuser, $edit=0)
Show list of ckeditor's themes.
Definition: doleditor.lib.php:34
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
FormOther
Classe permettant la generation de composants html autre Only common components are here.
Definition: html.formother.class.php:39