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); }
/** * Construct a row from the earlier defined constructed cells for the table. *
|
$this->_cells[] = array("data" => $data, "extra" => $extra); }
/** * 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"; } elseif(!isset($this->_cells[$key+1]))
|
if($key == 0) { $cell['extra']['class'] .= " first"; } elseif(!isset($this->_cells[$key+1]))
|
{
| {
|
$cell['extra']['class'] .= " last"; } if($i == 2)
| $cell['extra']['class'] .= " last"; } if($i == 2)
|
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'])."\""; } if(isset($cell['extra']['style'])) { $cells .= " style=\"".$cell['extra']['style']."\"";
|
$cells .= " class=\"".trim($cell['extra']['class'])."\""; } if(isset($cell['extra']['style'])) { $cells .= " style=\"".$cell['extra']['style']."\"";
|
}
| }
|
if(isset($cell['extra']['id'])) { $cells .= " id=\"".$cell['extra']['id']."\""; } if(isset($cell['extra']['colspan']) && $cell['extra']['colspan'] > 1)
|
if(isset($cell['extra']['id'])) { $cells .= " id=\"".$cell['extra']['id']."\""; } if(isset($cell['extra']['colspan']) && $cell['extra']['colspan'] > 1)
|
{
| {
|
$cells .= " colspan=\"".$cell['extra']['colspan']."\""; } if(isset($cell['extra']['rowspan']) && $cell['extra']['rowspan'] > 1)
|
$cells .= " colspan=\"".$cell['extra']['colspan']."\""; } if(isset($cell['extra']['rowspan']) && $cell['extra']['rowspan'] > 1)
|
{
| {
|
$cells .= " rowspan=\"".$cell['extra']['rowspan']."\""; } if(isset($cell['extra']['width']))
| $cells .= " rowspan=\"".$cell['extra']['rowspan']."\""; } if(isset($cell['extra']['width']))
|
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)
| * @return string The output of the row cells (optional). */ function output_row_cells($row_id, $return=false)
|
Zeile 153 | Zeile 141 |
---|
/** * 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()) { $this->_headers[] = array("data" => $data, "extra" => $extra);
| function construct_header($data, $extra=array()) { $this->_headers[] = array("data" => $data, "extra" => $extra);
|
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 239 | Zeile 227 |
---|
if(isset($data['extra']['style'])) { $table .= " style=\"".$data['extra']['style']."\"";
|
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 237 |
---|
$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 246 |
---|
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";
|