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


PHP ExerciseLib::get_best_average_score_by_exercise方法代码示例

本文整理汇总了PHP中ExerciseLib::get_best_average_score_by_exercise方法的典型用法代码示例。如果您正苦于以下问题:PHP ExerciseLib::get_best_average_score_by_exercise方法的具体用法?PHP ExerciseLib::get_best_average_score_by_exercise怎么用?PHP ExerciseLib::get_best_average_score_by_exercise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExerciseLib的用法示例。


在下文中一共展示了ExerciseLib::get_best_average_score_by_exercise方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_user_progress


//.........这里部分代码省略.........
                     $html .= '<a href="' . api_get_self() . '?course=' . $course_code . $extra_params . '">';
                     $html .= Display::return_icon('2rightarrow.png', get_lang('Details'));
                 }
                 $html .= '</a>';
                 $html .= '</td></tr>';
             }
             $html .= '</table>';
         }
     }
     // Session list
     if (!empty($course_in_session)) {
         $main_session_graph = '';
         //Load graphics only when calling to an specific session
         $session_graph = array();
         $all_exercise_graph_name_list = array();
         $my_results = array();
         $all_exercise_graph_list = array();
         $all_exercise_start_time = array();
         foreach ($course_in_session as $my_session_id => $session_data) {
             $course_list = $session_data['course_list'];
             $session_name = $session_data['name'];
             $user_count = count(SessionManager::get_users_by_session($my_session_id));
             $exercise_graph_name_list = array();
             //$user_results = array();
             $exercise_graph_list = array();
             foreach ($course_list as $course_data) {
                 $exercise_list = ExerciseLib::get_all_exercises($course_data, $my_session_id, false, null, false, 1);
                 foreach ($exercise_list as $exercise_data) {
                     $exercise_obj = new Exercise($course_data['id']);
                     $exercise_obj->read($exercise_data['id']);
                     //Exercise is not necessary to be visible to show results check the result_disable configuration instead
                     //$visible_return = $exercise_obj->is_visible();
                     if ($exercise_data['results_disabled'] == 0 || $exercise_data['results_disabled'] == 2) {
                         $best_average = intval(ExerciseLib::get_best_average_score_by_exercise($exercise_data['id'], $course_data['id'], $my_session_id, $user_count));
                         $exercise_graph_list[] = $best_average;
                         $all_exercise_graph_list[] = $best_average;
                         $user_result_data = ExerciseLib::get_best_attempt_by_user(api_get_user_id(), $exercise_data['id'], $course_data['real_id'], $my_session_id);
                         $score = 0;
                         if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
                             $score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100);
                         }
                         $time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
                         $all_exercise_start_time[] = $time;
                         $my_results[] = $score;
                         if (count($exercise_list) <= 10) {
                             $title = cut($course_data['title'], 30) . " \n " . cut($exercise_data['title'], 30);
                             $exercise_graph_name_list[] = $title;
                             $all_exercise_graph_name_list[] = $title;
                         } else {
                             // if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
                             $title = cut($exercise_data['title'], 30);
                             $exercise_graph_name_list[] = $title;
                             $all_exercise_graph_name_list[] = $title;
                         }
                     }
                 }
             }
         }
         // Complete graph
         if (!empty($my_results) && !empty($all_exercise_graph_list)) {
             asort($all_exercise_start_time);
             //Fix exams order
             $final_all_exercise_graph_name_list = array();
             $my_results_final = array();
             $final_all_exercise_graph_list = array();
             foreach ($all_exercise_start_time as $key => $time) {
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:67,代码来源:tracking.lib.php


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