logo       

cvs: pear /HTML_QuickForm/QuickForm group.php: msg#00609

php.cvs.pear

Subject: cvs: pear /HTML_QuickForm/QuickForm group.php

mansion Fri Sep 27 06:28:56 2002 EDT

Modified files:
/pear/HTML_QuickForm/QuickForm group.php
Log:
Added 2 methods:
- getElements() which returns an array of all elements in group by reference,
- getGroupType() which returns the type of group as string or 'mixed' if
group is composed of different element types.
Fix $_elements to array instead of string.


Index: pear/HTML_QuickForm/QuickForm/group.php
diff -u pear/HTML_QuickForm/QuickForm/group.php:1.5
pear/HTML_QuickForm/QuickForm/group.php:1.6
--- pear/HTML_QuickForm/QuickForm/group.php:1.5 Fri Jun 14 09:11:10 2002
+++ pear/HTML_QuickForm/QuickForm/group.php Fri Sep 27 06:28:56 2002
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@xxxxxxxxxxx> |
// +----------------------------------------------------------------------+
//
-// $Id: group.php,v 1.5 2002/06/14 13:11:10 mansion Exp $
+// $Id: group.php,v 1.6 2002/09/27 10:28:56 mansion Exp $

require_once("HTML/QuickForm/element.php");

@@ -56,7 +56,7 @@
* @since 1.0
* @access private
*/
- var $_elements = '';
+ var $_elements = array();

/**
* String to seperator elements
@@ -189,6 +189,48 @@
{
$this->_elements = $elements;
} // end func setElements
+
+ // }}}
+ // {{{ getElements()
+
+ /**
+ * Gets the grouped elements
+ *
+ * @param array $elements Array of elements
+ * @since 1.1
+ * @access public
+ * @return void
+ * @throws
+ */
+ function &getElements()
+ {
+ return $this->_elements;
+ } // end func getElements
+
+ // }}}
+ // {{{ getGroupType()
+
+ /**
+ * Gets the group type based on its elements
+ * Will return 'mixed' if elements contained in the group
+ * are of different types.
+ *
+ * @access public
+ * @return string group elements type
+ * @throws
+ */
+ function getGroupType()
+ {
+ $prevType = '';
+ foreach ($this->_elements as $element) {
+ $type = $element->getType();
+ if ($type != $prevType) {
+ return 'mixed';
+ }
+ $prevType = $type;
+ }
+ return $type;
+ } // end func getGroupType

// }}}
// {{{ toHtml()



--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise