<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

/*
  -------------------- Name conventions --------------------
  Function names (except methods):

  ff_DescriptionOfFunction


  Constant names:

  cc_DescriptionOfConstant


  Variable names:

  $ST_DescriptionOfVariable

  where S is a scope, T is a type.

  The following scopes should be used:
  g - global
  s - static
  l - local
  m - member of class
  p - parameter

  The following types should be used:
  s - scalar
  a - array
  r - resource
  o - object
  m - mixed

  -------------------- end Name conventions --------------------
*/





include_once ( dirname(__FILE__) . "/module.Database.php" );





class MenuItems
{
    /* -------------------- Members -------------------- */
    var $mo_Query; // database query
    var $ms_MenuBlockID; // menublock_id field
    var $ms_Text; // text of menu
    var $ms_HRef; // href of menu
    var $ms_ID; // id field
		var $mi_InFrame; // open in frame
    /* -------------------- end Members -------------------- */





    /* -------------------- Constructor -------------------- */
    function MenuItems ( $ps_MenuBlockID )
    {
			$this->ms_MenuBlockID = $ps_MenuBlockID;
    }
    /* -------------------- end Constructor -------------------- */





    /* -------------------- iteration -------------------- */
    function Start()
    {
			$lo_DB =& get_db_connection();
			$this->mo_Query =& $lo_DB->Select
				( "SELECT * FROM menuitem WHERE menublock_id=" . db_full_quote($this->ms_MenuBlockID) . " ORDER BY id" );
    }

    function NextElement()
    {
			$la_Row = $this->mo_Query->nextrow();
			if ( ! $la_Row )
				return FALSE;
			$this->ms_Text = $la_Row["label"];
			$this->ms_HRef = $la_Row["href"];
			$this->ms_ID = $la_Row["id"];
			$this->mi_InFrame = $la_Row["in_frame"];

			return TRUE;
    }
    /* -------------------- end iteration -------------------- */





    /* -------------------- access to one element -------------------- */
    function GetLabel()
    {
			return $this->ms_Text;
    }

    function GetHRef()
    {
			global $PHP_AUTH_USER;
			return preg_replace ( "/\#\#username\#\#/", $PHP_AUTH_USER, $this->ms_HRef );
    }

    function GetID()
    {
			return $this->ms_ID;
    }

		function GetInFrame()
		{
			return $this->mi_InFrame;
		}
    /* -------------------- end access to one element -------------------- */

}
?>
