1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19: 20:
21:
22: class PageNotificationsPlugin extends Xoops\Module\Plugin\PluginAbstract implements NotificationsPluginInterface
23: {
24: 25: 26: 27: 28: 29:
30: public function item($category, $item_id)
31: {
32: $xoops = Xoops::getInstance();
33: $item = array();
34: $item_id = (int) $item_id;
35:
36: if ($category === 'global') {
37: $item['name'] = '';
38: $item['url'] = '';
39: return $item;
40: }
41:
42: if ($category == 'item') {
43: $sql = 'SELECT content_title FROM ' . $xoopsDB->prefix('page_content') . ' WHERE content_id = ' . $item_id;
44: $result = $xoopsDB->query($sql);
45: $result_array = $xoopsDB->fetchArray($result);
46: $item['name'] = $result_array['title'];
47: $item['url'] = \XoopsBaseConfig::get('url') . '/modules/page/viewpage.php?id=' . $item_id;
48: return $item;
49: }
50:
51: return $item;
52: }
53:
54: 55: 56:
57: public function categories()
58: {
59: Xoops::getInstance()->loadLocale('page');
60:
61: $ret = array();
62: $ret[1]['name'] = 'global';
63: $ret[1]['title'] = PageLocale::NOTIFICATION_GLOBAL;
64: $ret[1]['description'] = PageLocale::NOTIFICATION_GLOBAL_DSC;
65: $ret[1]['subscribe_from'] = array('index.php', 'viewpage.php');
66:
67: $ret[2]['name'] = 'item';
68: $ret[2]['title'] = PageLocale::NOTIFICATION_ITEM;
69: $ret[2]['description'] = PageLocale::NOTIFICATION_ITEM_DSC;
70: $ret[2]['subscribe_from'] = array('viewpage.php');
71: $ret[2]['item_name'] = 'id';
72: $ret[2]['allow_bookmark'] = 1;
73: return $ret;
74: }
75:
76: 77: 78:
79: public function events()
80: {
81: Xoops::getInstance()->loadLocale('page');
82:
83: $ret = array();
84: $ret[1]['name'] = 'newcontent';
85: $ret[1]['category'] = 'global';
86: $ret[1]['title'] = PageLocale::NOTIFICATION_GLOBAL_NEWCONTENT;
87: $ret[1]['caption'] = PageLocale::NOTIFICATION_GLOBAL_NEWCONTENT_CAP;
88: $ret[1]['description'] = PageLocale::NOTIFICATION_GLOBAL_NEWCONTENT_DSC;
89: $ret[1]['mail_template'] = 'global_newcontent';
90: $ret[1]['mail_subject'] = PageLocale::NOTIFICATION_GLOBAL_NEWCONTENT_SBJ;
91: return $ret;
92: }
93: 94: 95: 96: 97: 98: 99:
100: public function tags($category, $item_id, $event)
101: {
102: return array();
103: }
104: }
105: