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&categoryid=" . $categoryObj->getVar('categoryid') . "&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&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 .= ' '; } 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='' /> " . $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); }
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&categoryid=" . $categoryObj->categoryid() . "&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&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 .= ' '; } 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='' /> " . $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); }