示例#1
0
$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
0
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'));