1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* Module: SmartPartner |
6
|
|
|
* Author: The SmartFactory <www.smartfactory.ca> |
7
|
|
|
* Licence: GNU |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
/* THIS FILE COMES FROM SMARTSECTION AND NEEDS TO EDITED TO WORK... */ |
11
|
|
|
|
12
|
|
|
global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $smartPartnerItemHandler; |
|
|
|
|
13
|
|
|
$startitem = isset($_GET['startitem']) ? (int)$_GET['startitem'] : 0; |
14
|
|
|
|
15
|
|
|
$items_title = _AM_SPARTNER_CAT_ITEMS; |
16
|
|
|
$items_info = _AM_SPARTNER_CAT_ITEMS_DSC; |
17
|
|
|
$sel_cat = $categoryid; |
18
|
|
|
|
19
|
|
|
smartpartner_collapsableBar('bottomtable', 'bottomtableicon', $items_title, $items_info); |
20
|
|
|
|
21
|
|
|
// Get the total number of published ITEMS |
22
|
|
|
$totalitems = $smartPartnerItemHandler->getItemsCount($sel_cat, array(_SPARTNER_STATUS_PUBLISHED)); |
23
|
|
|
|
24
|
|
|
// creating the items objects that are published |
25
|
|
|
$itemsObj = $smartPartnerItemHandler->getAllPublished($xoopsModuleConfig['perpage'], $startitem, $sel_cat); |
26
|
|
|
|
27
|
|
|
$totalitemsOnPage = count($itemsObj); |
28
|
|
|
|
29
|
|
|
$allcats = $smartPartnerCategoryHandler->getObjects(null, true); |
30
|
|
|
echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
31
|
|
|
echo '<tr>'; |
32
|
|
|
echo "<td width='40' class='bg3' align='center'><b>" . _AM_SPARTNER_ITEMID . '</b></td>'; |
33
|
|
|
echo "<td width='20%' class='bg3' align='left'><b>" . _AM_SPARTNER_ITEMCOLNAME . '</b></td>'; |
34
|
|
|
echo "<td class='bg3' align='left'><b>" . _AM_SPARTNER_ITEMDESC . '</b></td>'; |
35
|
|
|
echo "<td width='90' class='bg3' align='center'><b>" . _AM_SPARTNER_CREATED . '</b></td>'; |
36
|
|
|
echo "<td width='60' class='bg3' align='center'><b>" . _AM_SPARTNER_ACTION . '</b></td>'; |
37
|
|
|
echo '</tr>'; |
38
|
|
|
|
39
|
|
|
if ($totalitems > 0) { |
40
|
|
|
global $pathIcon16; |
|
|
|
|
41
|
|
|
for ($i = 0; $i < $totalitemsOnPage; ++$i) { |
42
|
|
|
$categoryObj =& $allcats[$itemsObj[$i]->categoryid()]; |
43
|
|
|
$modify = "<a href='item.php?op=mod&itemid=" |
44
|
|
|
. $itemsObj[$i]->itemid() |
45
|
|
|
. "'><img src='" |
46
|
|
|
. $pathIcon16 |
47
|
|
|
. '/edit.png' |
48
|
|
|
. "' title='" |
49
|
|
|
. _AM_SPARTNER_EDITITEM |
50
|
|
|
. "' alt='" |
51
|
|
|
. _AM_SPARTNER_EDITITEM |
52
|
|
|
. "' /></a>"; |
53
|
|
|
$delete = "<a href='item.php?op=del&itemid=" |
54
|
|
|
. $itemsObj[$i]->itemid() |
55
|
|
|
. "'><img src='" |
56
|
|
|
. $pathIcon16 |
57
|
|
|
. '/delete.png' |
58
|
|
|
. "' title='" |
59
|
|
|
. _AM_SPARTNER_DELETEITEM |
60
|
|
|
. "' alt='" |
61
|
|
|
. _AM_SPARTNER_DELETEITEM |
62
|
|
|
. "'/></a>"; |
63
|
|
|
|
64
|
|
|
echo '<tr>'; |
65
|
|
|
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>'; |
66
|
|
|
echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
67
|
|
|
echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . '</td>'; |
68
|
|
|
|
69
|
|
|
echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub('s') . '</td>'; |
70
|
|
|
echo "<td class='even' align='center'> $modify $delete </td>"; |
71
|
|
|
echo '</tr>'; |
72
|
|
|
} |
73
|
|
|
} else { |
74
|
|
|
$itemid = -1; |
75
|
|
|
echo '<tr>'; |
76
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_SPARTNER_NOITEMS . '</td>'; |
77
|
|
|
echo '</tr>'; |
78
|
|
|
} |
79
|
|
|
echo "</table>\n"; |
80
|
|
|
echo "<br>\n"; |
81
|
|
|
$pagenav_extra_args = "op=mod&categoryid=$sel_cat&parentid=$parentid"; |
82
|
|
|
$pagenav = new XoopsPageNav($totalitems, $xoopsModuleConfig['perpage'], $startitem, 'startitem', $pagenav_extra_args); |
83
|
|
|
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
84
|
|
|
echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $sel_cat . "'\" value='" . _AM_SPARTNER_CREATEITEM . "'> "; |
85
|
|
|
echo '</div>'; |
86
|
|
|
|
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state