Пример #1
0
 /**
  * Fills table with provided data. RL & BT modes are not implemented yet.
  *
  * This function does the actual laying out of the data into the table.
  * It isn't necessary to call this unless you want to add or change something
  * in the table, as toHtml() calls this automatically if the table has not
  * yet been filled with data.
  *
  * @return mixed boolean true on success, PEAR_Error otherwise
  * @see setData()
  */
 function fillTable()
 {
     if (!HTML_Table_Matrix_Filler::isValid($this->_filler)) {
         return PEAR::raiseError("No Filler has been set.");
     }
     $this->_calculateSize();
     reset($this->_data);
     $size = $this->_getTableSize();
     $this->_data = array_slice($this->_data, 0, $size);
     if (isset($this->_filler->callback)) {
         if (!is_callable($this->_filler->callback) || !is_array($cr = call_user_func($this->_filler->callback, $this->_data))) {
             return PEAR::raiseError("Invalid filler callback.");
         }
         $this->_data = $cr;
     }
     for ($i = $index = 0; $i < $size; $i++, $index++) {
         list($row, $col) = $this->_filler->next($index);
         $this->_fillCell($row, $col);
     }
     $this->_isFilled = TRUE;
     return true;
 }