dolibarr  7.0.0-beta
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@capnetworks.com>
4  * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
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 <http://www.gnu.org/licenses/>.
18  * or see http://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" width="100%">';
62 
63  $var=false;
64 
65  // Title
66  print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';
67  print '<th align="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 align="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  }
115  else
116  {
117  print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="fckeditor_skin" value="'.$subdir.'"> '.$subdir;
118  }
119  print '</div>';
120 
121  $i++;
122  }
123  }
124  }
125  }
126  }
127 
128  print '</div></td></tr></table>';
129 
130  print '</td></tr>';
131 
132  print '</table>';
133 }
134 
show_skin($fuser, $edit=0)
Show list of ckeditor'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:91