<?php
// ------------------------------------------------------------------------- //
//                XOOPS - PHP Content Management System                      //
//                       <http://www.xoops.org/>                             //
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  This program 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 General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
// Author of File: 							     //
// Kazumi Ono (http://www.mywebaddons.com/ , http://www.myweb.ne.jp/)        //
// ------------------------------------------------------------------------- //
// public abstruct
class XoopsForm {
	// private
	var $action;

	//private
	var $method;

	//private
	var $name;

	//private
	var $title;

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

	// private
	var $extra;

	// private
	// required elements
	var $required = array();

	// public
	function XoopsForm($title, $name, $action, $method="post"){
		$this->title = $title;
		$this->name = $name;
		$this->action = $action;
		$this->method = $method;
	}

	// public
	function getTitle(){
		return $this->title;
	}

	// public
	function getName(){
		return $this->name;
	}

	// public
	function getAction(){
		return $this->action;
	}

	// public
	function getMethod(){
		return $this->method;
	}

	// public
	function addElement($ele){
		$this->elements[] = $ele;
	}

	// public
	function getElements(){
		return $this->elements;
	}

	function setExtra($extra){
		$this->extra = " ".$extra;
	}

	function getExtra(){
		if (isset($this->extra)) {
			return $this->extra;
		}
	}

	function setRequired($required){
		if ( is_array($required) ) {
			foreach ( $required as $req ) {
				$this->required[] = $req;
			}
		} else {
			$this->required[] = $required;
		}
	}

	function getRequired(){
		return $this->required;
	}

	// public abstract
	// returns renderered form
	function render(){
	}

	// public
	// displays rendered form
	function display(){
		echo $this->render();
	}
}
?>