function exec_calendrier_args($time, $type, $echelle, $partie_cal) { if ($time < 0) $time = time(); if (!$type) $type = 'mois'; elseif ($type == 'semaine') $GLOBALS['afficher_bandeau_calendrier_semaine'] = true; $ancre = 'calendrier-1'; $r = generer_url_ecrire('calendrier', "type=$type") . "#$ancre"; $r = http_calendrier_init($time, $type, $echelle, $partie_cal, $r); if (_AJAX) { ajax_retour($r); } else { $date = date("Y-m-d", $time); if ($type == 'jour') { $titre = nom_jour($date)." ". affdate_jourcourt($date); } else { $titre = _T('titre_page_calendrier', array('nom_mois' => nom_mois($date), 'annee' => annee($date))); } $commencer_page = charger_fonction('commencer_page', 'inc'); echo $commencer_page($titre, "accueil", "calendrier"); // ne produit rien par defaut, mais est utilisee par le plugin agenda echo barre_onglets("calendrier", "calendrier"); echo debut_grand_cadre(true); echo "\n<div> </div>\n<div id='", $ancre, "'>",$r,'</div>'; echo fin_grand_cadre(true); echo fin_page(); } }
function statistiques_nom_des_mois($date_debut, $date_today, $largeur, $pas, $agreg) { global $spip_lang_left; $res = ''; $largeur /= ($pas*$agreg); $gauche_prec = -50; for ($jour = $date_debut; $jour <= $date_today; $jour += $pas) { if (date("d", $jour) == "1") { $newy = (date("m", $jour) == 1); $gauche = floor(($jour - $date_debut) * $largeur); if ($gauche - $gauche_prec >= 40 OR $newy) { $afficher = $newy ? ("<b>".annee(date("Y-m-d", $jour))."</b>") : nom_mois(date("Y-m-d", $jour)); $res .= "<div class='arial0' style='border-$spip_lang_left: 1px solid black; padding-$spip_lang_left: 2px; padding-top: 3px; position: absolute; $spip_lang_left: ".$gauche."px; top: -1px;'>".$afficher."</div>"; $gauche_prec = $gauche; if ($gauche > 400) break; //400px max } } } return "<div style='position: relative; height: 15px'>$res</div>"; }
function http_calendrier_trimestre($annee, $mois, $jour, $echelle, $partie_cal, $self, $ancre, $evt) { global $spip_lang_right, $spip_lang_left, $spip_ecran; if (!isset($spip_ecran)) $spip_ecran = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : "large"; $script = preg_match('/\bscript=(\w+)/', $self, $m) ? $m[1]:''; $script = (preg_match('/\bprive=(.)/', $self, $m) ? $m[1] : 0) ? generer_url_ecrire($script) : generer_url_public($script); $fin = preg_replace('/^.*[?]page=agenda_trimestre/', '', $self) . calendrier_retire_defaults($echelle, $partie_cal); $res = "\n<tr><td colspan='3' style='text-align:$spip_lang_left;'>"; $annee_avant = $annee - 1; $annee_apres = $annee + 1; for ($i=$mois; $i < 13; $i++) { $nom = nom_mois("$annee_avant-$i-1"); $res .= calendrier_href($script,$annee_avant, $i, 1, "mois", $fin, $ancre,'', ($nom . ' ' . $annee_avant), 'calendrier-annee','', $nom) ; } for ($i=1; $i < $mois - 1; $i++) { $nom = nom_mois("$annee-$i-1"); $res .= calendrier_href($script,$annee, $i, 1, "mois", $fin, $ancre,'',($nom . ' ' . $annee),'calendrier-annee','', $nom); } $script .= $fin ; // http_calendrier_agenda devrait avoir cet arg en + $res .= "</td></tr>" . "\n<tr><td class='calendrier-tripleagenda'>" . http_calendrier_agenda($annee, $mois-1, $jour, $mois, $annee, $GLOBALS['afficher_bandeau_calendrier_semaine'], $script,$ancre) . "</td>\n<td class='calendrier-tripleagenda'>" . http_calendrier_agenda($annee, $mois, $jour, $mois, $annee, $GLOBALS['afficher_bandeau_calendrier_semaine'], $script,$ancre) . "</td>\n<td class='calendrier-tripleagenda'>" . http_calendrier_agenda($annee, $mois+1, $jour, $mois, $annee, $GLOBALS['afficher_bandeau_calendrier_semaine'], $script,$ancre) . "</td>" . "</tr>" . "\n<tr><td colspan='3' style='text-align:$spip_lang_right;'>"; for ($i=$mois+2; $i <= 12; $i++) { $nom = nom_mois("$annee-$i-1"); $res .= calendrier_href($script, $annee, $i, 1, "mois", $fin, $ancre,'',$nom . ' ' . $annee, 'calendrier-annee','', $nom); } for ($i=1; $i < $mois+1; $i++) { $nom = nom_mois("$annee_apres-$i-1"); $res .= calendrier_href($script, $annee_apres, $i, 1, "mois", $fin, $ancre,'',$nom . ' ' . $annee_apres, 'calendrier-annee','',$nom); } $res .= "</td></tr>"; $id = ($ancre ? $ancre : 'agenda') . "-nav"; return "<div><div id='$id'></div>" . "<table class='calendrier-cadreagenda calendrier-$spip_ecran' onmouseover=\"$('#$id').show();\" onmouseout=\"$('#$id').hide();\">$res</table>" . "</div>"; }
function agenda($mois, $annee, $jour_ved, $mois_ved, $annee_ved, $semaine = false) { global $couleur_foncee, $couleur_claire; global $connect_id_auteur; global $spip_lang_left, $spip_lang_right; $today = getdate(time()); $jour_today = $today["mday"]; $mois_today = $today["mon"]; $annee_today = $today["year"]; $date = date("Y-m-d", mktime(0, 0, 0, $mois, 1, $annee)); $mois = mois($date); $annee = annee($date); // rendez-vous personnels dans le mois $result_messages = spip_query("SELECT messages.* FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE ((lien.id_auteur='{$connect_id_auteur}' AND lien.id_message=messages.id_message) OR messages.type='affich') AND messages.rv='oui' AND messages.date_heure >='{$annee}-{$mois}-1' AND date_heure < DATE_ADD('{$annee}-{$mois}-1', INTERVAL 1 MONTH) AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure"); while ($row = spip_fetch_array($result_messages)) { $date_heure = $row["date_heure"]; $lejour = journum($row['date_heure']); $les_rv[$lejour]++; } $nom = mktime(1, 1, 1, $mois, 1, $annee); $jour_semaine = date("w", $nom); $nom_mois = nom_mois('2000-' . sprintf("%02d", $mois) . '-01'); if ($jour_semaine == 0) { $jour_semaine = 7; } if ($semaine) { $jour_valide = mktime(1, 1, 1, $mois_ved, $jour_ved, $annee_ved); $jour_semaine_valide = date("w", $jour_valide); if ($jour_semaine_valide == 0) { $jour_semaine_valide = 7; } $debut = mktime(1, 1, 1, $mois_ved, $jour_ved - $jour_semaine_valide + 1, $annee_ved); $fin = mktime(1, 1, 1, $mois_ved, $jour_ved - $jour_semaine_valide + 7, $annee_ved); } echo "<div align='center' style='padding: 5px;'><b class='verdana1'><a href='calendrier.php3?mois={$mois}&&annee={$annee}' style='color: black;'>" . affdate_mois_annee("{$annee}-{$mois}-1") . "</a></b></div>"; echo "<table width='100%' cellspacing='0' cellpadding='0'>"; echo "<tr>"; for ($i = 1; $i < $jour_semaine; $i++) { echo "<td></td>"; } for ($j = 1; $j < 32; $j++) { $jour_j = sprintf("%02d", $j); $nom = mktime(1, 1, 1, $mois, $jour_j, $annee); $jour_semaine = date("w", $nom); if ($jour_semaine == 0) { $jour_semaine = 7; } if (checkdate($mois, $j, $annee)) { if ($j == $jour_ved and $mois == $mois_ved and $annee == $annee_ved) { if ($semaine) { $lien = "calendrier_jour.php3"; } else { $lien = "calendrier_semaine.php3"; } echo "<td class='arial2' style='margin: 1px; padding: 2px; background-color: white; border: 1px solid {$couleur_foncee}; text-align: center; -moz-border-radius: 5px;'>"; echo "<a href='{$lien}?jour={$j}&mois={$mois}&annee={$annee}' style='color: black'><b>{$j}</b></a>"; echo "</td>"; } else { if ($semaine and $nom >= $debut and $nom <= $fin) { if ($jour_semaine == 1) { $style = "-moz-border-radius-top{$spip_lang_left}: 10px; -moz-border-radius-bottom{$spip_lang_left}: 10px;"; } else { if ($jour_semaine == 7) { $style = "-moz-border-radius-top{$spip_lang_right}: 10px; -moz-border-radius-bottom{$spip_lang_right}: 10px;"; } else { $style = ""; } } echo "<td class='arial2' style='margin: 0px; padding: 3px; background-color: white; text-align: center; {$style}'>"; echo "<a href='calendrier_semaine.php3?jour={$j}&mois={$mois}&annee={$annee}' style='color: black'><b>{$j}</b></a>"; echo "</td>"; } else { if ($j == $jour_today and $mois == $mois_today and $annee == $annee_today) { $couleur_fond = $couleur_foncee; $couleur = "white"; } else { if ($jour_semaine == 7) { $couleur_fond = "#aaaaaa"; $couleur = "white"; } else { $couleur_fond = "#ffffff"; $couleur = "#aaaaaa"; } if ($les_rv[$j] > 0) { $couleur = "black"; } } echo "<td>"; echo "<div class='arial2' style='margin-left: 1px; margin-top: 1px; padding: 2px; background-color: {$couleur_fond}; text-align: center; -moz-border-radius: 5px;'>"; if ($semaine) { echo "<a href='calendrier_semaine.php3?jour={$j}&mois={$mois}&annee={$annee}' style='color: {$couleur};'>{$j}</a>"; } else { echo "<a href='calendrier_jour.php3?jour={$j}&mois={$mois}&annee={$annee}' style='color: {$couleur};'>{$j}</a>"; } echo "</div>"; echo "</td>"; } } if ($jour_semaine == 7) { echo "</tr>\n<tr>"; } } } echo "</tr>\n"; echo "</table>"; }
function BOUCLE_archivehtml_76ddbc2b5f1671bea60186a8fa5bb500(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) { static $command = array(); static $connect; $command['connect'] = $connect = ''; $doublons_index = array(); // Initialise le(s) critère(s) doublons if (!isset($doublons[$d = 'articles' . 'archives'])) { $doublons[$d] = ''; } if (!isset($command['table'])) { $command['table'] = 'articles'; $command['id'] = '_archive'; $command['from'] = array('articles' => 'spip_articles', 'L1' => 'spip_mots_liens', 'L2' => 'spip_mots'); $command['type'] = array(); $command['groupby'] = array("articles.id_article"); $command['select'] = array("articles.date_redac", "articles.id_article", "articles.titre", "articles.lang"); $command['orderby'] = array('articles.date_redac DESC'); $command['join'] = array('L1' => array('articles', 'id_objet', 'id_article', 'L1.objet=' . sql_quote('article')), 'L2' => array('L1', 'id_mot')); $command['limit'] = ''; $command['having'] = array(); } $command['where'] = array(quete_condition_statut('articles.statut', 'publie,prop,prepa/auteur', 'publie', ''), array('=', 'L2.titre', "'Agenda'"), array('=', 'articles.lang', sql_quote($GLOBALS['spip_lang'], '', 'varchar(10) NOT NULL DEFAULT \'\'')), array(sql_in('articles.id_article', $doublons[$doublons_index[] = 'articles' . 'archives'], 'NOT'))); if (defined("_BOUCLE_PROFILER")) { $timer = time() + microtime(); } $t0 = ""; // REQUETE $iter = IterFactory::create("SQL", $command, array('squelettes/agenda.html', 'html_76ddbc2b5f1671bea60186a8fa5bb500', '_archive', 77, $GLOBALS['spip_lang'])); if (!$iter->err()) { // COMPTEUR $Numrows['_archive']['compteur_boucle'] = 0; lang_select($GLOBALS['spip_lang']); $SP++; // RESULTATS while ($Pile[$SP] = $iter->fetch()) { $Numrows['_archive']['compteur_boucle']++; foreach ($doublons_index as $k) { $doublons[$k] .= "," . $Pile[$SP]['id_article']; } // doublons lang_select_public($Pile[$SP]['lang'], '', $Pile[$SP]['titre']); $t0 .= ' ' . (($t1 = strval(unique(annee(normaliser_date($Pile[$SP]['date_redac']))))) !== '' ? ' ' . ($Numrows['_archive']['compteur_boucle'] > '1' ? '</ul></li></ul></div>' : '') . ' <div id="plan"> <h3>' . $t1 . '</h3> <ul> ' : '') . ' ' . (($t1 = strval(nom_mois(unique(affdate(normaliser_date($Pile[$SP]['date_redac']), 'Y-m'))))) !== '' ? ' ' . (unique(annee(normaliser_date($Pile[$SP]['date_redac'])), 'nouvelle') ? '' : '</ul></li>') . ' <li>' . $t1 . ' <ul> ' : '') . ' <li><a href="' . vider_url(urlencode_1738(generer_url_entite($Pile[$SP]['id_article'], 'article', '', '', true))) . '">' . interdire_scripts(supprimer_numero(typo(supprimer_numero($Pile[$SP]['titre']), "TYPO", $connect, $Pile[0]))) . '</a></li> '; lang_select(); } lang_select(); $iter->free(); } if (defined("_BOUCLE_PROFILER") and 1000 * ($timer = time() + microtime() - $timer) > _BOUCLE_PROFILER) { spip_log(intval(1000 * $timer) . "ms BOUCLE_archive @ squelettes/agenda.html", "profiler" . _LOG_AVERTISSEMENT); } return $t0; }
function http_agenda_invisible($id, $annee, $jour, $mois, $script, $ancre) { $couleur_claire = 'white'; // CSS FIXME $gadget = "<div id='{$id}' style='position: relative; visibility: hidden;z-index: 1000; ' " . " onmouseover=\"lcm_show('{$id}');\" " . " onmouseout=\"lcm_hide('{$id}');\">" . "<div style='position: absolute; padding: 5px; background-color: {$couleur_claire}; margin-bottom: 5px; -moz-border-radius-bottomleft: 8px; -moz-border-radius-bottomright: 8px;'>"; $gadget .= "<table cellpadding='0' cellspacing='5' border='0' width='98%'>\n"; $gadget .= "<tr>\n<td colspan='3' style='text-align:left;'>"; $annee_avant = $annee - 1; $annee_apres = $annee + 1; // // show month names before and after current month // for ($i = $mois; $i < 13; $i++) { $gadget .= http_href($script . "mois={$i}&annee={$annee_avant}{$ancre}", nom_mois("{$annee_avant}-{$i}-1"), '', '', 'cal_yearview'); } for ($i = 1; $i < $mois - 1; $i++) { $gadget .= http_href($script . "mois={$i}&annee={$annee}{$ancre}", nom_mois("{$annee}-{$i}-1"), '', '', 'cal_yearview'); } // // Show calendars for previous, current and next month // $show_week = $_REQUEST['type'] == 'semaine' ? true : false; $gadget .= "</td>\n</tr>\n</table>\n"; // [ML] I had a problem centering the name of month, so I removed the 'width="100%"' // but I know it's still ugly now, so if you have any ideas, feel free to fix :-) $gadget .= "<table cellpadding='0' cellspacing='5' border='0' align='center'>\n"; $gadget .= "<tr>\n<td valign='top' width='33%'>" . http_calendrier_agenda($mois - 1, $annee, $jour, $mois, $annee, $show_week, $script, $ancre) . "</td>\n<td valign='top' width='33%'>" . http_calendrier_agenda($mois, $annee, $jour, $mois, $annee, $show_week, $script, $ancre) . "</td>\n<td valign='top' width='33%'>" . http_calendrier_agenda($mois + 1, $annee, $jour, $mois, $annee, $show_week, $script, $ancre) . "</td>\n" . "</tr>\n</table>\n" . "<table cellpadding='0' cellspacing='5' border='0' width='98%'><tr><td colspan='3' style='text-align:right;'>"; for ($i = $mois + 2; $i <= 12; $i++) { $gadget .= http_href($script . "mois={$i}&annee={$annee}{$ancre}", nom_mois("{$annee}-{$i}-1"), '', '', 'cal_yearview'); } for ($i = 1; $i < $mois + 1; $i++) { $gadget .= http_href($script . "mois={$i}&annee={$annee_apres}{$ancre}", nom_mois("{$annee_apres}-{$i}-1"), '', '', 'cal_yearview'); } return $gadget . "</td></tr></table></div></div>\n\n"; }