field with one element selectable (drop down). */ class ezcWgTplFormSelectElement extends ezcWgFormFieldElement { private $properties = array(); public function __construct( ezcWgWidget $parent, ezcWgFormWidget $form, ezcWgTplSingleInputFilter $filter = null ) { parent::__construct( $parent, $form, "select_element" ); $this->options = array(); $this->filter = $filter; } /** * Sets the property $name to $value. * * @throws ezcBasePropertyNotFoundException if the property does not exist. * @param string $name * @param mixed $value * @ignore */ public function __set( $name, $value ) { switch ( $name ) { case 'value': case 'filter': case 'options': $this->properties[$name] = $value; break; default: parent::__set( $name, $value ); break; } } /** * Returns the property $name. * * @throws ezcBasePropertyNotFoundException if the property does not exist. * @param string $name * @return mixed * @ignore */ public function __get( $name ) { switch ( $name ) { case 'value': case 'filter': case 'options': return isset( $this->properties[$name] ) ? $this->properties[$name] : null; break; default: return parent::__get( $name ); break; } } public function addOption( $value, $text, $selected = false ) { $this->properties['options'][$value] = $text; if( $selected ) { $this->value = $value; } } public function render() { $output = ""; return $output; } public function dataRetrievedEvent( ezcWgFormEvent $e ) { if( $this->filter !== null ) { } else // default { $this->value = $_POST[$this->name]; $this->isValid = true; } } } ?>