Example #1
0
 /**
  *
  * This method gets the number of postings in an category
  */
 public static function getPostingsOfCategory($catid)
 {
     // get repositoy for Categories
     $repository = MUBoard_Util_Model::getCategoryRepository();
     // get category by id
     $category = $repository->selectById($catid);
     // get forums of this category
     $forums = $category->getForum();
     // get repository for Forums
     $repository2 = MUBoard_Util_Model::getForumRepository();
     $count = 0;
     // walk through the forums and take their postings
     foreach ($forums as $forum) {
         // get forum by id
         $forum = $repository2->selectById($forum['id']);
         // get postings of this forum
         $postings = $forum->getPosting();
         $number = count($postings);
         $count = $count + $number;
     }
     return $count;
 }