Completed
Pull Request — master (#599)
by Richard
17:07
created

PublisherSystemPlugin::waiting()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 0
dl 0
loc 14
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
//namespace XoopsModules\Publisher\Plugin;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * @copyright       XOOPS Project (http://xoops.org)
17
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
18
 * @author          Laurent JEN (aka DuGris)
19
 * @version         $Id$
20
 */
21
use Criteria;
22
use CriteriaCompo;
23
use SystemPluginInterface;
24
use Xoops\Module\Plugin\PluginAbstract;
25
use XoopsModules\Publisher\Helper;
26
27
/**
28
 * Class SystemPlugin
29
 * @package XoopsModules\Publisher\Plugin
30
 */
31
class PublisherSystemPlugin extends PluginAbstract implements SystemPluginInterface
32
{
33
    /**
34
     * @param int $uid
35
     *
36
     * @return int
37
     */
38
    public function userPosts($uid)
39
    {
40
        $criteria = new CriteriaCompo();
41
        $criteria->add(new Criteria('status', 2));
42
        $criteria->add(new Criteria('uid', (int)$uid));
43
44
        return Helper::getInstance()->getItemHandler()->getCount($criteria);
45
    }
46
47
    /**
48
     * @return array
49
     */
50
    public function waiting()
51
    {
52
        $helper = Helper::getInstance();
53
        $ret = [];
54
        $criteria = new CriteriaCompo();
55
        $criteria->add(new Criteria('status', 1));
56
        $count = $helper->getItemHandler()->getCount($criteria);
57
        if ($count) {
58
            $ret['count'] = $count;
59
            $ret['name'] = _MI_PUBLISHER_WAITING;
60
            $ret['link'] = $helper->url('admin/item.php');
61
        }
62
63
        return $ret;
64
    }
65
66
    /**
67
     * Used to populate backend
68
     *
69
     * @param int $limit : Number of item for backend
70
     *                   Expects an array containing:
71
     *                   title   : Title for the backend items
72
     *                   link    : Link for the backend items
73
     *                   content : content for the backend items
74
     *                   date    : Date of the backend items
75
     */
76
    public function backend($limit)
77
    {
78
        // TODO: Implement backend() method.
79
    }
80
81
    /**
82
     * Used to populate the User Block
83
     * Expects an array containing:
84
     *    name  : Name for the Link
85
     *    link  : Link relative to module
86
     *    image : Url of image to display, please use 16px*16px image
87
     */
88
    public function userMenus()
89
    {
90
        // TODO: Implement userMenus() method.
91
    }
92
}
93