mj              Wed Mar 21 22:23:38 2001 EDT

  Modified files:              
    /php4/pear/HTML     Common.php Table.php 
  Log:
  - some cosmetic changes in pear/html/HTML_Common and pear/html/HTML_Table for better
    readability.
  
  
Index: php4/pear/HTML/Common.php
diff -u php4/pear/HTML/Common.php:1.1 php4/pear/HTML/Common.php:1.2
--- php4/pear/HTML/Common.php:1.1       Wed Mar 21 20:14:42 2001
+++ php4/pear/HTML/Common.php   Wed Mar 21 22:23:38 2001
@@ -16,7 +16,7 @@
 // | Authors: Adam Daniel <[EMAIL PROTECTED]>                        |
 // +----------------------------------------------------------------------+
 //
-// $Id: Common.php,v 1.1 2001/03/22 04:14:42 adaniel Exp $
+// $Id: Common.php,v 1.2 2001/03/22 06:23:38 mj Exp $
 
 /**
 * Base class for all HTML classes
@@ -27,18 +27,21 @@
 * @since       PHP 4.0.3pl1
 */
 class HTML_Common {
+
     /**
     * Associative array of table attributes
     * @var  array
     * @access   private
     */
     var $_attributes = array();
+
     /**
     * Tab offset of the table
     * @var  int
     * @access   private
     */
     var $_tabOffset = 0;
+
     /**
     * Class constructor
     * @param    mixed   $attributes     Associative array of table tag attributes 
@@ -49,7 +52,8 @@
     {
         $this->setTabOffset($tabOffset);
         $this->setAttributes($attributes);
-    }
+    } // end constructor
+
     /**
     * Returns the current API version
     * @access   public
@@ -58,7 +62,8 @@
     function apiVersion()
     {
         return 1.3;
-    }
+    } // end func apiVersion
+
     /**
     * Returns a string of \t for the tabOffset property
     * @access   private
@@ -66,7 +71,8 @@
     function _getTabs()
     {
         return $this->_tabOffset > 0 ? str_repeat("\t", $this->_tabOffset) : "";
-    }
+    } // end func _getTabs
+
     /**
     * Returns an HTML formatted attribute string
     * @param    array   $attributes
@@ -86,7 +92,8 @@
             }
         }
         return $strAttr;
-    }
+    } // end func _getAttrString
+
     /**
     * Returns a valid atrributes array from either a string or array
     * @param    mixed   $attributes     Either a typical HTML attribute string or an 
associative array
@@ -118,7 +125,8 @@
                 return $arrAttr;
             }
         }
-    }
+    } // end func _parseAttributes
+
     /**
     * Updates the attributes in $attr1 with the values in $attr2 without changing the 
other existing attributes
     * @param    array   $attr1      Original attributes array
@@ -152,7 +160,8 @@
                 }
             }
         }
-    }
+    } // end func _updateAtrrArray
+
     /**
     * Sets the HTML attributes
     * @param    mixed   $attributes     Either a typical HTML attribute string or an 
associative array
@@ -161,7 +170,8 @@
     function setAttributes($attributes) 
     {
         $this->_attributes = $this->_parseAttributes($attributes);
-    }
+    } // end func _setAttributes
+
     /**
     * Updates the passed attributes without changing the other existing attributes
     * @param    mixed   $attributes     Either a typical HTML attribute string or an 
associative array
@@ -171,7 +181,8 @@
     {
         $attributes = $this->_parseAttributes($attributes);
         $this->_updateAttrArray($this->_attributes, $attributes);
-    }
+    } // end func updateAttributes
+
     /**
     * Sets the tab offset
     * @param    int     $offset
@@ -180,6 +191,7 @@
     function setTabOffset($offset)
     {
         $this->_tabOffset = $offset;
-    }
-}
+    } // end func setTabOffset
+    
+} // end class HTML_Common
 ?>
Index: php4/pear/HTML/Table.php
diff -u php4/pear/HTML/Table.php:1.1 php4/pear/HTML/Table.php:1.2
--- php4/pear/HTML/Table.php:1.1        Wed Mar 21 20:15:42 2001
+++ php4/pear/HTML/Table.php    Wed Mar 21 22:23:38 2001
@@ -14,10 +14,10 @@
 // | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
 // +----------------------------------------------------------------------+
 // | Authors: Adam Daniel <[EMAIL PROTECTED]>                        |
-// |          Bertrand Mansion <[EMAIL PROTECTED]>                                 
|
+// |          Bertrand Mansion <[EMAIL PROTECTED]>                     |
 // +----------------------------------------------------------------------+
 //
-// $Id: Table.php,v 1.1 2001/03/22 04:15:42 adaniel Exp $
+// $Id: Table.php,v 1.2 2001/03/22 06:23:38 mj Exp $
 
 require_once "PEAR.php";
 require_once "HTML/Common.php";
@@ -31,40 +31,46 @@
 * @since               PHP 4.0.3pl1
 *
 * Example:
-       $table = new HTML_Table;
-       ...
+*   $table = new HTML_Table;
+*   ...
 */
 class HTML_Table extends HTML_Common {
+
        /**
        * Automatically adds a new row or column if a given row or column index does 
not exist
        * @var  bool
        * @access       private
        */
        var $_autoGrow = true;
+
        /**
        * Value to insert into empty cells
        * @var  string
        * @access       private
        */
        var $_autoFill = "&nbsp;";
+
        /**
        * Array containing the table structure
        * @var  array
        * @access       private
        */
        var $_structure = array();
+
        /**
        * Number of rows composing in the table
        * @var  int
        * @access       private
        */
        var $_rows = 0;
+
        /**
        * Number of column composing the table
        * @var  int
        * @access       private
        */
        var $_cols = 0;
+
        /**
        * Class constructor
        * @param        array   $attributes             Associative array of table tag 
attributes
@@ -79,7 +85,8 @@
                 "HTML_Common version $commonVersion or greater.", 0, 
PEAR_ERROR_TRIGGER);
         }
                HTML_Common::HTML_Common($attributes, $tabOffset);
-       }
+       } // end constructor
+
        /**
        * Returns the API version
        * @access       public
@@ -88,7 +95,8 @@
        function apiVersion()
        {
                return 1.5;
-       }
+       } // end func apiVersion
+
        /**
        * Sets the table caption
        * @param        string  $caption
@@ -99,7 +107,8 @@
        {
                $attributes = $this->_parseAttributes($attributes);
                $this->_structure["caption"] = array("attr"=>$attributes, 
"contents"=>$caption);
-       }
+       } // end func setCaption
+
     /**
     * Sets the autoFill value
     * @param    mixed   $fill
@@ -108,7 +117,8 @@
     function setAutoFill($fill)
     {
         $this->_autoFill = $fill;
-    }
+    } // end func setAutoFill
+
     /**
     * Returns the autoFill value
     * @access   public
@@ -117,7 +127,8 @@
     function getAutoFill()
     {
         return $this->_autoFill;
-    }
+    } // end func getAutoFill
+
     /**
     * Sets the autoGrow value
     * @param    bool   $fill
@@ -126,7 +137,8 @@
     function setAutoGrow($grow)
     {
         $this->_autoGrow = $grow;
-    }
+    } // end func setAutoGrow
+
     /**
     * Returns the autoGrow value
     * @access   public
@@ -135,7 +147,8 @@
     function getAutoGrow()
     {
         return $this->_autoGrow;
-    }
+    } // end func getAutoGrow
+
     /**
     * Sets the number of rows in the table
     * @param    int     $rows
@@ -144,7 +157,8 @@
     function setRowCount($rows)
     {
         $this->_rows = $rows;
-    }
+    } // end func setRowCount
+
     /**
     * Sets the number of columns in the table
     * @param    int     $cols
@@ -153,7 +167,8 @@
     function setColCount($cols)
     {
         $this->_cols = $cols;
-    }
+    } // end func setColCount
+
     /**
     * Returns the number of rows in the table
     * @access   public
@@ -162,7 +177,8 @@
     function getRowCount()
     {
         return $this->_rows;
-    }
+    } // end func getRowCount
+
     /**
     * Sets the number of columns in the table
     * @access   public
@@ -171,19 +187,22 @@
     function getColCount()
     {
         return $this->_cols;
-    }
+    } // end func getColCount
+
     /**
     * Sets a rows type 'TH' or 'TD'
     * @param    int         $row    Row index
     * @param    string      $type   'TH' or 'TD'
     * @access   public
     */
+
     function setRowType($row, $type)
     {
         for ($counter=0; $counter < $this->_cols; $counter++) {
             $this->_structure[$row][$counter]["type"] = $type;
         }
-    }
+    } // end func setRowType
+
     /**
     * Sets a columns type 'TH' or 'TD'
     * @param    int         $col    Column index
@@ -195,7 +214,8 @@
         for ($counter=0; $counter < $this->_rows; $counter++) {
             $this->_structure[$counter][$col]["type"] = $type;
         }
-    }
+    } // end func setColType
+
        /**
        * Sets the cell attributes for an existing cell.
     *
@@ -228,7 +248,8 @@
                $attributes = $this->_parseAttributes($attributes);
                $this->_structure[$row][$col]["attr"] = $attributes;
                $this->_updateSpanGrid($row, $col);
-       }
+       } // end func setCellAttributes
+
     /**
     * Updates the cell attributes passed but leaves other existing attributes in tact
     * @param    int     $row        Row index
@@ -242,7 +263,8 @@
         $attributes = $this->_parseAttributes($attributes);
         $this->_updateAttrArray($this->_structure[$row][$col]["attr"], $attributes);
                $this->_updateSpanGrid($row, $col);
-    }
+    } // end func updateCellAttributes
+
        /**
        * Sets the cell contents for an existing cell
     *
@@ -275,7 +297,8 @@
                }
                $this->_structure[$row][$col]["contents"] = $contents;
                $this->_structure[$row][$col]["type"] = $type;
-       }
+       } // end func setCellContents
+
        /**
        * Returns the cell contents for an existing cell
        * @param        int             $row    Row index
@@ -287,7 +310,8 @@
        {               
         if ($this->_structure[$row][$col] == "SPANNED") return;
                return $this->_structure[$row][$col]["contents"];
-       }
+       } // end func getCellContents
+
     /**
     * Sets the contents of a header cell
     * @param    int     $row
@@ -298,7 +322,8 @@
     function setHeaderContents($row, $col, $contents)
     {
         $this->setCellContents($row, $col, $contents, 'TH');
-    }
+    } // end func setHeaderContents
+
        /**
        * Adds a table row and returns the row identifier
        * @param        array   $contents   (optional) Must be a indexed array of 
valid cell contents
@@ -322,7 +347,8 @@
         }
         $this->setRowAttributes($row, $attributes);
         return $row;
-    }
+    } // end func addRow
+
        /**
        * Sets the row attributes for an existing row
        * @param        int             $row            Row index
@@ -334,7 +360,8 @@
                for ($i = 0; $i < $this->_cols; $i++) {
                        $this->setCellAttributes($row,$i,$attributes);
                }
-       }
+       } // end func setRowAttributes
+
        /**
        * Updates the row attributes for an existing row
        * @param        int             $row            Row index
@@ -346,7 +373,8 @@
                for ($i = 0; $i < $this->_cols; $i++) {
                        $this->updateCellAttributes($row,$i,$attributes);
                }
-       }
+       } // end func updateRowAttributes
+
        /**
        * Alternates the row attributes starting at $start
        * @param        int             $start          Row index of row in which 
alternatign begins
@@ -360,7 +388,8 @@
                        $attributes = (($row+1+$start)%2==0) ? $attributes1 : 
$attributes2;
                        $this->updateRowAttributes($row, $attributes);
                }
-       }
+       } // end func altRowAttributes
+
        /**
        * Adds a table column and returns the column identifier
        * @param        array   $contents   (optional) Must be a indexed array of 
valid cell contents
@@ -380,7 +409,8 @@
         }
         $this->setColAttributes($col, $attributes);
         return $col;
-       }
+       } // end func addCol
+
        /**
        * Sets the column attributes for an existing column
        * @param        int             $col                    Column index
@@ -392,7 +422,8 @@
                for ($i = 0; $i < $this->_cols; $i++) {
                        $this->setCellAttributes($i,$col,$attributes);
                }
-       }
+       } // end func setColAttributes
+
        /**
        * Updates the column attributes for an existing column
        * @param        int             $col                    Column index
@@ -404,7 +435,8 @@
                for ($i = 0; $i < $this->_cols; $i++) {
                        $this->updateCellAttributes($i,$col,$attributes);
                }
-       }
+       } // end func updateColAttributes
+
        /**
        * Returns the table structure as HTML
        * @access       public
@@ -448,7 +480,8 @@
                }
                $strHtml .= $tabs . "</TABLE>";
                return $strHtml;
-       }        
+       } // end func toHtml
+
        /**
        * Prints the HTML table to the screen
        * @access       public
@@ -456,7 +489,8 @@
        function display()
        {
                print $this->toHtml();
-       }        
+       } // end func display
+
        /**
        * Checks if rows or columns are spanned
        * @param        int             $row                    Row index
@@ -484,6 +518,7 @@
                 }
             }
         }
-       }
-}
+       } // end func _updateSpanGrid
+
+} // end class HTML_Table
 ?>

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to