Zeile 31 | Zeile 31 |
---|
/** * Construct an individual cell for this table. *
|
/** * Construct an individual cell for this table. *
|
* @param string The HTML content for this cell. * @param array Array of extra information about this cell (class, id, colspan, rowspan, width)
| * @param string $data The HTML content for this cell. * @param array $extra Array of extra information about this cell (class, id, colspan, rowspan, width)
|
*/ function construct_cell($data, $extra=array()) {
|
*/ function construct_cell($data, $extra=array()) {
|
foreach(array('class', 'style', 'id') as $field) { // Common-used fields if(!isset($extra[$field])) { $extra[$field] = ''; } }
| |
$this->_cells[] = array("data" => $data, "extra" => $extra); }
|
$this->_cells[] = array("data" => $data, "extra" => $extra); }
|
|
|
/** * Construct a row from the earlier defined constructed cells for the table. *
|
/** * Construct a row from the earlier defined constructed cells for the table. *
|
* @param array Array of extra information about this row (class, id)
| * @param array $extra Array of extra information about this row (class, id)
|
*/ function construct_row($extra = array()) { $i = 1; $cells = '';
|
*/ function construct_row($extra = array()) { $i = 1; $cells = '';
|
foreach(array('class', 'style', 'id', 'rowspan', 'width') as $field) { // Common-used fields if(!isset($extra[$field])) { $extra[$field] = ''; } }
| |
// We construct individual cells here foreach($this->_cells as $key => $cell) { $cells .= "\t\t\t<td";
|
// We construct individual cells here foreach($this->_cells as $key => $cell) { $cells .= "\t\t\t<td";
|
| if(!isset($cell['extra']['class'])) { $cell['extra']['class'] = ''; }
|
if($key == 0) { $cell['extra']['class'] .= " first";
| if($key == 0) { $cell['extra']['class'] .= " first";
|
Zeile 85 | Zeile 73 |
---|
$i = 0; } $i++;
|
$i = 0; } $i++;
|
if(isset($cell['extra']['class']))
| if($cell['extra']['class'])
|
{ $cells .= " class=\"".trim($cell['extra']['class'])."\""; }
| { $cells .= " class=\"".trim($cell['extra']['class'])."\""; }
|
Zeile 123 | Zeile 111 |
---|
/** * return the cells of a row for the table based row. *
|
/** * return the cells of a row for the table based row. *
|
* @param string The id of the row you want to give it. * @param boolean Whether or not to return or echo the resultant contents.
| * @param string $row_id The id of the row you want to give it. * @param boolean $return Whether or not to return or echo the resultant contents.
|
* @return string The output of the row cells (optional). */ function output_row_cells($row_id, $return=false) { $row = $this->_rows[$row_id]['cells'];
|
* @return string The output of the row cells (optional). */ function output_row_cells($row_id, $return=false) { $row = $this->_rows[$row_id]['cells'];
|
|
|
if(!$return) { echo $row;
| if(!$return) { echo $row;
|
Zeile 154 | Zeile 142 |
---|
/** * Construct a header cell for this table. *
|
/** * Construct a header cell for this table. *
|
* @param string The HTML content for this header cell. * @param array Array of extra information for this header cell (class, style, colspan, width)
| * @param string $data The HTML content for this header cell. * @param array $extra Array of extra information for this header cell (class, style, colspan, width)
|
*/ function construct_header($data, $extra=array()) {
| */ function construct_header($data, $extra=array()) {
|
Zeile 165 | Zeile 153 |
---|
/** * Output this table to the browser. *
|
/** * Output this table to the browser. *
|
* @param string The heading for this table. * @param int The border width for this table. * @param string The class for this table. * @param boolean Whether or not to return or echo the resultant contents.
| * @param string $heading The heading for this table. * @param int $border The border width for this table. * @param string $class The class for this table. * @param boolean $return Whether or not to return or echo the resultant contents.
|
* @return string The output of the row cells (optional). */ function output($heading="", $border=1, $class="general", $return=false)
| * @return string The output of the row cells (optional). */ function output($heading="", $border=1, $class="general", $return=false)
|
Zeile 186 | Zeile 174 |
---|
/** * Fetch the built HTML for this table. *
|
/** * Fetch the built HTML for this table. *
|
* @param string The heading for this table. * @param int The border width for this table. * @param string The class for this table. * @param string The id for this table.
| * @param string $heading The heading for this table. * @param int $border The border width for this table. * @param string $class The class for this table. * @param string $table_id The id for this table.
|
* @return string The built HTML. */ function construct_html($heading="", $border=1, $class=null, $table_id="")
| * @return string The built HTML. */ function construct_html($heading="", $border=1, $class=null, $table_id="")
|
Zeile 215 | Zeile 203 |
---|
if($table_id != "") { $table .= " id=\"".$table_id."\"";
|
if($table_id != "") { $table .= " id=\"".$table_id."\"";
|
}
| }
|
$table .= " cellspacing=\"0\">\n"; if($this->_headers) {
| $table .= " cellspacing=\"0\">\n"; if($this->_headers) {
|
Zeile 224 | Zeile 212 |
---|
foreach($this->_headers as $key => $data) { $table .= "\t\t\t<th";
|
foreach($this->_headers as $key => $data) { $table .= "\t\t\t<th";
|
| if(!isset($data['extra']['class'])) { $data['extra']['class'] = ''; }
|
if($key == 0) { $data['extra']['class'] .= " first"; } elseif(!isset($this->_headers[$key+1]))
|
if($key == 0) { $data['extra']['class'] .= " first"; } elseif(!isset($this->_headers[$key+1]))
|
{
| {
|
$data['extra']['class'] .= " last";
|
$data['extra']['class'] .= " last";
|
} if(isset($data['extra']['class'])) {
| } if(!empty($data['extra']['class'])) {
|
$table .= " class=\"".$data['extra']['class']."\""; } if(isset($data['extra']['style'])) { $table .= " style=\"".$data['extra']['style']."\"";
|
$table .= " class=\"".$data['extra']['class']."\""; } if(isset($data['extra']['style'])) { $table .= " style=\"".$data['extra']['style']."\"";
|
}
| }
|
if(isset($data['extra']['width']))
|
if(isset($data['extra']['width']))
|
{
| {
|
$table .= " width=\"".$data['extra']['width']."\""; } if(isset($data['extra']['colspan']) && $data['extra']['colspan'] > 1)
| $table .= " width=\"".$data['extra']['width']."\""; } if(isset($data['extra']['colspan']) && $data['extra']['colspan'] > 1)
|
Zeile 249 | Zeile 241 |
---|
$table .= " colspan=\"".$data['extra']['colspan']."\""; } $table .= ">".$data['data']."</th>\n";
|
$table .= " colspan=\"".$data['extra']['colspan']."\""; } $table .= ">".$data['data']."</th>\n";
|
}
| }
|
$table .= "\t\t</tr>\n"; $table .= "\t</thead>\n"; }
| $table .= "\t\t</tr>\n"; $table .= "\t</thead>\n"; }
|
Zeile 258 | Zeile 250 |
---|
foreach($this->_rows as $key => $table_row) { $table .= "\t\t<tr";
|
foreach($this->_rows as $key => $table_row) { $table .= "\t\t<tr";
|
if($table_row['extra']['id']) {
| if(isset($table_row['extra']['id'])) {
|
$table .= " id=\"{$table_row['extra']['id']}\""; }
|
$table .= " id=\"{$table_row['extra']['id']}\""; }
|
| if(!isset($table_row['extra']['class'])) { $table_row['extra']['class'] = ''; }
|
if($key == 0) { $table_row['extra']['class'] .= " first";
| if($key == 0) { $table_row['extra']['class'] .= " first";
|