<?php
/*
 * This file is part of the Easy-CMS project.
 * Easy-CMS 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.
 * 
 * Easy-CMS 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 Easy-CMS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/**
 * @package    Core
 * @subpackage Forms
 */
 
include_once('classes/core/types/TypesManager.class.php');
include_once('classes/core/types/Type.class.php');

/**
 * @author     vinadelmar <vinadelmar@users.sourceforge.net>
 * @since      2006-02-20
 * @version    1.2.2d
 * @package    Core
 * @subpackage Forms
 */
class ObjectForm extends CoreObject {
	/**#@+
	 * @access protected
	 */

 /**
	 * Pointer to the Site instance
	 *
	 * @var object
	 */
	var $site;

	/**
	 * Action that is asked by the user
	 *
	 * @var string
	 */
	var $action;

	/**
	 * Object that is edited through HTML form
	 *
	 * @var object
	 */
	var $object;

 /**
	 * The manager for the Object that is edited through HTML form
	 *
	 * @var object
	 */
	var $objectManager;

	/**#@-*/
	
	/**
	 * Class Constructor
	 *
	 * @todo should be able to output warnings when expected hidden fields are not set 
	 */
	function ObjectForm(&$site) {
		$this->site = &$site;
		$this->debug("ObjectForm::__construct(), status : constructor invoked.", 10);
	}
	
	function getLangId() {
		return $this->site->getPersistentVar('lid');
	}

	function &getObject() {
		return $this->object;
	}

	function &getObjectManager() {
		return $this->objectManager;
	}

	/**
	 * @final
	 */
	function setAction($action) {
		$this->action = $action;
	}
	
	/**
	 * @final
	 */
	function getAction() {
		return $this->action;
	}
	
	/**
	 * @access protected
	 * @final
	 */
	function _addSlashes($val) {
		return get_magic_quotes_gpc()? $val : addslashes($val);
	}
	
	/**
	 * @access protected
	 * @final
	 */
	function _stripSlashes($val) {
		return get_magic_quotes_gpc()? stripslashes($val) : $val;
	}
	
	/**
	 * Process Form Data
	 *
	 * @abstract
	 */
	function processForm() {
	}
}

?>