1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Module: SmartFAQ |
5
|
|
|
* Author: The SmartFactory <www.smartfactory.ca> |
6
|
|
|
* Licence: GNU |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
use Xmf\Module\Admin; |
10
|
|
|
use Xmf\Request; |
11
|
|
|
use XoopsModules\Smartfaq; |
12
|
|
|
use XoopsModules\Smartfaq\Constants; |
13
|
|
|
|
14
|
|
|
require_once __DIR__ . '/admin_header.php'; |
15
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
16
|
|
|
|
17
|
|
|
/** @var Smartfaq\Helper $helper */ |
18
|
|
|
$helper = Smartfaq\Helper::getInstance(); |
19
|
|
|
$smartModuleConfig = $helper->getConfig(); |
20
|
|
|
$xoopsModule = $helper->getModule(); |
21
|
|
|
$pathIcon16 = Admin::iconUrl('', '16'); |
22
|
|
|
|
23
|
|
|
$faqid = Request::getInt('faqid', 0, 'POST'); |
24
|
|
|
|
25
|
|
|
//$pick = isset($_GET['pick'])? (int)($_GET['pick']) : 0; |
26
|
|
|
//$pick = isset($_POST['pick'])? (int)($_POST['pick']) : $_GET['pick']; |
27
|
|
|
|
28
|
|
|
$statussel = Request::getInt('statussel', Constants::SF_STATUS_ALL, 'GET'); |
29
|
|
|
$statussel = Request::getInt('statussel', $statussel, 'POST'); |
30
|
|
|
|
31
|
|
|
$sortsel = $_GET['sortsel'] ?? 'faqid'; |
32
|
|
|
$sortsel = $_POST['sortsel'] ?? $sortsel; |
33
|
|
|
|
34
|
|
|
$ordersel = $_GET['ordersel'] ?? 'DESC'; |
35
|
|
|
$ordersel = $_POST['ordersel'] ?? $ordersel; |
36
|
|
|
|
37
|
|
|
$module_id = $xoopsModule->getVar('mid'); |
38
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
39
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
40
|
|
|
$groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
41
|
|
|
|
42
|
|
|
function buildTable(): void |
43
|
|
|
{ |
44
|
|
|
/** @var Smartfaq\Helper $helper */ |
45
|
|
|
$helper = Smartfaq\Helper::getInstance(); |
|
|
|
|
46
|
|
|
|
47
|
|
|
echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
48
|
|
|
echo '<tr>'; |
49
|
|
|
echo "<th width='40' class='bg3' align='center'><b>" . _AM_SF_FAQID . '</b></td>'; |
50
|
|
|
echo "<th width='20%' class='bg3' align='center'><b>" . _AM_SF_FAQCAT . '</b></td>'; |
51
|
|
|
echo "<th class='bg3' align='center'><b>" . _AM_SF_QUESTION . '</b></td>'; |
52
|
|
|
|
53
|
|
|
echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ASKED . '</b></td>'; |
54
|
|
|
echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ANSWERED . '</b></td>'; |
55
|
|
|
|
56
|
|
|
echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_CREATED . '</b></td>'; |
57
|
|
|
echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_STATUS . '</b></td>'; |
58
|
|
|
//echo "<td width='30' class='bg3' align='center'><b>" . _AM_SF_ANSWERS . "</b></td>"; |
59
|
|
|
echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
60
|
|
|
echo '</tr>'; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
// Code for the page |
64
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
65
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
66
|
|
|
|
67
|
|
|
// Creating the category handler object |
68
|
|
|
/** @var \XoopsModules\Smartfaq\CategoryHandler $categoryHandler */ |
69
|
|
|
$categoryHandler = $helper::getInstance()->getHandler('Category'); |
70
|
|
|
|
71
|
|
|
// Creating the FAQ handler object |
72
|
|
|
/** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ |
73
|
|
|
$faqHandler = $helper::getInstance()->getHandler('Faq'); |
74
|
|
|
|
75
|
|
|
$startentry = Request::getInt('startentry', 0, 'GET'); |
76
|
|
|
|
77
|
|
|
$adminObject = Admin::getInstance(); |
78
|
|
|
xoops_cp_header(); |
79
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
80
|
|
|
global $xoopsUser, $xoopsDB, $faqid; |
81
|
|
|
|
82
|
|
|
// Total FAQs -- includes everything on the table |
83
|
|
|
$totalfaqs = $faqHandler->getFaqsCount(); |
84
|
|
|
|
85
|
|
|
// Total categories |
86
|
|
|
$totalcategories = $categoryHandler->getCategoriesCount(-1); |
87
|
|
|
|
88
|
|
|
// Total FAQ count by status |
89
|
|
|
$totalfaqbystatus = $faqHandler->getFaqsCountByStatus(); |
90
|
|
|
|
91
|
|
|
// Total asked FAQs |
92
|
|
|
$totalasked = $totalfaqbystatus[Constants::SF_STATUS_ASKED] ?? 0; |
93
|
|
|
|
94
|
|
|
// Total opened FAQs |
95
|
|
|
$totalopened = $totalfaqbystatus[Constants::SF_STATUS_OPENED] ?? 0; |
96
|
|
|
|
97
|
|
|
// Total answered FAQs |
98
|
|
|
$totalanswered = $totalfaqbystatus[Constants::SF_STATUS_ANSWERED] ?? 0; |
99
|
|
|
|
100
|
|
|
// Total submitted FAQs |
101
|
|
|
$totalsubmitted = $totalfaqbystatus[Constants::SF_STATUS_SUBMITTED] ?? 0; |
102
|
|
|
|
103
|
|
|
// Total published FAQs |
104
|
|
|
$totalpublished = $totalfaqbystatus[Constants::SF_STATUS_PUBLISHED] ?? 0; |
105
|
|
|
|
106
|
|
|
// Total offline FAQs |
107
|
|
|
$totaloffline = $totalfaqbystatus[Constants::SF_STATUS_OFFLINE] ?? 0; |
108
|
|
|
|
109
|
|
|
// Total rejected question |
110
|
|
|
$totalrejectedquestion = $totalfaqbystatus[Constants::SF_STATUS_REJECTED_QUESTION] ?? 0; |
111
|
|
|
|
112
|
|
|
// Total rejected smartfaq |
113
|
|
|
$totalrejectedsmartfaq = $totalfaqbystatus[Constants::SF_STATUS_REJECTED_SMARTFAQ] ?? 0; |
114
|
|
|
|
115
|
|
|
// Total Q&A with new answers |
116
|
|
|
$totalnewanswers = $totalfaqbystatus[Constants::SF_STATUS_NEW_ANSWER] ?? 0; |
117
|
|
|
|
118
|
|
|
// -- // |
119
|
|
|
//Smartfaq\Utility::collapsableBar('toptable', 'toptableicon'); |
120
|
|
|
//echo "<img onclick='toggle('toptable'); toggleIcon('toptableicon');' id='toptableicon' name='toptableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_INVENTORY . "</h3>"; |
121
|
|
|
//echo "<div id='toptable'>"; |
122
|
|
|
//echo "<br>"; |
123
|
|
|
//echo "<table width='100%' class='outer' cellspacing='1' cellpadding='3' border='0' ><tr>"; |
124
|
|
|
//echo "<td class='head'>" . _AM_SF_TOTALCAT . "</td><td align='center' class='even'>" . $totalcategories . "</td>"; |
125
|
|
|
//echo "<td class='head'>" . _AM_SF_TOTALASKED . "</td><td align='center' class='even'>" . $totalasked . "</td>"; |
126
|
|
|
//echo "<td class='head'>" . _AM_SF_TOTALOPENED . "</td><td align='center' class='even'>" . $totalopened . "</td>"; |
127
|
|
|
//echo "<td class='head'>" . _AM_SF_TOTALSUBMITTED . "</td><td align='center' class='even'>" . $totalsubmitted . "</td>"; |
128
|
|
|
//echo "<td class='head'>" . _AM_SF_TOTALPUBLISHED . "</td><td align='center' class='even'>" . $totalpublished . "</td>"; |
129
|
|
|
//echo "<td class='head'>" . _AM_SF_TOTALNEWANSWERS . "</td><td align='center' class='even'>" . $totalnewanswers . "</td>"; |
130
|
|
|
//echo "</tr></table>"; |
131
|
|
|
//echo "<br>"; |
132
|
|
|
|
133
|
|
|
//$adminObject = \Xmf\Module\Admin::getInstance(); |
134
|
|
|
$adminObject->addItemButton(_AM_SF_CATEGORY_CREATE, 'category.php?op=mod', 'add', ''); |
135
|
|
|
$adminObject->addItemButton(_AM_SF_CREATEART, 'faq.php?op=mod', 'add', ''); |
136
|
|
|
$adminObject->addItemButton(_AM_SF_CREATEQUESTION, 'question.php?op=mod', 'add', ''); |
137
|
|
|
$adminObject->displayButton('left', ''); |
138
|
|
|
|
139
|
|
|
//echo "<form><div style=\"margin-bottom: 24px;\">"; |
140
|
|
|
//echo "<input type='button' name='button' onclick=\"location='category.php?op=mod'\" value='" . _AM_SF_CATEGORY_CREATE . "'> "; |
141
|
|
|
//echo "<input type='button' name='button' onclick=\"location='faq.php?op=mod'\" value='" . _AM_SF_CREATEART . "'> "; |
142
|
|
|
//echo "<input type='button' name='button' onclick=\"location='question.php?op=mod'\" value='" . _AM_SF_CREATEQUESTION . "'> "; |
143
|
|
|
//echo "</div></form>"; |
144
|
|
|
//echo "</div>"; |
145
|
|
|
|
146
|
|
|
// Construction of lower table |
147
|
|
|
Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon'); |
148
|
|
|
echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_ALLFAQS . '</h3>'; |
149
|
|
|
echo "<div id='bottomtable'>"; |
150
|
|
|
echo '<span style="color: #567; margin: 3px 0 18px 0; font-size: small; display: block; ">' . _AM_SF_ALLFAQSMSG . '</span>'; |
151
|
|
|
|
152
|
|
|
$showingtxt = ''; |
153
|
|
|
$selectedtxt = ''; |
154
|
|
|
$cond = ''; |
155
|
|
|
$selectedtxt0 = ''; |
156
|
|
|
$selectedtxt1 = ''; |
157
|
|
|
$selectedtxt2 = ''; |
158
|
|
|
$selectedtxt3 = ''; |
159
|
|
|
$selectedtxt4 = ''; |
160
|
|
|
$selectedtxt5 = ''; |
161
|
|
|
$selectedtxt6 = ''; |
162
|
|
|
$selectedtxt7 = ''; |
163
|
|
|
$selectedtxt8 = ''; |
164
|
|
|
$selectedtxt9 = ''; |
165
|
|
|
$selectedtxt10 = ''; |
166
|
|
|
|
167
|
|
|
$sorttxtquestion = ''; |
168
|
|
|
$sorttxtcategory = ''; |
169
|
|
|
$sorttxtcreated = ''; |
170
|
|
|
$sorttxtweight = ''; |
171
|
|
|
$sorttxtfaqid = ''; |
172
|
|
|
|
173
|
|
|
$ordertxtasc = ''; |
174
|
|
|
$ordertxtdesc = ''; |
175
|
|
|
|
176
|
|
|
switch ($sortsel) { |
177
|
|
|
case 'faq.question': |
178
|
|
|
$sorttxtquestion = 'selected'; |
179
|
|
|
break; |
180
|
|
|
case 'category.name': |
181
|
|
|
$sorttxtcategory = 'selected'; |
182
|
|
|
break; |
183
|
|
|
case 'faq.datesub': |
184
|
|
|
$sorttxtcreated = 'selected'; |
185
|
|
|
break; |
186
|
|
|
case 'faq.weight': |
187
|
|
|
$sorttxtweight = 'selected'; |
188
|
|
|
break; |
189
|
|
|
default: |
190
|
|
|
$sorttxtfaqid = 'selected'; |
191
|
|
|
break; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
switch ($ordersel) { |
195
|
|
|
case 'ASC': |
196
|
|
|
$ordertxtasc = 'selected'; |
197
|
|
|
break; |
198
|
|
|
default: |
199
|
|
|
$ordertxtdesc = 'selected'; |
200
|
|
|
break; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
switch ($statussel) { |
204
|
|
|
case Constants::SF_STATUS_ALL: |
205
|
|
|
$selectedtxt0 = 'selected'; |
206
|
|
|
$caption = _AM_SF_ALL; |
207
|
|
|
$cond = ''; |
208
|
|
|
$status_explaination = _AM_SF_ALL_EXP; |
209
|
|
|
break; |
210
|
|
|
case Constants::SF_STATUS_ASKED: |
211
|
|
|
$selectedtxt1 = 'selected'; |
212
|
|
|
$caption = _AM_SF_ASKED; |
213
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_ASKED . ' '; |
214
|
|
|
$status_explaination = _AM_SF_ASKED_EXP; |
215
|
|
|
break; |
216
|
|
|
case Constants::SF_STATUS_OPENED: |
217
|
|
|
$selectedtxt2 = 'selected'; |
218
|
|
|
$caption = _AM_SF_OPENED; |
219
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_OPENED . ' '; |
220
|
|
|
$status_explaination = _AM_SF_OPENED_EXP; |
221
|
|
|
break; |
222
|
|
|
case Constants::SF_STATUS_ANSWERED: |
223
|
|
|
$selectedtxt3 = 'selected'; |
224
|
|
|
$caption = _AM_SF_ANSWERED; |
225
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_ANSWERED . ' '; |
226
|
|
|
$status_explaination = _AM_SF_ANSWERED_EXP; |
227
|
|
|
break; |
228
|
|
|
case Constants::SF_STATUS_SUBMITTED: |
229
|
|
|
$selectedtxt4 = 'selected'; |
230
|
|
|
$caption = _AM_SF_SUBMITTED; |
231
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_SUBMITTED . ' '; |
232
|
|
|
$status_explaination = _AM_SF_SUBMITTED_EXP; |
233
|
|
|
break; |
234
|
|
|
case Constants::SF_STATUS_PUBLISHED: |
235
|
|
|
$selectedtxt5 = 'selected'; |
236
|
|
|
$caption = _AM_SF_PUBLISHED; |
237
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_PUBLISHED . ' '; |
238
|
|
|
$status_explaination = _AM_SF_PUBLISHED_EXP; |
239
|
|
|
break; |
240
|
|
|
case Constants::SF_STATUS_NEW_ANSWER: |
241
|
|
|
$selectedtxt6 = 'selected'; |
242
|
|
|
$caption = _AM_SF_NEW_ANSWER; |
243
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_NEW_ANSWER . ' '; |
244
|
|
|
$status_explaination = _AM_SF_NEW_ANSWER_EXP; |
245
|
|
|
break; |
246
|
|
|
case Constants::SF_STATUS_OFFLINE: |
247
|
|
|
$selectedtxt7 = 'selected'; |
248
|
|
|
$caption = _AM_SF_OFFLINE; |
249
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_OFFLINE . ' '; |
250
|
|
|
$status_explaination = _AM_SF_OFFLINE_EXP; |
251
|
|
|
break; |
252
|
|
|
case Constants::SF_STATUS_REJECTED_QUESTION: |
253
|
|
|
$selectedtxt8 = 'selected'; |
254
|
|
|
$caption = _AM_SF_REJECTED_QUESTION; |
255
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_REJECTED_QUESTION . ' '; |
256
|
|
|
$status_explaination = _AM_SF_REJECTED_QUESTION_EXP; |
257
|
|
|
break; |
258
|
|
|
case Constants::SF_STATUS_REJECTED_SMARTFAQ: |
259
|
|
|
$selectedtxt9 = 'selected'; |
260
|
|
|
$caption = _AM_SF_REJECTED_SMARTFAQ; |
261
|
|
|
$cond = ' WHERE status = ' . Constants::SF_STATUS_REJECTED_SMARTFAQ . ' '; |
262
|
|
|
$status_explaination = _AM_SF_REJECTED_SMARTFAQ_EXP; |
263
|
|
|
break; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/* -- Code to show selected terms -- */ |
267
|
|
|
echo "<form name='pick' id='pick' action='" . $_SERVER['SCRIPT_NAME'] . "' method='POST' style='margin: 0;'>"; |
268
|
|
|
|
269
|
|
|
echo " |
270
|
|
|
<table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'> |
271
|
|
|
<tr> |
272
|
|
|
<td><span style='font-weight: bold; font-size: 12px; font-variant: small-caps;'>" . _AM_SF_SHOWING . ' ' . $caption . "</span></td> |
273
|
|
|
<td align='right'>" . _AM_SF_SELECT_SORT . " |
274
|
|
|
<select name='sortsel' onchange='submit()'> |
275
|
|
|
<option value='faq.faqid' $sorttxtfaqid>" . _AM_SF_ID . "</option> |
276
|
|
|
<option value='category.name' $sorttxtcategory>" . _AM_SF_CATEGORY . "</option> |
277
|
|
|
<option value='faq.question' $sorttxtquestion>" . _AM_SF_QUESTION . "</option> |
278
|
|
|
<option value='faq.datesub' $sorttxtcreated>" . _AM_SF_CREATED . "</option> |
279
|
|
|
<option value='faq.weight' $sorttxtweight>" . _AM_SF_WEIGHT . "</option> |
280
|
|
|
</select> |
281
|
|
|
<select name='ordersel' onchange='submit()'> |
282
|
|
|
<option value='ASC' $ordertxtasc>" . _AM_SF_ASC . "</option> |
283
|
|
|
<option value='DESC' $ordertxtdesc>" . _AM_SF_DESC . '</option> |
284
|
|
|
</select> |
285
|
|
|
' . _AM_SF_SELECT_STATUS . " : |
286
|
|
|
<select name='statussel' onchange='submit()'> |
287
|
|
|
<option value='0' $selectedtxt0>" . _AM_SF_ALL . " [$totalfaqs]</option> |
288
|
|
|
<option value='1' $selectedtxt1>" . _AM_SF_ASKED . " [$totalasked]</option> |
289
|
|
|
<option value='2' $selectedtxt2>" . _AM_SF_OPENED . " [$totalopened]</option> |
290
|
|
|
<option value='3' $selectedtxt3>" . _AM_SF_ANSWERED . " [$totalanswered]</option> |
291
|
|
|
<option value='4' $selectedtxt4>" . _AM_SF_SUBMITTED . " [$totalsubmitted]</option> |
292
|
|
|
<option value='5' $selectedtxt5>" . _AM_SF_PUBLISHED . " [$totalpublished]</option> |
293
|
|
|
<option value='6' $selectedtxt6>" . _AM_SF_NEWANSWER . " [$totalnewanswers]</option> |
294
|
|
|
<option value='7' $selectedtxt7>" . _AM_SF_OFFLINE . " [$totaloffline]</option> |
295
|
|
|
<option value='8' $selectedtxt8>" . _AM_SF_REJECTED_QUESTION . " [$totalrejectedquestion]</option> |
296
|
|
|
<option value='9' $selectedtxt9>" . _AM_SF_REJECTED_SMARTFAQ . " [$totalrejectedsmartfaq]</option> |
297
|
|
|
</select> |
298
|
|
|
</td> |
299
|
|
|
</tr> |
300
|
|
|
</table> |
301
|
|
|
</form>"; |
302
|
|
|
|
303
|
|
|
// Get number of entries in the selected state |
304
|
|
|
$numrows = (0 == $statussel) ? $totalfaqs : $totalfaqbystatus[$statussel]; |
305
|
|
|
$statusSelected = (0 == $statussel) ? Constants::SF_STATUS_ALL : $statussel; |
306
|
|
|
|
307
|
|
|
// creating the Q&As objects |
308
|
|
|
$faqsObj = $faqHandler->getFaqsAdminSide($helper->getConfig('perpage'), $startentry, $statusSelected, -1, $sortsel, $ordersel); |
309
|
|
|
|
310
|
|
|
// fetching all categories |
311
|
|
|
$allCats = $categoryHandler->getObjects(null, true); |
312
|
|
|
//$totalItemsOnPage = count($faqsObj); |
313
|
|
|
buildTable(); |
314
|
|
|
|
315
|
|
|
if ($numrows > 0) { |
316
|
|
|
//$answer_criteria = new \Criteria('faqid', "(".implode(',', array_keys($faqsObj)).")", 'IN'); |
317
|
|
|
//$answer_criteria->setGroupby("faqid"); |
318
|
|
|
//$answerHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Answer'); |
319
|
|
|
//$answer_arr = $answerHandler->getCountByFAQ($answer_criteria); |
320
|
|
|
|
321
|
|
|
foreach (array_keys($faqsObj) as $i) { |
322
|
|
|
// Creating the category object to which this faq is linked |
323
|
|
|
$categoryObj = $allCats[$faqsObj[$i]->categoryid()]; |
324
|
|
|
|
325
|
|
|
//$answers = $answer_arr[$i]; |
326
|
|
|
|
327
|
|
|
$approve = ''; |
328
|
|
|
|
329
|
|
|
switch ($faqsObj[$i]->status()) { |
330
|
|
|
case Constants::SF_STATUS_ASKED: |
331
|
|
|
$statustxt = _AM_SF_ASKED; |
332
|
|
|
$approve = "<a href='question.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/on.png' . "' title='" . _AM_SF_QUESTION_MODERATE . "' alt='" . _AM_SF_QUESTION_MODERATE . "'></a> "; |
333
|
|
|
$modify = ''; |
334
|
|
|
$delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "'></a>"; |
335
|
|
|
break; |
336
|
|
|
case Constants::SF_STATUS_OPENED: |
337
|
|
|
$statustxt = _AM_SF_OPENED; |
338
|
|
|
$approve = ''; |
339
|
|
|
$modify = "<a href='question.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_QUESTION_EDIT . "' alt='" . _AM_SF_QUESTION_EDIT . "'></a> "; |
340
|
|
|
$delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "'></a>"; |
341
|
|
|
break; |
342
|
|
|
case Constants::SF_STATUS_ANSWERED: |
343
|
|
|
$statustxt = _AM_SF_ANSWERED; |
344
|
|
|
$approve = "<a href='answer.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/approve.gif' title='" . _AM_SF_ANSWERED_MODERATE . "' alt='" . _AM_SF_ANSWERED_MODERATE . "'></a> "; |
345
|
|
|
$modify = ''; |
346
|
|
|
$delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/delete.gif' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "'></a>"; |
347
|
|
|
break; |
348
|
|
|
case Constants::SF_STATUS_SUBMITTED: |
349
|
|
|
$statustxt = _AM_SF_SUBMITTED; |
350
|
|
|
$approve = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/approve.gif' title='" . _AM_SF_SUBMISSION_MODERATE . "' alt='" . _AM_SF_SUBMISSION_MODERATE . "'></a> "; |
351
|
|
|
$delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/delete.gif' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
352
|
|
|
$modify = ''; |
353
|
|
|
break; |
354
|
|
|
case Constants::SF_STATUS_PUBLISHED: |
355
|
|
|
$statustxt = _AM_SF_PUBLISHED; |
356
|
|
|
$approve = ''; |
357
|
|
|
$modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_FAQ_EDIT . "' alt='" . _AM_SF_FAQ_EDIT . "'></a> "; |
358
|
|
|
$delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
359
|
|
|
break; |
360
|
|
|
case Constants::SF_STATUS_NEW_ANSWER: |
361
|
|
|
$statustxt = _AM_SF_NEWANSWER; |
362
|
|
|
$approve = "<a href='answer.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/approve.gif' title='" . _AM_SF_FAQ_EDIT . "' alt='" . _AM_SF_FAQ_EDIT . "'></a> "; |
363
|
|
|
$delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/delete.gif' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
364
|
|
|
$modify = ''; |
365
|
|
|
break; |
366
|
|
|
case Constants::SF_STATUS_OFFLINE: |
367
|
|
|
$statustxt = _AM_SF_OFFLINE; |
368
|
|
|
$approve = ''; |
369
|
|
|
$modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_FAQ_EDIT . "' alt='" . _AM_SF_FAQ_EDIT . "'></a> "; |
370
|
|
|
$delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
371
|
|
|
break; |
372
|
|
|
case Constants::SF_STATUS_REJECTED_QUESTION: |
373
|
|
|
$statustxt = _AM_SF_REJECTED_QUESTION; |
374
|
|
|
$approve = ''; |
375
|
|
|
$modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_REJECTED_EDIT . "' alt='" . _AM_SF_REJECTED_EDIT . "'></a> "; |
376
|
|
|
$delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEQUESTION . "' alt='" . _AM_SF_DELETEQUESTION . "'></a>"; |
377
|
|
|
break; |
378
|
|
|
case Constants::SF_STATUS_REJECTED_SMARTFAQ: |
379
|
|
|
$statustxt = _AM_SF_REJECTED_SMARTFAQ; |
380
|
|
|
$approve = ''; |
381
|
|
|
$modify = "<a href='faq.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_REJECTED_EDIT . "' alt='" . _AM_SF_REJECTED_EDIT . "'></a> "; |
382
|
|
|
$delete = "<a href='faq.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
383
|
|
|
break; |
384
|
|
|
case 'default': |
385
|
|
|
default: |
386
|
|
|
$statustxt = _AM_SF_STATUS0; |
387
|
|
|
$approve = ''; |
388
|
|
|
$modify = ''; |
389
|
|
|
break; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
//$modify = "<a href='faq.php?op=mod&faqid=" . $faqid . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/assets/images/icon/edit.gif' alt='" . _AM_SF_EDITART . "'></a> "; |
393
|
|
|
|
394
|
|
|
echo '<tr>'; |
395
|
|
|
echo "<td class='head' align='center'>" . $faqsObj[$i]->faqid() . '</td>'; |
396
|
|
|
echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
397
|
|
|
echo "<td class='even' align='left'>" . $faqsObj[$i]->question(100) . '</td>'; |
398
|
|
|
|
399
|
|
|
//mb--------------------------------------- |
400
|
|
|
//adding name of the Question Submitter |
401
|
|
|
if (isset($faqsObj[$i])) { |
402
|
|
|
$requester = Smartfaq\Utility::getLinkedUnameFromId($faqsObj[$i]->uid(), $smartModuleConfig['userealname']); |
403
|
|
|
echo "<td class='even' align='center'>" . $requester . '</td>'; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
//adding name of the Answer Submitter |
407
|
|
|
/** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ |
408
|
|
|
$answerHandler = $helper::getInstance()->getHandler('Answer'); |
409
|
|
|
|
410
|
|
|
$criteria = new \CriteriaCompo(); |
411
|
|
|
$criteria->add(new \Criteria('faqid', $faqsObj[$i]->faqid())); |
412
|
|
|
$criteria->add(new \Criteria('status', true)); |
|
|
|
|
413
|
|
|
|
414
|
|
|
$answerObjects = &$answerHandler->getObjects($criteria, true); |
415
|
|
|
|
416
|
|
|
foreach (array_keys($answerObjects) as $j) { |
417
|
|
|
$answerObj = $answerObjects[$j]; |
418
|
|
|
} |
419
|
|
|
|
420
|
|
|
if (isset($answerObj->vars['uid']['value'])) { |
421
|
|
|
$answerSubmitterID = $answerObj->vars['uid']['value']; |
422
|
|
|
|
423
|
|
|
$answerSubmitter = Smartfaq\Utility::getLinkedUnameFromId($answerSubmitterID, $smartModuleConfig['userealname']); |
424
|
|
|
} else { |
425
|
|
|
$answerSubmitter = '--------'; |
426
|
|
|
} |
427
|
|
|
echo "<td class='even' align='center'>" . $answerSubmitter . '</td>'; |
428
|
|
|
|
429
|
|
|
//mb--------------------------------------- |
430
|
|
|
|
431
|
|
|
echo "<td class='even' align='center'>" . $faqsObj[$i]->datesub('s') . '</td>'; |
432
|
|
|
echo "<td class='even' align='center'>" . $statustxt . '</td>'; |
433
|
|
|
//echo "<td class='even' align='center'>" . $answers . "</td>"; |
434
|
|
|
echo "<td class='even' align='center'> " . $approve . $modify . $delete . '</td>'; |
435
|
|
|
echo '</tr>'; |
436
|
|
|
} |
437
|
|
|
} else { |
438
|
|
|
// that is, $numrows = 0, there's no entries yet |
439
|
|
|
echo '<tr>'; |
440
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOFAQSSEL . '</td>'; |
441
|
|
|
echo '</tr>'; |
442
|
|
|
} |
443
|
|
|
echo "</table>\n"; |
444
|
|
|
echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">$status_explaination</span>"; |
445
|
|
|
$pagenav = new \XoopsPageNav($numrows, $helper->getConfig('perpage'), $startentry, 'startentry', "statussel=$statussel&sortsel=$sortsel&ordersel=$ordersel"); |
446
|
|
|
|
447
|
|
|
if (1 == $helper->getConfig('useimagenavpage')) { |
448
|
|
|
echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderImageNav() . '</div>'; |
449
|
|
|
} else { |
450
|
|
|
echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderNav() . '</div>'; |
451
|
|
|
} |
452
|
|
|
// ENDs code to show active entries |
453
|
|
|
echo '</div>'; |
454
|
|
|
// Close the collapsable div |
455
|
|
|
echo '</div>'; |
456
|
|
|
echo '</div>'; |
457
|
|
|
|
458
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
459
|
|
|
|