Esempio n. 1
0
             echo "&nbsp;&nbsp;&nbsp;&nbsp;"  . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE_FILE, $arrFile['filerealname']) . "<br />";
             }
             }
             }
             }
             */
             $newArticleArray[$arrArticle['storyid']] = $itemObj->getVar('itemid');
             echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "<br />";
             ++$cnt_imported_articles;
         }
     }
     // Saving category permissions
     $groupsIds = $gperm_handler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id);
     PublisherUtils::saveCategoryPermissions($groupsIds, $categoryObj->getVar('categoryid'), 'category_read');
     $groupsIds = $gperm_handler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id);
     PublisherUtils::saveCategoryPermissions($groupsIds, $categoryObj->getVar('categoryid'), 'item_submit');
     $newCatArray[$newCat['oldid']] = $newCat;
     unset($newCat);
     echo "<br/>";
 }
 // Looping through cat to change the parentid to the new parentid
 foreach ($newCatArray as $oldid => $newCat) {
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('categoryid', $newCat['newid']));
     $oldpid = $newCat['oldpid'];
     if ($oldpid == 0) {
         $newpid = $parentId;
     } else {
         $newpid = $newCatArray[$oldpid]['newid'];
     }
     $publisher->getCategoryHandler()->updateAll('parentid', $newpid, $criteria);
Esempio n. 2
0
     PublisherUtils::saveCategoryPermissions($grpmoderation, $categoryObj->getVar('categoryid'), 'category_moderation');
     //Added by fx2024
     $parentCat = $categoryObj->getVar('categoryid');
     $sizeof = sizeof($_POST['scname']);
     for ($i = 0; $i < $sizeof; ++$i) {
         if ($_POST['scname'][$i] != '') {
             $categoryObj = $publisher->getCategoryHandler()->create();
             $categoryObj->setVar('name', $_POST['scname'][$i]);
             $categoryObj->setVar('parentid', $parentCat);
             if (!$categoryObj->store()) {
                 $xoops->redirect("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . PublisherUtils::formatErrors($categoryObj->getErrors()));
             }
             // TODO : put this function in the category class
             PublisherUtils::saveCategoryPermissions($grpread, $categoryObj->getVar('categoryid'), 'category_read');
             PublisherUtils::saveCategoryPermissions($grpsubmit, $categoryObj->getVar('categoryid'), 'item_submit');
             PublisherUtils::saveCategoryPermissions($grpmoderation, $categoryObj->getVar('categoryid'), 'category_moderation');
         }
     }
     //end of fx2024 code
     $xoops->redirect($redirect_to, 2, $redirect_msg);
     break;
     //Added by fx2024
 //Added by fx2024
 case "addsubcats":
     $categoryid = 0;
     $nb_subcats = (int) $_POST['nb_subcats'] + $_POST['nb_sub_yet'];
     $categoryObj = $publisher->getCategoryHandler()->create();
     $categoryObj->setVar('name', $_POST['name']);
     $categoryObj->setVar('description', $_POST['description']);
     $categoryObj->setVar('weight', $_POST['weight']);
     if (isset($parentCat)) {