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

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

//require_once XOOPS_TRUST_PATH."/modules/$mytrustdirname/class/AbstractDeleteAction.class.php";
require_once dirname(dirname(dirname(__FILE__)))."/class/AbstractDeleteAction.class.php";

class Myuploader_Admin_CategoryDeleteAction extends Myuploader_AbstractDeleteAction
{
    function isMemberOnly() {
        return true;
    }

	/**
	 * @protected
	 */
	function _getId()
	{
		return xoops_getrequest('category_id');
	}

	/**
	 * @protected
	 */
	function &_getHandler()
	{
		$handler =& $this->mAsset->getObject('handler', 'category');
		return $handler;
	}

	/**
	 * @protected
	 */
	function _setupActionForm()
	{
		// $this->mActionForm = new Myuploader_Admin_CategoryDeleteForm();
		$this->mActionForm =& $this->mAsset->getObject('form', 'category', true, 'delete');
		$this->mActionForm->prepare();
	}

	/**
	 * @public
	 */
	function executeViewInput(&$render)
	{
		$render->setTemplateName("category_delete.html");
		$render->setAttribute('actionForm', $this->mActionForm);
		#cubson::lazy_load('category', $this->mObject);
		$render->setAttribute('object', $this->mObject);
	}

	/**
	 * @public
	 */
	function executeViewSuccess(&$render)
	{
		$this->mRoot->mController->executeForward("./index.php?op=CategoryList");
	}

	/**
	 * @public
	 */
	function executeViewError(&$render)
	{
		$this->mRoot->mController->executeRedirect("./index.php?op=CategoryList", 1, _MD_MYUPLOADER_ERROR_DBUPDATE_FAILED);
	}

	/**
	 * @public
	 */
	function executeViewCancel(&$render)
	{
		$this->mRoot->mController->executeForward("./index.php?op=CategoryList");
	}
}

?>