[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/ -> calendrier.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  include  ("inc.php");
  20  
  21  function afficher_mois ($jour_today, $mois_today, $annee_today, $nom_mois) {
  22      global $spip_lang_rtl, $spip_lang_right, $spip_lang_left;
  23      global $connect_id_auteur, $connect_statut;
  24      global $les_articles;
  25      global $les_breves;
  26      global $spip_lang_rtl;
  27      global $spip_ecran;
  28      global $couleur_claire, $couleur_foncee;
  29  
  30      // calculer de nouveau la date du jour pour affichage en blanc
  31      $ce_jour = date("Y-m-d");
  32  
  33      $nom = mktime(1, 1, 1, $mois_today, 1, $annee_today);
  34      $jour_semaine = date("w", $nom);
  35  
  36      if ($jour_semaine == 0)
  37          $jour_semaine = 7;
  38  
  39      if ($spip_ecran == "large") {
  40          $largeur_table = 974;
  41          $largeur_gauche = 130;
  42      }
  43      else {
  44          $largeur_table = 750;
  45          $largeur_gauche = 100;
  46      }
  47  
  48      $largeur_table = $largeur_table - ($largeur_gauche + 20);
  49      $largeur_col = round($largeur_table / 7);
  50  
  51      echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"".($largeur_table + 10 + $largeur_gauche)."'>\n";
  52      echo "<tr>\n";
  53  
  54      echo "<td width='$largeur_gauche' class='verdana1' valign='top'>";
  55  
  56      // date du jour
  57      $today = getdate(time());
  58      $mois = $today["mon"];
  59      $annee = $today["year"];
  60  
  61      if ($mois != $mois_today OR $annee != $annee_today)
  62          $afficher_lien_aujourdhui = true;
  63  
  64      $annee_avant = $annee_today - 1;
  65      $annee_apres = $annee_today + 1;
  66  
  67      echo "<div>&nbsp;</div>";
  68      echo "<div>&nbsp;</div>";
  69      echo "<div class='verdana1'>";
  70      echo "<div><strong>$annee_avant</strong></div>";
  71  
  72      for ($i = $mois_today; $i < 13; $i++) {
  73          echo "<div style='margin-$spip_lang_left:10px; padding:2px; -moz-border-radius:5px; margin-top:2px; border:1px solid #ccc; background-color: #ccc;'>"
  74          ."<a href='calendrier.php?mois=$i&annee=$annee_avant'>".nom_mois("$annee_avant - $i - 1")."</a></div>";
  75      }
  76  
  77      echo "<div><strong>$annee_today</strong></div>";
  78  
  79      for ($i = 1; $i < 13; $i++) {
  80          if ($i == $mois_today) {
  81              echo "<div style='margin-$spip_lang_left:10px; padding:2px; -moz-border-radius:5px; margin-top:2px; border:1px solid #666; background-color:#fff;'>"
  82              ."<strong>".nom_mois("$annee_today - $i - 1")."</strong></div>";
  83          }
  84          else {
  85              echo "<div style='margin-$spip_lang_left:10px; padding:2px; -moz-border-radius:5px; margin-top:2px; border:1px solid #ccc; background-color:#ccc;'>"
  86              ."<a href='calendrier.php?mois=$i&annee=$annee_today'>".nom_mois("$annee_today - $i - 1")."</a></div>";
  87          }
  88      }
  89  
  90      echo "<div><strong>$annee_apres</strong></div>";
  91  
  92      for ($i = 1; $i < $mois_today + 1; $i++) {
  93          echo "<div style='margin-$spip_lang_left:10px; padding:2px; -moz-border-radius:5px; margin-top:2px; border:1px solid #ccc; background-color:#ccc;'>"
  94          ."<a href='calendrier.php?mois=$i&annee=$annee_apres'>".nom_mois("$annee_apres - $i - 1")."</a></div>";
  95      }
  96  
  97      echo "</div>";
  98  
  99      echo "</td>";
 100      echo "<td width='20'>&nbsp;</td>";
 101  
 102      echo "<td width='$largeur_table' valign='top'>";
 103      echo "<table border='0' cellspacing='0' cellpadding='3' width='$largeur_table'>";
 104  
 105      $mois_suiv = $mois_today + 1;
 106      $annee_suiv = $annee_today;
 107      $mois_prec = $mois_today - 1;
 108      $annee_prec = $annee_today;
 109  
 110      if ($mois_today == 1) {
 111          $mois_prec = 12;
 112          $annee_prec = $annee_today - 1;
 113      }
 114  
 115      if ($mois_today == 12) {
 116          $mois_suiv = 1;
 117          $annee_suiv = $annee_today + 1;
 118      }
 119  
 120      // articles du jour
 121      $articleMetier = &recuperer_instance_article();
 122      $todayArticles = $articleMetier->getToday($mois_today, $annee_today);
 123  
 124      while (list(, $articleMetier) = each($todayArticles)) {
 125          $id_article = $articleMetier->getArticleId();
 126          $titre = $articleMetier->getTitre();
 127          $datePub = $articleMetier->getDate();
 128          $lejour = journum($datePub);
 129          $lemois = mois($datePub);
 130          if ($lemois == $mois_today)
 131              $les_articles["$lejour"]
 132              .= "<br /><a href='articles.php?id_article=$id_article'>"
 133              ."<img src='img_pack/puce-verte.gif' width='7' height='7' border='0' /> "
 134              ."$titre</a>";
 135      }
 136  
 137      $breveMetier = &recuperer_instance_breve();
 138      $todayBreves = $breveMetier->getToday($mois_today, $annee_today);
 139  
 140      while (list(, $breveMetier) = each($todayBreves)) {
 141          $id_breve = $breveMetier->getBreveId();
 142          $titre = $breveMetier->getTitre();
 143          $lejour = journum($breveMetier->getDateHeure());
 144          $lemois = mois($breveMetier->getDateHeure());
 145          if ($lemois == $mois_today)
 146              $les_breves["$lejour"]
 147              .= "<br /><a href='breves_voir.php?id_breve=$id_breve'>"
 148              ."<img src='img_pack/puce-blanche.gif' width='7' height='7' border='0' /> ".
 149              "<em>$titre</em></a>";
 150      }
 151  
 152      // rendez-vous personnels
 153      $messageMetier = &recuperer_instance_message();
 154      $allMessages = $messageMetier->getPersonnalRDVForMonth($connect_id_auteur, $annee_today, $mois_today);
 155  
 156      if (PEAR::isError($allMessages)) {
 157          die ($allMessages->getMessage());
 158      }
 159  
 160      while (list(, $messageMetier) = each($allMessages)) {
 161          $id_message = $messageMetier->getMessageId();
 162          $date_heure = $messageMetier->getDateHeure();
 163          $titre = typo($messageMetier->getTitre());
 164          $type = $messageMetier->getType();
 165          $lejour = journum($messageMetier->getDateHeure());
 166  
 167          if ($type == "normal") {
 168              $la_couleur = "#02531B";
 169              $couleur_fond = "#CFFEDE";
 170          }
 171          elseif ($type == "pb") {
 172              $la_couleur = "#3874B0";
 173              $couleur_fond = "#EDF3FE";
 174          }
 175          elseif ($type == "affich") {
 176              $la_couleur = "#ccaa00";
 177              $couleur_fond = "#ffffee";
 178          }
 179          else {
 180              $la_couleur = "black";
 181              $couleur_fond = "#aaaaaa";
 182          }
 183          $les_rv["$lejour"][] = 
 184              "<div style='padding:2px; margin-top:2px; background-color:$couleur_fond; border:1px solid $la_couleur; -moz-border-radius:3px;' class='arial0'>"
 185              ."<font color='$la_couleur'><strong>".heures($date_heure).":".minutes($date_heure)."</strong></font> "
 186              ."<a href='message.php?id_message=$id_message' style='color:black;'>$titre</a></div>";
 187      }
 188  
 189      $activer_messagerie = lire_meta("activer_messagerie");
 190      $connect_activer_messagerie = $GLOBALS["connect_activer_messagerie"];
 191  
 192      echo "<tr>\n"
 193          ."<td style='text-align:$spip_lang_left;'>"
 194          ." <a href='calendrier.php?mois=$mois_prec&annee=$annee_prec'>"
 195          ."<img src='img_pack/fleche-$spip_lang_left.png' alt='&lt;&lt;&lt;' width='12' height='12' border='0' /></a></td>\n";
 196      echo "<td style='text-align:center;' colspan='5''>";
 197  
 198      if ($afficher_lien_aujourdhui) {
 199          echo "<div style='float: $spip_lang_left; width: 150px; align: left;'>";
 200          icone_horizontale(_T("info_aujourdhui")."<br />".affdate_mois_annee("$annee-$mois-1"), "calendrier.php", "calendrier-24.gif", "", "left");
 201          echo "</div>";
 202      }
 203  
 204      if ($activer_messagerie == "oui" AND $connect_activer_messagerie != "non") {
 205          echo "<div style='float: $spip_lang_right; width: 120px;'>";
 206          echo "<a href='calendrier_jour.php?jour=$jour_today&mois=$mois_today&annee=$annee_today'>"
 207              ."<img src='img_pack/cal-jour.gif' alt='jour' width='26' height='20' border='0' style='filter:alpha(opacity=50);'></a>";
 208          echo "&nbsp;";
 209          echo "<a href='calendrier_semaine.php?jour=$jour_today&mois=$mois_today&annee=$annee_today'>"
 210              ."<img src='img_pack/cal-semaine.gif' alt='semaine' width='26' height='20' border='0' style='filter:alpha(opacity=50);'></a>";
 211          echo "&nbsp;";
 212          echo "<img src='img_pack/cal-mois.gif' alt='mois' width='26' height='20' border='0' style='border:1px solid black;'>";
 213          echo aide("messcalen");
 214          echo "</div>";
 215      }
 216  
 217      echo "<font face='arial,helvetica,sans-serif' size='4'><strong>".affdate_mois_annee("$annee_today-$mois_today-1")."</strong></font>";
 218  
 219      echo "</td>\n";
 220      echo "<td style='text-align:$spip_lang_right;'>"
 221          ."<a href='calendrier.php?mois=$mois_suiv&annee=$annee_suiv'>"
 222          ."<img src='img_pack/fleche-$spip_lang_right.png' alt='&gt;&gt;&gt;' width='12' height='12' border='0' />"
 223          ."</a></td>\n</tr>\n";
 224  
 225      echo "<tr>\n";
 226      echo "<td align='center' width='$largeur_col' "
 227          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 228          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_2'). "</strong></td>";
 229      echo "<td align='center' width='$largeur_col' "
 230          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 231          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_3'). "</strong></td>";
 232      echo "<td align='center' width='$largeur_col' "
 233          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 234          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_4'). "</strong></td>";
 235      echo "<td align='center' width='$largeur_col' "
 236          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 237          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_5'). "</strong></td>";
 238      echo "<td align='center' width='$largeur_col' "
 239          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 240          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_6'). "</strong></td>";
 241      echo "<td align='center' width='$largeur_col' "
 242          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 243          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_7'). "</strong></td>";
 244      echo "<td align='center' width='$largeur_col' "
 245          ."style='border-bottom: 1px solid black; border-right:1px solid black; border-left:1px solid $couleur_claire; border-top:1px solid $couleur_claire;' bgcolor='$couleur_foncee'>"
 246          ."<font class='verdana2' color='#FFFFFF'><strong>" . _T('date_jour_1'). "</strong></td>";
 247  
 248      echo "</tr>\n<tr>\n";
 249  
 250      for ($i = 1; $i < $jour_semaine; $i++) {
 251          echo "<td></td>\n";
 252      }
 253  
 254      for ($j = 1; $j < 32; $j++) {
 255          $jour = sprintf("%02d", $j);
 256  
 257          $nom = mktime(1, 1, 1, $mois_today, $jour, $annee_today);
 258          $jour_semaine = date("w", $nom);
 259          if (checkdate($mois_today, $jour, $annee_today)) {
 260              if ("$annee_today-$mois_today-$jour" == $ce_jour) {
 261                  $couleur_lien = "red";
 262                  $couleur_fond = "white";
 263              }
 264              else {
 265                  $couleur_lien = "black";
 266                  $couleur_fond = "#e4e4e4";
 267              }
 268  
 269              if ($activer_messagerie == "oui" AND $connect_activer_messagerie != "non") {
 270                  echo "<td width='$largeur_col' height='100' bgcolor='$couleur_fond' valign='top' "
 271                  ."style='border-bottom:1px solid white; border-right:1px solid white; border-left:1px solid #aaa; border-top:1px solid #aaa;'>"
 272                  ."<a href='calendrier_jour.php?jour=$jour&mois=$mois_today&annee=$annee_today'>"
 273                  ."<font face='arial,helvetica,sans-serif' size=3 color='$couleur_lien'><strong>$jour</strong></a></font>";
 274              }
 275              else {
 276                  echo "<td width='$largeur_col' height='100' bgcolor='$couleur_fond' valign='top' "
 277                  ."style='border-bottom:1px solid white; border-right:1px solid white; border-left:1px solid #aaa; border-top:1px solid #aaa;'>"
 278                  ."<font face='arial,helvetica,sans-serif' size=3 color='$couleur_lien'><strong>$jour</strong></font>";
 279              }
 280  
 281              if ($activer_messagerie == "oui" AND $connect_activer_messagerie != "non") {
 282                  echo " <a href='message_edit.php?rv=$annee_today-$mois_today-$jour&new=oui&type=pb' "
 283                  ."title='"._T("lien_nouvea_pense_bete")."'>"
 284                  ."<img src='img_pack/m_envoi_bleu$spip_lang_rtl.gif' width='14' height='7' border='0' /></a>";
 285                  echo " <a href='message_edit.php?rv=$annee_today-$mois_today-$jour&new=oui&type=normal' "
 286                  ."title='"._T("lien_nouveau_message")."'>"
 287                  ."<img src='img_pack/m_envoi$spip_lang_rtl.gif' width='14' height='7' border='0' /></a>";
 288              }
 289  
 290              $authorization = &recuperer_instance_authorization('annoncerNouvelleGenerale', $GLOBALS['connect_id_auteur']);
 291  
 292              if ($authorization->isAuthorizedAction())
 293                  echo " <a href='message_edit.php?rv=$annee_today-$mois_today-$jour&new=oui&type=affich' "
 294                  ."title='"._T("lien_nouvelle_annonce")."'>"
 295                  ."<img src='img_pack/m_envoi_jaune$spip_lang_rtl.gif' width='14' height='7' border='0' /></a>\n";
 296  
 297              echo "<font face='arial,helvetica,sans-serif' size=1>";
 298  
 299              if (count($les_rv[$j]) > 0) {
 300                  echo join($les_rv[$j], "\n");
 301              }
 302  
 303              echo $les_articles[$j];
 304  
 305              echo $les_breves[$j];
 306  
 307              echo "</font></td>";
 308              if ($jour_semaine == 0)
 309                  echo "</tr><tr>";
 310          }
 311      }
 312  
 313      echo "</tr></table>";
 314      echo "</td></tr></table>";
 315  }
 316  
 317  // date du jour
 318  $today = getdate(time());
 319  
 320  // sans arguments => mois courant
 321  if (!$mois) {
 322      $jour = $today["mday"];
 323      $jour = $today["mday"];
 324      $mois = $today["mon"];
 325      $annee = $today["year"];
 326  }
 327  
 328  if (!$jour)
 329      $jour = $today["mday"];
 330  
 331  $nom_mois = nom_mois('2000-' . sprintf("%02d", $mois). '-01');
 332  
 333  debut_page(d_apostrophe(_T('titre_page_calendrier', array('nom_mois' => $nom_mois, 'annee' => $annee))), "redacteurs", "calendrier");
 334  $activer_messagerie = lire_meta("activer_messagerie");
 335  $connect_activer_messagerie = $GLOBALS["connect_activer_messagerie"];
 336  
 337  // marges et pied de page supprimes pour prendre toute la largeur
 338  // debut_gauche();
 339  // debut_droite();
 340  
 341  echo "<div>&nbsp;</div>";
 342  
 343  afficher_mois($jour, sprintf("%02d", $mois), $annee, $nom_mois);
 344  
 345  if (strlen($les_breves["0"]) > 0 OR $les_articles["0"] > 0) {
 346      echo "<table width=200 background=''><tr width=200><td><font face='arial,helvetica,sans-serif' size=1>";
 347      echo "<strong>" . _T('info_mois_courant'). "</strong>";
 348      echo $les_breves["0"];
 349      echo $les_articles["0"];
 350      echo "</font></td></tr></table>";
 351  }
 352  
 353  if ($activer_messagerie == "oui" AND $connect_activer_messagerie != "non") {
 354      echo "<br /><br /><br />"
 355          ."<table width='700' background=''>\n"
 356          ."<tr width='700'>\n"
 357          ."<td><font face='arial,helvetica,sans-serif' size=2>";
 358      echo "<strong>" . _T('info_aide'). "</strong>";
 359      echo "<br /><img src='img_pack/m_envoi_bleu$spip_lang_rtl.gif' width='14' height='7' border='0'> "
 360          ._T('info_symbole_bleu')."\n";
 361      echo "<br /><img src='img_pack/m_envoi$spip_lang_rtl.gif' width='14' height='7' border='0'> "
 362          ._T('info_symbole_vert'). "\n";
 363      echo "<br /><img src='img_pack/m_envoi_jaune$spip_lang_rtl.gif' width='14' height='7' border='0'> "
 364          ._T('info_symbole_jaune'). "\n";
 365      echo "</font></td>\n";
 366      echo "</tr>\n</table>\n\n";
 367  }
 368  
 369  // fin_page();
 370  
 371  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7