Only displays binet and psc options for inpacted promotions on list creation page.
authorStéphane Jacob <jacou@melix.net>
Thu, 17 Jul 2008 21:09:13 +0000 (23:09 +0200)
committerStéphane Jacob <jacou@melix.net>
Thu, 17 Jul 2008 21:23:19 +0000 (23:23 +0200)
modules/lists.php
templates/lists/create.tpl

index 7567fb5..0333db8 100644 (file)
@@ -170,6 +170,19 @@ class ListsModule extends PLModule
 
         $page->changeTpl('lists/create.tpl');
 
+        $user_promo  = S::i('promo');
+        $year        = date('Y');
+        $month       = date('m');
+        $young_promo = $very_young_promo = 0;
+        if ((($year > $user_promo) && ($month > 3)) && ($year < $user_promo + 5)) {
+            $young_promo = 1;
+        }
+        if ((($year > $user_promo) && ($month > 7)) && (($year < $user_promo + 1) && ($month < 8))) {
+            $very_young_promo = 1;
+        }
+        $page->assign('young_promo', $young_promo);
+        $page->assign('very_young_promo', $very_young_promo);
+
         $owners  = preg_split("/[\s]+/", Post::v('owners'), -1, PREG_SPLIT_NO_EMPTY);
         $members = preg_split("/[\s]+/", Post::v('members'), -1, PREG_SPLIT_NO_EMPTY);
 
index 8d9dd2c..4f4dc66 100644 (file)
@@ -45,18 +45,24 @@ liste&nbsp;:
     </tr>
     <tr>
       <td class='titre'>C'est une liste pour&nbsp;:</td>
-      <td colspan='2'><input type='radio' name='asso' value='binet'
-        {if $smarty.post.asso eq 'binet' && $smarty.post}checked='checked'{/if} />un binet</td>
+      <td colspan='2'><input type='radio' name='asso' value='groupex'
+        {if $smarty.post.asso eq 'groupex' && $smarty.post}checked='checked'{/if} />un groupe X</td>
       <td colspan='2'><input type='radio' name='asso' value=''
         {if !$smarty.post.asso || !$smarty.post}checked='checked'{/if} />une liste de portée générale ou d'amis</td>
     </tr>
+    {if $young_promo}
     <tr>
       <td></td>
-      <td colspan='2'><input type='radio' name='asso' value='groupex'
-        {if $smarty.post.asso eq 'groupex' && $smarty.post}checked='checked'{/if} />un groupe X</td>
+      <td colspan='2'><input type='radio' name='asso' value='binet'
+        {if $smarty.post.asso eq 'binet' && $smarty.post}checked='checked'{/if} />un binet</td>
+      {if $very_young_promo}
       <td colspan='2'><input type='radio' name='asso' value='alias'
         {if $smarty.post.asso eq 'alias' && $smarty.post}checked='checked'{/if} />un alias psc, ...</td>
+      {else}
+      <td colspan='2'></td>
+      {/if}
     </tr>
+    {/if}
     <tr class='promo'>
       <td class='titre'>Promotion&nbsp;:</td>
       <td><input type='text' name='promo' size='4' maxlength='4'