Example #1
0
 /**
  * return the number max of question in a category
  * count the number of questions in all categories, and return the max
  * @param int $exerciseId
  * @author - hubert borderiou
  */
 public static function getNumberMaxQuestionByCat($exerciseId)
 {
     $res_num_max = 0;
     // foreach question
     $tabcatid = TestCategory::getListOfCategoriesIDForTest($exerciseId);
     for ($i = 0; $i < count($tabcatid); $i++) {
         if ($tabcatid[$i] > 0) {
             // 0 = no category for this question
             $nbQuestionInThisCat = TestCategory::getNumberOfQuestionsInCategoryForTest($exerciseId, $tabcatid[$i]);
             if ($nbQuestionInThisCat > $res_num_max) {
                 $res_num_max = $nbQuestionInThisCat;
             }
         }
     }
     return $res_num_max;
 }