function showcatlist($parent = 0, $level = 0) { global $locale, $aidlink, $row_num; $result = dbquery("SELECT weblink_cat_id, weblink_cat_name, weblink_cat_description FROM " . DB_WEBLINK_CATS . " WHERE weblink_cat_parent='" . $parent . "'" . (multilang_table("WL") ? " AND weblink_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY weblink_cat_name"); if (dbrows($result) != 0) { while ($data = dbarray($result)) { $description = strip_tags(parse_textarea($data['weblink_cat_description'])); echo "<tr>\n"; echo "<td><strong>" . str_repeat("—", $level) . $data['weblink_cat_name'] . "</strong>\n"; if ($data['weblink_cat_description']) { echo "<br />" . str_repeat("—", $level) . "<span class='small'>" . $description . "</span></td>\n"; } echo "<td align='center' width='1%' style='white-space:nowrap'>\n\n\t\t\t<a href='" . FUSION_SELF . $aidlink . "&section=weblinks_category&action=edit&cat_id=" . $data['weblink_cat_id'] . "'>" . $locale['wl_0205'] . "</a> -\n"; echo "<a href='" . FUSION_SELF . $aidlink . "&section=weblinks_category&action=delete&cat_id=" . $data['weblink_cat_id'] . "' onclick=\"return confirm('" . $locale['wl_0310'] . "');\">" . $locale['wl_0206'] . "</a></td>\n"; echo "</tr>\n"; $row_num++; showcatlist($data['weblink_cat_id'], $level + 1); } } }
function showcatlist($parent = 0, $level = 0) { global $locale, $aidlink; $result = dbquery("\n\tSELECT article_cat_id, article_cat_name, article_cat_description\n\tFROM " . DB_ARTICLE_CATS . "\n\tWHERE article_cat_parent='" . $parent . "'" . (multilang_table("AR") ? " AND article_cat_language='" . LANGUAGE . "'" : "") . "\n\tORDER BY article_cat_name"); $rows = dbrows($result); if ($rows > 0) { while ($data = dbarray($result)) { $description = strip_tags(parse_textarea($data['article_cat_description'])); echo "<tr>\n"; echo "<td><strong>" . str_repeat("—", $level) . $data['article_cat_name'] . "</strong>\n"; if ($data['article_cat_description']) { echo "<br />" . str_repeat("—", $level) . "<span class='small'>" . trimlink($description, 45) . "</span></td>\n"; } echo "<td align='center' width='1%' style='white-space:nowrap'>\n\n\t\t\t<a href='" . clean_request("action=edit&cat_id=" . $data['article_cat_id'], array("section", "aid"), true) . "'>" . $locale['edit'] . "</a> -\n"; echo "<a href='" . clean_request("action=delete&cat_id=" . $data['article_cat_id'], array("section", "aid"), true) . "' onclick=\"return confirm('" . $locale['articles_0350'] . "');\">" . $locale['delete'] . "</a></td>\n"; echo "</tr>\n"; showcatlist($data['article_cat_id'], $level + 1); } } }
/** * display download category container * @param int $parent * @param int $level */ function showcatlist($parent = 0, $level = 0) { global $locale, $aidlink, $row_num; $result = dbquery("\n\tSELECT d.download_cat_id, d.download_cat_name, d.download_cat_description,\n\tcount(dl.download_id) 'download_count',\n\tdc.download_cat_id 'child_categories'\n\tfrom " . DB_DOWNLOAD_CATS . " d\n\tleft join " . DB_DOWNLOAD_CATS . " dc on dc.download_cat_parent=d.download_cat_id\n\tleft join " . DB_DOWNLOADS . " dl on dl.download_cat=d.download_cat_id\n\tWHERE d.download_cat_parent='{$parent}' " . (multilang_table("DL") ? "and d.download_cat_language='" . LANGUAGE . "'" : "") . "\n\tgroup by d.download_cat_id\n\tORDER BY d.download_cat_name\n\t"); if (dbrows($result) != 0) { while ($data = dbarray($result)) { echo "<div class='list-group-item clearfix'>\n"; echo "<div class='btn-group pull-right m-t-5'>\n"; echo "<a class='btn btn-sm btn-default' href='" . clean_request("action=edit&cat_id=" . $data['download_cat_id'], array("section", "aid"), TRUE) . "'>" . $locale['edit'] . "</a>"; echo "<a class='btn btn-sm btn-danger " . ($data['download_count'] || $data['child_categories'] ? "disabled" : "") . "' href='" . clean_request("action=delete&cat_id=" . $data['download_cat_id'], array("section", "aid"), TRUE) . "' onclick=\"return confirm('" . $locale['download_0350'] . "');\"><i class='fa fa-trash fa-fw'></i> " . $locale['delete'] . "</a>\n"; echo "</div>\n"; echo "<div class='overflow-hide p-r-10'>\n"; echo "<span class='display-inline-block m-r-10 strong text-bigger'>" . str_repeat("—", $level) . $data['download_cat_name'] . "</span>"; if ($data['download_cat_description']) { echo "<br />" . str_repeat("—", $level) . "<span class='small'>" . fusion_first_words($data['download_cat_description'], 50) . "</span>"; } echo "</div>\n"; echo "</div>\n"; $row_num++; showcatlist($data['download_cat_id'], $level + 1); } } }