Minahito
minah****@users*****
2006年 7月 27日 (木) 18:30:24 JST
Index: xoops2jp/html/modules/base/kernel/Legacy_EventFunctions.class.php diff -u xoops2jp/html/modules/base/kernel/Legacy_EventFunctions.class.php:1.1.2.7 xoops2jp/html/modules/base/kernel/Legacy_EventFunctions.class.php:1.1.2.8 --- xoops2jp/html/modules/base/kernel/Legacy_EventFunctions.class.php:1.1.2.7 Tue May 30 12:58:04 2006 +++ xoops2jp/html/modules/base/kernel/Legacy_EventFunctions.class.php Thu Jul 27 18:30:24 2006 @@ -1,55 +1,184 @@ <?php /** - * @version $Id: Legacy_EventFunctions.class.php,v 1.1.2.7 2006/05/30 03:58:04 minahito Exp $ + * @package legacy + * @version $Id: Legacy_EventFunctions.class.php,v 1.1.2.8 2006/07/27 09:30:24 minahito Exp $ */ if (!defined('XOOPS_ROOT_PATH')) exit(); class Legacy_EventFunction { - function AccessToImageManager(&$controller,$eventArgs) + function imageManager() { require_once XOOPS_MODULE_PATH . "/base/class/ActionFrame.class.php"; + $root =& XCube_Root::getSingleton(); + $moduleRunner =& new Legacy_ActionFrame(false); $action = isset($_REQUEST['op']) ? ucfirst(xoops_getrequest('op')) : "List"; - - $moduleRunner->setActionName('Image' . $action); + $moduleRunner->setMode(LEGACY_FRAME_MODE_IMAGE); + $moduleRunner->setActionName($action); - $controller->setActionStrategy($moduleRunner); + $root->mController->setActionStrategy($moduleRunner); - $controller->executeAction(); + $root->mController->executeAction(); - $controller->executeView(); + $root->mController->executeView(); } - function AccessToBackend(&$controller,$eventArgs) + function backend() { require_once XOOPS_MODULE_PATH . "/base/class/ActionFrame.class.php"; + $root =& XCube_Root::getSingleton(); + $moduleRunner =& new Legacy_ActionFrame(false); $moduleRunner->setActionName('Backend'); - $controller->setActionStrategy($moduleRunner); + $root->mController->setActionStrategy($moduleRunner); - $controller->executeAction(); + $root->mController->executeAction(); - $controller->executeView(); + $root->mController->executeView(); } - function AccessToSearch(&$controller,$eventArgs) + function search() { require_once XOOPS_MODULE_PATH . "/base/class/ActionFrame.class.php"; + $root =& XCube_Root::getSingleton(); + $moduleRunner =& new Legacy_ActionFrame(false); - $moduleRunner->setActionName('Search' . ucfirst(xoops_getrequest('action'))); + $moduleRunner->setMode(LEGACY_FRAME_MODE_SEARCH); + $moduleRunner->setActionName(ucfirst(xoops_getrequest('action'))); + + $root->mController->setActionStrategy($moduleRunner); + + $root->mController->executeAction(); + + $root->mController->executeView(); + + } + + function misc() + { + require_once XOOPS_BASE_PATH . "/class/ActionFrame.class.php"; + + $root =& XCube_Root::getSingleton(); + + $actionName = isset($_REQUEST['type']) ? ucfirst(xoops_getrequest('type')) : "Smilies"; - $controller->setActionStrategy($moduleRunner); + $moduleRunner = new Legacy_ActionFrame(false); + $moduleRunner->setMode(LEGACY_FRAME_MODE_MISC); + $moduleRunner->setActionName($actionName); - $controller->executeAction(); + $root->mController->setActionStrategy($moduleRunner); - $controller->executeView(); + $root->mController->setDialogMode(true); + + $root->mController->executeAction(); + + $root->mController->executeView(); + } + + function notifications() + { + require_once XOOPS_BASE_PATH . "/class/ActionFrame.class.php"; + + $root =& XCube_Root::getSingleton(); + + // + // 'Notify' is prefix to guard accessing from misc.php. + // + $actionName = isset($_REQUEST['op']) ? trim(xoops_getrequest('op')) : "List"; + if (isset($_REQUEST['delete'])) { + $actionName = "Delete"; + } + if (isset($_REQUEST['delete_cancel'])) { + $actionName = "Cancel"; + } + + $moduleRunner = new Legacy_ActionFrame(false); + $moduleRunner->setMode(LEGACY_FRAME_MODE_NOTIFY); + $moduleRunner->setActionName($actionName); + + $root->mController->setActionStrategy($moduleRunner); + + $root->mController->executeAction(); + + $root->mController->executeView(); + } + + /** + * This functions is add to 'Legacyfunction.Notificatins.Select'. + * + * @param XCube_RenderBuffer $render + */ + function notifications_select(&$render) + { + require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; + require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; + + $root =& XCube_Root::getSingleton(); + $xoopsModule =& $root->mController->mModuleController->mModuleObject; + $moduleConfig =& $root->mController->mModuleController->mConfig; + $xoopsUser =& $root->mController->getXoopsUser(); + + $xoops_notification = array(); + $xoops_notification['show'] = is_object($xoopsModule) && is_object($xoopsUser) && notificationEnabled('inline') ? 1 : 0; + + if ($xoops_notification['show']) { + $root->mLanguageManager->loadPageTypeMessageCatalog('notification'); + $categories =& notificationSubscribableCategoryInfo(); + $event_count = 0; + if (!empty($categories)) { + $notification_handler =& xoops_gethandler('notification'); + foreach ($categories as $category) { + $section['name'] = $category['name']; + $section['title'] = $category['title']; + $section['description'] = $category['description']; + $section['itemid'] = $category['item_id']; + $section['events'] = array(); + $subscribed_events =& $notification_handler->getSubscribedEvents($category['name'], $category['item_id'], $xoopsModule->get('mid'), $xoopsUser->get('uid')); + foreach (notificationEvents($category['name'], true) as $event) { + if (!empty($event['admin_only']) && !$xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { + continue; + } + if (!empty($event['invisible'])) { + continue; + } + $subscribed = in_array($event['name'], $subscribed_events) ? 1 : 0; + $section['events'][$event['name']] = array ('name'=>$event['name'], 'title'=>$event['title'], 'caption'=>$event['caption'], 'description'=>$event['description'], 'subscribed'=>$subscribed); + $event_count ++; + } + $xoops_notification['categories'][$category['name']] = $section; + } + $xoops_notification['target_page'] = "notification_update.php"; + $xoops_notification['redirect_script'] = xoops_getenv('PHP_SELF'); + + $render->setAttribute('editprofile_url', $urlXOOPS_URL . '/edituser.php?uid=' . $xoopsUser->getShow('uid')); + + switch ($xoopsUser->getVar('notify_method')) { + case XOOPS_NOTIFICATION_METHOD_DISABLE: + $render->setAttribute('user_method', _NOT_DISABLE); + break; + case XOOPS_NOTIFICATION_METHOD_PM: + $render->setAttribute('user_method', _NOT_PM); + break; + case XOOPS_NOTIFICATION_METHOD_EMAIL: + $render->setAttribute('user_method', _NOT_EMAIL); + break; + } + } else { + $xoops_notification['show'] = 0; + } + if ($event_count == 0) { + $xoops_notification['show'] = 0; + } + } + + $render->setAttribute('xoops_notification', $xoops_notification); } }