Completed
Push — master ( 65a58d...61df55 )
by Michael
08:26 queued 04:14
created

admin/index.php (6 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
/**
13
 * @copyright    The XOOPS Project http://sourceforge.net/projects/xoops/
14
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15
 * @package
16
 * @since
17
 * @author     XOOPS Development Team
18
 * @version    $Id $
19
 */
20
21
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
22
include_once __DIR__ . '/admin_header.php';
23
24
xoops_cp_header();
25
26
    $indexAdmin = new ModuleAdmin();
27
28
//----------------------
29
30
// Creating the category handler object
31
$category_handler =& sf_gethandler('category');
32
33
// Creating the FAQ handler object
34
$faq_handler =& sf_gethandler('faq');
35
36
// Total FAQs -- includes everything on the table
37
$totalfaqs = $faq_handler->getFaqsCount();
38
39
// Total categories
40
$totalcategories = $category_handler->getCategoriesCount(-1);
41
42
// Total FAQ count by status
43
$totalfaqbystatus = $faq_handler->getFaqsCountByStatus();
44
45
// Total asked FAQs
46
$totalasked = isset($totalfaqbystatus[_SF_STATUS_ASKED])? $totalfaqbystatus[_SF_STATUS_ASKED] : 0;
47
48
// Total opened FAQs
49
$totalopened = isset($totalfaqbystatus[_SF_STATUS_OPENED])? $totalfaqbystatus[_SF_STATUS_OPENED] : 0;
50
51
// Total answered FAQs
52
$totalanswered = isset($totalfaqbystatus[_SF_STATUS_ANSWERED])? $totalfaqbystatus[_SF_STATUS_ANSWERED] : 0;
53
54
// Total submitted FAQs
55
$totalsubmitted = isset($totalfaqbystatus[_SF_STATUS_SUBMITTED])? $totalfaqbystatus[_SF_STATUS_SUBMITTED] : 0;
56
57
// Total published FAQs
58
$totalpublished = isset($totalfaqbystatus[_SF_STATUS_PUBLISHED])? $totalfaqbystatus[_SF_STATUS_PUBLISHED] : 0;
59
60
// Total offline FAQs
61
$totaloffline = isset($totalfaqbystatus[_SF_STATUS_OFFLINE])? $totalfaqbystatus[_SF_STATUS_OFFLINE] : 0;
62
63
// Total rejected question
64
$totalrejectedquestion = isset($totalfaqbystatus[_SF_STATUS_REJECTED_QUESTION])? $totalfaqbystatus[_SF_STATUS_REJECTED_QUESTION] : 0;
65
66
// Total rejected smartfaq
67
$totalrejectedsmartfaq = isset($totalfaqbystatus[_SF_STATUS_REJECTED_SMARTFAQ])? $totalfaqbystatus[_SF_STATUS_REJECTED_SMARTFAQ] : 0;
68
69
// Total Q&A with new answers
70
$totalnewanswers = isset($totalfaqbystatus[_SF_STATUS_NEW_ANSWER])? $totalfaqbystatus[_SF_STATUS_NEW_ANSWER] : 0;
71
72
//set info block
73
$indexAdmin->addInfoBox(_AM_SF_INVENTORY);
74
75 View Code Duplication
if ($totalcategories > 0) {
0 ignored issues
show
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...
76
    $indexAdmin->addInfoBoxLine(
77
        _AM_SF_INVENTORY, "<infolabel>" . '<a href="category.php">' . _AM_SF_TOTALCAT . '</a><b>'
78
        . "</infolabel>", $totalcategories, 'Green'
79
    );
80
} else {
81
    $indexAdmin->addInfoBoxLine(
82
        _AM_SF_INVENTORY, "<infolabel>" . _AM_SF_TOTALCAT . "</infolabel>", $totalcategories, 'Green'
83
    );
84
}
85 View Code Duplication
if ($totalasked > 0) {
0 ignored issues
show
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...
86
    $indexAdmin->addInfoBoxLine(
87
        _AM_SF_INVENTORY, "<infolabel>" . '<a href="main.php">' . _AM_SF_TOTALASKED . '</a><b>'
88
        . "</infolabel>", $totalasked, 'Green'
89
    );
90
} else {
91
    $indexAdmin->addInfoBoxLine(
92
        _AM_SF_INVENTORY, "<infolabel>" . _AM_SF_TOTALASKED . "</infolabel>", $totalasked, 'Green'
93
    );
94
}
95 View Code Duplication
if ($totalopened > 0) {
0 ignored issues
show
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...
96
    $indexAdmin->addInfoBoxLine(
97
        _AM_SF_INVENTORY, "<infolabel>" . '<a href="question.php">' . _AM_SF_TOTALOPENED . '</a><b>'
98
        . "</infolabel>", $totalopened, 'Red'
99
    );
100
} else {
101
    $indexAdmin->addInfoBoxLine(
102
        _AM_SF_INVENTORY, "<infolabel>" . _AM_SF_TOTALOPENED . "</infolabel>", $totalopened, 'Green'
103
    );
104
}
105 View Code Duplication
if ($totalsubmitted > 0) {
0 ignored issues
show
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...
106
    $indexAdmin->addInfoBoxLine(
107
        _AM_SF_INVENTORY, "<infolabel>" . '<a href="category.php">' . _AM_SF_TOTALSUBMITTED . '</a><b>'
108
        . "</infolabel>", $totalsubmitted, 'Green'
109
    );
110
} else {
111
    $indexAdmin->addInfoBoxLine(
112
        _AM_SF_INVENTORY, "<infolabel>" . _AM_SF_TOTALSUBMITTED . "</infolabel>", $totalsubmitted, 'Green'
113
    );
114
}
115 View Code Duplication
if ($totalpublished > 0) {
0 ignored issues
show
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...
116
    $indexAdmin->addInfoBoxLine(
117
        _AM_SF_INVENTORY, "<infolabel>" . '<a href="faq.php">' . _AM_SF_TOTALPUBLISHED . '</a><b>'
118
        . "</infolabel>", $totalpublished, 'Green'
119
    );
120
} else {
121
    $indexAdmin->addInfoBoxLine(
122
        _AM_SF_INVENTORY, "<infolabel>" . _AM_SF_TOTALPUBLISHED . "</infolabel>", $totalpublished, 'Green'
123
    );
124
}
125 View Code Duplication
if ($totalnewanswers > 0) {
0 ignored issues
show
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...
126
    $indexAdmin->addInfoBoxLine(
127
        _AM_SF_INVENTORY, "<infolabel>" . '<a href="main.php">' . _AM_SF_TOTALNEWANSWERS . '</a><b>'
128
        . "</infolabel>", $totalnewanswers, 'Red'
129
    );
130
} else {
131
    $indexAdmin->addInfoBoxLine(
132
        _AM_SF_INVENTORY, "<infolabel>" . _AM_SF_TOTALNEWANSWERS . "</infolabel>", $totalnewanswers, 'Green'
133
    );
134
}
135
136
//----------------------
137
138
    echo $indexAdmin->addNavigation('index.php');
139
    echo $indexAdmin->renderIndex();
140
141
include_once __DIR__ . '/admin_footer.php';
142