Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00034 include_once './webservice/soap/classes/class.ilXMLResultSetColumn.php';
00035 include_once './webservice/soap/classes/class.ilXMLResultSetRow.php';
00036
00037 class ilXMLResultSet
00038 {
00039 var $colspecs = array();
00040 var $rows = array();
00041
00042
00043 function ilXMLResultSet ()
00044 {
00045 }
00046
00047 function getColumnName ($index) {
00048 if (is_numeric($index) && ($index < 0 || $index > count($this->colspecs)))
00049 {
00050 return null;
00051 }
00052 return $this->colspecs[$index] instanceof ilXMLResultSetColumn ? $this->colspecs[$index]->getName() : null;
00053 }
00054
00060 function addColumn($columname)
00061 {
00062 $this->colspecs [count($this->colspecs)] = new ilXMLResultSetColumn (count($this->colspecs), $columname);
00063 }
00064
00070 function getColSpecs ()
00071 {
00072 return $this->colspecs;
00073 }
00074
00080 function getRows ()
00081 {
00082 return $this->rows;
00083 }
00084
00090 function addRow (&$row)
00091 {
00092 $this->rows [] = $row;
00093 }
00094
00095
00106 function setArray ($array)
00107 {
00108 $this->addArray($array, true);
00109 }
00110
00122 function addArray ($array, $overwrite = false) {
00123 if ($overwrite) {
00124 $this->clear();
00125 }
00126 foreach ($array as $row) {
00127 if ($overwrite)
00128 {
00129
00130 $columnNames = array_keys($row);
00131 foreach ($columnNames as $columnName)
00132 {
00133 $this->addColumn($columnName);
00134 }
00135 $overwrite = false;
00136 }
00137 $xmlRow = & new ilXMLResultSetRow();
00138 $xmlRow->setValues ($row);
00139 $this->addRow($xmlRow);
00140 }
00141 }
00142
00147 function clear () {
00148 $this->rows = array();
00149 $this->colspecs = array();
00150 }
00151
00157 function getColumnCount () {
00158 return count($this->colspecs);
00159 }
00160
00166 function getRowCount () {
00167 return count($this->rows);
00168 }
00169
00170 }
00171 ?>