b_waiting_lexikon()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 28
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 18
nc 4
nop 0
dl 0
loc 28
rs 9.6666
c 0
b 0
f 0
1
<?php
2
// waiting Plugin for Lexikon glossary module
3
4
/**
5
 * @return array
6
 */
7
function b_waiting_lexikon()
8
{
9
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
10
    $ret     = [];
11
12
    $moduleDirName = \basename(\dirname(__DIR__));
13
    xoops_loadLanguage('plugin', $moduleDirName);
14
15
    // Waiting
16
    $block  = [];
17
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit=1 AND request=0 ');
18
    if ($result) {
19
        $block['adminlink'] = XOOPS_URL . '/modules/lexikon/admin/main.php?statussel=1';
20
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
21
        $block['lang_linkname'] = _PI_WAITING_SUBMITTED;
0 ignored issues
show
Bug introduced by
The constant _PI_WAITING_SUBMITTED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
22
    }
23
    $ret[] = $block;
24
25
    // Request
26
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit=1 AND request=1 ');
27
    if ($result) {
28
        $block['adminlink'] = XOOPS_URL . '/modules/lexikon/admin/main.php?statussel=4';
29
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
30
        $block['lang_linkname'] = _PI_WAITING_REQUESTS;
0 ignored issues
show
Bug introduced by
The constant _PI_WAITING_REQUESTS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
31
    }
32
    $ret[] = $block;
33
34
    return $ret;
35
}
36