diff options
Diffstat (limited to 'h-source/Library/Html/Form.php')
| -rw-r--r-- | h-source/Library/Html/Form.php | 48 | 
1 files changed, 11 insertions, 37 deletions
diff --git a/h-source/Library/Html/Form.php b/h-source/Library/Html/Form.php index 91b2aa0..ec81cfb 100644 --- a/h-source/Library/Html/Form.php +++ b/h-source/Library/Html/Form.php @@ -2,7 +2,7 @@  // EasyGiant is a PHP framework for creating and managing dynamic content  // -// Copyright (C) 2009 - 2014  Antonio Gallo (info@laboratoriolibero.com) +// Copyright (C) 2009 - 2011  Antonio Gallo  // See COPYRIGHT.txt and LICENSE.txt.  //  // This file is part of EasyGiant @@ -70,10 +70,10 @@ class Html_Form {  				$a = $optionValue;  			} -			if (strcmp($optionValue,'optgroupOpen') === 0) +			if (strcmp($b,'optgroupOpen') === 0)  			{  				if ($flag === 1) $returnString .= "</optgroup>\n"; -				$returnString .= "<optgroup label='" . $optionName . "'>\n"; +				$returnString .= "<optgroup label='" . $a . "'>\n";  				$flag = 1;  			}  			else @@ -83,7 +83,7 @@ class Html_Form {  			}  		}  		if ($flag === 1) $returnString .= "</optgroup>\n"; -		$returnString .= "</select>"; +		$returnString .= "</select>\n";  		return $returnString;  	} @@ -97,7 +97,7 @@ class Html_Form {  		$strClass = isset($className) ? "class='".$className."'" : null;  		$idStr = isset($idName) ? "id='".$idName."'" : null; -		$returnString ="<input $attributes ".$idStr." $strClass type='text' name='" .$name. "' value = '$value' />"; +		$returnString ="<input $attributes ".$idStr." $strClass type='text' name='" .$name. "' value = '$value' />\n";  		return $returnString;  	} @@ -110,7 +110,7 @@ class Html_Form {  		$strClass = isset($className) ? "class='".$className."'" : null;  		$idStr = isset($idName) ? "id='".$idName."'" : null; -		$returnString ="<input $attributes ".$idStr." $strClass type='file' name='" .$name. "' />"; +		$returnString ="<input $attributes ".$idStr." $strClass type='file' name='" .$name. "' />\n";  		return $returnString;  	} @@ -126,7 +126,7 @@ class Html_Form {  		$idStr = isset($idName) ? "id='".$idName."'" : null;  		$str = (strcmp($value,$option) === 0) ? "checked = 'checked'" : null; -		return "<input $attributes ".$idStr." $strClass type='checkbox' name='".$name."' value='".$option."' $str />"; +		return "<input $attributes ".$idStr." $strClass type='checkbox' name='".$name."' value='".$option."' $str />\n";  	}  	//return the HTML of a hidden entry @@ -137,7 +137,7 @@ class Html_Form {  		$strClass = isset($className) ? "class='".$className."'" : null;  		$idStr = isset($idName) ? "id='".$idName."'" : null; -		return "<input $attributes ".$idStr." $strClass type='hidden' name='" .$name. "' value = '$value'>"; +		return "<input $attributes ".$idStr." $strClass type='hidden' name='" .$name. "' value = '$value'>\n";  	}  	//return the HTML of a password entry @@ -149,7 +149,7 @@ class Html_Form {  		$strClass = isset($className) ? "class='".$className."'" : null;  		$idStr = isset($idName) ? "id='".$idName."'" : null; -		return "<input $attributes ".$idStr." $strClass type='password' name='" .$name. "' value='$value' />"; +		return "<input $attributes ".$idStr." $strClass type='password' name='" .$name. "' value='$value' />\n";  	}  	//return the HTML of a textarea @@ -161,7 +161,7 @@ class Html_Form {  		$strClass = isset($className) ? "class='".$className."'" : null;  		$idStr = isset($idName) ? "id='".$idName."'" : null; -		return "<textarea $attributes ".$idStr." $strClass name='" .$name. "'>$value</textarea>"; +		return "<textarea $attributes ".$idStr." $strClass name='" .$name. "'>$value</textarea>\n";  	}  	//return the HTML of a radio button @@ -202,33 +202,7 @@ class Html_Form {  			}  			$str= (strcmp($value,$optionValue) === 0) ? "checked='checked'" : null; -			$returnString .= "$before<input $attributes ".$idStr." $strClass type='radio' name='".$name."' value='".$optionValue."' $str />$after"; -		} -		 -		return $returnString; -	} -	 -	//return the HTML of an <input type='submit' ...> -	//$name: the name of the input -	//$value: the value of the input -	//$className: the class name of the input -	//$idName: name of the id -	//$image: url of the image (if it is an image button) -	//$attributes: list of attributes -	static public function submit($name, $value, $className = null, $idName = null, $image = null, $attributes = null) -	{ -		$strClass = isset($className) ? "class='".$className."'" : null; -		$idStr = isset($idName) ? "id='".$idName."'" : null; -		 -		if (isset($image)) -		{ -			$returnString = "<input $attributes $idStr $strClass type='image' src='".$image."' value='$value'>"; -			$returnString .= "<input type='hidden' name='".$name."' value='$value'>"; -		} -		else -		{ -			$returnString = '<button '.$idStr.' '.$attributes.' '.$strClass.' type="submit" name="' .$name. '">'.$value.'</button>'; -			$returnString .= "<input type='hidden' name='".$name."' value='$value'>"; +			$returnString .= "$before<input $attributes ".$idStr." $strClass type='radio' name='".$name."' value='".$optionValue."' $str />$after\n";  		}  		return $returnString;  | 
