function print_contents($pid, $list, $pIndexes = array(), $path = '', $afterInfo = false) { global $cclasses; $arr = get_contents_by_pid($pid, $list); $n = count($arr); $cntPrefix = ''; for ($i = 0; $i < count($pIndexes); $i++) { $cntPrefix .= $pIndexes[$i] . '.'; } $depth = count($pIndexes); for ($i = 0; $i < $n; $i++) { $r = $arr[$i]; $cntString = $cntPrefix . ($i + 1); $p = $path . '/' . $r['path']; $childs = get_contents_by_pid($r['id'], $list); $nChilds = count($childs); ?> <div style="padding-left: <?php echo $depth * 24; ?> px;"><table class="list<?php echo $nChilds == 0 && $i == $n - 1 && !$afterInfo ? ' smb' : ''; ?> "> <tr <?php echo $nChilds == 0 && $i == $n - 1 && !$afterInfo ? 'class="last"' : ''; ?> ><td class="n"><?php echo $cntString; ?> .</td><td width="86"><?php dnd_anchor($r['id'], update_element_parent, ''); ibtnav($i != $n - 1 ? 'arrdown_blue.gif' : 'arrdown_d.gif', $i != $n - 1 ? '?action=down&id=' . $r['id'] : '', 'Опустить'); ibtnav($i != 0 ? 'arrup_blue.gif' : 'arrup_d.gif', $i != 0 ? '?action=up&id=' . $r['id'] : '', 'Поднять'); ?> </td><td><a href=".?action=editor&id=<?php echo $r['id']; ?> "><?php echo $r['name']; ?> </a> (<?php echo $p; ?> )</td><td width="250"><?php echo $cclasses[$r['class']]; ?> </td><td width="48" align="right"><?php ibtnav('prefs.gif', '?action=edit&id=' . $r['id'], 'Изменить элемент'); ibtnav('cross.gif', '?action=delete&id=' . $r['id'], 'Удалить элемент', 'Удалить этот элемент?'); ?> </td></tr> </table></div> <?php $printed = true; $s_pIndexes = $pIndexes; $pIndexes[] = $i + 1; print $counter; print_contents($r['id'], $list, $pIndexes, $p, $i != $n - 1); $pIndexes = $s_pIndexes; } }
<li><a href="tripleplay.php?a=actualizar" class="update" ><span class="hidden">Actualizar</span></a></li> </ul> </div> <div id="content"> <div id="content-left"> <div id="title"> <h2 class="hidden">Indice</h2> </div> <div id="description"> <center><?php print_views($a); ?> </center> </div> </div> <div id="content-right"> <div id="main"> <?php print_contents($a, $v); ?> </div> </div> </div> </div> <div id="footer"> <p>Un producto de Ñángara, Inc. <img src="images/vendor.png" alt="Una pieza del teclado de un computador, con el simbolo de ñangara." /></p> </div> </div> </body> </html>