<?php
// $Id: formelementtray.php,v 1.1 2004/07/11 10:27:19 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: Kazumi Ono
// Author Website : http://www.mywebaddons.com/ , http://www.myweb.ne.jp
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //

if (!defined("EXOOPS_XOOPSFORMELEMENTTRAY_INCLUDED")) {
	define("EXOOPS_XOOPSFORMELEMENTTRAY_INCLUDED", 1);

include_once(XOOPS_ROOT_PATH."/class/xoopsform/formelement.php");

class XoopsFormElementTray extends XoopsFormElement {

	// array of form element objects
	var $elements = array();
	var $delimeter;

	function XoopsFormElementTray($caption, $delimeter="&nbsp;") {
		$this->setCaption($caption);
		$this->delimeter = $delimeter;
	}

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function addElement($ele) {
	$this->elements[] = $ele;
}

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function getElements() {
	return $this->elements;
}

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function getDelimeter() {
	return $this->delimeter;
}

//---------------------------------------------------------------------------------------//
/**
* Description
*
* @param type $var description
* @return type description
*/
function render() {

$count = 0;
$ret   = "";

foreach ( $this->getElements() as $ele ) {
	if ($count > 0) {
		$ret .= $this->getDelimeter();
	}
	$ret .= $ele->getCaption()."&nbsp;".$ele->render();
	$count++;
}

return $ret;
}

//---------------------------------------------------------------------------------------//
} // END CLASS
} // END DEFINED
?>
