function ShowCategos() { global $xoopsDB; list($num) = $xoopsDB->fetchRow($xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("rmdp_categos") . " ORDER BY nombre")); if ($num <= 0) { header('location: categos.php?op=new'); die; } include 'functions.php'; xoops_cp_header(); DP_ShowNav(); echo "<a href='categos.php?op=new'>" . _AM_RMDP_NEWCATEGO . "</a><br>\n\t\t <table width='100%' class='outer' cellspacing='1'>\n\t\t\t<tr><th colspan='3' align='left'>" . _AM_RMDP_CATEGOLIST . "</th></tr>\n\t\t\t<tr align='center'><td class='head'>" . _AM_RMDP_LNAME . "</td>\n\t\t\t<td class='head'>" . _AM_RMDP_LACCESS . "</td>\n\t\t\t<td class='head'>" . _AM_RMDP_OPTIONS . "</td></tr>"; DP_ChildCatego(); echo "</table>"; xoops_cp_footer(); }
function DP_ChildCatego($parent = '0', $tabs = 0, $class = 'even') { global $xoopsDB; $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix('rmdp_categos') . " WHERE parent={$parent}"); while ($row = $xoopsDB->fetchArray($result)) { echo "<tr><td class='{$class}' align='left'>" . str_repeat(' ', $tabs) . "\n\t\t\t <a href='categos.php?op=view&idc={$row['id_cat']}'>{$row['nombre']}</a></td>\n\n\t\t\t\t<td class='{$class}' align='center'>"; if ($row['acceso']) { echo _AM_RMDP_REGISTERED; } else { echo _AM_RMDP_EVERYBODY; } echo "</td>\n\n\t\t\t\t<td class='{$class}'align='center'><a href='categos.php?op=mod&idc={$row['id_cat']}'>" . _AM_RMDP_MODIFY . "</a> | \n\t\t\t\t<a href='categos.php?op=del&idc={$row['id_cat']}'>" . _AM_RMDP_DELETE . "</a></td></tr>"; DP_ChildCatego($row['id_cat'], $tabs + 2, $class = 'odd'); if ($tabs == 0) { $class = 'even'; } } }