Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

config_checkbox_select()

Description

Generate an html checkbox options block

used to generate the values of the checkbox, and the values are the checkbox labels the user sees. (But see
$usekeys, below.)
If set to false the values from $choices will be used for both the values of the options
and the text the user sees. Defaulted to true.

Parameters

ColumnTypeDefaultDescription
$name string the name of the checkbox block.
$label string the user text displayed to label the checkbox block. Usually a $lang string.
$current
$choices
$usekeys boolean true tells whether to use the keys from $choices as the values of the options.
$width integer 300 the width of the input field in pixels. Default: 300.
$columns integer 1 the number of columns to use
$autosave false
$on_change_js null
$hidden false
array string $choices the array of choices -- the list of checkboxes. The keys are

Location

include/config_functions.php lines 746 to 805

Definition

 
function config_checkbox_select($name$label$current$choices$usekeys=true$width=300$columns=1$autosave false,$on_change_js=null$hidden=false)
    {
    global 
$lang;
    
$currentvalues=explode(",",$current);
    
$wrap 0;
    
?>
    <div class="Question" id="question_ echo $name?> if ($hidden){echo "style=\"display:none;\"";} ?> >
    <label for=" echo htmlspecialchars($name)?>" > echo htmlspecialchars($label)?></label>
        
        
if($autosave)
            {
            
?>
            <div class="AutoSaveStatus">
                <span id="AutoSaveStatus- echo $name?>" style="display:none;"></span>
            </div>
            
            
}
        
?>
     
        <table cellpadding=2 cellspacing=0>
            <tr>
        
        
foreach($choices as $key => $choice)
            {
            
$value=$usekeys?$key:$choice;
            
$wrap++;
            if(
$wrap $columns)
                {
                
$wrap 1;
                
?>
                </tr>
                <tr>
                
                
}
                
?>
            <td width="1">
                <input type="checkbox"
                       name=" echo $name?>"
                       value=" echo $value?>"
                    
                    
if($autosave) { ?> onChange=" echo $on_change_js?>AutoSaveConfigOption(' echo $name?>');" }
                    if(
in_array($value$currentvalues))
                        {
                        
?>
                        checked
                        
                        
}?>
                    >
            </td>
            <td> echo htmlspecialchars(i18n_get_translated($choice)); ?>&nbsp;</td>
            
            
}
            
?>
            </tr>
        </table>
        <div class="clearerleft"></div>
  </div>
  

    
}

This article was last updated 30th November 2020 11:05 Europe/London time based on the source file dated 6th October 2020 10:25 Europe/London time.