cvs: pear /DB_DataObject_FormBuilder FormBuilder.php
| From: | Justin Patrin | Date: | Fri, 27 May 2005 05:03:35 +0000 |
| Subject: | cvs: pear /DB_DataObject_FormBuilder FormBuilder.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32151@lists.php.net to get a copy of this message | ||
justinpatrin Fri May 27 01:03:35 2005 EDT
Modified files:
/pear/DB_DataObject_FormBuilder FormBuilder.php
Log:
Instead of leaving excludeFromAutoRules as a string (__ALL__), set an internal var
http://cvs.php.net/diff.php/pear/DB_DataObject_FormBuilder/FormBuilder.php?r1=1.181&r2=1.182&ty=u
Index: pear/DB_DataObject_FormBuilder/FormBuilder.php
diff -u pear/DB_DataObject_FormBuilder/FormBuilder.php:1.181
pear/DB_DataObject_FormBuilder/FormBuilder.php:1.182
--- pear/DB_DataObject_FormBuilder/FormBuilder.php:1.181 Fri May 27 00:25:02 2005
+++ pear/DB_DataObject_FormBuilder/FormBuilder.php Fri May 27 01:03:33 2005
@@ -94,7 +94,7 @@
* @author Justin Patrin <papercrane@reversefold.com>
* @copyright 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version $Id: FormBuilder.php,v 1.181 2005/05/27 04:25:02 justinpatrin Exp $
+ * @version $Id: FormBuilder.php,v 1.182 2005/05/27 05:03:33 justinpatrin Exp $
* @link http://pear.php.net/package/DB_DataObject_FormBuilder
* @see DB_DataObject, HTML_QuickForm
*/
@@ -168,6 +168,10 @@
*/
var $_queryType = DB_DATAOBJECT_FORMBUILDER_QUERY_AUTODETECT;
+ /**
+ * Is set to true if excludeFromAutoRules is set to __ALL__ (or includes __ALL__)
+ */
+ var $_excludeAllFromAutoRules = false;
//PUBLIC vars
/**
@@ -404,7 +408,8 @@
/**
* Array of fields for which no auto-rules may be generated.
- * If set to string "__ALL__", no rules are generated for any field.
+ * If set to string "__ALL__" or the array includes "__ALL__",
+ * no rules are automatically generated for any field.
*/
var $excludeFromAutoRules = array();
@@ -894,8 +899,7 @@
if (in_array($key, $vars) && $key[0] != '_') {
if ((!isset($defVars[$key])
|| is_array($defVars[$key]))
- && is_string($value)
- && $value != '__ALL__') {
+ && is_string($value)) {
$value = $this->_explodeArrString($value);
}
$this->$key = $value;
@@ -1445,7 +1449,8 @@
} // End if
//SET AUTO-RULES IF NOT DEACTIVATED FOR THIS OR ALL ELEMENTS
- if ($this->excludeFromAutoRules != '__ALL__' && !in_array($key,
$this->excludeFromAutoRules)) {
+ if (!$this->_excludeAllFromAutoRules
+ && !in_array($key, $this->excludeFromAutoRules)) {
//ADD REQURED RULE FOR NOT_NULL FIELDS
if ((!in_array($key, $keys)
|| $this->hidePrimaryKey == false)
@@ -2040,6 +2045,12 @@
$this->linkNewValue = array();
}
}
+ if (is_array($this->excludeFromAutoRules)
+ && in_array('__ALL__', $this->excludeFromAutoRules)
+ || '__ALL__' == $this->excludeFromAutoRules) {
+ $this->excludeFromAutoRules = array();
+ $this->_excludeAllFromAutoRules = true;
+ }
$this->_form->populateOptions();
}