Minahito
minah****@users*****
2006年 8月 5日 (土) 22:20:56 JST
Index: xoops2jp/html/modules/base/actions/MiscFriendAction.class.php diff -u /dev/null xoops2jp/html/modules/base/actions/MiscFriendAction.class.php:1.1.2.1 --- /dev/null Sat Aug 5 22:20:56 2006 +++ xoops2jp/html/modules/base/actions/MiscFriendAction.class.php Sat Aug 5 22:20:55 2006 @@ -0,0 +1,80 @@ +<?php +/** + * @package Legacy + * @version $Id$ + */ + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +require_once XOOPS_MODULE_PATH . "/base/class/PageNavigator.class.php"; +require_once XOOPS_MODULE_PATH . "/base/class/AbstractListAction.class.php"; +require_once XOOPS_MODULE_PATH . "/base/forms/MiscFriendForm.class.php"; + +class Legacy_MiscFriendAction extends Legacy_Action +{ + var $mActionForm = null; + var $mMailer = null; + + function hasPerm(&$controller, &$xoopsUser) + { + return is_object($xoopsUser); + } + + function prepare(&$controller, &$xoopsUser) + { + // + // TODO We will remove the following loading. + // + $controller->mRoot->mLanguageManager->loadPageTypeMessageCatalog('misc'); + + $this->mActionForm =& new Legacy_MiscFriendForm(); + $this->mActionForm->prepare(); + } + + function getDefaultView(&$controller, &$xoopsUser) + { + $this->mActionForm->load($xoopsUser); + return LEGACY_FRAME_VIEW_INPUT; + } + + function execute(&$controller, &$xoopsUser) + { + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if ($this->mActionForm->hasError()) { + return LEGACY_FRAME_VIEW_INPUT; + } + + $this->mMailer =& getMailer(); + $this->mMailer->setTemplate("tellfriend.tpl"); + $this->mMailer->assign("SITENAME", $controller->getConfig('sitename')); + $this->mMailer->assign("ADMINMAIL", $controller->getConfig('adminmail')); + $this->mMailer->assign("SITEURL", XOOPS_URL . '/'); + + $this->mActionForm->update($this->mMailer); + + $this->mMailer->setSubject(sprintf(_MSC_INTSITE, $xoopsConfig['sitename'])); + + return $this->mMailer->send() ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR; + } + + function executeViewInput(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("legacy_misc_friend.html"); + $render->setAttribute('actionForm', $this->mActionForm); + } + + function executeViewSuccess(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("legacy_misc_friend_success.html"); + } + + function executeViewError(&$controller, &$xoopsUser, &$render) + { + $render->setTemplateName("legacy_misc_friend_error.html"); + $render->setTemplate('xoopsMailer', $this->mMailer); + } +} + +?>