Esempio n. 1
0
    foreach ($categoryTreeHelper as $categoryId => $categoryName) {
        $indent = str_repeat(' ', $categoryTreeHelper->indent);
        $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage();
        $parentId = $categoryTreeHelper->getInnerIterator()->current()->getParentId();
        // show category name
        printf("<p>%s<strong style=\"vertical-align: top;\">&middot; %s</strong> ", $indent, $categoryName);
        if ($categoryLang == $lang) {
            // add sub category (if actual language)
            printf('<a href="?action=addcategory&amp;cat=%s&amp;lang=%s"><img src="images/add.png" width="16" height="16" alt="%s" title="%s" border="0" /></a>&nbsp;', $categoryId, $categoryLang, $PMF_LANG['ad_quick_category'], $PMF_LANG['ad_quick_category']);
            // rename (sub) category (if actual language)
            printf('<a href="?action=editcategory&amp;cat=%s"><img src="images/edit.png" width="16" height="16" border="0" title="%s" alt="%s" /></a>&nbsp;', $categoryId, $PMF_LANG['ad_kateg_rename'], $PMF_LANG['ad_kateg_rename']);
        }
        // translate category (always)
        printf('<a href="?action=translatecategory&amp;cat=%s"><img src="images/translate.png" width="16" height="16" border="0" title="%s" alt="%s" /></a>&nbsp;', $categoryId, $PMF_LANG['ad_categ_translate'], $PMF_LANG['ad_categ_translate']);
        // delete (sub) category (if actual language)
        if (!$categoryTreeHelper->callHasChildren() && $categoryLang == $lang) {
            printf('<a href="?action=deletecategory&amp;cat=%s&amp;lang=%s"><img src="images/delete.png" width="16" height="16" alt="%s" title="%s" border="0" /></a>&nbsp;', $categoryId, $categoryLang, $PMF_LANG['ad_categ_delete'], $PMF_LANG['ad_categ_delete']);
        }
        if ($categoryLang == $lang) {
            // cut category (if actual language)
            printf('<a href="?action=cutcategory&amp;cat=%s"><img src="images/cut.png" width="16" height="16" alt="%s" border="0" title="%s" /></a>&nbsp;', $categoryId, $PMF_LANG['ad_categ_cut'], $PMF_LANG['ad_categ_cut']);
            if ($categoryHelper->numParent($parentId) > 1) {
                // move category (if actual language) AND more than 1 category at the same level)
                printf('<a href="?action=movecategory&amp;cat=%s&amp;parent_id=%s"><img src="images/move.gif" width="16" height="16" alt="%s" border="0" title="%s" /></a>', $categoryId, $parentId, $PMF_LANG['ad_categ_move'], $PMF_LANG['ad_categ_move']);
            }
        }
        print "</p>\n";
    }
    printf('<p>%s</p>', $PMF_LANG['ad_categ_remark']);
} else {
    print $PMF_LANG['err_NotAuth'];