Public Member Functions | |
ilXMLResultSet () | |
getColumnName ($index) | |
addColumn ($columname) | |
create a new column with columnname and attach it to column list | |
getColSpecs () | |
return array of ilXMLResultSetColumn | |
getRows () | |
return array of ilXMLResultSetRow | |
addRow (&$row) | |
add row object | |
setArray ($array) | |
Clear table value and sets them based on array. | |
addArray ($array, $overwrite=false) | |
Add table values. | |
clear () | |
Clear resultset (colspecs and row values). | |
getColumnCount () | |
return column count | |
getRowCount () | |
return row count | |
Data Fields | |
$colspecs = array() | |
$rows = array() |
Definition at line 37 of file class.ilXMLResultSet.php.
ilXMLResultSet::addArray | ( | $ | array, | |
$ | overwrite = false | |||
) |
Add table values.
Exspects a 2-dimension array. Column indeces of second dimensions in first row are column names.
e.g. array (array("first" => "val1_1", "second" => "val1_2), array ("first" => "val2_1", "second" => "val2_2")) results in Table first second val1_1 va11_2 val2_1 val2_2
array | $array 2 dimensional array | |
boolean | $overwrite if false, column names won't be changed, rows will be added,true: result set will be reset to null and data will be added. |
Definition at line 122 of file class.ilXMLResultSet.php.
References $row, addColumn(), addRow(), and clear().
Referenced by setArray().
{ if ($overwrite) { $this->clear(); } foreach ($array as $row) { if ($overwrite) { // add column names from first row $columnNames = array_keys($row); foreach ($columnNames as $columnName) { $this->addColumn($columnName); } $overwrite = false; } $xmlRow = & new ilXMLResultSetRow(); $xmlRow->setValues ($row); $this->addRow($xmlRow); } }
ilXMLResultSet::addColumn | ( | $ | columname | ) |
create a new column with columnname and attach it to column list
String | $columname |
Definition at line 60 of file class.ilXMLResultSet.php.
Referenced by addArray().
{ $this->colspecs [count($this->colspecs)] = new ilXMLResultSetColumn (count($this->colspecs), $columname); }
ilXMLResultSet::addRow | ( | &$ | row | ) |
add row object
ilXMLResultSetRow | $row |
Definition at line 90 of file class.ilXMLResultSet.php.
References $row.
Referenced by addArray().
{ $this->rows [] = $row; }
ilXMLResultSet::clear | ( | ) |
Clear resultset (colspecs and row values).
Definition at line 147 of file class.ilXMLResultSet.php.
Referenced by addArray().
{ $this->rows = array(); $this->colspecs = array(); }
ilXMLResultSet::getColSpecs | ( | ) |
return array of ilXMLResultSetColumn
Definition at line 70 of file class.ilXMLResultSet.php.
{
return $this->colspecs;
}
ilXMLResultSet::getColumnCount | ( | ) |
return column count
Definition at line 157 of file class.ilXMLResultSet.php.
{
return count($this->colspecs);
}
ilXMLResultSet::getColumnName | ( | $ | index | ) |
Definition at line 47 of file class.ilXMLResultSet.php.
{ if (is_numeric($index) && ($index < 0 || $index > count($this->colspecs))) { return null; } return $this->colspecs[$index] instanceof ilXMLResultSetColumn ? $this->colspecs[$index]->getName() : null; }
ilXMLResultSet::getRowCount | ( | ) |
return row count
Definition at line 166 of file class.ilXMLResultSet.php.
{
return count($this->rows);
}
ilXMLResultSet::getRows | ( | ) |
return array of ilXMLResultSetRow
Definition at line 80 of file class.ilXMLResultSet.php.
{
return $this->rows;
}
ilXMLResultSet::ilXMLResultSet | ( | ) |
Definition at line 43 of file class.ilXMLResultSet.php.
{ }
ilXMLResultSet::setArray | ( | $ | array | ) |
Clear table value and sets them based on array.
Exspects a 2-dimension array. Column indeces of second dimensions in first row are column names.
e.g. array (array("first" => "val1_1", "second" => "val1_2), array ("first" => "val2_1", "second" => "val2_2")) results in Table first second val1_1 va11_2 val2_1 val2_2
array | $array 2 dimensional array |
Definition at line 106 of file class.ilXMLResultSet.php.
References addArray().
{ $this->addArray($array, true); }
ilXMLResultSet::$colspecs = array() |
Definition at line 39 of file class.ilXMLResultSet.php.
ilXMLResultSet::$rows = array() |
Definition at line 40 of file class.ilXMLResultSet.php.