From c948c596c9c1802d4ac9ab88cec1aeb114262357 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 29 Jul 2002 11:03:49 +0000 Subject: [PATCH] . --- htdocs/gitoyen.php3 | 64 +++++++++++ htdocs/langs/en | 3 + htdocs/langs/fr | 7 ++ htdocs/rtplang.class.php | 238 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 312 insertions(+) create mode 100644 htdocs/gitoyen.php3 create mode 100644 htdocs/langs/en create mode 100644 htdocs/langs/fr create mode 100644 htdocs/rtplang.class.php diff --git a/htdocs/gitoyen.php3 b/htdocs/gitoyen.php3 new file mode 100644 index 00000000000..c9b28f411a5 --- /dev/null +++ b/htdocs/gitoyen.php3 @@ -0,0 +1,64 @@ + + * + * 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$ + * $Source$ + * + */ +require("./pre.inc.php3"); + +llxHeader(); + +$qt_r = 2.75; +$pu_r = 17.53; +$total_r = $qt_r * $pu_r; + +$qt_tr = 2.75; $pu_tr = 23; $total_tr = $qt_tr * $pu_tr; +$qt_bpr = 0.33333 ; $pu_bpr = 270; $total_bpr = $qt_bpr * $pu_bpr; + + +$qt_m = 2.75; +$pu_m = 17.53; +$total_m = $qt_m * $pu_m; + +print ""; +print ""; + +print ""; +print ""; +print ""; + +print ""; + +print ""; +print ""; + +print "
QuantitéPUTotal
Rodolphe Interxion$qt_r$pu_r".price($total_r)."
Rodolphe Telehouse$qt_tr$pu_tr".price($total_tr)."
Rodolphe BP$qt_bpr$pu_bpr".price($total_bpr)."
".price($total_r+$total_tr+$total_bpr)."
Mose$qt_m$pu_m$total_m
".($total_r+$total_m)."
"; + + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> + + + + + + + + + + diff --git a/htdocs/langs/en b/htdocs/langs/en new file mode 100644 index 00000000000..a608bbc7f8f --- /dev/null +++ b/htdocs/langs/en @@ -0,0 +1,3 @@ +#do not change next line please ! +#{@"htmltagoption"=>"nothing","charset"=>"iso-8859-1","name"=>"English"} +User=User diff --git a/htdocs/langs/fr b/htdocs/langs/fr new file mode 100644 index 00000000000..1b0ff9a35bd --- /dev/null +++ b/htdocs/langs/fr @@ -0,0 +1,7 @@ +#do not change next line please ! +#{@"htmltagoption"=>"nothing","charset"=>"iso-8859-1","name"=>"Français","translator_0"=>"Éric SEIGNE "} +Please choose your language=Choisissez votre langue +Commercial=Commercial +Company=Société +Date=Date +User=Utilisateur diff --git a/htdocs/rtplang.class.php b/htdocs/rtplang.class.php new file mode 100644 index 00000000000..57ff17a636d --- /dev/null +++ b/htdocs/rtplang.class.php @@ -0,0 +1,238 @@ + + * + * 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 + * 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 : rtplang.class.php + * Author : Eric SEIGNE + * mailto:erics@rycks.com + * http://www.rycks.com/ + * Date : 09/09/2001 + * Licence : GNU/GPL Version 2 ou plus + * + * Description: + * ------------ + * + * + * + * @version 1.0 + * @author Eric Seigne + * @project AbulEdu + * @copyright Eric Seigne 09/09/2001 + * + * ************************************************************************* */ + +if(isset($RTPLANG_CLASS)){ + return; +} +$RTPLANG_CLASS=1; + + +Class rtplang { + var $tab_langs; + var $tab_translate; + var $file_lang; + /** Default language interface (isocode) */ + var $defaultiso; + /** Source language (isocode) */ + var $sourceiso; + /** This session language (isocode) */ + var $sessioniso; + /** Where are languages files ? */ + var $dir; + var $debug; + + //------------------------------------------------- + /** Constructor */ + function rtplang($dir = "", $sourceiso = "", $defaultiso = "", $sessioniso = ""){ + $this->tab_langs = array(); + $this->tab_translate = array(); + $this->file_lang = ""; + $this->debug = 0; + $this->dir = $dir; + $this->sessioniso = $sessioniso; + $this->sourceiso = $sourceiso; + $this->defaultiso = $defaultiso; + + //Si on a une langue par defaut + if(($this->defaultiso != "") && ($this->sessioniso == "")) + $this->file_lang = $this->dir . "/" . $this->defaultiso; + else if($this->sessioniso != "") + $this->file_lang = $this->dir . "/" . $this->sessioniso; + + /* initialize tabs */ + $i = 0; + if(is_dir($this->dir)) { + $handle=opendir($this->dir); + while ($file = trim(readdir($handle))){ + if($file != "." && $file != "..") { + $filet = $this->dir . "/" . $file; + if($fp = @fopen($filet,"r")){ + $finded = 0; + while (($ligne = fgets($fp,10000)) && ($finded == 0)){ + if($ligne[0] == "#" && $ligne[1] == "{" && $ligne[2] == "@") { + $ligneok = "array(" . substr($ligne,2,strlen($ligne)-4) . ");"; + eval("\$tablanginfo = $ligneok;"); + $this->tablangs["htmltagoption"][$i] = $tablanginfo["htmltagoption"]; + $this->tablangs["charset"][$i] = $tablanginfo["charset"]; + $this->tablangs["name"][$i] = $tablanginfo["name"]; + $this->tablangs["iso"][$i] = $file; + $finded = 1; + //print "fichier indice $i $file " . $tablanginfo["charset"] . "
\n"; + $i++; + + } + } + fclose($fp); + } + } + } + closedir($handle); + } + } + + /** + * Return translated version of parameter string + * [fr] Retourne la version traduite du texte passé en paramètre + * Si il n'y a pas de correspondance pour ce texte, il est retourné + * "tel quel" précédé d'un "[vo] " et terminé par un + * + * @access public + * @return string translated version of parameter string, or original version of this string with "[vo] " before and "" after + * @param string $str original string to translate + * @param int $mark bolean, 1 or nothing: add [vo] if this translation does not exists, 0 don't add [vo] tags + */ + function translate($str, $mark){ + //Si le tableau des langues n'est pas défini c'est que c'est le 1er appel + if((count($this->tab_translate) < 1) && (trim($this->file_lang) != "")){ + if($fp = @fopen($this->file_lang,"r")){ + while ($ligne = fgetcsv($fp,10000, "=")){ + //On ne prends pas en compte les commentaires etc. + if(trim($ligne[0]) != "") + if($ligne[0][0] != "#" && $ligne[0][0] != ";"){ + if(isset($ligne[1]) && $ligne[1] != "") + $this->tab_translate[$ligne[0]] = $ligne[1]; + } + } + fclose($fp); + } + else + if($this->debug) + print "File - $this->file_lang - is unreadable"; + } + $retour = $this->tab_translate[$str]; + + if($retour == "") { + //Si on est pas déjà en vo, on le marque + if($this->sessioniso && $this->sourceiso != $this->sessioniso && $mark) + $retour = "[vo] $str"; + else + $retour = $str; + } + return $retour; + } + + /** + * Return the list of available languages + * [fr] Retourne la liste des langues disponibles + * + * @access public + * @return array: list of languages + */ + function get_available_languages() + { + $tab = array(); + + if($this->sessioniso != "") { + $tab[$this->sessioniso] = array($this->sessioniso => ""); + $tab[$this->sourceiso] = array($this->sourceiso => ""); + } + else if($this->defaultiso != "") { + $tab[$this->defaultiso] = array($this->defaultiso => ""); + $tab[$this->sourceiso] = array($this->sourceiso => ""); + } + else { + $tab[$this->sourceiso] = array($this->sourceiso => ""); + } + + for($i = 0; $i < count($this->tablangs["iso"]); $i++) { + $isocode = $this->tablangs["iso"][$i]; + $lang = $this->tablangs["name"][$i]; + $tab[$isocode] = array($isocode => $lang); + } + return $tab; + } + + /** + * Send header and return a string of html start page + * [fr] Expédie le header correct et retourne le début de la page html + * + * @access public + * @return string + */ + function lang_header() + { + $search = ""; + $ind = 0; + + if($this->sessioniso != "") + $search = $this->sessioniso; + else + $search = $this->defaultiso; + + // indice du tab ? + for($i = 0; $i < count($this->tablangs["iso"]) && !$ind; $i++) + if($this->tablangs["iso"][$i] == $search) + $ind = $i; + + $htmltag = "tablangs["htmltagoption"][$ind] != "nothing" && $this->tablangs["htmltagoption"][$ind] != "") + $htmltag .= " " . $this->tablangs["htmltagoption"][$ind]; + $htmltag .= ">"; + + if($this->tablangs["charset"][$ind] == "") + $charset = "iso-8859-1"; + else + $charset = $this->tablangs["charset"][$ind]; + + // print "fichier indice $ind $search / $charset" ; + + header("Content-Type: text/html; charset=$charset"); + $texte .= "$htmltag + +\n"; + + return $texte; + } +} + +/** + * Return translated version of parameter string + * [fr] Retourne la version traduite du texte passé en paramètre + * Si il n'y a pas de correspondance pour ce texte, il est retourné + * "tel quel" précédé d'un "[vo] " et terminé par un + * + * @access public + * @return string translated version of parameter string, or original version of this string with "[vo] " before and "" after + * @param string $str original string to translate + * @param int $mark bolean, 1 or nothing: add [vo] if this translation does not exists, 0 don't add [vo] tags + */ +function translate($str, $mark = 1){ + global $rtplang; + return $rtplang->translate($str, $mark); +} + +?>