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
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 include_once( "lib/ezxml/classes/ezxml.php" );
00042
00043 class eZMatrix
00044 {
00045
00046
00047
00048 function eZMatrix( $name, $numRows = false, $matrixColumnDefinition = false )
00049 {
00050 $this->Name = $name;
00051 $this->Matrix = array();
00052
00053 if ( $numRows !== false && $matrixColumnDefinition !== false )
00054 {
00055 $columns = $matrixColumnDefinition->attribute( 'columns' );
00056 $numColumns = count( $columns );
00057 $this->NumColumns = $numColumns;
00058
00059 $sequentialColumns = array();
00060 foreach ( $columns as $column )
00061 {
00062 $sequentialColumns[] = array( 'identifier' => $column['identifier'],
00063 'index' => $column['index'],
00064 'name' => $column['name'] );
00065
00066 }
00067 $this->Matrix['columns'] = array();
00068 $this->Matrix['columns']['sequential'] =& $sequentialColumns;
00069
00070 $this->NumRows = $numRows;
00071 $cells = array();
00072 for ( $i = 0; $i < $numColumns; ++$i )
00073 {
00074 for ( $j = 0; $j < $numRows; ++$j )
00075 {
00076 $cells[] = '';
00077 }
00078 }
00079 $this->Cells =& $cells;
00080
00081
00082 $xmlString =& $this->xmlString();
00083 $this->decodeXML( $xmlString );
00084 }
00085 }
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 function adjustColumnsToDefinition( $classColumnsDefinition )
00098 {
00099 $matrixWasModified = false;
00100
00101 $matrixWasModified |= $this->removeUselessColumns( $classColumnsDefinition );
00102 $matrixWasModified |= $this->updateColumns ( $classColumnsDefinition, true, true );
00103
00104 if ( $matrixWasModified )
00105 {
00106 $this->reorderColumns();
00107
00108 $columns =& $classColumnsDefinition->attribute( 'columns' );
00109 $numColumns = count( $columns );
00110 $this->NumColumns = $numColumns;
00111
00112 $xmlString =& $this->xmlString();
00113 $this->decodeXML( $xmlString );
00114 }
00115
00116 return $matrixWasModified;
00117 }
00118
00119
00120
00121
00122 function buildReorderChains( &$chain, &$columns, &$curPos, &$startPos )
00123 {
00124 $column =& $columns[$curPos];
00125 $toPos = $column['index'];
00126 $chain[] = $toPos;
00127
00128 $curPos = $toPos;
00129 $column =& $columns[$curPos];
00130 if ( $column['index'] != $startPos )
00131 {
00132 eZMatrix::buildReorderChains( $chain, $columns, $curPos, $startPos );
00133 }
00134 }
00135
00136
00137
00138
00139 function &buildReorderRuleForColumn( &$columns, $curPos, $startPos )
00140 {
00141 $rule = array( $curPos );
00142 eZMatrix::buildReorderChains( $rule, $columns, $curPos, $startPos );
00143 return $rule;
00144 }
00145
00146
00147
00148
00149 function &buildReorderRules( &$columns )
00150 {
00151 $rules = array();
00152 $positions = array_keys( $columns );
00153
00154 foreach ( $positions as $pos )
00155 {
00156 if ( eZMatrix::hasRuleForColumn( $rules, $pos ) )
00157 {
00158 continue;
00159 }
00160
00161 $column =& $columns[$pos];
00162 if ( $column['index'] != $pos )
00163 {
00164 $rules[] =& eZMatrix::buildReorderRuleForColumn( $columns, $pos, $pos );
00165 }
00166 }
00167 return $rules;
00168 }
00169
00170
00171
00172 function reorderColumns()
00173 {
00174 $matrix =& $this->attribute( 'matrix' );
00175 $columns =& $matrix['columns']['sequential'];
00176
00177 $rules =& eZMatrix::buildReorderRules( $columns );
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 foreach( $rules as $rule )
00189 {
00190 $buffer = array( 'columnDefinition' => array(),
00191 'cellsData' => array() );
00192
00193
00194 $pos = count( $rule ) - 1;
00195
00196 $this->copyColumn( $rule[$pos], $buffer, true );
00197
00198 while ( $pos != 0 )
00199 {
00200 $this->copyDataBetweenColumns( $rule[$pos - 1], $rule[$pos]);
00201 --$pos;
00202 }
00203
00204
00205 $this->copyColumn( $rule[0], $buffer, false );
00206 }
00207 }
00208
00209
00210
00211
00212 function hasRuleForColumn( &$rules, $pos )
00213 {
00214 $keys = array_keys( $rules );
00215
00216 foreach ( $keys as $key )
00217 {
00218 $rule =& $rules[$key];
00219 foreach ( $rule as $columnPos )
00220 {
00221 if ( $columnPos == $pos )
00222 {
00223 return true;
00224 }
00225 }
00226 }
00227 return false;
00228 }
00229
00230
00231
00232 function copyColumn( $colIdx, &$buffer, $toBuffer )
00233 {
00234 $this->copyColumnDefinition( $colIdx, $buffer['columnDefinition'], $toBuffer );
00235 $this->copyColumnCellsData ( $colIdx, $buffer['cellsData'], $toBuffer );
00236 }
00237
00238
00239
00240 function copyColumnDefinition( $colIdx, &$buffer, $toBuffer )
00241 {
00242 $matrix =& $this->attribute( 'matrix' );
00243 $columns =& $matrix['columns']['sequential'];
00244
00245 if ( $toBuffer )
00246 $buffer = $columns[$colIdx];
00247 else
00248 $columns[$colIdx] = $buffer;
00249 }
00250
00251
00252
00253 function copyColumnCellsData( $colIdx, &$buffer, $toBuffer )
00254 {
00255 $columnCount = $this->attribute( 'columnCount' );
00256 $rowCount = $this->attribute( 'rowCount' );
00257 $cells =& $this->attribute( 'cells' );
00258 $pos = $colIdx;
00259 $i = 0;
00260
00261
00262 while ( $rowCount > 0 )
00263 {
00264 if ( $toBuffer )
00265 {
00266 $buffer[] = $cells[$pos];
00267 }
00268 else
00269 {
00270 $cells[$pos] = $buffer[$i];
00271 ++$i;
00272 }
00273
00274 $pos += $columnCount;
00275 --$rowCount;
00276 }
00277 }
00278
00279
00280
00281 function copyDataBetweenColumns( $firstColIdx, $secondColIdx, $toSecondCol = true )
00282 {
00283 $this->copyDefinitionBetweenColumns( $firstColIdx, $secondColIdx, $toSecondCol );
00284 $this->copyCellsDataBetweenColumns ( $firstColIdx, $secondColIdx, $toSecondCol );
00285 }
00286
00287
00288
00289 function copyDefinitionBetweenColumns( $firstColIdx, $secondColIdx, $toSecondCol )
00290 {
00291 $matrix =& $this->attribute( 'matrix' );
00292 $columns =& $matrix['columns']['sequential'];
00293
00294 if ( $toSecondCol )
00295 $columns[$secondColIdx] = $columns[$firstColIdx];
00296 else
00297 $columns[$firstColIdx] = $columns[$secondColIdx];
00298 }
00299
00300
00301
00302 function copyCellsDataBetweenColumns ( $firstColIdx, $secondColIdx, $toSecondCol )
00303 {
00304 $columnCount = $this->attribute( 'columnCount' );
00305 $rowCount = $this->attribute( 'rowCount' );
00306 $cells =& $this->attribute( 'cells' );
00307 $firstColPos = $firstColIdx;
00308 $secondColIdx= $secondColIdx;
00309
00310
00311 while ( $rowCount > 0 )
00312 {
00313 if ( $toSecondCol )
00314 {
00315 $cells[$secondColIdx] = $cells[$firstColIdx];
00316 }
00317 else
00318 {
00319 $cells[$firstColIdx] = $cells[$secondColIdx];
00320 }
00321
00322 $firstColIdx += $columnCount;
00323 $secondColIdx += $columnCount;
00324 --$rowCount;
00325 }
00326 }
00327
00328
00329
00330
00331
00332
00333
00334 function updateColumns( &$matrixColumnDefinition, $addNewColumnsAllowed, $updateColumnsAttributesAllowed )
00335 {
00336 $matrixWasModified = false;
00337
00338 if ( $matrixColumnDefinition && $matrixColumnDefinition !== false )
00339 {
00340 $columns =& $matrixColumnDefinition->attribute( 'columns' );
00341 foreach ( $columns as $column )
00342 {
00343 $originalColumn =& $this->getColumnDefinitionByID( $column['identifier'] );
00344 if ( $originalColumn !== false && $updateColumnsAttributesAllowed )
00345 {
00346 $matrixWasModified |= $this->adjustColumnName( $originalColumn, $column['name'] );
00347 $matrixWasModified |= $this->adjustColumnIndex( $originalColumn, $column['index'] );
00348 }
00349 else if ( $addNewColumnsAllowed )
00350 {
00351 $matrixWasModified |= $this->addColumn( $column );
00352 }
00353 }
00354 }
00355 return $matrixWasModified;
00356 }
00357
00358
00359
00360
00361 function removeUselessColumns( &$matrixColumnDefinition )
00362 {
00363 $matrixWasModified = false;
00364 $columnsToRemove =& $this->getColumnsToRemove( $matrixColumnDefinition );
00365
00366 if ( count( $columnsToRemove ) > 0 )
00367 {
00368
00369 $keys = array_keys( $columnsToRemove );
00370 $keys = array_reverse( $keys );
00371
00372 foreach ( $keys as $key )
00373 {
00374 $column =& $columnsToRemove[$key];
00375 $this->removeColumn( $column );
00376 }
00377
00378 $matrixWasModified = true;
00379 }
00380
00381 return $matrixWasModified;
00382 }
00383
00384
00385
00386
00387
00388
00389 function adjustColumnName( &$columnDefinition, $newColumnName )
00390 {
00391 if ( $columnDefinition['name'] != $newColumnName )
00392 {
00393 $this->setColumnName( $columnDefinition, $newColumnName );
00394 return true;
00395 }
00396 return false;
00397 }
00398
00399
00400
00401
00402 function setColumnName( &$columnDefinition, $newColumnName )
00403 {
00404 $columnDefinition['name'] = $newColumnName;
00405 }
00406
00407
00408
00409
00410
00411
00412 function adjustColumnIndex( &$columnDefinition, $newColumnIndex )
00413 {
00414 $colIdx = $columnDefinition['index'];
00415
00416 if ( $columnDefinition['index'] != $newColumnIndex )
00417 {
00418 $this->setColumnIndex( $columnDefinition, $newColumnIndex );
00419 return true;
00420 }
00421 return false;
00422 }
00423
00424
00425
00426
00427 function setColumnIndex( &$columnDefinition, $newColumnIndex )
00428 {
00429 $columnDefinition['index'] = $newColumnIndex;
00430 }
00431
00432
00433
00434
00435
00436 function &getColumnDefinitionByID( &$id )
00437 {
00438 $isColumnExists = false;
00439 $matrix =& $this->attribute( 'matrix' );
00440 $columns =& $matrix['columns']['sequential'];
00441
00442 $keys = array_keys( $columns );
00443 foreach ( $keys as $key )
00444 {
00445 $column =& $columns[$key];
00446 if ( $column['identifier'] == $id )
00447 {
00448 return $column;
00449 }
00450 }
00451 return $isColumnExists;
00452 }
00453
00454
00455
00456
00457 function &getColumnsToRemove( &$matrixColumnsDefinition )
00458 {
00459 $columnsToRemove = array();
00460 $matrix =& $this->attribute( 'matrix' );
00461 $columns =& $matrix['columns']['sequential'];
00462
00463 foreach ( $columns as $column )
00464 {
00465 if ( !eZMatrix::isColumnExists( $column, $matrixColumnsDefinition ) )
00466 {
00467 $columnsToRemove[] = $column;
00468 }
00469 }
00470
00471 return $columnsToRemove;
00472 }
00473
00474
00475
00476
00477
00478
00479 function isColumnExists( &$columnToFind, &$matrixColumnsDefinition )
00480 {
00481 $columns =& $matrixColumnsDefinition->attribute( 'columns' );
00482
00483 foreach ( $columns as $column )
00484 {
00485 if ( $column['identifier'] === $columnToFind['identifier'] )
00486 return true;
00487 }
00488
00489 return false;
00490 }
00491
00492
00493
00494
00495 function addColumn( &$columnDefinition )
00496 {
00497 $this->addColumnToMatrix( $columnDefinition );
00498 $this->addColumnToCells( $columnDefinition );
00499 return true;
00500 }
00501
00502
00503
00504
00505 function addColumnToMatrix( &$columnDefinition )
00506 {
00507 $matrix =& $this->attribute( 'matrix' );
00508 $columns =& $matrix['columns']['sequential'];
00509
00510 $newColumn = array( 'identifier' => $columnDefinition['identifier'],
00511 'index' => $columnDefinition['index'],
00512 'name' => $columnDefinition['name'] );
00513
00514 array_splice( $columns, $columnDefinition['index'], 0, array( $newColumn ) );
00515 }
00516
00517
00518
00519
00520 function addColumnToCells( &$columnDefinition )
00521 {
00522 $cells =& $this->attribute( 'cells' );
00523 $columnCount = $this->attribute( 'columnCount' );
00524 $rowCount = $this->attribute( 'rowCount' );
00525 $pos = $columnDefinition['index'];
00526
00527
00528 while ( $rowCount > 0 )
00529 {
00530 array_splice( $cells, $pos, 0, '' );
00531 $pos += $columnCount;
00532 --$rowCount;
00533 }
00534 }
00535
00536
00537
00538
00539 function removeColumn( &$columnDefinition )
00540 {
00541 $this->removeColumnFromCells( $columnDefinition );
00542 $this->removeColumnFromMatrix( $columnDefinition );
00543 }
00544
00545
00546
00547
00548 function removeColumnFromCells( &$columnDefinition )
00549 {
00550 $cells =& $this->attribute( 'cells' );
00551 $rowCount = $this->attribute( 'rowCount' );
00552 $columnCount = $this->attribute( 'columnCount' );
00553
00554
00555 $pos = ( $rowCount - 1 ) * $columnCount + $columnDefinition['index'];
00556
00557
00558 while ( $rowCount > 0 )
00559 {
00560 array_splice( $cells, $pos, 1 );
00561 $pos -= $columnCount;
00562 --$rowCount;
00563 }
00564 }
00565
00566
00567
00568
00569 function removeColumnFromMatrix( &$columnDefinition )
00570 {
00571 $matrix =& $this->attribute( 'matrix' );
00572 $columns =& $matrix['columns']['sequential'];
00573 $pos = 0;
00574
00575 foreach ( $columns as $column )
00576 {
00577 if ( $column['identifier'] == $columnDefinition['identifier'] )
00578 {
00579 array_splice( $columns, $pos, 1 );
00580 return true;
00581 }
00582 ++$pos;
00583 }
00584 return false;
00585 }
00586
00587
00588
00589
00590 function setName( $name )
00591 {
00592 $this->Name = $name;
00593 }
00594
00595
00596
00597
00598 function &name()
00599 {
00600 return $this->Name;
00601 }
00602
00603 function attributes()
00604 {
00605 return array( 'name' ,
00606 'rows',
00607 'columns',
00608 'matrix',
00609 'cells',
00610 'rowCount',
00611 'columnCount' );
00612 }
00613
00614 function hasAttribute( $name )
00615 {
00616 return in_array( $name, $this->attributes() );
00617 }
00618
00619 function &attribute( $name )
00620 {
00621 switch ( $name )
00622 {
00623 case "name" :
00624 {
00625 return $this->Name;
00626 }break;
00627 case "matrix" :
00628 {
00629 return $this->Matrix;
00630 }break;
00631 case "cells" :
00632 {
00633 return $this->Cells;
00634 }break;
00635 case "rows" :
00636 {
00637 return $this->Matrix['rows'];
00638 }break;
00639 case "columns" :
00640 {
00641 return $this->Matrix['columns'];
00642 }break;
00643 case "rowCount" :
00644 {
00645 $rowCount = count( $this->Matrix['rows']['sequential'] );
00646 return $rowCount;
00647 }break;
00648 case "columnCount" :
00649 {
00650 $columnCount = count( $this->Matrix['columns']['sequential'] );
00651 return $columnCount;
00652 }break;
00653 default:
00654 {
00655 eZDebug::writeError( "Attribute '$name' does not exist", 'eZMatrix::attribute' );
00656 $retValue = null;
00657 return $retValue;
00658 }break;
00659 }
00660 }
00661
00662 function addRow( $beforeIndex = false, $addCount = 1 )
00663 {
00664 $addCount = min( $addCount, 40 );
00665
00666 for ( $r = $addCount; $r > 0; $r-- )
00667 {
00668 $newCells = array();
00669 $numColumns = $this->attribute( 'columnCount' );
00670 $numRows = $this->attribute( 'rowCount' );
00671 for ( $i = 0; $i < $numColumns; $i++ )
00672 {
00673 $newCells[] = '';
00674 }
00675 $newRow = array();
00676 $newRow['columns'] = $newCells;
00677 $this->NumRows++;
00678 if ( $beforeIndex === false )
00679 {
00680 $this->Cells = array_merge( $this->Cells, $newCells );
00681 $newRow['identifier'] = 'row_' . ( $numRows + 1 );
00682 $newRow['name'] = 'Row_' . ( $numRows + 1 );
00683 $this->Matrix['rows']['sequential'][] = $newRow;
00684
00685 }
00686 else
00687 {
00688 $insertIndex = ( $beforeIndex + 1 ) * $numColumns - $numColumns;
00689 array_splice( $this->Cells, $insertIndex, 0, $newCells );
00690 $newRow['identifier'] = 'row_' . $beforeIndex;
00691 $newRow['name'] = 'Row_' . ( $numRows + 1 );
00692 array_splice( $this->Matrix['rows']['sequential'], $beforeIndex, 0, array( $newRow ) );
00693
00694 }
00695 }
00696 }
00697
00698 function removeRow( $rowNum )
00699 {
00700 $numColumns = $this->attribute( 'columnCount' );
00701 $numRows = $this->attribute( 'rowCount' );
00702
00703 array_splice( $this->Cells, $rowNum * $numColumns, $numColumns );
00704 array_splice( $this->Matrix['rows']['sequential'], $rowNum, 1 );
00705 $this->NumRows--;
00706 }
00707
00708
00709
00710
00711 function decodeXML( $xmlString )
00712 {
00713 $xml = new eZXML();
00714 $dom = $xml->domTree( $xmlString );
00715 if ( $xmlString != "" )
00716 {
00717
00718 $nameArray = $dom->elementsByName( "name" );
00719 $this->setName( $nameArray[0]->textContent() );
00720
00721 $columns = $dom->elementsByName( "columns" );
00722 $numColumns = $columns[0]->attributeValue( 'number');
00723
00724 $rows = $dom->elementsByName( "rows" );
00725 $numRows = $rows[0]->attributeValue( 'number');
00726
00727 $namedColumns = $dom->elementsByName( "column" );
00728 $namedColumnList = array();
00729 if ( count( $namedColumns ) > 0 )
00730 {
00731 foreach ( $namedColumns as $namedColumn )
00732 {
00733 $columnName = $namedColumn->textContent();
00734 $columnID = $namedColumn->attributeValue( 'id' );
00735 $columnNumber = $namedColumn->attributeValue( 'num' );
00736 $namedColumnList[$columnNumber] = array( 'name' => $columnName,
00737 'column_number' => $columnNumber,
00738 'column_id' => $columnID );
00739 }
00740 }
00741 $cellArray = $dom->elementsByName( "c" );
00742 $cellCount = count( $cellArray );
00743 $cellList = array();
00744 for ( $i = 0; $i < $cellCount; ++$i )
00745 {
00746 $cellList[] = $cellArray[$i]->textContent();
00747 }
00748
00749 $rows = array( 'sequential' => array() );
00750 $sequentialRows =& $rows['sequential'];
00751
00752 for ( $i = 1; $i <= $numRows; $i++ )
00753 {
00754 $row = array( 'identifier' => 'row_' . $i ,
00755 'name' => 'Row_' . $i );
00756 $rowColumns = array();
00757 for ( $j = 1; $j <= $numColumns; $j++ )
00758 {
00759 $rowColumns[] = $cellList[ ($i-1) * $numColumns + $j-1];
00760 }
00761 $row['columns'] = $rowColumns;
00762 $sequentialRows[] = $row;
00763 }
00764
00765 $columns = array( 'sequential' => array(),
00766 'id' => array() );
00767 $sequentialColumns =& $columns['sequential'];
00768 $idColumns =& $columns['id'];
00769
00770 for ( $i = 0; $i < $numColumns; $i++ )
00771 {
00772 if ( isset( $column ) )
00773 unset( $column );
00774 $column = array();
00775 if ( isset( $namedColumnList[$i] ) && is_array( $namedColumnList[$i] ) )
00776 {
00777 $column = array( 'identifier' => $namedColumnList[$i]['column_id'],
00778 'index' => $i,
00779 'name' => $namedColumnList[$i]['name'] );
00780 }
00781 else
00782 {
00783 $column = array( 'identifier' => 'col_' . ($i + 1),
00784 'index' => $i,
00785 'name' => 'Col_' . ($i + 1) );
00786
00787 }
00788
00789 $columnRows = array();
00790 for( $j = 0; $j < $numRows; $j++ )
00791 {
00792 $columnRows[] =& $sequentialRows[$j]['columns'][$i];
00793 }
00794 $column['rows'] =& $columnRows;
00795 unset( $columnRows );
00796 $sequentialColumns[] =& $column;
00797 $idColumns[$column['identifier']] =& $column;
00798
00799 }
00800 $matrix = array( 'rows' => &$rows,
00801 'columns' => &$columns,
00802 'cells' => &$cellList );
00803
00804 $this->Matrix =& $matrix;
00805 $this->NumRows =& $numRows;
00806 $this->NumColumns =& $numColumns;
00807 $this->Cells =& $cellList;
00808 }
00809 else
00810 {
00811 $this->Cells = array();
00812 $this->Matrix = array();
00813 }
00814 }
00815
00816
00817
00818
00819
00820
00821 function domString( &$domDocument )
00822 {
00823 $ini =& eZINI::instance();
00824 $xmlCharset = $ini->variable( 'RegionalSettings', 'ContentXMLCharset' );
00825 if ( $xmlCharset == 'enabled' )
00826 {
00827 include_once( 'lib/ezi18n/classes/eztextcodec.php' );
00828 $charset = eZTextCodec::internalCharset();
00829 }
00830 else if ( $xmlCharset == 'disabled' )
00831 $charset = true;
00832 else
00833 $charset = $xmlCharset;
00834 if ( $charset !== true )
00835 {
00836 include_once( 'lib/ezi18n/classes/ezcharsetinfo.php' );
00837 $charset = eZCharsetInfo::realCharsetCode( $charset );
00838 }
00839 $domString = $domDocument->toString( $charset );
00840 return $domString;
00841 }
00842
00843
00844
00845
00846 function &xmlString( )
00847 {
00848 $doc = new eZDOMDocument( "Matrix" );
00849 $root = $doc->createElementNode( "ezmatrix" );
00850 $doc->setRoot( $root );
00851
00852 $name = $doc->createElementNode( "name" );
00853 $nameValue = $doc->createTextNode( $this->Name );
00854 $name->appendChild( $nameValue );
00855
00856 $name->setContent( $this->Name() );
00857 $root->appendChild( $name );
00858
00859
00860 $columnsNode = $doc->createElementNode( "columns" );
00861
00862
00863 $sequentalColumns =& $this->Matrix['columns']['sequential'];
00864
00865 $columnAmount = $this->NumColumns;
00866 $columnsNode->appendAttribute( $doc->createAttributeNode( 'number', $columnAmount ) );
00867 $root->appendChild( $columnsNode );
00868
00869 if ( $sequentalColumns != null )
00870 {
00871 for( $i = 0; $i < $columnAmount; $i++ )
00872 {
00873 $column =& $sequentalColumns[$i];
00874 if( $column != null && $column['identifier'] != 'col_'. $i+1 )
00875 {
00876 unset( $columnNode );
00877 $columnNode = $doc->createElementNode( 'column' );
00878 $columnNode->appendAttribute( $doc->createAttributeNode( 'num', $i ) );
00879 $columnNode->appendAttribute( $doc->createAttributeNode( 'id', $column['identifier'] ) );
00880
00881 unset( $columnValueNode );
00882 $columnValueNode = $doc->createTextNode( $column["name"] );
00883
00884 $columnNode->appendChild( $columnValueNode );
00885 $columnsNode->appendChild( $columnNode );
00886 }
00887 }
00888
00889 }
00890
00891
00892 $rowsNode = $doc->createElementNode( "rows" );
00893
00894 $rowAmount = $this->NumRows;
00895
00896 $rowsNode->appendAttribute( $doc->createAttributeNode( 'number', $rowAmount ) );
00897
00898 $root->appendChild( $rowsNode );
00899
00900 foreach ( $this->Cells as $cell )
00901 {
00902 unset( $cellNode );
00903 $cellNode = $doc->createElementNode( 'c' );
00904
00905 unset( $columnValueNode );
00906 $columnValueNode = $doc->createTextNode( $cell );
00907
00908 $cellNode->appendChild( $columnValueNode );
00909 $root->appendChild( $cellNode );
00910 }
00911
00912 $xml = eZMatrix::domString( $doc );
00913
00914 return $xml;
00915 }
00916
00917
00918 var $Name;
00919
00920
00921 var $Matrix;
00922
00923
00924 var $NumColumns;
00925
00926
00927
00928 var $NumRows;
00929 var $Cells;
00930
00931
00932
00933 }
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961 ?>