本文整理汇总了PHP中GradebookUtils::score_badges方法的典型用法代码示例。如果您正苦于以下问题:PHP GradebookUtils::score_badges方法的具体用法?PHP GradebookUtils::score_badges怎么用?PHP GradebookUtils::score_badges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GradebookUtils
的用法示例。
在下文中一共展示了GradebookUtils::score_badges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_table_data
//.........这里部分代码省略.........
//$score = $item->calc_score(api_get_user_id());
//$new_score = $data[3] * $score[0] / $score[1];
//$new_score = floatval(number_format($new_score, api_get_setting('gradebook_number_decimals')));
// Result
$row[] = $value_data;
$best = isset($data['best']) ? $data['best'] : null;
$average = isset($data['average']) ? $data['average'] : null;
$ranking = isset($data['ranking']) ? $data['ranking'] : null;
// Ranking
$row[] = $ranking;
// Best
$row[] = $best;
// Average
$row[] = $average;
}
}
if (!empty($cats)) {
if ($this->exportToPdf == false) {
$row[] = null;
}
}
}
if ($this->exportToPdf == false) {
$row['child_of'] = $parent_id;
}
$sortable_data[] = $row;
}
// "Warning row"
if (!empty($data_array)) {
if ($this->teacherView) {
// Compare the category weight to the sum of all weights inside the category
if (intval($total_weight) == $category_weight) {
$label = null;
$total = GradebookUtils::score_badges(array($total_weight . ' / ' . $category_weight, '100'));
} else {
$label = Display::return_icon('warning.png', sprintf(get_lang('TotalWeightMustBeX'), $category_weight));
$total = Display::badge($total_weight . ' / ' . $category_weight, 'warning');
}
$row = array(null, null, " <h5>" . get_lang('SubTotal') . '</h5>', null, $total . ' ' . $label, 'child_of' => $parent_id);
$sortable_data[] = $row;
}
}
}
}
}
}
//end looping categories
$main_weight = 0;
if (count($main_cat) > 1) {
/** @var Category $myCat */
foreach ($main_cat as $myCat) {
$myParentId = $myCat->get_parent_id();
if ($myParentId == 0) {
$main_weight = intval($myCat->get_weight());
}
}
}
if ($this->teacherView) {
// Total for teacher.
if (count($main_cat) > 1) {
if (intval($total_categories_weight) == $main_weight) {
$total = GradebookUtils::score_badges(array($total_categories_weight . ' / ' . $main_weight, '100'));
} else {
$total = Display::badge($total_categories_weight . ' / ' . $main_weight, 'warning');
}
$row = array(null, null, '<strong>' . get_lang('Total') . '</strong>', null, $total);