/** * Calculates the number of questions in a test * * @return int The number of questions in the test * @access public */ function _getQuestionCount($test_id) { global $ilDB; $num = 0; $test =& ilObjTestAccess::_getTestData($test_id); if ($test["random_test"] == 1) { if ($test["random_question_count"] > 0) { $num = $test["random_question_count"]; } else { $result = $ilDB->queryF("SELECT SUM(num_of_q) questioncount FROM tst_test_random WHERE test_fi = %s ORDER BY test_random_id", array('integer'), array($test_id)); if ($result->numRows()) { $row = $ilDB->fetchAssoc($result); $num = $row["questioncount"]; } } } else { $result = $ilDB->queryF("SELECT test_question_id FROM tst_test_question WHERE test_fi = %s", array('integer'), array($test_id)); $num = $result->numRows(); } return $num; }