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


PHP ExerciseLib::get_average_score_by_course_by_user方法代码示例

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


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

示例1: show_user_progress


//.........这里部分代码省略.........
             $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'));
             $html .= '<table class="data_table" width="100%">';
             //'.Display::tag('th', get_lang('DoneExercises'),         array('class'=>'head')).'
             $html .= '
                 <tr>
                   <th width="300px">' . get_lang('Course') . '</th>
                   ' . Display::tag('th', get_lang('PublishedExercises'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('NewExercises'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('MyAverage'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('AverageExerciseResult'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('TimeSpentInTheCourse'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('LPProgress'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('Score') . Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('LastConnexion'), array('class' => 'head')) . '
                   ' . Display::tag('th', get_lang('Details'), array('class' => 'head')) . '
                 </tr>';
             foreach ($course_list as $course_data) {
                 $course_code = $course_data['code'];
                 $course_title = $course_data['title'];
                 $courseInfo = api_get_course_info($course_code);
                 $courseId = $courseInfo['real_id'];
                 // All exercises in the course @todo change for a real count
                 $exercises = ExerciseLib::get_all_exercises($course_data, $session_id_from_get);
                 $count_exercises = 0;
                 if (!empty($exercises)) {
                     $count_exercises = count($exercises);
                 }
                 $answered_exercises = 0;
                 foreach ($exercises as $exercise_item) {
                     $attempts = Event::count_exercise_attempts_by_user(api_get_user_id(), $exercise_item['id'], $courseId, $session_id_from_get);
                     if ($attempts > 1) {
                         $answered_exercises++;
                     }
                 }
                 $unanswered_exercises = $count_exercises - $answered_exercises;
                 // Average
                 $average = ExerciseLib::get_average_score_by_course($courseId, $session_id_from_get);
                 $my_average = ExerciseLib::get_average_score_by_course_by_user(api_get_user_id(), $courseId, $session_id_from_get);
                 $stats_array[$course_code] = array('exercises' => $count_exercises, 'unanswered_exercises_by_user' => $unanswered_exercises, 'done_exercises' => $done_exercises, 'average' => $average, 'my_average' => $my_average);
                 $weighting = 0;
                 $last_connection = Tracking::get_last_connection_date_on_the_course($user_id, $courseInfo, $session_id_from_get);
                 $progress = Tracking::get_avg_student_progress($user_id, $course_code, array(), $session_id_from_get);
                 $total_time_login = Tracking::get_time_spent_on_the_course($user_id, $courseId, $session_id_from_get);
                 $time = api_time_to_hms($total_time_login);
                 $percentage_score = Tracking::get_avg_student_score($user_id, $course_code, array(), $session_id_from_get);
                 $courseCodeFromGet = isset($_GET['course']) ? $_GET['course'] : null;
                 if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) {
                     $html .= '<tr class="row_odd" style="background-color:#FBF09D" >';
                 } else {
                     $html .= '<tr class="row_even">';
                 }
                 $url = api_get_course_url($course_code, $session_id_from_get);
                 $course_url = Display::url($course_title, $url, array('target' => SESSION_LINK_TARGET));
                 $html .= Display::tag('td', $course_url);
                 $html .= Display::tag('td', $stats_array[$course_code]['exercises']);
                 $html .= Display::tag('td', $stats_array[$course_code]['unanswered_exercises_by_user']);
                 //$html .= Display::tag('td', $stats_array[$course_code]['done_exercises']);
                 $html .= Display::tag('td', ExerciseLib::convert_to_percentage($stats_array[$course_code]['my_average']));
                 $html .= Display::tag('td', $stats_array[$course_code]['average'] == 0 ? '-' : '(' . ExerciseLib::convert_to_percentage($stats_array[$course_code]['average']) . ')');
                 $html .= Display::tag('td', $time, array('align' => 'center'));
                 if (is_numeric($progress)) {
                     $progress = $progress . '%';
                 } else {
                     $progress = '0%';
                 }
                 //Progress
                 $html .= Display::tag('td', $progress, array('align' => 'center'));
                 if (is_numeric($percentage_score)) {
                     $percentage_score = $percentage_score . '%';
                 } else {
                     $percentage_score = '0%';
                 }
                 //Score
                 $html .= Display::tag('td', $percentage_score, array('align' => 'center'));
                 $html .= Display::tag('td', $last_connection, array('align' => 'center'));
                 if ($course_code == $courseCodeFromGet && $_GET['session_id'] == $session_id_from_get) {
                     $details = '<a href="#">';
                     $details .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
                 } else {
                     $details = '<a href="' . api_get_self() . '?course=' . $course_code . '&session_id=' . $session_id_from_get . $extra_params . '">';
                     $details .= Display::return_icon('2rightarrow.png', get_lang('Details'));
                 }
                 $details .= '</a>';
                 $html .= Display::tag('td', $details, array('align' => 'center'));
                 $html .= '</tr>';
             }
             $html .= '</table>';
         }
     }
     return $html;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:tracking.lib.php


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