From 18fb3c63ca7dc8f3467fdd4d2d9763a2dcfeaeb1 Mon Sep 17 00:00:00 2001 From: Pascal Corpet Date: Sat, 29 May 2010 15:23:24 +0200 Subject: [PATCH] Fix 'young promo' for binets and PSC aliases display in list creation --- modules/lists.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/lists.php b/modules/lists.php index 3e85e72..954ecdd 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -169,14 +169,20 @@ class ListsModule extends PLModule $page->changeTpl('lists/create.tpl'); - $user_promo = S::i('promo'); + $user_promo = S::user()->profile()->yearPromo(); $year = date('Y'); $month = date('m'); + // scolar year starts in september + $scolarmonth = ($year - $user_promo) * 12 + ($month - 8); $young_promo = $very_young_promo = 0; - if ((($year > $user_promo) && ($month > 3)) && ($year < $user_promo + 5)) { + // binet are accessible only in april in the first year and until + // march of the 5th year + if ($scolarmonth >= 8 && $scolarmonth < 56) { $young_promo = 1; } - if ((($year > $user_promo) && ($month > 7)) && (($year < $user_promo + 1) && ($month < 8))) { + // PSC aliases are accesible only between september and june of the second + // year of scolarity + if ($scolarmonth >= 12 && $scolarmonth < 22) { $very_young_promo = 1; } $page->assign('young_promo', $young_promo); -- 2.1.4