X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Finc%2Fdate.php;fp=www%2Fecrire%2Finc%2Fdate.php;h=fc3d72b6646b29aef5b69d1c45737857d06fd674;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c
diff --git a/www/ecrire/inc/date.php b/www/ecrire/inc/date.php
new file mode 100644
index 0000000..fc3d72b
--- /dev/null
+++ b/www/ecrire/inc/date.php
@@ -0,0 +1,121 @@
+$tex\n";
+}
+
+// http://doc.spip.org/@format_mysql_date
+function format_mysql_date($annee=0, $mois=0, $jour=0, $h=0, $m=0, $s=0) {
+ $annee = sprintf("%04s",$annee);
+ $mois = sprintf("%02s",$mois);
+
+ if ($annee == "0000") $mois = 0;
+ if ($mois == "00") $jour = 0;
+
+ return sprintf("%04u",$annee) . '-' . sprintf("%02u",$mois) . '-'
+ . sprintf("%02u",$jour) . ' ' . sprintf("%02u",$h) . ':'
+ . sprintf("%02u",$m) . ':' . sprintf("%02u",$s);
+}
+
+
+// http://doc.spip.org/@afficher_mois
+function afficher_mois($mois, $attributs, $autre=false){
+ return
+ "\n";
+}
+
+// http://doc.spip.org/@afficher_annee
+function afficher_annee($annee, $attributs, $debut=null, $fin=null) {
+
+ if (!isset($debut)) $debut = $annee - 8;
+ if (!isset($fin)) $fin = max($annee, date('Y')) + 3;
+
+ if ($fin - $debut > 15)
+ return "";
+
+ $res = ($annee > $debut) ? '' : my_sel($annee,$annee,$annee);
+ for ($i=$debut; $i < $fin; $i++) {
+ $res .= my_sel($i,$i,$annee);
+ }
+ // plus de choix... on met une vieille date arbitraire, et au tour
+ // suivant on aura un champ input a la place du select (pas genial...)
+ $res .= my_sel(date('Y')-10,' ...',$annee);
+ return "\n";
+}
+
+// http://doc.spip.org/@afficher_jour
+function afficher_jour($jour, $attributs, $autre=false){
+
+ $res = (!$autre ? "" : my_sel("00",_T('jour_non_connu_nc'),$jour));
+ for($i=1;$i<32;$i++){
+ if ($i<10){$aff=" ".$i;}else{$aff=$i;}
+ $res .= my_sel($i,$aff,$jour);
+ }
+ return "\n";
+}
+
+// http://doc.spip.org/@afficher_heure
+function afficher_heure($heure, $attributs, $autre=false){
+ $res = '';
+ for($i=0;$i<=23;$i++){
+ $aff = sprintf("%02s", $i);
+ $res .= my_sel($i,$aff,$heure);
+ }
+ return "\n";
+}
+
+// http://doc.spip.org/@afficher_minute
+function afficher_minute($minute, $attributs, $autre=false){
+ $res = '';
+ for($i=0;$i<=59;$i+=5){
+ $aff = sprintf("%02s", $i);
+ $res .= my_sel($i,$aff,$minute);
+
+ if ($minute>$i AND $minute<$i+5)
+ $res .= my_sel($minute,sprintf("%02s", $minute),$minute);
+ }
+ return "\n";
+}
+
+
+// http://doc.spip.org/@afficher_jour_mois_annee_h_m
+function afficher_jour_mois_annee_h_m($date, $heures, $minutes, $suffixe='')
+{
+ return
+ afficher_jour(jour($date), "name='jour$suffixe' id='jour$suffixe' size='1' class='verdana1'") .
+ afficher_mois(mois($date), "name='mois$suffixe' id='mois$suffixe' size='1' class='verdana1'") .
+ afficher_annee(annee($date), "name='annee$suffixe' id='annee$suffixe' class='verdana1'", date('Y')-1) .
+ " ".majuscules(_T('date_mot_heures'))." " .
+ "";
+}
+
+?>