[ Index ] |
|
Code source de SPIP 1.9.2c |
1 <?php 2 3 /***************************************************************************\ 4 * SPIP, Systeme de publication pour l'internet * 5 * * 6 * Copyright (c) 2001-2007 * 7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * 8 * * 9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * 10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * 11 \***************************************************************************/ 12 13 // 14 if (!defined("_ECRIRE_INC_VERSION")) return; 15 16 // http://doc.spip.org/@my_sel 17 function my_sel($num, $tex, $comp) { 18 return "<option value='$num'" . (($num != $comp) ? '' : " selected='selected'") . 19 ">$tex</option>\n"; 20 } 21 22 // http://doc.spip.org/@format_mysql_date 23 function format_mysql_date($annee=0, $mois=0, $jour=0, $h=0, $m=0, $s=0) { 24 $annee = sprintf("%04s",$annee); 25 $mois = sprintf("%02s",$mois); 26 27 if ($annee == "0000") $mois = 0; 28 if ($mois == "00") $jour = 0; 29 30 return sprintf("%04u",$annee) . '-' . sprintf("%02u",$mois) . '-' 31 . sprintf("%02u",$jour) . ' ' . sprintf("%02u",$h) . ':' 32 . sprintf("%02u",$m) . ':' . sprintf("%02u",$s); 33 } 34 35 36 // http://doc.spip.org/@afficher_mois 37 function afficher_mois($mois, $attributs, $autre=false){ 38 return 39 "<select $attributs>\n" . 40 (!$autre ? '' : my_sel("00",_T('mois_non_connu'),$mois)) . 41 my_sel("01", _T('date_mois_1'), $mois) . 42 my_sel("02", _T('date_mois_2'), $mois) . 43 my_sel("03", _T('date_mois_3'), $mois) . 44 my_sel("04", _T('date_mois_4'), $mois) . 45 my_sel("05", _T('date_mois_5'), $mois) . 46 my_sel("06", _T('date_mois_6'), $mois) . 47 my_sel("07", _T('date_mois_7'), $mois) . 48 my_sel("08", _T('date_mois_8'), $mois) . 49 my_sel("09", _T('date_mois_9'), $mois) . 50 my_sel("10", _T('date_mois_10'), $mois) . 51 my_sel("11", _T('date_mois_11'), $mois) . 52 my_sel("12", _T('date_mois_12'), $mois) . 53 "</select>\n"; 54 } 55 56 // http://doc.spip.org/@afficher_annee 57 function afficher_annee($annee, $attributs, $debut=1996) { 58 $res = ($annee > 1996) ? '' : my_sel($annee,$annee,$annee); 59 for ($i=$debut; $i < date("Y") + 3; $i++) { 60 $res .= my_sel($i,$i,$annee); 61 } 62 return "<select $attributs>\n$res</select>\n"; 63 } 64 65 // http://doc.spip.org/@afficher_jour 66 function afficher_jour($jour, $attributs, $autre=false){ 67 68 $res = (!$autre ? "" : my_sel("00",_T('jour_non_connu_nc'),$jour)); 69 for($i=1;$i<32;$i++){ 70 if ($i<10){$aff=" ".$i;}else{$aff=$i;} 71 $res .= my_sel($i,$aff,$jour); 72 } 73 return "<select $attributs>\n$res</select>\n"; 74 } 75 76 // http://doc.spip.org/@afficher_heure 77 function afficher_heure($heure, $attributs, $autre=false){ 78 $res = ''; 79 for($i=0;$i<=23;$i++){ 80 $aff = sprintf("%02s", $i); 81 $res .= my_sel($i,$aff,$heure); 82 } 83 return "<select $attributs>\n$res</select>\n"; 84 } 85 86 // http://doc.spip.org/@afficher_minute 87 function afficher_minute($minute, $attributs, $autre=false){ 88 $res = ''; 89 for($i=0;$i<=59;$i+=5){ 90 $aff = sprintf("%02s", $i); 91 $res .= my_sel($i,$aff,$minute); 92 93 if ($minute>$i AND $minute<$i+5) 94 $res .= my_sel($minute,sprintf("%02s", $minute),$minute); 95 } 96 return "<select $attributs>\n$res</select>\n"; 97 } 98 99 100 // http://doc.spip.org/@afficher_jour_mois_annee_h_m 101 function afficher_jour_mois_annee_h_m($date, $heures, $minutes, $suffixe='') 102 { 103 return 104 afficher_jour(jour($date), "name='jour$suffixe' size='1' class='fondl verdana1'") . 105 afficher_mois(mois($date), "name='mois$suffixe' size='1' class='fondl verdana1'") . 106 afficher_annee(annee($date), "name='annee$suffixe' size='1' class='fondl verdana1'", date('Y')-1) . 107 " <input type='text' class='fondl verdana1' name='heures$suffixe' value=\"".$heures."\" size='3'/> ".majuscules(_T('date_mot_heures'))." " . 108 "<input type='text' class='fondl verdana1' name='minutes$suffixe' value=\"$minutes\" size='3'/>"; 109 } 110 111 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 10:20:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |