function GetSubIndex($id) { global $xoopsDB, $xoopsTpl, $tab; $tab += 20; $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("rmlib_indice") . " WHERE parent = '{$id}' ORDER BY orden"); while (list($iid, $titulo, $tema, $parent, $orden, $fecha) = $xoopsDB->fetchRow($result)) { list($num) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("rmlib_indice") . " WHERE parent = '{$iid}'")); if ($num > 0) { $imagen = 0; } else { $imagen = 1; } $xoopsTpl->append('indices', array('id' => $iid, 'titulo' => $titulo, 'fecha' => date("d/m/Y", $fecha), 'imagen' => $imagen, 'link' => 'content.php?index=' . $iid, 'tabs' => $tab)); GetSubIndex($iid); } $tab -= 20; }
function ShowIndex() { global $xoopsDB; if ($_GET['tid'] <= 0) { header("location: index.php?op=showthemes&cid={$_GET['cid']}"); die; } $tid = $_GET['tid']; list($catego) = $xoopsDB->fetchRow($xoopsDB->query("SELECT titulo FROM " . $xoopsDB->prefix("rmlib_categos") . " WHERE cid = '{$_GET['cid']}'")); list($ntema, $cid) = $xoopsDB->fetchRow($xoopsDB->query("SELECT titulo, catego FROM " . $xoopsDB->prefix("rmlib_temas") . " WHERE tid = '{$_GET['tid']}'")); $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("rmlib_indice") . " WHERE tema = '{$_GET['tid']}' AND parent = '0' ORDER by orden"); $num = $xoopsDB->getRowsNum($result); xoops_cp_header(); echo "<img src='../images/up.gif' align='absmiddle'> <a href='index.php?op=showthemes&cid={$cid}'>" . _RH_GENERAL_BACKTHEMES . "</a>\n\n\t\t <table width='60%' cellpadding='0' cellspacing='1' class='outer' align='left'>\n\n\t\t\t<tr><th>" . sprintf(_RH_INDEX_TITLE, $catego, $ntema) . "</th>\n\n\t\t\t<th align='center'>" . _RH_INDEX_ORDER . "</th>\n\n\t\t\t<th align='center'>" . _RH_THEMES_DATE . "</th>\n\n\t\t\t<th align='center'>" . _RH_THEMES_OPTIONS . "</th></tr>\n"; if ($num <= 0) { echo "<tr><td class='head' colspan='4'>" . _RH_INDEX_NOTFOUND . "</td></tr>"; } while (list($iid, $titulo, $tema, $parent, $orden, $fecha) = $xoopsDB->fetchRow($result)) { list($num) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("rmlib_indice") . " WHERE parent = '{$iid}'")); if ($num > 0 || $parent == 0) { $imagen = "../images/chapter.gif"; } else { $imagen = "../images/content.gif"; } echo "<tr class='even'><td><img src='{$imagen}' border='0' align='absmiddle'> {$titulo}</td>\n\n\t\t\t\t<td align='center'>{$orden}</td>\n\n\t\t\t\t<td align='center'>" . date("d/m/Y", $fecha) . "</td>\n\n\t\t\t\t<td width='80' align='center'>\n\n\t\t\t\t<a href='books.php?op=content&iid={$iid}'><img src='../images/content.gif' border='0'></a>\n\n\t\t\t\t<a href='books.php?op=editindex&iid={$iid}'><img src='../images/edit.gif' border='0'></a>\n\n\t\t\t\t<a href='books.php?op=deleteindex&iid={$iid}'><img src='../images/delete.gif' border='0' alt='Eliminar'></a>\n</td></tr>\n"; GetSubIndex($iid); } echo "</table>\n<br>"; echo "<table width='40%' class='outer' cellpadding='0' cellspacing='1' align='center'>\n\n\t\t \t<tr><th colspan='2'>" . _RH_INDEX_NEWINDEX . "</th></tr>\n\n\t\t\t<form name='frmNew' action='books.php' method='post'>\n\n\t\t\t<tr><td class='even' align='left'>" . _RH_INDEX_TITLEI . "</td>\n\n\t\t\t<td class='odd' align='left'><input type='text' name='titulo' size='30' maxlength='150'></td></tr>\n\n\t\t\t<tr><td class='even' align='left'>" . _RH_INDEX_THEME . "</td>\n\n\t\t\t<td class='odd' align='left'><strong>{$ntema}</strong></td></tr>\n\n\t\t\t<tr><td class='even' align='left'>" . _RH_INDEX_PARENT . "</td>\n\n\t\t\t<td class='odd' align='left'><select name='parent'>\n\n\t\t\t<option value='0'>Sin Indice superior</option>\n"; $result = $xoopsDB->query("SELECT iid, titulo FROM " . $xoopsDB->prefix("rmlib_indice") . " WHERE tema = '{$_GET['tid']}'"); while (list($iid, $titulo) = $xoopsDB->fetchRow($result)) { echo "<option value='{$iid}'>{$titulo}</option>"; } echo "</select></td></tr>\n\n\t \t <tr><td class='even' align='left'>" . _RH_INDEX_ORDER . "</td>\n\n\t\t\t<td align='left' class='odd'><input type='text' name='orden' size='5' value='0'></td></tr>\n\n\t\t\t<tr><td class='even'> </td>\n\n\t\t\t<td class='odd' align='left'>\n\n\t\t\t<input type='submit' name='sbt' value='" . _RH_GENERAL_SEND . "'>\n\n\t\t\t<input type='hidden' name='op' value='saveindex'>\n\n\t\t\t<input type='hidden' name='tid' value='{$_GET['tid']}'>\n\n\t\t\t</form>\n\t\t\t</table>\n"; WritePermissions($tid); xoops_cp_footer(); }