⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user_fields.php

📁 jsp程序开发系统
💻 PHP
📖 第 1 页 / 共 3 页
字号:

			$name .= "<tr><td><b>$lang[name]</b>:</td><td>" . form_input($lang[id], $user_field[display_name][$lang[id]], 30, 'display_name') . "</td></tr>";
			$description .= "<tr><td><b>$lang[name]</b>:</td><td>" . form_textarea($lang[id], 40, 5, $user_field[description][$lang[id]], 'description') . "</td></tr>";
			$error .= "<tr><td><b>$lang[name]</b>:</td><td>" . form_textarea($lang[id], 40, 5, $user_field[error_message][$lang[id]], 'error_message') . "</td></tr>";

		}

		$name .= "</table><input type=\"button\" value=\"Collapse Language Options\" onclick=\"oc('name');oc('name2')\"></div><div id=\"name2\"><input type=\"button\" value=\"Expand Language Options\" onclick=\"oc('name');oc('name2');\"><div><script>oc('name')</script>";

		$description .= "</table><input type=\"button\" value=\"Collapse Language Options\" onclick=\"oc('description');oc('description2')\"></div><div id=\"description2\"><input type=\"button\" value=\"Expand Language Options\" onclick=\"oc('description');oc('description2');\"><div><script>oc('description')</script>";
		
		$error .= "</table><input type=\"button\" value=\"Collapse Language Options\" onclick=\"oc('error');oc('error2')\"></div><div id=\"error2\"><input type=\"button\" value=\"Expand Language Options\" onclick=\"oc('error');oc('error2');\"><div><script>oc('error')</script>";

	} else {

		$name = form_input('display_name', $user_field[display_name][$settings[default_language]]);
		$description = form_textarea('description', 50, 5, $user_field[description][$settings[default_language]]);
		$error = form_textarea('error_message', 50, 5, $user_field[error_message][$settings[default_language]]);

	}
	############################### STANDARD FOR ALL ############################### 

	// display options
	$table[] = array('<b>Display Name</b><br />This is the name of the field that will be presented to technicians and users', $name);

	// show different message if new/edit
	if ($_REQUEST['do'] == "edit") {
		$table[] = array('<b>Database Name</b><br />This is the name of the field as it is in the database. This is the name you would use to call the value in your templates', $user_field[name]);
	} else {
		$table[] = array('<b>Database Name</b><br />This is the name of the field as it is in the database. This is the name you would use to call the value in your templates', '<I>Generated upon field creation</I>');
	}

	$table[] = array('<b>Description</b><br />The description that will be presented for this field to your users', $description);

	if ($user_field[formtype] != "system") {
		$table[] = array('<b>Display During Registration</b><br />Do you wish this field to be presented to the user during registration?', form_radio_yn('user_start', '', $user_field[user_start]));
	}

	$width = array('60%', '40%');
	table_header('Field Details');
	table_content('', $table, '', '', '', '', $width);
	table_footer();
	unset($table, $width);

	// field permissions
	$table[] = array('<b>User Viewable</b><br />Do you wish to allow your users to view this field?', form_radio_yn('user_viewable', '', $user_field[user_viewable]));
	if ($user_field[formtype] != "system") {
		$table[] = array('<b>User Editable</b><br />Do you wish to allow your users to edit the data held in this field?', form_radio_yn('user_editable', '', $user_field[user_editable]));
	}
	$table[] = array('<b>Tech Viewable</b><br />Do you wish to allow your staff to view this field?', form_radio_yn('tech_viewable', '', $user_field[tech_viewable]));
	if ($user_field[formtype] != "system") {
		$table[] = array('<b>Tech Editable</b><br />Do you wish to allow your staff to edit this field?', form_radio_yn('tech_editable', '', $user_field[tech_editable]));
	}

	$width = array('60%', '40%');
	table_header('Field Permissions');
	table_content('', $table, '', '', '', '', $width);
	table_footer();
	unset($table, $width);


	############################### INPUT ############################### 

	if ($user_field[formtype] == "input") {

		echo form_hidden('formtype', 'input');

		// regex
		$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 PHP 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 INPUT field to be?', form_input('length', $user_field[length], '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);

	############################### TEXTAREA ############################### 

	} elseif ($user_field[formtype] == "textarea") {

		echo form_hidden('formtype', 'textarea');

		// regex
		$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. 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[4])
				);
		}

		$table[] = array('<I>To delete a field, empty its New / Edit value. Note this will also delete any
			data associated with that field.</I>');

		$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>
		<?

	############################### 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 require 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();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -