Example #1
0
function printCats($f_arrCats, $f_iLevel = 1)
{
    $szOptions = '';
    foreach ($f_arrCats as $objCat) {
        $szOptions .= '<option value="' . $objCat->id . '"' . ($_GET['selected'] == (int) $objCat->id ? ' selected="1"' : '') . '>' . trim(str_repeat('&nbsp;&gt;', $f_iLevel) . ' ' . htmlspecialchars($objCat->title)) . '</option';
        $arrSubCats = AROShopProductCategory::finder()->findMany('parent_category_id = ?', $objCat->id);
        $szOptions .= printCats($arrSubCats, $f_iLevel + 1);
    }
    return $szOptions;
}
Example #2
0
function printCats($f_arrCats)
{
    echo '<table border="2" cellpadding="3" cellspacing="0" bordercolor="white" width="300"><tbody>';
    foreach ($f_arrCats as $objCat) {
        echo '<tr' . (empty($_GET['sort']) ? '' : ' bgcolor="#cccccc"') . '><td>';
        echo '<div>&gt; <a href="edit_category.php?id=' . $GLOBALS['objShop']->id . '&cat=' . $objCat->id . '">' . htmlspecialchars($objCat->title) . ' (' . htmlspecialchars($objCat->url_id) . ')</a> (<a href="new_category.php?id=' . $GLOBALS['objShop']->id . '&selected=' . $objCat->id . '">+</a>) (<a href="?id=' . $GLOBALS['objShop']->id . '&del=' . $objCat->id . '">x</a>)</div>';
        $arrSubCats = AROShopProductCategory::finder()->findMany('parent_category_id = ?', $objCat->id);
        if (0 < count($arrSubCats)) {
            echo '<div class="sub">';
            printCats($arrSubCats);
            echo '</div>';
        }
        echo '</td></tr>';
    }
    echo '</tbody></table>';
}