本文整理汇总了PHP中ExerciseLib::get_average_score_by_course方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::get_average_score_by_course方法的具体用法?PHP ExerciseLib::get_average_score_by_course怎么用?PHP ExerciseLib::get_average_score_by_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExerciseLib
的用法示例。
在下文中一共展示了ExerciseLib::get_average_score_by_course方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_user_progress
//.........这里部分代码省略.........
$course_list = $session_data['course_list'];
$session_name = $session_data['name'];
if ($showAllSessions == false) {
if (isset($session_id) && !empty($session_id)) {
if ($session_id != $my_session_id) {
continue;
}
}
}
$all_exercises = 0;
$all_unanswered_exercises_by_user = 0;
$all_average = 0;
$stats_array = array();
foreach ($course_list as $course_data) {
//All exercises in the course @todo change for a real count
$exercises = ExerciseLib::get_all_exercises($course_data, $my_session_id);
$count_exercises = 0;
if (is_array($exercises) && !empty($exercises)) {
$count_exercises = count($exercises);
}
// Count of user results
$done_exercises = null;
$courseInfo = api_get_course_info($course_data['code']);
$answered_exercises = 0;
if (!empty($exercises)) {
foreach ($exercises as $exercise_item) {
$attempts = Event::count_exercise_attempts_by_user(api_get_user_id(), $exercise_item['id'], $courseInfo['real_id'], $my_session_id);
if ($attempts > 1) {
$answered_exercises++;
}
}
}
// Average
$average = ExerciseLib::get_average_score_by_course($courseInfo['real_id'], $my_session_id);
$all_exercises += $count_exercises;
$all_unanswered_exercises_by_user += $count_exercises - $answered_exercises;
$all_average += $average;
}
$all_average = $all_average / count($course_list);
if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
$html .= '<tr style="background-color:#FBF09D">';
} else {
$html .= '<tr>';
}
$url = api_get_path(WEB_CODE_PATH) . "session/index.php?session_id={$my_session_id}";
$html .= Display::tag('td', Display::url($session_name, $url, array('target' => SESSION_LINK_TARGET)));
$html .= Display::tag('td', $all_exercises);
$html .= Display::tag('td', $all_unanswered_exercises_by_user);
//$html .= Display::tag('td', $all_done_exercise);
$html .= Display::tag('td', ExerciseLib::convert_to_percentage($all_average));
if (isset($_GET['session_id']) && $my_session_id == $_GET['session_id']) {
$icon = Display::url(Display::return_icon('2rightarrow_na.png', get_lang('Details')), '?session_id=' . $my_session_id);
} else {
$icon = Display::url(Display::return_icon('2rightarrow.png', get_lang('Details')), '?session_id=' . $my_session_id);
}
$html .= Display::tag('td', $icon);
$html .= '</tr>';
}
$html .= '</table><br />';
$html .= Display::div($main_session_graph, array('id' => 'session_graph', 'class' => 'chart-session', 'style' => 'position:relative; text-align: center;'));
// Checking selected session.
if (isset($_GET['session_id'])) {
$session_id_from_get = intval($_GET['session_id']);
$session_data = $course_in_session[$session_id_from_get];
$course_list = $session_data['course_list'];
$html .= Display::tag('h3', $session_data['name'] . ' - ' . get_lang('CourseList'));