本文整理汇总了PHP中ExerciseLib::get_number_students_question_with_answer_count方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::get_number_students_question_with_answer_count方法的具体用法?PHP ExerciseLib::get_number_students_question_with_answer_count怎么用?PHP ExerciseLib::get_number_students_question_with_answer_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExerciseLib
的用法示例。
在下文中一共展示了ExerciseLib::get_number_students_question_with_answer_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_course_id
$courseCode = api_get_course_id();
if (empty($sessionId)) {
$students = CourseManager::get_student_list_from_course_code($courseCode, false);
} else {
$students = CourseManager::get_student_list_from_course_code($courseCode, true, $sessionId);
}
$count_students = count($students);
$question_list = $objExercise->get_validated_question_list();
$data = array();
// Question title # of students who tool it Lowest score Average Highest score Maximum score
$headers = array(get_lang('Question'), get_lang('QuestionType'), get_lang('NumberStudentWhoSelectedIt'), get_lang('LowestScore'), get_lang('AverageScore'), get_lang('HighestScore'), get_lang('Weighting'));
if (!empty($question_list)) {
foreach ($question_list as $question_id) {
$question_obj = Question::read($question_id);
$exercise_stats = ExerciseLib::get_student_stats_by_question($question_id, $exercise_id, $courseCode, $sessionId);
$count_users = ExerciseLib::get_number_students_question_with_answer_count($question_id, $exercise_id, $courseCode, $sessionId, $question_obj->type);
$data[$question_id]['name'] = cut($question_obj->question, 100);
$data[$question_id]['type'] = $question_obj->get_question_type_name();
$percentange = 0;
if ($count_students) {
$percentange = $count_users / $count_students * 100;
}
$data[$question_id]['students_who_try_exercise'] = Display::bar_progress($percentange, false, $count_users . ' / ' . $count_students);
$data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2);
$data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
$data[$question_id]['highest_score'] = round($exercise_stats['max'], 2);
$data[$question_id]['max_score'] = round($question_obj->weighting, 2);
}
}
// Format A table
$table = new HTML_Table(array('class' => 'data_table'));
示例2: count
if (empty($session_id)) {
$students = CourseManager::get_student_list_from_course_code(api_get_course_int_id(), false);
} else {
$students = CourseManager::get_student_list_from_course_code(api_get_course_int_id(), true, $session_id);
}
$count_students = count($students);
$question_list = $objExercise->getQuestionOrderedListByName();
$data = array();
//Question title # of students who tool it Lowest score Average Highest score Maximum score
$headers = array(get_lang('Question'), get_lang('QuestionType'), get_lang('NumberStudentWhoSelectedIt'), get_lang('LowestScore'), get_lang('AverageScore'), get_lang('HighestScore'), get_lang('Weighting'));
if (!empty($question_list)) {
foreach ($question_list as $row) {
$question_id = $row['question_id'];
$question_obj = Question::read($question_id);
$exercise_stats = ExerciseLib::get_student_stats_by_question($question_id, $exercise_id, api_get_course_int_id(), api_get_session_id());
$count_users = ExerciseLib::get_number_students_question_with_answer_count($question_id, $exercise_id, api_get_course_int_id(), api_get_session_id());
$data[$question_id]['name'] = Text::cut($question_obj->question, 100);
$data[$question_id]['type'] = $question_obj->get_question_type_name();
$percentage = 0;
if ($count_students) {
$percentage = $count_users / $count_students * 100;
}
$data[$question_id]['students_who_try_exercise'] = Display::bar_progress($percentage, false, $count_users . ' / ' . $count_students);
$data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2);
$data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
$data[$question_id]['highest_score'] = round($exercise_stats['max'], 2);
$data[$question_id]['max_score'] = round($question_obj->weighting, 2);
}
}
//Format A table
$table = new HTML_Table(array('class' => 'data_table'));