📄 ticket_fields.php
字号:
$table[] = array('<b>Maximum Characters</b><br />You can set a maximum number of characters that the user may enter. Set to 0 to allow for unlimited entry', form_input('maxlength', $user_field[maxlength], '3'));
$table[] = array('<b>Custom Regex</b><br />You may use a custom regex to validate the input. You can find details about creating these in PHP\'s manual. A custom regex overrides any stipulations on minimum or maximum field length', form_input('regex', $user_field[regex], '45'));
$table[] = array('<b>Error Message</b><br />If the user enters text that fails the criteria you have specified above, this is the error that will be presented', $error);
$width = array('60%', '40%');
table_header('Field Criteria');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
// default value
$table[] = array('<b>Default Value</b><br />You may specify a default starting value here', form_input('default_value', $user_field[default_value], '45'));
$table[] = array('<b>Parsed Default Value</b><br />You may specify a parsed default value. This overrides any default value you may have set.', form_input('parsed_default_value', $user_field[parsed_default_value], '45'));
$width = array('60%', '40%');
table_header('Default Value');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
// display properties
$table[] = array('<b>Length</b><br />How long do you wish the TEXTAREA field to be?', form_input('length', $user_field[length], '4'));
$table[] = array('<b>Height</b><br />How many lines do you wish the TEXTAREA field to have?', form_input('height', $user_field[height], '4'));
$table[] = array('<b>Order</b><br />What order you wish the field to be displayed in relation to your other fields?', form_input('displayorder', $user_field[displayorder], '4'));
$width = array('60%', '40%');
table_header('Field Display Properties');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
############################### RADIO ###############################
} elseif ($user_field[formtype] == "radio") {
echo form_hidden('formtype', 'radio');
// regex
$table[] = array('<b>Require a Selection</b><br />Set yes to require the selection of a radio element)', form_radio_yn('required', '', $user_field[required]));
$table[] = array('<b>Error Message</b><br />The error message to be displayed if the user does not select an option. If you are enabling the extra INPUT field and have a custom regex which is not satisfied then this message would then be displayed.', $error);
$width = array('60%', '40%');
table_header('Field Criteria');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
// display properties
$table[] = array('<b>Order</b><br />What order you wish the field to be displayed in relation to your other fields?', form_input('displayorder', $user_field[displayorder], '3'));
$table[] = array('<b>Radio Elements Per line</b><br />How many radio elements do you want to display per line?', form_input('perline', $user_field[perline], '3'));
$width = array('60%', '40%');
table_header('Field Display Properties');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
// extra bit
$table[] = array('<b>Allow Alternative Input</b><br />Selecting Yes will generate an alternative INPUT field that will allow your user to enter custom information if none of the SELECT options are suitable. If you enable this feature it will override the requirement of a selection you may have set earlier.', form_radio_yn('extrainput', '', $user_field[extrainput], '', 'onClick="extrainput2();"'));
$table[] = array('<b>Minimum Characters</b><br />You can set a minimum number of characters that the user must enter in this field. Set to 0 for no stipulation (and to allow the field to be left empty)', form_input('minlength', $user_field[minlength], '3'));
$table[] = array('<b>Maximum Characters</b><br />You can set a maximum number of characters that the user may enter. Set to 0 to allow for unlimited entry', form_input('maxlength', $user_field[maxlength], '3'));
$table[] = array('<b>Custom Regex</b><br />You may use a custom regex to validate the input. You can find details about creating these in PHP\'s manual.', form_input('regex', $user_field[regex], '45'));
$table[] = array('<b>Length</b><br />How long do you wish the INPUT field to be?', form_input('length', $user_field[length], '3'));
$table[] = array('<b>Extrainput Text</b><br />The text to display to explain the presence of the input box. For example <I>Or enter your own option</I>', form_input('extrainput_text', $user_field[extrainput_text], 45));
$table[] = array('<b>Extrainput Location</b><br />Do you want the INPUT field to be displayed on a new line?', form_radio_yn('extrainput_location', '', $user_field[extrainput_location]));
$width = array('60%', '40%');
table_header('Extra Input');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
$field_data = unserialize($user_field[data]);
// get max number for creating new fields
if (is_array($field_data)) {
while (list ($key, $val) = each ($field_data)) {
$array_count[] = $field_data[$key][0];
}
$max = max($array_count);
reset($field_data);
}
$field_data[] = array($max+1, '', '', '', '');
$field_data[] = array($max+2, '', '', '', '');
$field_data[] = array($max+3, '', '', '', '');
$field_data[] = array($max+4, '', '', '', '');
$field_data[] = array($max+5, '', '', '', '');
while (list ($key, $val) = each ($field_data)) {
$table[] = array(
$val[0] . form_hidden($key, '1', $arrayto='elementid'),
form_input($val[0], $val[1], '3', 'order'),
iff($val[2], "<B>$val[2]</B>", "<I>n/a</I>"),
form_input($val[0], $val[2], '45', 'name'),
form_radio_yn($val[0], 'start', $val[3])
);
}
$columns = array('ID', 'Order', 'Current Value', 'New / Edit Value', 'Select by Default');
table_header('Field Data');
table_content($columns, $table);
table_footer();
unset($table);
// javascript to control options
?>
<SCRIPT>
function extrainput2() {
var value;
for (value = 0; value < document.fields.extrainput.length; value++)
{
if (document.fields.extrainput[value].checked == true)
{
yesno = document.fields.extrainput[value].value;
}
}
if (yesno == '1')
{
document.fields.minlength.disabled=false;
document.fields.maxlength.disabled=false;
document.fields.regex.disabled=false;
document.fields.length.disabled=false;
document.fields.extrainput_location[0].disabled=false;
document.fields.extrainput_location[1].disabled=false;
document.fields.extrainput_text.disabled=false;
} else {
document.fields.minlength.disabled=true;
document.fields.maxlength.disabled=true;
document.fields.regex.disabled=true;
document.fields.length.disabled=true;
document.fields.extrainput_location[0].disabled=true;
document.fields.extrainput_location[1].disabled=true;
document.fields.extrainput_text.disabled=true;
}
}
extrainput2();
</SCRIPT>
<?
// javascript to only allow one selected by default
############################### SELECT ###############################
} elseif ($user_field[formtype] == "select") {
echo form_hidden('formtype', 'select');
// regex
$table[] = array('<b>Require a Selection</b><br />Do you wish to require a selection. Note this field has no affect if you allow multiple selections, you should use the minimum option setting to control the amount of required information.', form_radio_yn('required', '', $user_field[required]));
$table[] = array('<b>Allow multiple selections</b><br />By allowing multiple selections your users can pick a number of options from the select menu. In terms of HTML, the element becomes a multiselect field. <b>Note:</b> enabling multiselect disables the alternative input option', form_radio_yn('multiselect', '', $user_field[multiselect], '', 'onClick="multipleselect();"'));
$table[] = array('<b>Maximum Options</b><br />The maximum number of options that can be selected. Set a 0 to have no maximum. (only applies if you are allowing multiple selections)', form_input('maxoptions', $user_field[maxoptions], '3'));
$table[] = array('<b>Minimum Options</b><br />The minimum amount of options that must be selected. Set a 0 to have no minumum. (only applies if you are allowing multiple selections otherwise use the require a selection setting)', form_input('minoptions', $user_field[minoptions], '3'));
$table[] = array('<b>Error Message</b><br />The error message to be displayed if the user does not select an option. If you are enabling the extra INPUT field and have a custom regex which is not satisfied then this message would then be displayed.', $error);
$width = array('60%', '40%');
table_header('Field Criteria');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
// display properties
$table[] = array('<b>Order</b><br />What order you wish the field to be displayed in relation to your other fields?', form_input('displayorder', $user_field[displayorder], '3'));
$table[] = array('<b>Height</b><br />How many rows do you wish to display for the select menu', form_input('height', $user_field[height], '3'));
$width = array('60%', '40%');
table_header('Field Display Properties');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
// extra bit
$table[] = array('<b>Allow Alternative Input</b><br />Selecting Yes will generate an alternative INPUT field that will allow your user to enter custom information if none of the SELECT options are suitable. If you enable this feature it will override the requirement of a selection you may have set earlier.', form_radio_yn('extrainput', '', $user_field[extrainput], '', 'onClick="extrainput2();"'));
$table[] = array('<b>Minimum Characters</b><br />You can set a minimum number of characters that the user must enter in this field. Set to 0 for no stipulation (and to allow the field to be left empty)', form_input('minlength', $user_field[minlength], '3'));
$table[] = array('<b>Maximum Characters</b><br />You can set a maximum number of characters that the user may enter. Set to 0 to allow for unlimited entry', form_input('maxlength', $user_field[maxlength], '3'));
$table[] = array('<b>Custom Regex</b><br />You may use a custom regex to validate the input. You can find details about creating these in PHP\'s manual', form_input('regex', $user_field[regex], '45'));
$table[] = array('<b>Length</b><br />How long do you wish the INPUT field to be?', form_input('length', $user_field[length], '3'));
$table[] = array('<b>Extrainput Text</b><br />The text to display to explain the presence of the input box. For example <I>Or enter your own option</I>', form_input('extrainput_text', $user_field[extrainput_text], 45));
$table[] = array('<b>Extrainput Location</b><br />Do you want the INPUT field to be displayed on a new line?', form_radio_yn('extrainput_location', '', $user_field[extrainput_location]));
$width = array('60%', '40%');
table_header('Extra Input');
table_content('', $table, '', '', '', '', $width);
table_footer();
unset($table, $width);
$field_data = unserialize($user_field[data]);
// get max number for creating new fields
if (is_array($field_data)) {
while (list ($key, $val) = each ($field_data)) {
$array_count[] = $field_data[$key][0];
}
$max = max($array_count);
reset($field_data);
}
$field_data[] = array($max+1, '', '', '');
$field_data[] = array($max+2, '', '', '');
$field_data[] = array($max+3, '', '', '');
$field_data[] = array($max+4, '', '', '');
$field_data[] = array($max+5, '', '', '');
while (list ($key, $val) = each ($field_data)) {
$table[] = array(
$val[0] . form_hidden($val[0], '1', $arrayto='elementid'),
form_input($val[0], $val[1], '3', 'order'),
iff($val[2], "<B>$val[2]</B>", "<I>n/a</I>"),
form_input($val[0], $val[2], '45', 'name'),
form_radio_yn($val[0], 'start', $val[3])
);
}
$columns = array('ID', 'Order', 'Current Value', 'New / Edit Value', 'Select by Default');
table_header('Field Data');
table_content($columns, $table);
table_footer();
unset($table);
// javascript to control options
?>
<SCRIPT>
function extrainput2() {
var value;
for (value = 0; value < document.fields.extrainput.length; value++)
{
if (document.fields.extrainput[value].checked == true)
{
yesno = document.fields.extrainput[value].value;
}
}
if (yesno == '1')
{
document.fields.minlength.disabled=false;
document.fields.maxlength.disabled=false;
document.fields.regex.disabled=false;
document.fields.length.disabled=false;
document.fields.extrainput_location[0].disabled=false;
document.fields.extrainput_location[1].disabled=false;
document.fields.extrainput_text.disabled=false;
} else {
document.fields.minlength.disabled=true;
document.fields.maxlength.disabled=true;
document.fields.regex.disabled=true;
document.fields.length.disabled=true;
document.fields.extrainput_location[0].disabled=true;
document.fields.extrainput_location[1].disabled=true;
document.fields.extrainput_text.disabled=true;
}
}
function multipleselect() {
var value;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -