1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_ROOT_PATH . "/include/notification_functions.php";
14:
15: require_once XOOPS_MODULE_PATH . "/legacy/forms/NotifyDeleteForm.class.php";
16:
17: 18: 19: 20: 21:
22: class Legacy_NotifyDeleteAction extends Legacy_Action
23: {
24: var $mModules = array();
25: var $mActionForm = null;
26:
27: var $mErrorMessage = null;
28:
29: function prepare(&$controller, &$xoopsUser)
30: {
31: $controller->mRoot->mLanguageManager->loadPageTypeMessageCatalog('notification');
32: $controller->mRoot->mLanguageManager->loadModuleMessageCatalog('legacy');
33:
34: $this->mActionForm =new Legacy_NotifyDeleteForm();
35: $this->mActionForm->prepare();
36: }
37:
38: function hasPermission(&$controller, &$xoopsUser)
39: {
40: return is_object($xoopsUser);
41: }
42:
43: 44: 45: 46:
47: function execute(&$contoller, &$xoopsUser)
48: {
49: $this->mActionForm->fetch();
50: $this->mActionForm->validate();
51:
52:
53:
54:
55:
56: if ($this->mActionForm->hasError()) {
57: return $this->mActionForm->mFatalError ? LEGACY_FRAME_VIEW_ERROR : LEGACY_FRAME_VIEW_INPUT;
58: }
59:
60:
61:
62:
63: $successFlag = true;
64: $handler =& xoops_gethandler('notification');
65: foreach ($this->mActionForm->mNotifiyIds as $t_idArr) {
66: $t_notify =& $handler->get($t_idArr['id']);
67: if (is_object($t_notify) && $t_notify->get('not_uid') == $xoopsUser->get('uid') && $t_notify->get('not_modid') == $t_idArr['modid']) {
68: $successFlag = $successFlag & $handler->delete($t_notify);
69: }
70: }
71:
72: return $successFlag ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR;
73: }
74:
75: function executeViewInput(&$controller, &$xoopsUser, &$render)
76: {
77: $render->setTemplateName("legacy_notification_delete.html");
78: $render->setAttribute('actionForm', $this->mActionForm);
79: }
80:
81: function executeViewSuccess(&$controller, &$xoopsUser, &$render)
82: {
83: $controller->executeForward(XOOPS_URL . "/notifications.php");
84: }
85:
86: function executeViewError(&$controller, &$xoopsUser, &$render)
87: {
88: $controller->executeRedirect(XOOPS_URL . "/notifications.php", 2, _NOT_NOTHINGTODELETE);
89: }
90: }
91:
92: ?>
93: