la fonction moisdecal existe déjà dans baz_april
This commit is contained in:
parent
95bb52efa2
commit
c78181fc8a
|
@ -14,39 +14,3 @@ include_spip('inc/cextras_autoriser');
|
||||||
restreindre_extras('article', 'transcriptions', 'transcriptions', 'composition');
|
restreindre_extras('article', 'transcriptions', 'transcriptions', 'composition');
|
||||||
restreindre_extras('mot', 'soustitre', 5, 'groupemot');
|
restreindre_extras('mot', 'soustitre', 5, 'groupemot');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reprise de la fonction dans agenda :
|
|
||||||
* decale les mois de la date.
|
|
||||||
* cette fonction peut raboter le jour si le nouveau mois ne les contient pas
|
|
||||||
* exemple 31/01/2007 + 1 mois => 28/02/2007
|
|
||||||
*
|
|
||||||
* @param string $date
|
|
||||||
* @param int $decalage
|
|
||||||
* @param string $format
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function librealire_moisdecal($date, $decalage, $format = 'Y-m-d H:i:s') {
|
|
||||||
include_spip('inc/filtres');
|
|
||||||
$date_array = recup_date($date);
|
|
||||||
if ($date_array) {
|
|
||||||
list($annee, $mois, $jour) = $date_array;
|
|
||||||
}
|
|
||||||
if (!$jour) {
|
|
||||||
$jour = 1;
|
|
||||||
}
|
|
||||||
if (!$mois) {
|
|
||||||
$mois = 1;
|
|
||||||
}
|
|
||||||
$mois2 = $mois + $decalage;
|
|
||||||
$date2 = mktime(1, 1, 1, $mois2, intval($jour), $annee);
|
|
||||||
// mois normalement attendu
|
|
||||||
$mois3 = date('m', mktime(1, 1, 1, $mois2, intval(1), $annee));
|
|
||||||
// et si le mois de la nouvelle date a moins de jours...
|
|
||||||
$mois2 = date('m', $date2);
|
|
||||||
if ($mois2 - $mois3) {
|
|
||||||
$date2 = mktime(1, 1, 1, $mois2, intval(0), $annee);
|
|
||||||
}
|
|
||||||
return date($format, $date2);
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
* periode = sous forme stricte Y-m
|
* periode = sous forme stricte Y-m
|
||||||
soit |periode=2020-02
|
soit |periode=2020-02
|
||||||
]
|
]
|
||||||
#SET{'borne_debut_mois', (#ENV{date}|affdate{'Y-m'}|librealire_moisdecal{0,'Y-m-d'})}
|
#SET{'borne_debut_mois', (#ENV{date}|affdate{'Y-m'}|baz_moisdecal{0,'Y-m-d'})}
|
||||||
#SET{'borne_fin_mois', (#ENV{date}|affdate{'Y-m'}|librealire_moisdecal{1,'Y-m-d'})}
|
#SET{'borne_fin_mois', (#ENV{date}|affdate{'Y-m'}|baz_moisdecal{1,'Y-m-d'})}
|
||||||
[(#ENV{periode}|oui)
|
[(#ENV{periode}|oui)
|
||||||
[(#SET{'borne_debut_mois', [(#ENV{periode}|librealire_moisdecal{0,'Y-m-d'})]})]
|
[(#SET{'borne_debut_mois', [(#ENV{periode}|baz_moisdecal{0,'Y-m-d'})]})]
|
||||||
[(#SET{'borne_fin_mois', [(#ENV{periode}|librealire_moisdecal{1,'Y-m-d'})]})]
|
[(#SET{'borne_fin_mois', [(#ENV{periode}|baz_moisdecal{1,'Y-m-d'})]})]
|
||||||
]
|
]
|
||||||
<BOUCLE_compo(RUBRIQUES){composition=transcriptions}>
|
<BOUCLE_compo(RUBRIQUES){composition=transcriptions}>
|
||||||
<B_trans>
|
<B_trans>
|
||||||
|
|
Loading…
Reference in New Issue