当前位置: 首页>>代码示例>>PHP>>正文


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怎么用?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'));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:stats.php

示例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'));
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:stats.php


注:本文中的ExerciseLib::get_number_students_question_with_answer_count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。