get_category_id() < 0) { // if category id is negative, then the evaluation's origin is a link $link = LinkFactory::get_evaluation_link($eval->get_id()); $currentcat = Category::load($link->get_category_id()); } else { $currentcat = Category::load($eval->get_category_id()); } $interbreadcrumb[] = [ 'url' => Category::getUrl().'selectcat='.$currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'), ]; if (api_is_allowed_to_edit()) { $interbreadcrumb[] = [ 'url' => 'gradebook_view_result.php?selecteval='.$categoryId.'&'.api_get_cidreq(), 'name' => get_lang('ViewResult'), ]; } $displayScore = ScoreDisplay::instance(); Display::display_header(get_lang('EvaluationStatistics')); DisplayGradebook::display_header_result( $eval, $currentcat[0]->get_id(), 0, 'statistics' ); // Bad, Regular, Good - User definitions $displays = $displayScore->get_custom_score_display_settings(); if (!$displayScore->is_custom() || empty($displays)) { if (api_is_platform_admin() || api_is_course_admin()) { echo Display::return_message(get_lang('PleaseEnableScoringSystem'), 'error', false); } } else { $allresults = Result::load(null, null, $eval->get_id()); $nr_items = []; foreach ($displays as $itemsdisplay) { $nr_items[$itemsdisplay['display']] = 0; } $resultcount = 0; foreach ($allresults as $result) { $score = $result->get_score(); if (isset($score)) { $display = $displayScore->display_score( [$score, $eval->get_max()], SCORE_CUSTOM, SCORE_ONLY_CUSTOM, true ); $nr_items[$display]++; $resultcount++; } } $keys = array_keys($nr_items); // find the region with the most scores, this is 100% of the bar $highest_ratio = 0; foreach ($keys as $key) { if ($nr_items[$key] > $highest_ratio) { $highest_ratio = $nr_items[$key]; } } // Generate table $html = ''; $html .= ''; $html .= ''; $html .= ''; $counter = 0; $model = ExerciseLib::getCourseScoreModel(); foreach ($keys as $key) { $bar = ($highest_ratio > 0 ? ($nr_items[$key] / $highest_ratio) * 100 : 0); $html .= ''; $html .= ''; if (empty($model)) { $html .= ''; } else { $html .= ''; } $html .= ''; $html .= ''; $counter++; } $html .= '
'.get_lang('ScoringSystem').''.get_lang('Percentage').''.get_lang('CountUsers').'
'.$key.''.Display::bar_progress($bar).''.ExerciseLib::convertScoreToModel($bar).''.$nr_items[$key].'
'; echo $html; } Display :: display_footer();