mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-12 12:31:26 +01:00
201 lines
6.9 KiB
PHP
201 lines
6.9 KiB
PHP
<?php
|
|
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
* $Id$
|
|
*/
|
|
|
|
/**
|
|
\file htdocs/html.formadmin.class.php
|
|
\brief Fichier de la classe des fonctions prédéfinie de composants html pour les pages admin
|
|
*/
|
|
|
|
|
|
/**
|
|
\class FormAdmin
|
|
\brief Classe permettant la génération de composants html pour les pages admin
|
|
*/
|
|
|
|
class FormAdmin
|
|
{
|
|
var $db;
|
|
var $error;
|
|
|
|
|
|
/**
|
|
\brief Constructeur
|
|
\param DB handler d'accès base de donnée
|
|
*/
|
|
function FormAdmin($DB)
|
|
{
|
|
$this->db = $DB;
|
|
|
|
return 1;
|
|
}
|
|
|
|
/**
|
|
* \brief Retourne la liste déroulante des menus disponibles (eldy_backoffice, ...)
|
|
* \param selected Menu pré-sélectionnée
|
|
* \param htmlname Nom de la zone select
|
|
* \param dirmenu Repértoire à scanner
|
|
*/
|
|
function select_menu($selected='',$htmlname,$dirmenu)
|
|
{
|
|
global $langs,$conf;
|
|
|
|
if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // Pour compatibilité
|
|
|
|
$menuarray=array();
|
|
$handle=opendir($dirmenu);
|
|
while (($file = readdir($handle))!==false)
|
|
{
|
|
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
|
{
|
|
$filelib=eregi_replace('\.php$','',$file);
|
|
$prefix='';
|
|
if (eregi('^eldy',$file)) $prefix='0'; // Recommanded
|
|
else if (eregi('^auguria',$file)) $prefix='2'; // Other
|
|
else if (eregi('^default',$file)) $prefix='2'; // Other
|
|
else if (eregi('^rodolphe',$file)) $prefix='2'; // Other
|
|
else if (eregi('^empty',$file)) $prefix='2'; // Other
|
|
else $prefix='1'; // Experimental
|
|
|
|
if ($file == $selected)
|
|
{
|
|
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'" selected="true">'.$filelib.'</option>';
|
|
}
|
|
else
|
|
{
|
|
$menuarray[$prefix.'_'.$file]='<option value="'.$file.'">'.$filelib.'</option>';
|
|
}
|
|
}
|
|
}
|
|
ksort($menuarray);
|
|
|
|
// Affichage liste deroulante des menus
|
|
print '<select class="flat" name="'.$htmlname.'">';
|
|
$oldprefix='';
|
|
foreach ($menuarray as $key => $val)
|
|
{
|
|
$tab=split('_',$key);
|
|
$newprefix=$tab[0];
|
|
if ($conf->browser->firefox && $newprefix != $oldprefix)
|
|
{
|
|
// Affiche titre
|
|
print '<option value="-1" disabled="disabled">';
|
|
if ($newprefix=='0') print '-- '.$langs->trans("VersionRecommanded").' --';
|
|
if ($newprefix=='1') print '-- '.$langs->trans("VersionExperimental").' --';
|
|
if ($newprefix=='2') print '-- '.$langs->trans("Other").' --';
|
|
print '</option>';
|
|
$oldprefix=$newprefix;
|
|
}
|
|
print $val."\n";
|
|
}
|
|
print '</select>';
|
|
}
|
|
|
|
/**
|
|
* \brief Retourne la liste déroulante des menus disponibles (eldy)
|
|
* \param selected Menu pré-sélectionnée
|
|
* \param htmlname Nom de la zone select
|
|
* \param dirmenu Repertoire à scanner
|
|
*/
|
|
function select_menu_families($selected='',$htmlname,$dirmenu)
|
|
{
|
|
global $langs,$conf;
|
|
|
|
$menuarray=array();
|
|
$handle=opendir($dirmenu);
|
|
while (($file = readdir($handle))!==false)
|
|
{
|
|
if (is_file($dirmenu."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
|
{
|
|
$filelib=eregi_replace('(_backoffice|_frontoffice)?\.php$','',$file);
|
|
if (eregi('^default',$filelib)) continue;
|
|
if (eregi('^empty',$filelib)) continue;
|
|
|
|
$menuarray[$filelib]=1;
|
|
}
|
|
$menuarray['all']=1;
|
|
}
|
|
ksort($menuarray);
|
|
|
|
// Affichage liste deroulante des menus
|
|
print '<select class="flat" name="'.$htmlname.'">';
|
|
$oldprefix='';
|
|
foreach ($menuarray as $key => $val)
|
|
{
|
|
$tab=split('_',$key);
|
|
$newprefix=$tab[0];
|
|
print '<option value="'.$key.'"';
|
|
if ($key == $selected)
|
|
{
|
|
print ' selected="true"';
|
|
}
|
|
//if ($key == 'rodolphe') print ' disabled="true"';
|
|
print '>';
|
|
if ($key == 'all') print $langs->trans("AllMenus");
|
|
else print $key;
|
|
//if ($key == 'rodolphe') print ' ('.$langs->trans("PersonalizedMenusNotSupported").')';
|
|
print '</option>'."\n";
|
|
}
|
|
print '</select>';
|
|
}
|
|
|
|
|
|
/**
|
|
* \brief Retourne la liste déroulante des menus disponibles (eldy)
|
|
* \param selected Menu pré-sélectionnée
|
|
* \param htmlname Nom de la zone select
|
|
*/
|
|
function select_timezone($selected='',$htmlname)
|
|
{
|
|
global $langs,$conf;
|
|
|
|
print '<select class="flat" name="'.$htmlname.'">';
|
|
print '<option value="-1"> </option>';
|
|
print '<option value="Pacific/Midway">GMT-11:00</option>';
|
|
print '<option value="Pacific/Fakaofo">GMT-10:00</option>';
|
|
print '<option value="America/Anchorage">GMT-09:00</option>';
|
|
print '<option value="America/Los_Angeles">GMT-08:00</option>';
|
|
print '<option value="America/Dawson_Creek">GMT-07:00</option>';
|
|
print '<option value="America/Chicago">GMT-06:00</option>';
|
|
print '<option value="America/Bogota">GMT-05:00</option>';
|
|
print '<option value="America/Anguilla">GMT-04:00</option>';
|
|
print '<option value="America/Araguaina">GMT-03:00</option>';
|
|
print '<option value="America/Noronha">GMT-02:00</option>';
|
|
print '<option value="Atlantic/Azores">GMT-01:00</option>';
|
|
print '<option value="Africa/Abidjan">GMT+00:00</option>';
|
|
print '<option value="Europe/Paris">GMT+01:00</option>';
|
|
print '<option value="Europe/Helsinki">GMT+02:00</option>';
|
|
print '<option value="Europe/Moscow">GMT+03:00</option>';
|
|
print '<option value="Asia/Dubai">GMT+04:00</option>';
|
|
print '<option value="Asia/Karachi">GMT+05:00</option>';
|
|
print '<option value="Indian/Chagos">GMT+06:00</option>';
|
|
print '<option value="Asia/Jakarta">GMT+07:00</option>';
|
|
print '<option value="Asia/Hong_Kong">GMT+08:00</option>';
|
|
print '<option value="Asia/Tokyo">GMT+09:00</option>';
|
|
print '<option value="Australia/Sydney">GMT+10:00</option>';
|
|
print '<option value="Pacific/Noumea">GMT+11:00</option>';
|
|
print '<option value="Pacific/Auckland">GMT+12:00</option>';
|
|
print '<option value="Pacific/Enderbury">GMT+13:00</option>';
|
|
print '</select>';
|
|
}
|
|
}
|
|
|
|
?>
|