Minahito
minah****@users*****
2006年 7月 27日 (木) 18:40:18 JST
Index: xoops2jp/html/modules/pm/actions/DeleteOneAction.class.php diff -u /dev/null xoops2jp/html/modules/pm/actions/DeleteOneAction.class.php:1.1.2.1 --- /dev/null Thu Jul 27 18:40:18 2006 +++ xoops2jp/html/modules/pm/actions/DeleteOneAction.class.php Thu Jul 27 18:40:18 2006 @@ -0,0 +1,69 @@ +<?php +/** + * @package pm + * @version $Id: DeleteOneAction.class.php,v 1.1.2.1 2006/07/27 09:40:18 minahito Exp $ + */ + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/pm/class/AbstractDeleteAction.class.php"; +require_once XOOPS_MODULE_PATH . "/pm/forms/DeleteOneForm.class.php"; + +class Pm_DeleteOneAction extends Pm_AbstractDeleteAction +{ + function _getId() + { + return xoops_getrequest('msg_id'); + } + + function &_getHandler() + { + $handler =& xoops_gethandler('privmessage'); + return $handler; + } + + function _setupActionForm() + { + $this->mActionForm =& new Pm_DeleteOneForm(); + $this->mActionForm->prepare(); + } + + function hasPermission(&$controller, &$xoopsUser, $moduleConfig) + { + if (parent::hasPermission($controller, $xoopsUser, $moduleConfig)) { + return $xoopsUser->get('uid') == $this->mObject->get('to_userid'); + } + else { + return false; + } + } + + function executeViewInput(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("pm_delete_one.html"); + $render->setAttribute('actionForm', $this->mActionForm); + $render->setAttribute('object', $this->mObject); + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + $controller->executeForward(XOOPS_URL . "/viewpmsg.php"); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + $controller->executeRedirect(XOOPS_URL . "/viewpmsg.php", 1, _MD_PM_ERROR_ACCESS); + } + + function executeViewCancel(&$controller, &$xoopsUser, &$render) + { + if (is_object($this->mObject)) { + $controller->executeForward(XOOPS_MODULE_URL . "/pm/index.php?action=read&msg_id=" . $this->mObject->get('msg_id')); + } + else { + $controller->executeForward(XOOPS_URL . "/viewpmsg.php"); + } + } +} + +?>