Location: PHPKode > projects > InvisiblePortal > trunk/includes/class-forms.php
<?
// Main conf extends forms, this will draw our config boxes, Forms defines the base layout.
class MainConf extends Forms
{
// $type is the type of form to draw, the $num is the number to draw it and $value is the inputs value.  $label is the id/name of the intput type and $ desc is used to add a description/instructions for the label.
	function main_intext($type, $value,$label, $desc)
	{
		// We check $type and draw it.
		switch($type)
		{
			case 'label':
				$this->name = $label;
				$this->base_label($value);
				break;
			case 'textbox':
				$this->name = $label;
				$this->base_textbox($value);
				echo $desc.'<br />';
				break;
			case 'textarea':
				$this->name = $label;
				$this->base_texarea($value);
				break;
			case 'submit':
				$this->name = $label;
				$this->base_submit($value);
				break;
			case 'intext':
				$this->name = $label;
				$this->base_intext($value);
				echo $desc.'<br />';
				break;
			case 'radio':
				$this->name = $label;
				$this->base_radio($value);
				break;
			case 'check':
				$this->name = $label;
				$this->base_check($value);
				break;
			case 'password':
				$this->name = $label;
				$this->base_password($value);
				break;
			default:
				die('Invalid Form Type');
				break;
		}
	}
}

class Forms
{
	public $name;

	function base_textbox($value)
	{
		echo '<input type="text" id="'.$this->name.'" name="'.$this->name.'" value="'.$value.'" class="commentbox" />';
	}

	function base_texarea($value)
	{
		echo '<textarea id="'.$this->name.'" name="'.$this->name.'" class="commenttextbox">'.$value.'</textarea>';
	}

	function base_submit($value)
	{
		echo '<input type="submit" id="'.$this->name.'" name="'.$this->name.'" value="'.$value.'" class="commentbutton" />';
	}

	function base_label($value)
	{
		echo '<label for="'.$this->name.'">'.$value.'</label>';
	}

	function base_radio($value)
	{
		echo '<input type="radio" id="'.$this->name.'" name="'.$this->name.'" value="'.$value.'" />';
	}

	function base_check($value)
	{
		echo 'input type="checked" id"'.$this->name.'" name "'.$this->name.'" value="'.$value.'" />';
	}
	
	function base_password($value)
	{
		echo '<input type="password" id="'.$this->name.'" name="'.$this->name.'" value="'.$value.'" class="commentbox" />';
	}
}
?>
Return current item: InvisiblePortal