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 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);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| 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);
}
Here is the caller graph for this function:| ilXMLResultSet::addRow | ( | &$ | row | ) |
add row object
| ilXMLResultSetRow | $row |
Definition at line 90 of file class.ilXMLResultSet.php.
Referenced by addArray().
{
$this->rows [] = $row;
}
Here is the caller graph for this function:| 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();
}
Here is the caller graph for this function:| 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);
}
Here is the call graph for this function:| ilXMLResultSet::$colspecs = array() |
Definition at line 39 of file class.ilXMLResultSet.php.
| ilXMLResultSet::$rows = array() |
Definition at line 40 of file class.ilXMLResultSet.php.
1.7.1