- <?php
- /**
- * @copyright sptpl_clsBlock.php is part of Sptpl project {@link http://www.andrioli.com/en/sptpl.html} and it is LGPL
- * @author Andrioli Darvin <darvin (inside) andrioli (dot) com>
- * @version $Header: d:\cvs/classistd/sptpl/sptpl_clsBlock.php,v 2.6 2005/03/02 21:00:54 Darvin Exp $
- */
- /*
- * +-------------------------------------------------------------------------+
- * | Sptpl |
- * +-------------------------------------------------------------------------+
- * | Copyright (c) 2003-2005 Andrioli Darvin |
- * | Email <darvin (inside) andrioli (dot) com> |
- * | Web http://www.andrioli.com/en/sptpl.html |
- * | Download http://www.phpclasses.org/browse.html/package/1326.html |
- * | |
- * +-------------------------------------------------------------------------+
- * | This library is free software; you can redistribute it and/or modify |
- * | it under the terms of the GNU Lesser General Public License as |
- * | published by the Free Software Foundation; either version 2 of the |
- * | License, or (at your option) any later version. |
- * | |
- * | This library is distributed in the hope that it will be useful, but |
- * | WITHOUT ANY WARRANTY; without even the implied warranty of |
- * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
- * | Lesser General Public License for more details. |
- * | |
- * | You should have received a copy of the GNU Lesser General Public |
- * | License along with this library; if not, write to the Free Software |
- * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
- * +-------------------------------------------------------------------------+
- */
-
- class CBlock {
- /**
- * reference to the instance of DataManager, created by the class sptpl
- * @var object CDataStorage $DataMgr
- */
- var $DataMgr;
-
- var $SuggestedId;
-
- var $MyId;
-
- var $Param;
-
- /**
- * Block type:
- * block (block of rows), single (single row)
- * @var string
- */
- var $Type;
- /**
- * Id of the columnset to use to print the block's contents
- * default='' =no columnset required
- * @var string
- */
- var $ColumnSet;
- /**
- * The array contains the parameters for each level of grouping
- * @var array
- * @see ParseXml()
- */
- var $Levels;
-
- /**
- * Groups definition
- * @var array
- * @see ParseXml()
- */
- var $Groups;
-
- /**
- * Parameters to connect to the db to extract tha data
- * @var array
- */
- var $Db;
- /**
- * Name of tha global array where look for the information to printout
- * @var array
- */
- var $Source;
-
- /**
- * Type of data source configured for the block.
- * Values: Sql, Variable, Function
- * @var string
- */
- var $SourceType;
-
- var $Rows;
- /**
- * reference to the instance of PageManager created by the class sptpl
- * @var object CPageMgr
- */
- var $PageMgr;
- /**
- * Array holding the name of the counters defined
- * in this block.
- * @var array
- */
- var $Counters;
- /**
- * Array holding the name of the counters defined at block
- * level
- * @var array
- */
- var $GlobalCounters;
-
- /**
- * Class constructor
- * @param object CDataStorage &$RefToDataMgr
- * @param object CPageMgr &$clsPageMgr
- * @param string $id
- * @param object CXml2Array $Node
- */
- function CBlock(&$RefToDataMgr,&$clsPageMgr,$id,$Node)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('CBlock');
- $this->DataMgr=&$RefToDataMgr;
- $this->MyId="";
- $this->SuggestedId=$id;
- $this->Param=array();
- $this->Db=array();
- $this->Counters=array();
- $this->GlobalCounters=array();
- $this->ColumnSet='';
- $this->PageMgr=&$clsPageMgr;
- if(!is_object($this->PageMgr))
- trigger_error('Internal error. CBlock second parameter should be an object',E_USER_ERROR);
-
- switch (strtolower($Node->GetNodeName())) {
- case 'row':
- $this->_SingleRowBlock($Node);
- break;
- case 'block':
- $this->ParseXml($Node);
- break;
- case 'newpage':
- $this->_NewPageBlock($Node);
- break;
- }
-
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Returns the block Id
- * @access public
- */
- function GetId()
- {
- return($this->MyId);
- }
-
-
- /**
- * Parse the block tag and its childs and set the intenal structure
- *
- * @param object CXml2Array $Node
- * @access public
- */
- function ParseXml($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('ParseXml');
- // Check some attribute
- while(($ret=$Cfg->EachAttribute())!=FALSE)
- {
- list($AttribName,$value)=$ret;
- switch(strtolower($AttribName))
- {
- case 'id':
- if($this->MyId=="")
- $this->MyId=$value;
- else
- trigger_error("You cannot change the id to an existing block",E_USER_ERROR);
- break;
- case 'columnset':
- $this->ColumnSet=$value;
- break;
- }
- }
- // No Id from the configuration node, use the suggested
- if($this->MyId=="") {$this->MyId=$this->SuggestedId;}
- $this->Type='Block';
- $this->Levels=array();
- $this->Groups=array();
- // loop on root's child
- while(($ret=$Cfg->EachChild())!=FALSE)
- {
- list($ChildName,$child)=$ret;
- switch(strtolower($ChildName)) {
- case 'counter':
- $this->_NewBlockCounter($child);
- break;
- case 'datasource' :
- $this->_BlockAddDataSource($child);
- break;
- case 'group' :
- $this->_BlockAddGroup($child);
- break;
- case 'openbody' :
- $this->_BlockBodyRows($child,'openbody',CURRENTVALUE);
- break;
- case 'closebody' :
- $this->_BlockBodyRows($child,'closebody',OLDVALUE);
- break;
- case 'body' :
- $this->_BlockAddBody($child);
- break;
- case 'endgroup' :
- $this->_BlockCloseGroup($child);
- break;
- case 'font' :
- $this->PageMgr->NewFont($child);
- break;
- default:
- trigger_error('Unknown tag '.$ChildName,E_USER_ERROR);
- break;
- }
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- return;
- }
-
- /**
- * Create a new counter at block level.
- *
- * @parameter object CXml2Array $Node
- * @access private
- */
- function _NewBlockCounter($Node)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_NewBlockCounter');
- $c_name=$this->DataMgr->AddCounter($Node);
- $this->Counters[]=$c_name;
- $this->GlobalCounters[]=$c_name;
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Create a new counter for the group $Name.
- *
- * @parameter object CXml2Array $Node
- * @parameter string $Name group name
- * @access private
- */
- function _NewGroupCounter($Node,$Name)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_NewGroupCounter');
- $c_name=$this->DataMgr->AddCounter($Node);
- $this->Counters[]=$c_name;
- $this->Groups[$Name]['counters'][]=$c_name;
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
-
- /**
- * Load the rows from openbody tag.
- * Notice: the tag may contains only text or many row childs
- *
- * @param object CXml2Array $Cfg
- * @param string which tag I'm parsing from the configuration, openbody or closebody
- * @param string OLDVALUE, CURRENTVALUE, constant to pass to crow. OLDVALUE is used by
- * closebody, CURRENTVALUE is iused by openbody
- * @see OLDVALUE
- * @see CURRENTVALUE
- * @see CRow()
- * @access private
- */
- function _BlockBodyRows($Cfg,$index,$valueType)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_BlockBodyRows');
- $this->Rows[$index]=array();
- // If I've some text add it as normal row
- $InnerText=$Cfg->GetText();
- if($InnerText<>'')
- $this->Rows[$index][]=new CRow($this->DataMgr,$child,$valueType);
-
- // loop over the row childs
- while(($ret=$Cfg->EachChild())!=FALSE)
- {
- list($ChildName,$child)=$ret;
- switch(strtolower($ChildName)) {
- case 'row' :
- $this->Rows[$index][]=new CRow($this->DataMgr,$child,$valueType);
- break;
- }
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
-
- /**
- * Set the data source information for the current block
- *
- * @param object CXml2Array $Cfg
- * @access private
- */
- function _BlockAddDataSource($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_BlockAddDataSource');
- while(($ret=$Cfg->EachChild())!=FALSE)
- {
- list($ChildName,$child)=$ret;
- switch(strtolower($ChildName)) {
- case 'dbname' :
- case 'dbserver' :
- case 'dbuser' :
- case 'dbpasswd' :
- case 'dbclass' :
- $this->Db[$ChildName]=$child->GetText();
- break;
- case 'sql' :
- // it allows many sql statement
- $this->Db['sql'][]=$child->GetText();
- $this->SourceType='Sql';
- break;
- case 'varname' :
- // Global variable name
- $this->Source=$child->GetText();
- $this->SourceType='Variable';
- break;
- case 'function' :
- // Function to call
- $this->Source=$child->GetText();
- $this->SourceType='Function';
- break;
- default:
- trigger_error('Unknown tag '.$ChildName,E_USER_ERROR);
- break;
- }
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
-
- /**
- * Set the grouping information for the current block
- *
- * @param object CXml2Array $Cfg
- * @access private
- */
- function _BlockAddGroup($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_BlockAddGroup');
- $Level=-1;
- $Name='';
- $Key='';
- while(($ret=$Cfg->EachAttribute())!=FALSE)
- {
- list($AttribName,$value)=$ret;
- if(strtolower($AttribName)=='level') { $Level=$value;}
- if(strtolower($AttribName)=='name') { $Name=$value;}
- if(strtolower($AttribName)=='key') { $Key=$value;}
- }
-
- if($Level==-1)
- trigger_error('Group level not specified',E_USER_ERROR);
-
- if($Name=='')
- trigger_error('Group name not specified',E_USER_ERROR);
-
- if($Key=='')
- trigger_error('Group key not specified',E_USER_ERROR);
-
- if(array_key_exists($Level,$this->Levels))
- trigger_error('Level '.$Level.' for group '.$Name.' already exists',E_USER_ERROR);
-
- if(array_key_exists($Level,$this->Groups))
- trigger_error('Group name '.$Name.' already exists',E_USER_ERROR);
-
- $this->Groups[$Name]['key']=$Key;
- $this->Groups[$Name]['level']=$Level;
- $this->Groups[$Name]['open']=array();
- $this->Groups[$Name]['counters']=array();
- $this->Groups[$Name]['close']=array();
- $this->Levels[$Level]['groupname']=$Name;
- $this->Levels[$Level]['key']=$Key;
- $this->Levels[$Level]['value']='';
- // the open group may contains many row tag
- while(($ret=$Cfg->EachChild())!=FALSE)
- {
- list($ChildName,$child)=$ret;
- switch(strtolower($ChildName)) {
- case 'row' :
- $this->Groups[$Name]['open'][]=new CRow($this->DataMgr,$child);
- break;
- case 'counter':
- $this->_NewGroupCounter($child,$Name);
- break;
- }
- }
-
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Set the body
- *
- * @param object CXml2Array $Cfg
- * @access private
- */
- function _BlockAddBody($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_BlockAddBody');
- $this->Rows['row']=array();
- $this->Rows['header']=array();
- while(($ret=$Cfg->EachChild())!=FALSE)
- {
- list($ChildName,$child)=$ret;
- switch(strtolower($ChildName)) {
- case 'row' :
- case 'header' :
- $this->Rows[strtolower($ChildName)][]=new CRow($this->DataMgr,$child);
- break;
- default:
- trigger_error('Unknown tag '.$ChildName,E_USER_ERROR);
- break;
- }
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
-
- /**
- * Set the text for the closing group row.
- *
- * @param object CXml2Array $Cfg
- * @access private
- */
- function _BlockCloseGroup($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_BlockCloseGroup');
- $Name='';
- while(($ret=$Cfg->EachAttribute())!=FALSE)
- {
- list($AttribName,$value)=$ret;
- switch(strtolower($AttribName))
- {
- case 'name' :
- $Name=$value;
- break;
- }
- }
- if($Name=='')
- trigger_error('Endgroup name not specified',E_USER_ERROR);
- // the open group may contains many row tag
- while(($ret=$Cfg->EachChild())!=FALSE)
- {
- list($ChildName,$child)=$ret;
- switch(strtolower($ChildName)) {
- case 'row' :
- $this->Groups[$Name]['close'][]=new CRow($this->DataMgr,$child,OLDVALUE);
- break;
- }
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Parse the tag row and add it to the array report as block
- * with only a single row. Return the block id assigned or what I get
- * from the attribute id.
- *
- * @param object CXml2Array $Cfg
- * @access private
- */
- function _SingleRowBlock($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_SingleRowBlock');
- // Check some attribute
- $idBlock=$this->SuggestedId;
- while(($ret=$Cfg->EachAttribute())!=FALSE)
- {
- list($AttribName,$value)=$ret;
- if(strtolower($AttribName)=='id') { $idBlock=$value;}
-
- }
- $this->Type='row';
- $this->Rows['row'][]=new CRow($this->DataMgr,$Cfg);
- $this->Levels=array();
- $this->Groups=array();
- $this->MyId=$idBlock;
- if(DEBUG) $GLOBALS['dbg']->f_out();
- return;
- }
-
- /**
- * Parse the tag newpage and add it to the array report as block
- * with only a single row. Return the block id assigned or what I get
- * from the attribute id.
- *
- * @param object CXml2Array $Cfg
- * @access private
- */
- function _NewPageBlock($Cfg)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_NewPageBlock');
- // Check some attribute
- $idBlock=$this->SuggestedId;
- while(($ret=$Cfg->EachAttribute())!=FALSE)
- {
- list($AttribName,$value)=$ret;
- if(strtolower($AttribName)=='id') { $idBlock=$value;}
- }
- $this->Type='row';
- $this->Rows['row'][]=new CNewPage();
- $this->Levels=array();
- $this->Groups=array();
- $this->MyId=$idBlock;
- if(DEBUG) $GLOBALS['dbg']->f_out();
- return;
- }
-
-
- //********************************************************************************
-
- /**
- * Draw one block. In this function I establish wich type block I've
- * and run the right function to manage it
- *
- * @access public
- */
- function RunBlock()
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('RunBlock');
- // single row block?
- // var_dump($this->Groups);
- if(!is_object($this->PageMgr))
- trigger_error('Internal error. RunBlock, first parameter should be an object',E_USER_ERROR);
- // Set the required columnset (if set)
- if($this->ColumnSet!='')
- $this->PageMgr->NewColumnSet($this->ColumnSet);
- if($this->Type=='row')
- {
- // Single row type, I'm expecting to get the row key
- if(array_key_exists('row',$this->Rows))
- $this->_RunBlockSingleRow();
- else
- trigger_error('Internal error, block without any row',E_USER_ERROR);
- }
- else
- {
- // block type. Loop over many row.
- // Switch between the diifferent source types
- switch($this->SourceType)
- {
- case 'Sql': // Data from database
- $this->_RunBlockFromDb();
- break;
- case 'Variable': // Data from GLOBAL array
- $this->_RunBlockFromArray();
- break;
- case 'Function': // Data from custom function
- $this->_RunBlockFromFunction();
- break;
- default:
- trigger_error('ERROR: undefined block\'s datasource.',E_USER_ERROR);
- }
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Block without repetition
- */
- function _RunBlockSingleRow()
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_RunBlockSingleRow');
- $this->DataMgr->ResetCounter($this->GlobalCounters);
- $this->_WriteDataBlock(array(),0,0);
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Open db connection, run the query, and loop through the returned rows
- *
- * @access private
- */
- function _RunBlockFromDb()
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('RunBlockFromDb');
- $RepDb=$this->Db;
- // open the connection to the db
- // From DbClass, I establish which class use to connect to the db
- if(!array_key_exists('dbclass',$RepDb))
- trigger_error('Undefined dbclass for block id:'.$this->MyId,E_USER_ERROR);
- eval('$DbConn=new '.$RepDb['dbclass'].'();');
- $ConStr='$DbConn->DbOpen(';
- //Db server
- if(!array_key_exists('dbserver',$RepDb))
- trigger_error('Undefined dbserver for block id:'.$this->MyId,E_USER_ERROR);
- $ConStr.='"'.$RepDb['dbserver'].'",';
- //dbUser
- if(!array_key_exists('dbuser',$RepDb))
- trigger_error('Undefined dbuser for block id:'.$this->MyId,E_USER_ERROR);
- $ConStr.='"'.$RepDb['dbuser'].'",';
- //dbpasswd
- if(array_key_exists('dbpasswd',$RepDb))
- $ConStr.='"'.$RepDb['dbpasswd'].'",';
- else
- $ConStr.='"",';
- //dbname
- if(!array_key_exists('dbname',$RepDb))
- trigger_error('Undefined dbname for block id:'.$this->MyId,E_USER_ERROR);
- $ConStr.='"'.$RepDb['dbname'].'");';
- // Open the connection
- eval($ConStr);
-
- //Run all query
- foreach($RepDb['sql'] as $sql)
- {
- $DbConn->DbExecSql($sql);
- }
- $NumLevels=$this->_InitGrouping();
- //loop over all returned data row
- $counter=0;
- $this->DataMgr->ResetCounter($this->GlobalCounters);
- while($fields=$DbConn->DbGetValue())
- {
- $this->_WriteDataBlock($fields,$NumLevels,!$counter);
- $counter++;
- }
- $this->_CloseAllGroups($NumLevels);
- $DbConn->DbClose();
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Printout all record form a given array (from $GLOBAL)
- *
- * @access private
- */
- function _RunBlockFromArray()
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('RunBlockFromArray');
- $ArrayName=$this->Source;
- if(!array_key_exists($ArrayName,$GLOBALS))
- trigger_error('Array '.$ArrayName.' does not exist in $GLOBAL',E_USER_ERROR);
- $DataArray=$GLOBALS[$ArrayName];
- // Init tha grouping index
- $NumLevels=$this->_InitGrouping();
- //loop over all keys
- $counter=0;
- $this->DataMgr->ResetCounter($this->GlobalCounters);
- foreach($DataArray as $fields)
- {
- $this->_WriteDataBlock($fields,$NumLevels,!$counter);
- $counter++;
- }
- $this->_CloseAllGroups($NumLevels);
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Printout all data from the values returned by the custom function
- * Note: the function must return an associative array.
- * The names of the fields are the indexes of the array.
- *
- * @access private
- */
- function _RunBlockFromFunction()
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('RunBlockFromFunction');
- if(!function_exists($this->Source))
- trigger_error('The function '.$this->Source.' does not exist in $GLOBAL',E_USER_ERROR);
- // Init the grouping index
- $NumLevels=$this->_InitGrouping();
- //loop over all keys
- $counter=0;
- $this->DataMgr->ResetCounter($this->GlobalCounters);
- eval('$fields='.$this->Source.'();');
- while($fields)
- {
- $this->_WriteDataBlock($fields,$NumLevels,!$counter);
- $counter++;
- eval('$fields='.$this->Source.'();');
- }
- $this->_CloseAllGroups($NumLevels);
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Initialize the variable used to manage the grouping for the specified block
- * The function return the max level specified. 0 if none.
- * @return integer
- * @access private
- */
- function _InitGrouping()
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_InitGrouping');
- // var_dump($this->Levels);
- if(!count($this->Levels))
- return(0);
-
- $MaxLevel=0;
- foreach($this->Levels as $key=>$level)
- {
- if($key>$MaxLevel)
- $MaxLevel=$key;
- $this->Levels[$key]['value']='';
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- return($MaxLevel);
- }
-
-
- /**
- * Main draw function.
- * Manage the grouping, run the open/close group
- * Menage the open/close table (with header) and write the row
- *
- * @parameter array $fields Data field for the current row.
- * @parameter integer $NumLevels number of nested level for the current block
- * @parameter boolean $FirstRow Is the first time for the current block?
- * @access private
- *
- */
-
- function _WriteDataBlock($fields,$NumLevels,$FirstRow)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_WriteDataBlock');
- // var_dump($NumLevels);
- $this->DataMgr->ToValue($fields);
- $ChangeKey=false;
- $CurrentLevel=1;
- // check if some key is changed
- while($CurrentLevel<$NumLevels+1&&!$ChangeKey)
- {
- if(!$this->DataMgr->ExistValue($this->Levels[$CurrentLevel]['key']))
- trigger_error('The key for grouping '.$this->Levels[$CurrentLevel]['key'].' does not exists',E_USER_ERROR);
- if($this->Levels[$CurrentLevel]['value']!=$this->DataMgr->GetVar($this->Levels[$CurrentLevel]['key']))
- {
- // We have some change
- if($this->Levels[$CurrentLevel]['value']!='')
- {
- // Ok, I need to run the closing group from the inner to the outer
- for($i=$NumLevels;!$i<$CurrentLevel;$i--)
- $this->_CloseGroup($i);
- }
- // Open the group for the new key value
- for($i=$CurrentLevel;!($i>$NumLevels);$i++)
- {
- if(!$this->DataMgr->ExistValue($this->Levels[$i]['key']))
- trigger_error('The key for grouping '.$this->Levels[$i]['key'].' does not exists',E_USER_ERROR);
- $this->Levels[$i]['value']=$this->DataMgr->GetVar($this->Levels[$i]['key']);
- $this->_OpenGroup($i);
- }
- $ChangeKey=true;
- } // if key change
- $CurrentLevel++;
- } // while
-
- if($ChangeKey||$FirstRow)
- {
- if(array_key_exists('openbody',$this->Rows))
- {
- foreach($this->Rows['openbody'] as $Key => $Value)
- $Value->WriteOut($this->PageMgr);
- }
- $this->PageMgr->PrintColumnsHeader(); // If the columns have its own headers
- if(array_key_exists('header',$this->Rows))
- {
- foreach($this->Rows['header'] as $Key => $Value)
- $Value->WriteOut($this->PageMgr);
- }
- }
- // Update All counters
- $this->DataMgr->UpdateCounters($this->Counters);
- // print "<br>out:".$this->MyId."<br>";
- // and finally print out the row
- foreach($this->Rows['row'] as $Key => $Value)
- $Value->WriteOut($this->PageMgr);
-
- $this->DataMgr->RemoveFromValue($fields);
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
-
- /**
- * Print out the opening row for the group level $Level
- * @parameter integer $Level group level to close
- * @access private
- */
- function _OpenGroup($Level)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_OpenGroup');
- $GroupName=$this->Levels[$Level]['groupname'];
- $Group=$this->Groups[$GroupName];
- if(array_key_exists('open',$Group))
- {
- foreach($Group['open'] as $Key => $Value)
- $Value->WriteOut($this->PageMgr);
- }
- $this->DataMgr->ResetCounter($this->Groups[$GroupName]['counters']);
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Print out the closing row for the group level $Level
- * @parameter integer $Level group level to close
- * @access private
- */
- function _CloseGroup($Level)
- {
- if(DEBUG) $GLOBALS['dbg']->f_in('_CloseGroup');
- $GroupName=$this->Levels[$Level]['groupname'];
- // $Group=$this->Groups[$GroupName];
- if(array_key_exists('close',$this->Groups[$GroupName]))
- {
- foreach($this->Groups[$GroupName]['close'] as $Key => $Value)
- $Value->WriteOut($this->PageMgr);
- }
- if(DEBUG) $GLOBALS['dbg']->f_out();
- }
-
- /**
- * Close all opend groups.
- * @param integer $NumLevels
- * @access private
- */
- function _CloseAllGroups($NumLevels)
- {
- for($i=$NumLevels;$i>0;$i--)
- $this->_CloseGroup($i);
- }
-
- }
-
- ?>