LSformElement :: select_list / select_box : permit to put possible values in labelled...
[ldapsaisie.git] / public_html / templates / default / LSformElement_select_box.tpl
index d97e5ac..2a4720d 100644 (file)
@@ -1,8 +1,9 @@
 <ul class='LSform' id='{$attr_name}'>
 {if $freeze}
   {foreach from=$values item=value}
-    {if array_key_exists($value,$possible_values)}
-    <li>{$possible_values.$value}</li>
+    {LSformElement_select_checkIsValidValue value=$value possible_values=$possible_values}
+    {if $LSformElement_select_isValidValue}
+    <li>{$LSformElement_select_isValidValue_label}</li>
     {else}
     <li class='LSform-errors'>{getFData format=$unrecognized_value_label_format data=$value}</li>
     {/if}
   {/foreach}
 {else}
     {foreach from=$possible_values item=label key=value name=LSformElement_selectbox}
-      <li>
-        <input type='{if $multiple}checkbox{else}radio{/if}' name='{$attr_name}[]' class='LSformElement_selectbox' id='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}' value="{$value}" {if in_array($value,$values)}checked{/if}/> <label for='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}'>{tr msg=$label}</label>
-      </li>
+      {if is_array($label)}
+        {if count($label.possible_values)>0}
+        <li>
+          <span class='LSformElement_selectbox_sub_values_label'>{$label.label} :</span>
+          <ul class='LSformElement_selectbox_sub_values'>
+            {foreach from=$label.possible_values item=l key=v name=LSformElement_selectbox_sub_values}
+              <li>
+                <input type='{if $multiple}checkbox{else}radio{/if}' name='{$attr_name}[]' class='LSformElement_selectbox' id='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}_{$smarty.foreach.LSformElement_selectbox_sub_values.index}' value="{$v}" {if in_array($v,$values)}checked{/if}/> <label for='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}_{$smarty.foreach.LSformElement_selectbox_sub_values.index}'>{tr msg=$l}</label>
+              </li>
+            {/foreach}
+          </ul>
+        </li>
+        {/if}
+      {else}
+        <li>
+          <input type='{if $multiple}checkbox{else}radio{/if}' name='{$attr_name}[]' class='LSformElement_selectbox' id='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}' value="{$value}" {if in_array($value,$values)}checked{/if}/> <label for='LSformElement_selectbox_{$attr_name}_{$smarty.foreach.LSformElement_selectbox.index}'>{tr msg=$label}</label>
+        </li>
+      {/if}
     {/foreach}
 {/if}
 </ul>