* Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Patrick Raguin * * 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. */ /** * \file htdocs/core/class/html.formadmin.class.php * \ingroup core * \brief File of class for html functions for admin pages * \version $Id$ */ /** * \class FormAdmin * \brief Class to generate html code for admin pages */ class FormAdmin { var $db; var $error; /** * \brief Constructor * \param DB handler d'acces base de donnee */ function FormAdmin($DB) { $this->db = $DB; return 1; } /** * Output list with available languages. * @deprecated Use select_language instead * @param selected Langue pre-selectionnee * @param htmlname Nom de la zone select * @param showauto Affiche choix auto * @param filter Array of keys to exclude in list * @param showempty Add empty value */ function select_lang($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0) { print $this->select_language($selected,$htmlname,$showauto,$filter,$showempty); } /** * Return html select list with available languages (key='en_US', value='United States' for example) * @param selected Langue pre-selectionnee * @param htmlname Nom de la zone select * @param showauto Affiche choix auto * @param filter Array of keys to exclude in list * @param showempty Add empty value * @param showwarning Show a warning if language is not complete */ function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0,$showwarning=0) { global $langs; $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12); $out=''; $out.= ''; return $out; } /** * Return list of available menus (eldy_backoffice, ...) * @param selected Preselected menu value * @param htmlname Name of html select * @param dirmenu Directory to scan or array of directories to scan * @param moreattrib More attributes on html select tag */ function select_menu($selected='', $htmlname, $dirmenu, $moreattrib='') { global $langs,$conf; if ($selected == 'eldy.php') $selected='eldy_backoffice.php'; // For compatibility $menuarray=array(); foreach ($conf->file->dol_document_root as $dirroot) { if (is_array($dirmenu)) $dirmenus=$dirmenu; else $dirmenus=array($dirmenu); foreach($dirmenus as $dirtoscan) { $dir=$dirroot.$dirtoscan; if (is_dir($dir)) { $handle=opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle))!==false) { if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { if (preg_match('/lib\.php$/i',$file)) continue; // We exclude library files $filelib=preg_replace('/\.php$/i','',$file); $prefix=''; // 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other if (preg_match('/^eldy/i',$file)) $prefix='0'; else if (preg_match('/^smartphone/i',$file)) $prefix='2'; else $prefix='3'; if ($file == $selected) { $menuarray[$prefix.'_'.$file]=''; } else { $menuarray[$prefix.'_'.$file]=''; } } } closedir($handle); } } } } ksort($menuarray); // Output combo list of menus print ''; } /** * Return combo list of available menu families * @param selected Menu pre-selected * @param htmlname Name of html select * @param dirmenuarray Directories to scan */ function select_menu_families($selected='',$htmlname,$dirmenuarray) { global $langs,$conf; //$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set $expdevmenu=array(); $menuarray=array(); foreach($dirmenuarray as $dirmenu) { foreach ($conf->file->dol_document_root as $dirroot) { $dir=$dirroot.$dirmenu; if (is_dir($dir)) { $handle=opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle))!==false) { if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { $filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i','',$file); if (preg_match('/^default/i',$filelib)) continue; if (preg_match('/^empty/i',$filelib)) continue; if (preg_match('/\.lib/i',$filelib)) continue; if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file,$expdevmenu)) continue; $menuarray[$filelib]=1; } $menuarray['all']=1; } closedir($handle); } } } } ksort($menuarray); // Affichage liste deroulante des menus print ''; } /** * \brief Retourne la liste deroulante des menus disponibles (eldy) * \param selected Menu pre-selectionnee * \param htmlname Nom de la zone select */ function select_timezone($selected='',$htmlname) { global $langs,$conf; print ''; } } ?>