Location: PHPKode > projects > FxFramework > fxFrm/fxControls.php
<?php
include_once('fxDataBase.php');
include_once('fxErrors.php');

class FxTextBox
{
	public static function textBox($name, $id, $style, $classname, $value)
	{
		$style = $style != '' ? "style=\"".$style."\"" : "";
		$classname = $classname != '' ? "class=\"".$classname."\"" : "";
		return "<input type='textbox' name='".$name."' id='".$id."' value='".$value."' ".$classname." ".$style." />";
	}
}

class FxPasswordBox
{
	public static function passwordBox($name, $id, $style, $classname, $value)
	{
		$style = $style != '' ? "style=\"".$style."\"" : "";
		$classname = $classname != '' ? "class=\"".$classname."\"" : "";
		return "<input type='password' name='".$name."' id='".$id."' value='".$value."' ".$classname." ".$style." />";
	}
}

class FxSubmit
{
	public static function submitButton($name, $id, $style, $classname, $value)
	{
		$style = $style != '' ? "style=\"".$style."\"" : "";
		$classname = $classname != '' ? "class=\"".$classname."\"" : "";
		return "<input type='submit' name='".$name."' id='".$id."' value='".$value."' ".$classname." ".$style." />";
	}
}

class FxPostBackLink
{
	public static function postBackLink($postBackURL, $value, $uID)
	{
		if(strpos($postBackURL, "?") !== false)
		{
			$conCat = "&uID=".base64_encode($uID);
		}
		else
		{
			$conCat = "?uID=".base64_encode($uID);
		}
		return "<a href='".$postBackURL.$conCat."'>".$value."</a>";
	}
}

class FxFileUpload
{
	public function fileUpload($name, $id, $style, $classname)
	{
		$style = $style != '' ? "style=\"".$style."\"" : "";
		$classname = $classname != '' ? "class=\"".$classname."\"" : "";
		return "<input type='file' name='".$name."' id='".$id."' ".$classname." ".$style." />";
	}
}

class FxDbComboBox
{
	public static function dbComboBox($connection, $sql, $valueField, $labelField, $name, $id, $style, $classname, $value)
	{
		if(!is_a($connection, "FxDataBase"))
		{
			FxError::fxCritical("The supplied argumen it not a connection object.");
		}
		
		$style = $style != '' ? "style=\"".$style."\"" : "";
		$classname = $classname != '' ? "class=\"".$classname."\"" : "";
		$retStr = "<select name='".$name."' id='".$id."' ".$classname." ".$style." >";
		
		$recordSet = array();
		$connection->fxDbQuery($sql, $recordSet);
		foreach ($recordSet as $row)
		{
			$retStr .= "<option value='".$row[$valueField]."'>".$row[$labelField]."</option>";
		}
		
		$retStr .= "</select>";
		return $retStr;
	}
}

class FxDateInput
{
	public static function dateInput($first, $name, $id, $style, $classname, $value, $lang)
	{
		$retStr = FxTextBox::textBox($name, $id, $style, $classname, $value);
		$retStr .= '<button type="reset" id="date_trigger_'.$name.'">...</button>';
		if($first)
		{
			$retStr .= '
			<!-- calendar stylesheet -->
			  <link rel="stylesheet" type="text/css" media="all" href="fxFrm/3rd_party_lib/jscalendar-1.0/calendar-win2k-cold-1.css" title="win2k-cold-1" />
			
			  <!-- main calendar program -->
			  <script type="text/javascript" src="fxFrm/3rd_party_lib/jscalendar-1.0/calendar.js"></script>
			
			  <!-- language for the calendar -->
			  <script type="text/javascript" src="fxFrm/3rd_party_lib/jscalendar-1.0/lang/calendar-'.$lang.'.js"></script>
			
			  <!-- the following script defines the Calendar.setup helper function, which makes
			       adding a calendar a matter of 1 or 2 lines of code. -->
			  <script type="text/javascript" src="fxFrm/3rd_party_lib/jscalendar-1.0/calendar-setup.js"></script>
			 ';
		}
		$retStr .= '
		<script type="text/javascript">
	    Calendar.setup({
	        inputField     :    "'.$name.'",      // id of the input field
	        ifFormat       :    "%d/%m/%Y %H:%M",       // format of the input field
	        showsTime      :    true,            // will display a time selector
	        timeFormat     :    "24",
	        button         :    "date_trigger_'.$name.'",   // trigger for the calendar (button ID)
	        singleClick    :    false,           // double-click mode
	        step           :    1                // show all years in drop-down boxes (instead of every other year as default)
	    });
		</script>
		';
		
		return $retStr;
	}
}

?>
Return current item: FxFramework