protected function _setCategoryPermissionIDs($Category, $PermissionID, $IDs)
{
static $CategoryModel;
if (!isset($CategoryModel)) {
$CategoryModel = new CategoryModel();
}
$CategoryID = $Category['CategoryID'];
if (isset($IDs[$CategoryID])) {
$PermissionID = $CategoryID;
}
if ($Category['PermissionCategoryID'] != $PermissionID) {
$CategoryModel->setField($CategoryID, 'PermissionCategoryID', $PermissionID);
}
$ChildIDs = val('ChildIDs', $Category, array());
foreach ($ChildIDs as $ChildID) {
$ChildCategory = CategoryModel::categories($ChildID);
if ($ChildCategory) {
$this->_setCategoryPermissionIDs($ChildCategory, $PermissionID, $IDs);
}
}
}