<?php
/**
 * @version $Id: CategoryDeleteForm.class.php 679 2012-08-20 12:41:35Z hodaka $
 * @package myuploader
 */

if (!defined('XOOPS_ROOT_PATH')) exit();

require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php';
//require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php';

class Myuploader_Admin_CategoryDeleteForm extends XCube_ActionForm
{
	/**
	 * @public
	 */
	function getTokenName()
	{
		return "module.myuploader.Admin_CategoryDeleteForm.TOKEN";
	}

	/**
	 * @public
	 */
	function prepare()
	{
		//
		// Set form properties
		//
		$this->mFormProperties['category_id'] = new XCube_IntProperty('category_id');
        $this->mFormProperties['delete_related'] = new XCube_BoolProperty('delete_related');
        
		//
		// Set field properties
		//
		$this->mFieldProperties['category_id'] = new XCube_FieldProperty($this);
		$this->mFieldProperties['category_id']->setDependsByArray(array('required'));
		$this->mFieldProperties['category_id']->addMessage('required', _MD_MYUPLOADER_ERROR_REQUIRED, _MD_MYUPLOADER_LANG_CATEGORY_ID);
/*        $this->mFieldProperties['delete_related'] = new XCube_FieldProperty($this);
        $this->mFieldProperties['delete_related']->setDependsByArray(array('required'));
        $this->mFieldProperties['delete_related']->addMessage('required', _MD_MYUPLOADER_ERROR_REQUIRED, _MD_MYUPLOADER_LANG_DELETE_RELATED_IMAGES);*/
	}

	/**
	 * @public
	 */
	function load(&$obj)
	{
		$this->set('category_id', $obj->get('category_id'));
//        $this->set('delete_related', $this->mContext->mRequest->getRequest('delete_related'));
        $this->set('delete_related', $obj->mDeleteRelatedImagesFlag);
	}

	/**
	 * @public
	 */
	function update(&$obj)
	{
//		$obj->set('category_id', $this->get('category_id'));
        $obj->mDeleteRelatedImagesFlag = $this->get('delete_related');
//        $this->set('delete_related', $this->mContext->mRequest->getRequest('delete_related'));
	}
}

?>