• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

webservice/soap/classes/class.ilXMLResultSet.php

Go to the documentation of this file.
00001 <?php
00002   /*
00003    +-----------------------------------------------------------------------------+
00004    | ILIAS open source                                                           |
00005    +-----------------------------------------------------------------------------+
00006    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007    |                                                                             |
00008    | This program is free software; you can redistribute it and/or               |
00009    | modify it under the terms of the GNU General Public License                 |
00010    | as published by the Free Software Foundation; either version 2              |
00011    | of the License, or (at your option) any later version.                      |
00012    |                                                                             |
00013    | This program is distributed in the hope that it will be useful,             |
00014    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016    | GNU General Public License for more details.                                |
00017    |                                                                             |
00018    | You should have received a copy of the GNU General Public License           |
00019    | along with this program; if not, write to the Free Software                 |
00020    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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                             // add column names from first row
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 ?>

Generated on Fri Dec 13 2013 13:52:16 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1