Author: Frederik Holljen
Date: 2006-08-28 14:21:11 +0200 (Mon, 28 Aug 2006)
New Revision: 3410
Log:
- update to follow property system (part deux)
Modified:
experimental/WidgetTemplateTiein/src/widgets/form_button_element.php
experimental/WidgetTemplateTiein/src/widgets/form_hidden_element.php
experimental/WidgetTemplateTiein/src/widgets/form_multi_select_element.php
experimental/WidgetTemplateTiein/src/widgets/form_select_element.php
experimental/WidgetTemplateTiein/src/widgets/form_text_area_element.php
experimental/WidgetTemplateTiein/src/widgets/form_text_element.php
Modified: experimental/WidgetTemplateTiein/src/widgets/form_button_element.php
===================================================================
--- experimental/WidgetTemplateTiein/src/widgets/form_button_element.php
2006-08-28 12:20:45 UTC (rev 3409)
+++ experimental/WidgetTemplateTiein/src/widgets/form_button_element.php
2006-08-28 12:21:11 UTC (rev 3410)
@@ -13,7 +13,7 @@
*/
class ezcWgTplFormButtonElement extends ezcWgFormFieldElement
{
- private $text = '';
+ private $properties = array();
public function __construct( ezcWgWidget $parent, ezcWgFormWidget $form,
$text = '' )
{
@@ -21,6 +21,50 @@
$this->text = $text;
}
+ /**
+ * 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 'text':
+ $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 'text':
+ return isset( $this->properties[$name] ) ?
$this->properties[$name] : null;
+ break;
+
+ default:
+ parent::__get( $name, $value );
+ break;
+ }
+ }
+
public function render()
{
return "<button name=\"{$this->name}\"
type=\"submit\">{$this->text}</button>";
Modified: experimental/WidgetTemplateTiein/src/widgets/form_hidden_element.php
===================================================================
--- experimental/WidgetTemplateTiein/src/widgets/form_hidden_element.php
2006-08-28 12:20:45 UTC (rev 3409)
+++ experimental/WidgetTemplateTiein/src/widgets/form_hidden_element.php
2006-08-28 12:21:11 UTC (rev 3410)
@@ -13,24 +13,60 @@
*/
class ezcWgTplFormHiddenElement extends ezcWgFormFieldElement
{
- private $value = '';
- private $filter = null;
+ private $properties = array();
public function __construct( ezcWgWidget $parent, ezcWgFormWidget $form,
$value = '',
ezcWgTplSingleInputFilter $filter = null )
{
parent::__construct( $parent, $form, "text_element" );
$this->value = $value;
+ $this->filter = $filter;
}
- public function getValue()
+ /**
+ * 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 )
{
- return $this->value;
+ switch ( $name )
+ {
+ case 'value':
+ case 'filter':
+ $this->properties[$name] = $value;
+ break;
+ default:
+ parent::__set( $name, $value );
+ break;
+ }
+
}
- public function setValue( $value )
+ /**
+ * Returns the property $name.
+ *
+ * @throws ezcBasePropertyNotFoundException if the property does not exist.
+ * @param string $name
+ * @return mixed
+ * @ignore
+ */
+ public function __get( $name )
{
- $this->value = $value;
+ switch ( $name )
+ {
+ case 'value':
+ case 'filter':
+ return isset( $this->properties[$name] ) ?
$this->properties[$name] : null;
+ break;
+
+ default:
+ return parent::__get( $name );
+ break;
+ }
}
public function render()
Modified:
experimental/WidgetTemplateTiein/src/widgets/form_multi_select_element.php
===================================================================
--- experimental/WidgetTemplateTiein/src/widgets/form_multi_select_element.php
2006-08-28 12:20:45 UTC (rev 3409)
+++ experimental/WidgetTemplateTiein/src/widgets/form_multi_select_element.php
2006-08-28 12:21:11 UTC (rev 3410)
@@ -13,41 +13,75 @@
*/
class ezcWgTplFormMultiSelectElement extends ezcWgFormFieldElement
{
- private $options = array();
- private $values = array();
- private $size = null;
- private $filter = null;
+ private $properties = array();
public function __construct( ezcWgWidget $parent, ezcWgFormWidget $form,
$size = 5, ezcWgTplSingleInputFilter $filter = null )
{
parent::__construct( $parent, $form, "multi_select_element", true );
$this->size = $size;
+ $this->values = array();
+ $this->options = array();
}
- public function getValues()
+ /**
+ * 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 )
{
- return $this->value;
+ switch ( $name )
+ {
+ case 'options':
+ case 'values':
+ case 'filter':
+ case 'size':
+ $this->properties[$name] = $value;
+ break;
+ default:
+ parent::__set( $name, $value );
+ break;
+ }
+
}
- public function setValues( $value )
+ /**
+ * Returns the property $name.
+ *
+ * @throws ezcBasePropertyNotFoundException if the property does not exist.
+ * @param string $name
+ * @return mixed
+ * @ignore
+ */
+ public function __get( $name )
{
- $this->values[] = $value;
+ switch ( $name )
+ {
+ case 'options':
+ case 'values':
+ case 'filter':
+ case 'size':
+ return isset( $this->properties[$name] ) ?
$this->properties[$name] : null;
+ break;
+
+ default:
+ return parent::__get( $name );
+ break;
+ }
}
public function addOption( $value, $text, $selected = false )
{
- $this->options[$value] = $text;
+ $this->properties['options'][$value] = $text;
if( $selected )
{
- $this->values = $value;
+ $this->properties['values'] = $value;
}
}
- public function getOptions()
- {
- return $this->options;
- }
-
public function render()
{
$output = "<select size=\"{$this->size}\" name=\"{$this->name}\"
multiple=\"multiple\">";
Modified: experimental/WidgetTemplateTiein/src/widgets/form_select_element.php
===================================================================
--- experimental/WidgetTemplateTiein/src/widgets/form_select_element.php
2006-08-28 12:20:45 UTC (rev 3409)
+++ experimental/WidgetTemplateTiein/src/widgets/form_select_element.php
2006-08-28 12:21:11 UTC (rev 3410)
@@ -13,28 +13,66 @@
*/
class ezcWgTplFormSelectElement extends ezcWgFormFieldElement
{
- private $options = array();
- private $value = null;
- private $filter = null;
+ 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;
}
- public function getValue()
+ /**
+ * 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 )
{
- return $this->value;
+ switch ( $name )
+ {
+ case 'value':
+ case 'filter':
+ case 'options':
+ $this->properties[$name] = $value;
+ break;
+ default:
+ parent::__set( $name, $value );
+ break;
+ }
+
}
- public function setValue( $value )
+ /**
+ * Returns the property $name.
+ *
+ * @throws ezcBasePropertyNotFoundException if the property does not exist.
+ * @param string $name
+ * @return mixed
+ * @ignore
+ */
+ public function __get( $name )
{
- $this->value = $value;
+ 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->options[$value] = $text;
+ $this->properties['options'][$value] = $text;
if( $selected )
{
$this->value = $value;
Modified:
experimental/WidgetTemplateTiein/src/widgets/form_text_area_element.php
===================================================================
--- experimental/WidgetTemplateTiein/src/widgets/form_text_area_element.php
2006-08-28 12:20:45 UTC (rev 3409)
+++ experimental/WidgetTemplateTiein/src/widgets/form_text_area_element.php
2006-08-28 12:21:11 UTC (rev 3410)
@@ -13,11 +13,7 @@
*/
class ezcWgTplFormTextAreaElement extends ezcWgFormFieldElement
{
- private $value = '';
- private $size = null;
- private $rows = null;
- private $cols = null;
- private $filter = null;
+ private $properties = array();
public function __construct( ezcWgWidget $parent, ezcWgFormWidget $form,
$rows, $cols, $value = '' )
{
@@ -27,19 +23,59 @@
$this->cols = $cols;
}
- public function render()
+ /**
+ * 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 )
{
- return "<textarea name=\"{$this->name}\" rows=\"{$this->rows}\"
cols=\"{$this->cols}\">{$this->value}</textarea>";
+ switch ( $name )
+ {
+ case 'value':
+ case 'rows':
+ case 'cols':
+ case 'filter':
+ $this->properties[$name] = $value;
+ break;
+ default:
+ parent::__set( $name, $value );
+ break;
+ }
+
}
- public function getValue()
+ /**
+ * Returns the property $name.
+ *
+ * @throws ezcBasePropertyNotFoundException if the property does not exist.
+ * @param string $name
+ * @return mixed
+ * @ignore
+ */
+ public function __get( $name )
{
- return $this->value;
+ switch ( $name )
+ {
+ case 'value':
+ case 'rows':
+ case 'cols':
+ case 'filter':
+ return isset( $this->properties[$name] ) ?
$this->properties[$name] : null;
+ break;
+
+ default:
+ return parent::__get( $name );
+ break;
+ }
}
- public function setValue( $value )
+ public function render()
{
- $this->value = $value;
+ return "<textarea name=\"{$this->name}\" rows=\"{$this->rows}\"
cols=\"{$this->cols}\">{$this->value}</textarea>";
}
public function dataRetrievedEvent( ezcWgFormEvent $e )
Modified: experimental/WidgetTemplateTiein/src/widgets/form_text_element.php
===================================================================
--- experimental/WidgetTemplateTiein/src/widgets/form_text_element.php
2006-08-28 12:20:45 UTC (rev 3409)
+++ experimental/WidgetTemplateTiein/src/widgets/form_text_element.php
2006-08-28 12:21:11 UTC (rev 3410)
@@ -13,9 +13,7 @@
*/
class ezcWgTplFormTextElement extends ezcWgFormFieldElement
{
- private $value = '';
- private $size = null;
- private $filter;
+ private $properties = array();
public function __construct( ezcWgWidget $parent, ezcWgFormWidget $form,
$size = null, $value = '',
ezcWgTplSingleInputFilter $filter = null )
@@ -26,14 +24,52 @@
$this->filter = $filter;
}
- public function getValue()
+ /**
+ * 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 )
{
- return $this->value;
+ switch ( $name )
+ {
+ case 'value':
+ case 'size':
+ case 'filter':
+ $this->properties[$name] = $value;
+ break;
+ default:
+ parent::__set( $name, $value );
+ break;
+ }
+
}
- public function setValue( $value )
+ /**
+ * Returns the property $name.
+ *
+ * @throws ezcBasePropertyNotFoundException if the property does not exist.
+ * @param string $name
+ * @return mixed
+ * @ignore
+ */
+ public function __get( $name )
{
- $this->value = $value;
+ switch ( $name )
+ {
+ case 'value':
+ case 'size':
+ case 'filter':
+ return isset( $this->properties[$name] ) ?
$this->properties[$name] : null;
+ break;
+
+ default:
+ return parent::__get( $name );
+ break;
+ }
}
public function render()
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components