cvs: php4 /pear/HTML Table.php
| From: | Adam Daniel | Date: | Tue, 20 Nov 2001 18:47:12 +0000 |
| Subject: | cvs: php4 /pear/HTML Table.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1386@lists.php.net to get a copy of this message | ||
adaniel Tue Nov 20 13:47:12 2001 EDT
Modified files:
/php4/pear/HTML Table.php
Log:
Added setAllAttributes and updateAllAttributes also changed all html tags to lowercase
Index: php4/pear/HTML/Table.php
diff -u php4/pear/HTML/Table.php:1.9 php4/pear/HTML/Table.php:1.10
--- php4/pear/HTML/Table.php:1.9 Mon Aug 6 17:14:39 2001
+++ php4/pear/HTML/Table.php Tue Nov 20 13:47:12 2001
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Table.php,v 1.9 2001/08/06 21:14:39 adaniel Exp $
+// $Id: Table.php,v 1.10 2001/11/20 18:47:12 adaniel Exp $
require_once "PEAR.php";
require_once "HTML/Common.php";
@@ -27,7 +27,7 @@
*
* @author Adam Daniel <adaniel1@eesus.jnj.com>
* @author Bertrand Mansion <bmansion@mamasam.com>
-* @version 1.5
+* @version 1.6
* @since PHP 4.0.3pl1
*/
class HTML_Table extends HTML_Common {
@@ -98,7 +98,7 @@
*/
function apiVersion()
{
- return 1.5;
+ return 1.6;
} // end func apiVersion
/**
@@ -426,6 +426,32 @@
} // end func updateColAttributes
/**
+ * Sets the attributes for all cells
+ * @param mixed $attributes (optional) Associative array or string of table row
attributes
+ * @since 1.6
+ * @access public
+ */
+ function setAllAttributes($attributes=null)
+ {
+ for ($i = 0; $i < $this->_rows; $i++) {
+ $this->setRowAttributes($i, $attributes);
+ }
+ } // end func setAllAttributes
+
+ /**
+ * Updates the attributes for all cells
+ * @param mixed $attributes (optional) Associative array or string of table row
attributes
+ * @since 1.6
+ * @access public
+ */
+ function updateAllAttributes($attributes=null)
+ {
+ for ($i = 0; $i < $this->_rows; $i++) {
+ $this->updateRowAttributes($i, $attributes);
+ }
+ } // end func updateAllAttributes
+
+ /**
* Returns the table structure as HTML
* @access public
* @return string
@@ -439,26 +465,26 @@
$strHtml .= $tabs . "<!-- $this->_comment -->\n";
}
$strHtml .=
- $tabs . "<TABLE" . $this->_getAttrString($this->_attributes) .
">\n";
+ $tabs . "<table" . $this->_getAttrString($this->_attributes) .
">\n";
if (!empty($this->_structure["caption"])) {
$attr = $this->_structure["caption"]["attr"];
$contents = $this->_structure["caption"]["contents"];
- $strHtml .= $tabs . "\t<CAPTION" . $this->_getAttrString($attr) .
">";
+ $strHtml .= $tabs . "\t<caption" . $this->_getAttrString($attr) .
">";
if (is_array($contents)) $contents = implode(", ",$contents);
$strHtml .= $contents;
- $strHtml .= "</CAPTION>\n";
+ $strHtml .= "</caption>\n";
}
for ($i = 0 ; $i < $this->_rows ; $i++) {
- $strHtml .= $tabs ."\t<TR>\n";
+ $strHtml .= $tabs ."\t<tr>\n";
for ($j = 0 ; $j < $this->_cols ; $j++) {
if (isset($this -> _structure[$i][$j]) && $this->_structure[$i][$j]
== "__SPANNED__") {
$strHtml .= $tabs ."\t\t<!-- span -->\n";
continue;
}
if (isset($this->_structure[$i][$j]["type"])) {
- $type = ($this->_structure[$i][$j]["type"] == "TH" ?
"TH" : "TD");
+ $type = (strtoupper($this->_structure[$i][$j]["type"]) ==
"TH" ? "th" : "td");
} else {
- $type = "TD";
+ $type = "td";
}
if (isset($this->_structure[$i][$j]["attr"])) {
$attr = $this->_structure[$i][$j]["attr"];
@@ -494,10 +520,10 @@
$strHtml .= $contents;
$strHtml .= "</$type>\n";
}
- $strHtml .= $tabs ."\t</TR>\n";
+ $strHtml .= $tabs ."\t</tr>\n";
}
$strHtml .=
- $tabs . "</TABLE><!-- END TABLE LEVEL: $this->_nestLevel -->";
+ $tabs . "</table><!-- END TABLE LEVEL: $this->_nestLevel -->";
return $strHtml;
} // end func toHtml