Example #1
0
function show_category_rows($cid = 0, $depth = 1)
{
    global $site_db, $site_sess, $lang, $category_cache, $cat_parent_cache;
    if (!isset($category_cache[$cid])) {
        return false;
    }
    foreach ($category_cache[$cid] as $key => $cats) {
        $class = "tablerow2";
        if ($cats['cat_parent_id'] == 0) {
            $class = "tablerow";
        }
        echo "<tr class=\"{$class}\">\n";
        if (!$GLOBALS['show_all_subcats']) {
            if (!empty($cat_parent_cache[$cats['cat_id']])) {
                $href = $site_sess->url("categories.php?action=modifycats");
                if (isset($GLOBALS['map'][$cats['cat_id']]) || $GLOBALS['open_all']) {
                    $char = $GLOBALS['close_cat_link'];
                    $href .= "&closecat=" . $cats['cat_id'];
                } else {
                    $char = $GLOBALS['open_cat_link'];
                    $href .= "&opencat=" . $cats['cat_id'];
                }
                $char = '<a href="' . $href . '">' . $char . '</a>';
            } else {
                $char = '&nbsp;';
            }
            echo "<td align=\"center\">" . $char . "</td>";
        }
        echo "<td>\n";
        if ($depth > 1) {
            echo str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1) . "<img src=\"images/folder_path.gif\" alt=\"\">\n";
        }
        echo "<img src=\"" . ROOT_PATH . "admin/images/folder.gif\" alt=\"\"><b><a href=\"" . $site_sess->url(ROOT_PATH . "categories.php?cat_id=" . $cats['cat_id']) . "\" target=\"_blank\">" . format_text($cats['cat_name'], 2) . "</a>\n</b> (ID: " . $cats['cat_id'] . ")&nbsp;&nbsp;&nbsp;&nbsp;";
        show_text_link($lang['edit'], "categories.php?action=editcat&cat_id=" . $cats['cat_id']);
        show_text_link($lang['delete'], "categories.php?action=removecat&cat_id=" . $cats['cat_id']);
        show_text_link($lang['add_subcategory'], "categories.php?action=addcat&cat_parent_id=" . $cats['cat_id']);
        echo "\n</td>\n<td align=\"center\">";
        echo "<a href=\"" . $site_sess->url("categories.php?action=ordercat&move=up&cat_id=" . $cats['cat_id']) . "\"><img src=\"images/arrow_up.gif\" border=\"0\"></a>\n";
        echo "<a href=\"" . $site_sess->url("categories.php?action=ordercat&move=down&cat_id=" . $cats['cat_id']) . "\"><img src=\"images/arrow_down.gif\" border=\"0\"></a>\n";
        echo "</td>\n</tr>\n";
        show_category_rows($cats['cat_id'], $depth + 1);
    }
    unset($category_cache[$cid]);
}
Example #2
0
function show_category_rows($cid = 0, $depth = 1)
{
    global $site_db, $site_sess, $lang, $cat_parent_cache, $cat_cache, $access_field_array, $cat_access_array, $permission_select_type;
    if (!isset($cat_parent_cache[$cid])) {
        return false;
    }
    foreach ($cat_parent_cache[$cid] as $key => $category_id) {
        $class = "tablerow2";
        if ($category_id == 0) {
            $class = "tablerow";
        }
        echo "<tr><td class=\"{$class}\" nowrap=\"nowrap\">\n";
        if ($depth > 1) {
            echo str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth - 1) . "<img src=\"images/folder_path.gif\" alt=\"\">\n";
        }
        $category_name = $cat_cache[$category_id]['cat_name'];
        echo "<img src=\"images/folder.gif\" alt=\"\"><b><a href=\"" . $site_sess->url("categories.php?action=editcat&cat_id=" . $category_id) . "\">" . format_text($category_name, 2) . "</a></b></td>";
        foreach ($access_field_array as $val) {
            echo "<td class=\"" . $class . "\" align=\"center\">";
            if ($cat_cache[$category_id][$val] == AUTH_ACL) {
                if ($permission_select_type == "radio") {
                    if (isset($cat_access_array[$category_id]) && $cat_access_array[$category_id][$val] == 1) {
                        echo "<input type=\"radio\" name=\"auth[" . $category_id . "][" . $val . "]\" value=\"1\" checked=\"checked\">" . $lang['yes'] . " \n<input type=\"radio\" name=\"auth[" . $category_id . "][" . $val . "]\" value=\"0\">" . $lang['no'] . "\n";
                    } else {
                        echo "<input type=\"radio\" name=\"auth[" . $category_id . "][" . $val . "]\" value=\"1\">" . $lang['yes'] . " \n<input type=\"radio\" name=\"auth[" . $category_id . "][" . $val . "]\" value=\"0\" checked=\"checked\">" . $lang['no'] . "\n";
                    }
                } elseif ($permission_select_type == "checkbox") {
                    $checked = "";
                    if (isset($cat_access_array[$category_id]) && $cat_access_array[$category_id][$val] == 1) {
                        $checked = " checked=\"checked\"\n";
                    }
                    echo "<input type=\"checkbox\" name=\"auth[" . $category_id . "][" . $val . "]\" value=\"1\"{$checked}>\n";
                } else {
                    echo "<select name=\"auth[" . $category_id . "][" . $val . "]\">\n";
                    if (isset($cat_access_array[$category_id]) && $cat_access_array[$category_id][$val] == 1) {
                        echo "<option value=\"1\" selected=\"selected\">" . $lang['yes'] . "</option>\n<option value=\"0\">" . $lang['no'] . "</option>\n";
                    } else {
                        echo "<option value=\"1\">" . $lang['yes'] . "</option>\n<option value=\"0\" selected=\"selected\">" . $lang['no'] . "</option>\n";
                    }
                    echo "</select>\n";
                }
            } else {
                echo "&nbsp;";
            }
            echo "</td>\n";
        }
        echo "</tr>";
        show_category_rows($category_id, $depth + 1);
    }
    unset($cat_parent_cache[$cid]);
}