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