public static function AllowedDiscussionTypes($Category)
 {
     $Category = self::PermissionCategory($Category);
     $Allowed = GetValue('AllowedDiscussionTypes', $Category);
     $AllTypes = DiscussionModel::DiscussionTypes();
     if (empty($Allowed) || !is_array($Allowed)) {
         return $AllTypes;
     } else {
         return array_intersect_key($AllTypes, array_flip($Allowed));
     }
 }
 protected function SetupDiscussionTypes($Category)
 {
     $DiscussionTypes = DiscussionModel::DiscussionTypes();
     $this->SetData('DiscussionTypes', $DiscussionTypes);
     if (!$this->Form->IsPostBack()) {
         $PCatID = GetValue('PermissionCategoryID', $Category, -1);
         if ($PCatID == GetValue('CategoryID', $Category)) {
             $PCat = $Category;
         } else {
             $PCat = CategoryModel::Categories($PCatID);
         }
         $AllowedTypes = GetValue('AllowedDiscussionTypes', $PCat);
         if (empty($AllowedTypes)) {
             $AllowedTypes = array_keys($DiscussionTypes);
         }
         $this->Form->SetValue("AllowedDiscussionTypes", $AllowedTypes);
     }
 }