Source for file grid.php
Documentation is available at grid.php
* JGrid class to dynamically generate HTML tables
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* JGrid class to dynamically generate HTML tables
* @package Joomla.Platform
* Rows of the table (including header and footer rows)
protected $rows =
array();
* Header and Footer row-IDs
protected $specialRows =
array('header' =>
array(), 'footer' =>
array());
* Associative array of attributes for the table-tag
* Constructor for a JGrid object
* @param array $options Associative array of attributes for the table-tag
* Magic function to render this object as a table.
* Method to set the attributes for a table-tag
* @param array $options Associative array of attributes for the table-tag
* @param bool $replace Replace possibly existing attributes
* @return JGrid This object for chaining
* Get the Attributes of the current table
* @return array Associative array of attributes
* Add new column name to process
* @param string $name Internal column name
* @return JGrid This object for chaining
* Returns the list of internal columns
* @return array List of internal columns
* @param string $name Name of the column to be deleted
* @return JGrid This object for chaining
* Method to set a whole range of columns at once
* This can be used to re-order the columns, too
* @param array $columns List of internal column names
* @return JGrid This object for chaining
* Adds a row to the table and sets the currently
* active row to the new row
* @param array $options Associative array of attributes for the row
* @param int $special 1 for a new row in the header, 2 for a new row in the footer
* @return JGrid This object for chaining
public function addRow($options =
array(), $special =
false)
$this->rows[]['_row'] =
$options;
* Method to get the attributes of the currently active row
* @return array Associative array of attributes
* Method to set the attributes of the currently active row
* @param array $options Associative array of attributes
* @return JGrid This object for chaining
* Get the currently active row ID
* @return int ID of the currently active row
* Set the currently active row
* @param int $id ID of the row to be set to current
* @return JGrid This object for chaining
* Set cell content for a specific column for the
* @param string $name Name of the column
* @param string $content Content for the cell
* @param array $option Associative array of attributes for the td-element
* @param bool $replace If false, the content is appended to the current content of the cell
* @return JGrid This object for chaining
public function setRowCell($name, $content, $option =
array(), $replace =
true)
$cell->options =
$option;
$cell->content =
$content;
* @param int $id ID of the row to return
* @return array Array of columns of a table row
public function getRow($id =
false)
if (isset
($this->rows[(int)
$id]))
return $this->rows[(int)
$id];
* Get the IDs of all rows in the table
* @param int $special false for the standard rows, 1 for the header rows, 2 for the footer rows
* @return array Array of IDs
public function getRows($special =
false)
* Delete a row from the object
* @param int $id ID of the row to be deleted
* @return JGrid This object for chaining
* @return string The rendered HTML table
* Render an area of the table
* @param array $ids IDs of the rows to render
* @param string $area Name of the area to render. Valid: tbody, tfoot, thead
* @param string $cell Name of the cell to render. Valid: td, th
* @return string The rendered table area
protected function renderArea($ids, $area =
'tbody', $cell =
'td')
$output[] =
'<' .
$area .
">\n";
if (isset
($this->rows[$id][$name]))
$column =
$this->rows[$id][$name];
$output[] =
"\t\t<" .
$cell .
$this->renderAttributes($column->options) .
'>' .
$column->content .
'</' .
$cell .
">\n";
$output[] =
'</' .
$area .
'>';
* Renders an HTML attribute from an associative array
* @param array $attributes Associative array of attributes
* @return string The HTML attribute string
if (count((array)
$attributes) ==
0)
foreach ($attributes as $key =>
$option)
$return[] =
$key .
'="' .
$option .
'"';
return ' ' .
implode(' ', $return);
Documentation generated on Tue, 19 Nov 2013 15:04:02 +0100 by phpDocumentor 1.4.3