Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

config_single_ftype_select()

Description

Generate an html single-select + options block for selecting one of the RS field types. The
selected field type is posted as the value of the "ref" column of the selected field type.

Parameters

ColumnTypeDefaultDescription
$name string the name of the select block. Usually the name of the config variable being set.
$label string the user text displayed to label the select block. Usually a $lang string.
$current integer the current value of the config variable being set
$width integer 300 the width of the input field in pixels. Default: 300.
$rtype false
$ftypes array
$autosave false

Location

include/config_functions.php lines 915 to 957

Definition

 
function config_single_ftype_select($name$label$current$width=300$rtype=false$ftypes=array(), $autosave false)
    {
    global 
$lang;
    
$fieldtypefilter="";
    if(
count($ftypes)>0)
        {
        
$fieldtypefilter " type in ('" implode("','"$ftypes) . "')";
        }
        
    if(
$rtype===false){
        
$fields=sql_query('select * from resource_type_field ' .  (($fieldtypefilter=="")?'':' where ' $fieldtypefilter) . ' order by title, name'"schema");
    }
    else{
        
$fields=sql_query("select * from resource_type_field where resource_type='$rtype' " .  (($fieldtypefilter=="")?"":" and " $fieldtypefilter) . "order by title, name""schema");
    }
?>
  <div class="Question">
    <label for=" echo $name?>" title=" echo str_replace('%cvn'$name$lang['plugins-configvar'])?>"> echo $label?></label>
    
     
    
if($autosave)
        {
        
?>
        <div class="AutoSaveStatus">
            <span id="AutoSaveStatus- echo $name?>" style="display:none;"></span>
        </div>
        
        
}
        
?>
    <select name=" echo $name?>" id=" echo $name?>" style="width: echo $width ?>px"
     if($autosave) { ?> onChange="AutoSaveConfigOption(' echo $name?>');" ?>>
    <option value=""  echo (($current=="")?' selected':''?>></option>

    
foreach($fields as $field)
        {
        echo 
'    <option value="'$field['ref'] . '"' . (($current==$field['ref'])?' selected':'') . '>' lang_or_i18n_get_translated($field['title'],'fieldtitle-') . '</option>';
        }
?>
    </select>
  <div class="clearerleft"></div>
  </div>

    
}

This article was last updated 5th July 2020 04:05 Europe/London time based on the source file dated 18th May 2020 17:14 Europe/London time.