1: <?php
2: /**
3: * Comments module
4: *
5: * You may not change or alter any portion of this comment or credits
6: * of supporting developers from this source code or any supporting source code
7: * which is considered copyrighted (c) material of the original comment or credit authors.
8: * This program is distributed in the hope that it will be useful,
9: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * @copyright XOOPS Project (http://xoops.org)
13: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
14: * @package Comments
15: * @since 2.6.0
16: * @author Laurent JEN (Aka DuGris)
17: * @version $Id$
18: */
19:
20: class CommentsSystemPlugin extends Xoops\Module\Plugin\PluginAbstract implements SystemPluginInterface
21: {
22: /**
23: * @param int $uid
24: *
25: * @return int
26: */
27: public function userPosts($uid)
28: {
29: $comments = \Xoops::getModuleHelper('comments'); //need this here to init constants
30: $criteria = new CriteriaCompo();
31: $criteria->add(new Criteria('status', Comments::STATUS_ACTIVE));
32: $criteria->add(new Criteria('uid', $uid));
33: return $comments->getHandlerComment()->getCount($criteria);
34: }
35:
36: /**
37: * @return array
38: */
39: public function waiting()
40: {
41: $comments = \Xoops::getModuleHelper('comments'); //need this here to init constants
42: $criteria = new CriteriaCompo(new Criteria('status', Comments::STATUS_PENDING));
43: $ret = array();
44: if ($count = $comments->getHandlerComment()->getCount($criteria)) {
45: $ret['count'] = $count;
46: $ret['name'] = Xoops::getInstance()->getHandlerModule()->getByDirname('comments')->getVar('name');
47: $ret['link'] = Xoops::getInstance()->url('modules/comments/admin/main.php');
48: }
49: return $ret;
50: }
51:
52: public function backend($limit)
53: {
54: return array();
55: }
56:
57: /**
58: * Used to populate the User Block
59: * Expects an array containing:
60: * name : Name for the Link
61: * link : Link relative to module
62: * image : Url of image to display, please use 16px*16px image
63: *
64: * @return array
65: */
66: public function userMenus()
67: {
68: // TODO: Implement userMenus() method.
69: }
70: }
71: