示例#1
0
文件: integer.php 项目: jonesxv/csf
function place_input_integer($sid, $value, $options, $setup)
{
    $dashboard_options = $options['dashboard_options'];
    echo '<div id="cover' . $sid . '">';
    echo reload_input_integer($sid, $value, $options, $setup);
    echo '</div>';
    //make sure dashboard is passed in here(check map for example)
    //also make sure at the top of this file, we have all setup information
    echo '	<script language="JavaScript" type="text/javascript">
				function update' . $sid . '(dashboard, response)
				{
					make_update(response.svid, response.value);
				}
				function reload' . $sid . '(dashboard, response)
				{
					place_input(dashboard, ' . $sid . ', {\'onUpdate\': function(response,xmlhttp){reload_update' . $sid . '(response)}});
				}
				function mark' . $sid . '(dashboard, response)
				{
					document.getElementById("' . $setup['value_svid'] . '").style.border=\'1px solid red\';
				}
				function reload_update' . $sid . '(response)
				{
					document.getElementById("cover' . $sid . '").innerHTML = response;
				}
			</script>';
}
示例#2
0
function place_input($dashboard, $sid)
{
	global $db;

	$sql="select ".$schema."station_variables.svid as svid, ".$schema."station_variables.name as name, ".$schema."station_variables.value as value from ".$schema."station_variables where ".$schema."station_variables.sid='".$sid."' and (".$schema."station_variables.name='name' or ".$schema."station_variables.name='value' or ".$schema."station_variables.name='xc' or ".$schema."station_variables.name='yc' or ".$schema."station_variables.name='show' or ".$schema."station_variables.name='type' or ".$schema."station_variables.name='options' or ".$schema."station_variables.name='taborder'  or ".$schema."station_variables.name='moduletype')";
	$result			= $db->fetchAll($sql);

	foreach($result as $variable)
	{
		$value[$variable['name']] = $variable['value'];
		$key[$variable['name']]   = $variable['svid'];
	}
	
		if (in_array($dashboard,explode(',',$value['show'])))
		{
			$key1	= array_search($dashboard, explode(',',$value['show']));
			$x		= explode(',',$value['xc']);
			$y		= explode(',',$value['yc']);
			if(isset($x[$key1])) $value['xc']	= $x[$key1];
			if(isset($y[$key1])) $value['yc']	= $y[$key1];
		}
		
		switch($value['type']):
			case "integer":
				$content = reload_input_integer($key['value'],$value['value'],$value['xc'],$value['yc'],$value['options'],$sid);
				break;
			case "float":
				$content = reload_input_float($key['value'],$value['value'],$value['xc'],$value['yc'],$value['options'],$sid);
				break;
			case "checkbox":
				$content = reload_input_checkbox($key['value'],$value['value'],$value['xc'],$value['yc'],$value['options'],$sid);
				break;
			case "dropdown":
				$content = reload_input_dropdown($key['value'],$value['value'],$value['xc'],$value['yc'],$value['options'],$sid);
				break;
			case "dropdowntable":
				$content = reload_input_dropdowntable($key['value'],$value['value'],$value['xc'],$value['yc'],$value['options'],$sid);
				break;
		endswitch;
	return $content;	
}