[ Index ]
 

Code source de SPIP 1.8.3

Accédez au Source d'autres logiciels libres | Soutenez Angelica Josefina !

title

Body

[fermer]

/ecrire/ -> inc_date.php3 (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2005                                                *
   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  // Ce fichier ne sera execute qu'une fois
  15  if (defined("_ECRIRE_INC_DATE")) return;
  16  define("_ECRIRE_INC_DATE", "1");
  17  
  18  function my_sel($num, $tex, $comp) {
  19    return "<option value='$num'" . (($num != $comp) ? '' : " selected='selected'") .
  20      ">$tex</option>\n";
  21  }
  22  
  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("%04s",$annee) . '-' . sprintf("%02s",$mois) . '-'
  31          . sprintf("%02s",$jour) . ' ' . sprintf("%02s",$h) . ':'
  32          . sprintf("%02s",$m) . ':' . sprintf("%02s",$s);
  33  }
  34  
  35  
  36  function afficher_mois($mois, $attributs, $autre=false){
  37    return
  38      "<select $attributs>\n" .
  39      (!$autre ? '' : my_sel("00",_T('mois_non_connu'),$mois)) .
  40      my_sel("01", _T('date_mois_1'), $mois) .
  41      my_sel("02", _T('date_mois_2'), $mois) .
  42      my_sel("03", _T('date_mois_3'), $mois) .
  43      my_sel("04", _T('date_mois_4'), $mois) .
  44      my_sel("05", _T('date_mois_5'), $mois) .
  45      my_sel("06", _T('date_mois_6'), $mois) .
  46      my_sel("07", _T('date_mois_7'), $mois) .
  47      my_sel("08", _T('date_mois_8'), $mois) .
  48      my_sel("09", _T('date_mois_9'), $mois) .
  49      my_sel("10", _T('date_mois_10'), $mois) .
  50      my_sel("11", _T('date_mois_11'), $mois) .
  51      my_sel("12", _T('date_mois_12'), $mois) .
  52      "</select>\n";
  53  }
  54  
  55  function afficher_annee($annee, $attributs, $debut=1996) {
  56      $res = ($annee > 1996) ? '' : my_sel($annee,$annee,$annee);
  57      for ($i=$debut; $i < date("Y") + 3; $i++) {
  58          $res .= my_sel($i,$i,$annee);
  59      }
  60      return "<select $attributs>\n$res</select>\n";
  61  }
  62  
  63  function afficher_jour($jour, $attributs, $autre=false){
  64  
  65      $res = (!$autre ? "" : my_sel("00",_T('jour_non_connu_nc'),$jour));
  66      for($i=1;$i<32;$i++){
  67          if ($i<10){$aff="&nbsp;".$i;}else{$aff=$i;}
  68          $res .= my_sel($i,$aff,$jour);
  69      }
  70      return "<select $attributs>\n$res</select>\n";
  71  }
  72  
  73  function afficher_heure($heure, $attributs, $autre=false){
  74      for($i=0;$i<=23;$i++){
  75          $aff = sprintf("%02s", $i);
  76          $res .= my_sel($i,$aff,$heure);
  77      }
  78      return "<select $attributs>\n$res</select>\n";
  79  }
  80  
  81  function afficher_minute($minute, $attributs, $autre=false){
  82      for($i=0;$i<=59;$i+=5){
  83          $aff = sprintf("%02s", $i);
  84          $res .= my_sel($i,$aff,$minute);
  85  
  86          if ($minute>$i AND $minute<$i+5)
  87              $res .= my_sel($minute,sprintf("%02s", $minute),$minute);
  88      }
  89      return "<select $attributs>\n$res</select>\n";
  90  }
  91  
  92  
  93  function afficher_jour_mois_annee_h_m($date, $heures, $minutes, $suffixe='')
  94  {
  95    return 
  96      afficher_jour(jour($date), "name='jour$suffixe' size='1' class='fondl verdana1'") .
  97      afficher_mois(mois($date), "name='mois$suffixe' size='1' class='fondl verdana1'") .
  98      afficher_annee(annee($date), "name='annee$suffixe' size='1' class='fondl verdana1'", date('Y')-1) .
  99      "&nbsp;  <input type='text' class='fondl verdana1' name='heures$suffixe' value=\"".$heures."\" size='3'/>&nbsp;".majuscules(_T('date_mot_heures'))."&nbsp;" .
 100      "<input type='text' class='fondl verdana1' name='minutes$suffixe' value=\"$minutes\" size='3'/>";
 101  }
 102  
 103  function afficher_formulaire_date($action, $texte, $jour, $mois, $annee)
 104  {
 105    global $couleur_foncee;
 106    return
 107      "<form action='$action' method='POST'>"
 108      . "<table cellpadding='5' cellspacing='0' border='0' width='100%' background='"
 109      .  _DIR_IMG_PACK
 110      . "rien.gif'>"
 111      . "<tr><td bgcolor='$couleur_foncee' colspan='2'><font size='2' color='#ffffff'><b>"
 112      ._T('texte_date_publication_article')
 113      . "</b></font></tr>"
 114      . "<tr><td align='center'>"
 115      . afficher_jour($jour, "name='jour' size='1' class='fondl'", true)
 116      . afficher_mois($mois, "name='mois' size='1' class='fondl'", true)
 117      . afficher_annee($annee, "name='annee' size='1' class='fondl'",1996)
 118      . "</td><td align='right'>"
 119      . "<input type='submit' name='Changer' class='fondo' value='"
 120      . _T('bouton_changer')
 121      . "'>"
 122      . "</td></tr></table>"
 123      . "</form>";
 124  }
 125  
 126  ?>


Généré le : Thu Feb 22 22:27:47 2007 par Balluche grâce à PHPXref 0.7