} $response = new Response(); $response->prepare_ajax_response(); $result = RMNotifications::get()->subscribe(); if (FALSE === $result) { $response->ajax_response(__('Sorry, your request could not be processed.', 'rmcommon'), 1, 0); } $message = 'subscribed' == $result->status ? __('Subscribed', 'rmcommon') : __('Subscription cancelled', 'rmcommon'); $response->ajax_response($message, 0, 0, $event); } elseif ('cu-notification-list' == $page) { // Show subscriptions list global $xoopsUser, $cuSettings; if (!$xoopsUser) { RMUris::redirect_with_message(__('You need to register/login to view this page.', 'rmcommon'), XOOPS_URL, RMMSG_WARN); } $subscriptions = RMNotifications::get()->subscriptions(); if (empty($subscriptions)) { RMUris::redirect_with_message(__('You are not subscribed to any notification event.', 'rmcommon'), XOOPS_URL, RMMSG_WARN); } $elements = array(); $items = array(); $tf = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'rmcommon')); $crypt = new Crypt(null, $cuSettings->secretkey); foreach ($subscriptions as $item) { $class = ucfirst($item->element . '_Notifications'); if (!class_exists($class)) { // Include controller file if ('plugin' == $event->type) { $file = XOOPS_ROOT_PATH . '/modules/rmcommon/plugins/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php'; } elseif ('theme' == $event->type) { $file = XOOPS_ROOT_PATH . '/themes/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php';
} $likes = array(); foreach ($likes_ids as $like) { if (!isset($users[$like])) { $users[$like] = new XoopsUser($like); } $like_user = $users[$like]; $likes[] = array('uid' => $like, 'uname' => $like_user->getVar('uname'), 'name' => $like_user->getVar('name') != '' ? $like_user->getVar('name') : $like_user->getVar('uname'), 'avatar' => RMEvents::get()->run_event("rmcommon.get.avatar", $like_user->getVar('email'), 40)); } $posts[$post->id()] = array('id' => $post->id(), 'text' => $post->text(), 'edit' => $post->editText(), 'approved' => $post->approved(), 'date' => $tf->ago($post->date()), 'canedit' => $canedit, 'candelete' => $candelete, 'canshow' => $canshow, 'canreport' => $report, 'poster' => $userData, 'attachs' => $attachs, 'attachscount' => count($attachs), 'parent' => $post->parent, 'replies' => $row['replies'], 'likes_count' => $row['likes'], 'likes' => $likes); $posts_ids[] = $post->id(); } $tpl->assign('posts', $posts); unset($userData, $bbUser, $users); // Common Utilities Notifications $notifications = RMNotifications::get(); $events = Bxpress_Notifications::get(); $permissions = $forum->permissions(); // New topics notifications $event = $events->event('reply')->parameters($topic->id())->permissions(array('groups' => in_array(0, $permissions['view']) ? array() : $permissions['view'])); $notifications->add_item($event); unset($event, $permissions); $tpl->assign('notifications', $notifications->render()); $tpl->assign('lang_edit', __('Edit', 'bxpress')); $tpl->assign('lang_delete', __('Delete', 'bxpress')); $tpl->assign('lang_report', __('Report', 'bxpress')); $tpl->assign('lang_quote', __('Quote', 'bxpress')); $tpl->assign('lang_online', __('Online!', 'bxpress')); $tpl->assign('lang_offline', __('Disconnected', 'bxpress')); $tpl->assign('lang_attachments', __('Attachments', 'bxpress')); $tpl->assign('xoops_pagetitle', $topic->title() . " » " . $xoopsModuleConfig['forum_title']);