Exemplo n.º 1
0
function publisher_displayCategory(PublisherCategory $categoryObj, $level = 0)
{
    $publisher = Publisher::getInstance();
    $description = $categoryObj->getVar('description');
    if (!XoopsLocale::isMultiByte()) {
        if (strlen($description) >= 100) {
            $description = substr($description, 0, 100 - 1) . "...";
        }
    }
    $modify = "<a href='category.php?op=mod&amp;categoryid=" . $categoryObj->getVar('categoryid') . "&amp;parentid=" . $categoryObj->getVar('parentid') . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>";
    $delete = "<a href='category.php?op=del&amp;categoryid=" . $categoryObj->getVar('categoryid') . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>";
    $spaces = '';
    for ($j = 0; $j < $level; ++$j) {
        $spaces .= '&nbsp;&nbsp;&nbsp;';
    }
    echo "<tr>";
    echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->getVar('categoryid') . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' />&nbsp;" . $categoryObj->getVar('name') . "</a></td>";
    echo "<td class='even' align='center'>" . $categoryObj->getVar('weight') . "</td>";
    echo "<td class='even' align='center'> {$modify} {$delete} </td>";
    echo "</tr>";
    $subCategoriesObj = $publisher->getCategoryHandler()->getCategories(0, 0, $categoryObj->getVar('categoryid'));
    if (count($subCategoriesObj) > 0) {
        ++$level;
        foreach ($subCategoriesObj as $thiscat) {
            publisher_displayCategory($thiscat, $level);
        }
    }
    unset($categoryObj);
}
Exemplo n.º 2
0
function publisher_displayCategory($categoryObj, $level = 0)
{
    $publisher = PublisherPublisher::getInstance();
    $description = $categoryObj->description();
    if (!XOOPS_USE_MULTIBYTES) {
        if (strlen($description) >= 100) {
            $description = substr($description, 0, 100 - 1) . "...";
        }
    }
    $modify = "<a href='category.php?op=mod&amp;categoryid=" . $categoryObj->categoryid() . "&amp;parentid=" . $categoryObj->parentid() . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>";
    $delete = "<a href='category.php?op=del&amp;categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>";
    $spaces = '';
    for ($j = 0; $j < $level; $j++) {
        $spaces .= '&nbsp;&nbsp;&nbsp;';
    }
    echo "<tr>";
    echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' />&nbsp;" . $categoryObj->name() . "</a></td>";
    echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>";
    echo "<td class='even' align='center'> {$modify} {$delete} </td>";
    echo "</tr>";
    $subCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryObj->categoryid());
    if (count($subCategoriesObj) > 0) {
        $level++;
        foreach ($subCategoriesObj as $key => $thiscat) {
            publisher_displayCategory($thiscat, $level);
        }
    }
    unset($categoryObj);
}