示例#1
0
    foreach ($allLanguages as $language) {
        if ($languageCodes[strtoupper($language)] != $currentLanguage) {
            print "    <th>" . $languageCodes[strtoupper($language)] . "</th>\n";
        }
    }
    $categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery();
    $categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider));
    $categoryHelper = new PMF_Category_Helper();
    foreach ($categoryTreeHelper as $categoryId => $categoryName) {
        $indent = str_repeat('&nbsp;', $categoryTreeHelper->indent);
        $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage();
        if ($categoryLang == $LANGCODE) {
            print "</tr>\n";
            print "<tr>\n";
        }
        printf("    <td>&nbsp;%s<strong>&middot; %s</strong>&nbsp</td>\n", $indent, $categoryName);
        foreach ($allLanguages as $language) {
            if ($language != $categoryLang && !$categoryHelper->hasTranslation($categoryId, $language)) {
                // translate category
                printf("    <td class=\"needsTranslation\">&nbsp;%s<strong>&middot; %s</strong>&nbsp", $indent, $categoryName);
                printf('<a href="index.php?action=translatecategory&amp;cat=%d&amp;trlang=%s" title="%s">', $categoryId, $LANGCODE, $PMF_LANG['ad_categ_translate']);
                printf('<img src="images/translate.png" width="13" height="16" border="0" title="%s" alt="%s" /></a>', $PMF_LANG['ad_categ_translate'], $PMF_LANG['ad_categ_translate']);
                print "</td>\n";
            }
        }
    }
    print "</tr>\n</table>\n";
    printf('<p>%s</p>', $PMF_LANG['ad_categ_remark_overview']);
} else {
    print $PMF_LANG['err_NotAuth'];
}
示例#2
0
         $categoryGroup->create($groupPermission);
         printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_added']);
     } else {
         printf('<p class="error">%s</p>', $db->error());
     }
 }
 // Updates an existing category
 if ($action == 'updatecategory') {
     $categoryHelper = new PMF_Category_Helper();
     $categoryId = PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT);
     $categoryData = array('id' => $categoryId, 'lang' => PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING), 'parent_id' => PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT), 'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING), 'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING), 'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT));
     $userperm = PMF_Filter::filterInput(INPUT_POST, 'userpermission', FILTER_SANITIZE_STRING);
     $userAllowed = 'all' == $userperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_users', FILTER_VALIDATE_INT);
     $groupperm = PMF_Filter::filterInput(INPUT_POST, 'grouppermission', FILTER_SANITIZE_STRING);
     $groupAllowed = 'all' == $groupperm ? -1 : PMF_Filter::filterInput(INPUT_POST, 'restricted_groups', FILTER_VALIDATE_INT);
     if ($categoryHelper->hasTranslation($categoryData['id'], $categoryData['lang'])) {
         if ($categoryNode->create($categoryData)) {
             printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_translated']);
         } else {
             printf('<p class="error">%s</p>', $db->error());
         }
     } else {
         if ($categoryNode->update($categoryId, $categoryData)) {
             $userPermission = array('category_id' => $categoryNode->getCategoryId(), 'user_id' => $userAllowed);
             $groupPermission = array('category_id' => $categoryNode->getCategoryId(), 'group_id' => $groupAllowed);
             $categoryUser->update($categoryId, $userPermission);
             $categoryGroup->update($categoryId, $groupPermission);
             printf('<p class="message">%s</p>', $PMF_LANG['ad_categ_updated']);
         } else {
             printf('<p class="error">%s</p>', $db->error());
         }