@@ 340-431 (lines=92) @@ | ||
337 | /** |
|
338 | * @param int $showCreate |
|
339 | */ |
|
340 | public static function showColumns($showCreate = 0) |
|
341 | { |
|
342 | global $xoopsGTicket; |
|
343 | global $xoopsModuleConfig, $xoopsModule; |
|
344 | $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
|
345 | $myts = MyTextSanitizer::getInstance(); |
|
346 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
347 | require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
348 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php'; |
|
349 | $module_id = $xoopsModule->getVar('mid'); |
|
350 | $startcol = isset($_GET['startcol']) ? (int)$_GET['startcol'] : 0; |
|
351 | ||
352 | /* Code to show existing columns */ |
|
353 | echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWCOLS . '</h3>'; |
|
354 | echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_COLSTEXT . '</span>'; |
|
355 | ||
356 | // if ($showCreate == 1) { |
|
357 | // echo |
|
358 | // "<a style='border: 1px solid #5E5D63; color: #000000; font-family: verdana, tahoma, arial, helvetica, sans-serif; font-size: 1em; padding: 4px 8px; text-align:center;' href='column.php'>" |
|
359 | // . _AM_SOAPBOX_CREATECOL . "</a><br><br>"; |
|
360 | // } |
|
361 | // To create existing columns table |
|
362 | //---------------------------- |
|
363 | //get category object |
|
364 | $entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname()); |
|
365 | $numrows = $entrydataHandler->getColumnCount(); |
|
366 | $criteria = new CriteriaCompo(); |
|
367 | $criteria->setSort('weight'); |
|
368 | $criteria->setLimit((int)$xoopsModuleConfig['perpage']); |
|
369 | $criteria->setStart((int)$startcol); |
|
370 | $categoryobArray = $entrydataHandler->getColumns($criteria); |
|
371 | unset($criteria); |
|
372 | if ($numrows > 0) { |
|
373 | echo '<form action="column.php" method="post" name="reordercols">'; |
|
374 | } |
|
375 | echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
|
376 | echo '<tr>'; |
|
377 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ID . '</b></td>'; |
|
378 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_WEIGHT . '</b></td>'; |
|
379 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_AUTHOR . '</b></td>'; |
|
380 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTCOLNAME . '</b></td>'; |
|
381 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_DESCRIP . '</b></td>'; |
|
382 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ACTION . '</b></td>'; |
|
383 | echo '</tr>'; |
|
384 | ||
385 | if ($numrows > 0) { // That is, if there ARE columns in the system |
|
386 | //---------------------------- |
|
387 | $cont = 0; |
|
388 | foreach ($categoryobArray as $_categoryob) { |
|
389 | //---------------------------- |
|
390 | //get vars |
|
391 | ++$cont; |
|
392 | $category = $_categoryob->toArray(); //all assign |
|
393 | $category_vars = $_categoryob->getVars(); |
|
394 | foreach ($category_vars as $k => $v) { |
|
395 | ${$k} = $_categoryob->getVar($k); |
|
396 | } |
|
397 | //---------------------------- |
|
398 | ||
399 | $author = SoapboxUtility::getLinkedUnameFromId($author, 0); |
|
400 | $modify = "<a href='column.php?op=mod&columnID=" . $category['columnID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITCOL . "'></a>"; |
|
401 | $delete = "<a href='column.php?op=del&columnID=" . $category['columnID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETECOL . "'></a>"; |
|
402 | $style = (($cont % 2) === 0) ? 'even' : 'odd'; |
|
403 | echo '<tr class="' . $style . '">'; |
|
404 | echo '<td class="txtcenter">' . $category['columnID'] . '</td>'; |
|
405 | echo '<td class="txtcenter"><input type="text" name="columnweight[' . $category['columnID'] . ']" value="' . $weight . '" size="3" maxlength="3" style="text-align: center;"></td>'; |
|
406 | echo '<td class="txtcenter">' . $category['author'] . '</td>'; |
|
407 | echo '<td class="txtcenter">' . $category['name'] . '</td>'; |
|
408 | echo '<td class="txtcenter">' . $category['description'] . '</td>'; |
|
409 | echo '<td class="txtcenter">' . $modify . ' ' . $delete . '</td>'; |
|
410 | echo '</tr>'; |
|
411 | } |
|
412 | } else { // that is, $numrows = 0, there's no columns yet |
|
413 | echo '<tr>'; |
|
414 | echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOCOLS . '</td>'; |
|
415 | echo '</tr>'; |
|
416 | $category['columnID'] = '0'; |
|
417 | } |
|
418 | echo "</table>\n"; |
|
419 | $pagenav = new XoopsPageNav($numrows, (int)$xoopsModuleConfig['perpage'], $startcol, 'startcol', 'columnID=' . $category['columnID']); |
|
420 | echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
421 | echo "<br>\n"; |
|
422 | ||
423 | if ($numrows > 0) { |
|
424 | echo "<input type='hidden' name='op' value='reorder' />"; |
|
425 | //-------------------- |
|
426 | echo $xoopsGTicket->getTicketHtml(__LINE__); |
|
427 | //-------------------- |
|
428 | echo '<div style="margin-bottom: 18px;"><input type="submit" name="submit" class="formButton" value="' . _AM_SOAPBOX_REORDERCOL . '" /></div>'; |
|
429 | echo '</form>'; |
|
430 | } |
|
431 | } |
|
432 | ||
433 | /** |
|
434 | * @param int $showCreate |
@@ 225-316 (lines=92) @@ | ||
222 | /** |
|
223 | * @param int $showCreate |
|
224 | */ |
|
225 | function showColumns($showCreate = 0) |
|
226 | { |
|
227 | global $xoopsGTicket; |
|
228 | global $xoopsModuleConfig, $xoopsModule; |
|
229 | $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
|
230 | $myts = MyTextSanitizer::getInstance(); |
|
231 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
232 | require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
233 | require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php'; |
|
234 | $module_id = $xoopsModule->getVar('mid'); |
|
235 | $startcol = isset($_GET['startcol']) ? (int)$_GET['startcol'] : 0; |
|
236 | ||
237 | /* Code to show existing columns */ |
|
238 | echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWCOLS . '</h3>'; |
|
239 | echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_COLSTEXT . '</span>'; |
|
240 | ||
241 | // if ($showCreate == 1) { |
|
242 | // echo |
|
243 | // "<a style='border: 1px solid #5E5D63; color: #000000; font-family: verdana, tahoma, arial, helvetica, sans-serif; font-size: 1em; padding: 4px 8px; text-align:center;' href='column.php'>" |
|
244 | // . _AM_SOAPBOX_CREATECOL . "</a><br><br>"; |
|
245 | // } |
|
246 | // To create existing columns table |
|
247 | //---------------------------- |
|
248 | //get category object |
|
249 | $entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname()); |
|
250 | $numrows = $entrydataHandler->getColumnCount(); |
|
251 | $criteria = new CriteriaCompo(); |
|
252 | $criteria->setSort('weight'); |
|
253 | $criteria->setLimit((int)$xoopsModuleConfig['perpage']); |
|
254 | $criteria->setStart((int)$startcol); |
|
255 | $categoryobArray = $entrydataHandler->getColumns($criteria); |
|
256 | unset($criteria); |
|
257 | if ($numrows > 0) { |
|
258 | echo '<form action="column.php" method="post" name="reordercols">'; |
|
259 | } |
|
260 | echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
|
261 | echo '<tr>'; |
|
262 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ID . '</b></td>'; |
|
263 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_WEIGHT . '</b></td>'; |
|
264 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_AUTHOR . '</b></td>'; |
|
265 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTCOLNAME . '</b></td>'; |
|
266 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_DESCRIP . '</b></td>'; |
|
267 | echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ACTION . '</b></td>'; |
|
268 | echo '</tr>'; |
|
269 | ||
270 | if ($numrows > 0) { // That is, if there ARE columns in the system |
|
271 | //---------------------------- |
|
272 | $cont = 0; |
|
273 | foreach ($categoryobArray as $_categoryob) { |
|
274 | //---------------------------- |
|
275 | //get vars |
|
276 | ++$cont; |
|
277 | $category = $_categoryob->toArray(); //all assign |
|
278 | $category_vars = $_categoryob->getVars(); |
|
279 | foreach ($category_vars as $k => $v) { |
|
280 | ${$k} = $_categoryob->getVar($k); |
|
281 | } |
|
282 | //---------------------------- |
|
283 | ||
284 | $author = getLinkedUnameFromId($author, 0); |
|
285 | $modify = "<a href='column.php?op=mod&columnID=" . $category['columnID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITCOL . "'></a>"; |
|
286 | $delete = "<a href='column.php?op=del&columnID=" . $category['columnID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETECOL . "'></a>"; |
|
287 | $style = (($cont % 2) === 0) ? 'even' : 'odd'; |
|
288 | echo '<tr class="' . $style . '">'; |
|
289 | echo '<td class="txtcenter">' . $category['columnID'] . '</td>'; |
|
290 | echo '<td class="txtcenter"><input type="text" name="columnweight[' . $category['columnID'] . ']" value="' . $weight . '" size="3" maxlength="3" style="text-align: center;"></td>'; |
|
291 | echo '<td class="txtcenter">' . $category['author'] . '</td>'; |
|
292 | echo '<td class="txtcenter">' . $category['name'] . '</td>'; |
|
293 | echo '<td class="txtcenter">' . $category['description'] . '</td>'; |
|
294 | echo '<td class="txtcenter">' . $modify . ' ' . $delete . '</td>'; |
|
295 | echo '</tr>'; |
|
296 | } |
|
297 | } else { // that is, $numrows = 0, there's no columns yet |
|
298 | echo '<tr>'; |
|
299 | echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOCOLS . '</td>'; |
|
300 | echo '</tr>'; |
|
301 | $category['columnID'] = '0'; |
|
302 | } |
|
303 | echo "</table>\n"; |
|
304 | $pagenav = new XoopsPageNav($numrows, (int)$xoopsModuleConfig['perpage'], $startcol, 'startcol', 'columnID=' . $category['columnID']); |
|
305 | echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
306 | echo "<br>\n"; |
|
307 | ||
308 | if ($numrows > 0) { |
|
309 | echo "<input type='hidden' name='op' value='reorder' />"; |
|
310 | //-------------------- |
|
311 | echo $xoopsGTicket->getTicketHtml(__LINE__); |
|
312 | //-------------------- |
|
313 | echo '<div style="margin-bottom: 18px;"><input type="submit" name="submit" class="formButton" value="' . _AM_SOAPBOX_REORDERCOL . '" /></div>'; |
|
314 | echo '</form>'; |
|
315 | } |
|
316 | } |
|
317 | ||
318 | /** |
|
319 | * @param int $showCreate |