waiting.plugin.php ➔ b_waiting_presenter()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 27

Duplication

Lines 10
Ratio 37.04 %

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 0
dl 10
loc 27
rs 9.488
c 0
b 0
f 0
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
/**
12
 * presenter module for xoops
13
 *
14
 * @copyright       XOOPS Project (https://xoops.org)
15
 * @license         GPL 2.0 or later
16
 * @package         presenter
17
 * @since           2.5.5
18
 * @author          XOOPS Development Team <[email protected]> - <https://xoops.org>
19
 */
20
function b_waiting_presenter()
21
{
22
    $db  = XoopsDatabaseFactory::getDatabaseConnection();
23
    $ret = [];
24
25
    // waiting categories
26
    $block  = [];
27
    $result = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('presenter_categories') . ' WHERE cat_waiting = 1');
28 View Code Duplication
    if ($result) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
        $block['adminlink'] = XOOPS_URL . '/modules/presenter/admin/categories.php?op=list_waiting';
30
        list($block['pendingnum']) = $db->fetchRow($result);
31
        $block['lang_linkname'] = _MB_PRESENTER_CATEGORIES_WAITING;
32
    }
33
    $ret[] = $block;
34
35
    // waiting slides
36
    $block  = [];
37
    $result = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('presenter_slides') . ' WHERE slides_waiting = 1');
38 View Code Duplication
    if ($result) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
        $block['adminlink'] = XOOPS_URL . '/modules/presenter/admin/slides.php?op=list_waiting';
40
        list($block['pendingnum']) = $db->fetchRow($result);
41
        $block['lang_linkname'] = _MB_PRESENTER_SLIDES_WAITING;
42
    }
43
    $ret[] = $block;
44
45
    return $ret;
46
}
47