type = $type;
$this->name = $name;
$this->value = $value;
$this->setCssClass('input');
}
// ###################################################################
/**
* If the type is either checkbox, radio, or option then this will
* set the selected/checked attribute
*
* @param boolean Active?
*/
public function setActive($active)
{
if (!in_array($this->type, array('checkbox', 'radio', 'option')))
{
trigger_error('PrinterBaseElement::setActive() can only be used on elements of type checkbox, radio, or option');
}
$this->active = $active;
}
// ###################################################################
/**
* Returns the output HTML
*
* @return string Output HTML
*/
public function paint()
{
$name = ' name="' . $this->name . '"';
$value = ' value="' . $this->value . '"';
switch ($this->type)
{
case 'text':
case 'password':
case 'button':
case 'submit':
case 'reset':
return 'type == 'text' OR $this->type == 'password') ? ' size="35" maxlength="255"' : ''). $this->_prepareStyle() . ' />';
break;
case 'hidden':
return '';
break;
case 'checkbox':
case 'radio':
return 'active ? ' checked="checked"' : '') . $this->_prepareStyle() . ' />';
break;
case 'upload':
return '_prepareStyle() . ' />';
break;
case 'option':
return '';
break;
default:
trigger_error('Invalid PrinterBaseElement type "' . $this->type . '"');
break;
}
}
}
/*=====================================================================*
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>