| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 
 | <?php
	/**
	 * Class to handle basic HTML GUI functions
	 *
	 * $Id: Gui.php,v 1.2 2004/06/07 20:03:22 soranzo Exp $
	 */
	 class GUI {
		/**
		 *Constructor
		 */
		function GUI () {}
		 
		/**
		 * Prints a combox box
		 * @param $arrOptions associative array storing options and values of combo should be Option => Value
		 * @param $szName string to specify the name of the form element
		 * @param (optional) $bBlankEntry bool to specify whether or not we want a blank selection 
		 * @param (optional) $szDefault string to specify the default VALUE selected 
		 * @param (optional) $bMultiple bool to specify whether or not we want a multi select combo box
		 * @param (optional) $iSize int to specify the size IF a multi select combo
		 * @return string with the generated HTML select box
		 */
		function printCombo(&$arrOptions, $szName, $bBlankEntry = true, $szDefault = '', $bMultiple = false, $iSize = 10) {
			$htmlOut = '';
			if ($bMultiple) // If multiple select combo
				$htmlOut .= "<select name=\"$szName\" id=\"$szName\" multiple=\"multiple\" size=\"$iSize\">\n";
			else
				$htmlOut .= "<select name=\"$szName\" id=\"$szName\">\n";
			if ($bBlankEntry)
				$htmlOut .= "<option value=\"\"></option>\n";				
			
			foreach ($arrOptions AS $curKey => $curVal) {
				$curVal = htmlspecialchars($curVal);
				$curKey = htmlspecialchars($curKey);
				if ($curVal == $szDefault) {			
					$htmlOut .= "<option value=\"$curVal\" selected=\"selected\">$curKey</option>\n";	
				}
				else {
					$htmlOut .= "<option value=\"$curVal\">$curKey</option>\n";	
				}
			}
			$htmlOut .= "</select>\n";
			return $htmlOut;
		}
	 }
?>
 |