[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/inc/ -> dater.php (source)

   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  if (!defined("_ECRIRE_INC_VERSION")) return;
  14  
  15  include_spip('inc/presentation');
  16  include_spip('inc/texte');
  17  include_spip('inc/actions');
  18  include_spip('inc/date');
  19  
  20  // http://doc.spip.org/@inc_dater_dist
  21  function inc_dater_dist($id, $flag, $statut, $type, $script, $date, $date_redac='')
  22  {
  23      global $spip_lang_left, $spip_lang_right, $options;
  24  
  25      if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})( ([0-9]{2}):([0-9]{2}))?", $date_redac, $regs)) {
  26          $annee_redac = $regs[1];
  27          $mois_redac = $regs[2];
  28          $jour_redac = $regs[3];
  29          $heure_redac = $regs[5];
  30          $minute_redac = $regs[6];
  31          if ($annee_redac > 4000) $annee_redac -= 9000;
  32      } else $annee_redac = $mois_redac = $jour_redac = 0;
  33  
  34      $possedeDateRedac= ($annee_redac + $mois_redac + $jour_redac);
  35  
  36      if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})( ([0-9]{2}):([0-9]{2}))?", $date, $regs)) {
  37          $annee = $regs[1];
  38          $mois = $regs[2];
  39          $jour = $regs[3];
  40          $heure = $regs[5];
  41          $minute = $regs[6];
  42      }
  43  
  44    if ($flag AND $options == 'avancees') {
  45  
  46      if ($statut == 'publie') {
  47  
  48          $js = "size='1' class='fondl'
  49  onchange=\"findObj_forcer('valider_date').style.visibility='visible';\"";
  50  
  51          $invite =  "<b><span class='verdana1'>"
  52          . _T('texte_date_publication_article')
  53          . '</span> '
  54          .  majuscules(affdate($date))
  55          .  "</b>"
  56          . aide('artdate');
  57  
  58          $masque = 
  59            afficher_jour($jour, "name='jour' $js", true)
  60          . afficher_mois($mois, "name='mois' $js", true)
  61          . afficher_annee($annee, "name='annee' $js")
  62          . (($type != 'article')
  63             ? ''
  64             : (' - '
  65              . afficher_heure($heure, "name='heure' $js")
  66                . afficher_minute($minute, "name='minute' $js")))
  67            . "&nbsp;\n";
  68  
  69          $res = "<div style='margin: 5px; margin-$spip_lang_left: 20px;'>"
  70          .  ajax_action_post("dater", 
  71                      "$id/$type",
  72                      $script,
  73                      "id_$type=$id",
  74                      $masque,
  75                      _T('bouton_changer'),
  76                         " class='fondo visible_au_chargement' id='valider_date'", "",
  77                      "&id=$id&type=$type")
  78          .  "</div>";
  79  
  80          $res = block_parfois_visible('datepub', $invite, $res, 'text-align: left');
  81  
  82      } else {
  83          $res = "\n<div><b> <span class='verdana1'>"
  84          . _T('texte_date_creation_article')
  85          . "</span>\n"
  86          . majuscules(affdate($date))."</b>".aide('artdate')."</div>";
  87      }
  88  
  89      if (($type == 'article')
  90      AND (($options == 'avancees' AND $GLOBALS['meta']["articles_redac"] != 'non')
  91          OR $possedeDateRedac)) {
  92          if ($possedeDateRedac)
  93              $date_affichee = majuscules(affdate($date_redac))
  94  #            ." " ._T('date_fmt_heures_minutes', array('h' =>$heure_redac, 'm'=>$minute_redac))
  95              ;
  96          else
  97              $date_affichee = majuscules(_T('jour_non_connu_nc'));
  98  
  99          $js = "\"findObj_forcer('valider_date_redac').style.visibility='visible';\"";
 100  
 101          $invite = "<b>"
 102          . "<span class='verdana1'>"
 103          . majuscules(_T('texte_date_publication_anterieure'))
 104          . '</span> '
 105          . $date_affichee
 106          . " "
 107          . aide('artdate_redac')
 108          .  "</b>";
 109  
 110          $masque = 
 111   "<div style='float: $spip_lang_left; width: 80%;position:relative;display:inline;'>" .
 112   '<input type="radio" name="avec_redac" value="non" id="avec_redac_on"' .
 113   ($possedeDateRedac ? '' : ' checked="checked"') .
 114   " onclick=$js" .
 115   ' /> <label for="avec_redac_on">'.
 116   _T('texte_date_publication_anterieure_nonaffichee').
 117   '</label>' .
 118   '<br /><input type="radio" name="avec_redac" value="oui" id="avec_redac_off"' .
 119   (!$possedeDateRedac ? '' : ' checked="checked"') .
 120   " onclick=$js /> <label for='avec_redac_off'>" .
 121   _T('bouton_radio_afficher').
 122   ' :</label> ' .
 123   afficher_jour($jour_redac, "name='jour_redac' class='fondl' onchange=$js", true) .
 124   afficher_mois($mois_redac, "name='mois_redac' class='fondl' onchange=$js", true) .
 125   "<input type='text' name='annee_redac' class='fondl' value='".$annee_redac."' size='5' maxlength='4' onclick=$js />" .
 126   '<div style="text-align: center; width: 80%;">' .
 127   afficher_heure($heure_redac, "name='heure_redac' class='fondl' onchange=$js", true) .
 128   afficher_minute($minute_redac, "name='minute_redac' class='fondl' onchange=$js", true) .
 129   "</div></div>";
 130  
 131  
 132          $masque =  "<div style='margin: 5px; margin-$spip_lang_left: 20px;'>" .
 133            ajax_action_post("dater", 
 134                     "$id/$type",
 135                     $script,
 136                     "id_$type=$id",
 137                     $masque,
 138                     _T('bouton_changer'),
 139                     " style='float: $spip_lang_right; margin-top: 20px;position:relative;display:inline;' class='fondo visible_au_chargement' id='valider_date_redac'", "",
 140                     "&id=$id&type=$type")
 141                     ."<br class='nettoyeur' />"
 142          . '</div>';
 143  
 144          $res .= block_parfois_visible('dateredac', $invite, $masque, 'text-align: left');
 145      }
 146    } else {
 147  
 148      $res = "<div style='text-align:center;'><b> <span class='verdana1'>"
 149        . (($statut == 'publie' OR $type != 'article')
 150          ? _T('texte_date_publication_article')
 151          : _T('texte_date_creation_article'))
 152      . "</span> "
 153      .  majuscules(affdate($date))."</b>".aide('artdate')."</div>";
 154  
 155      if ($possedeDateRedac) {
 156          $res .= "<div style='text-align:center;'><b><span class='verdana1'>"
 157          . _T('texte_date_publication_anterieure')
 158          . "</span> "
 159          . ' : '
 160          . majuscules(affdate($date_redac))
 161          . "</b>"
 162          . aide('artdate_redac')
 163          . "</div>";
 164      }
 165    }
 166  
 167    $res =  debut_cadre_couleur('',true) . $res .  fin_cadre_couleur(true);
 168  
 169    return ajax_action_greffe("dater-$id", $res);
 170  }
 171  
 172  ?>


Généré le : Wed Nov 21 10:20:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics