get_custom_score_display_settings();
$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
$this->setDefaults(
[
'scorecolpercent' => $displayscore->get_color_split_value(),
]
);
$this->addElement('hidden', 'maxvalue', '100');
$this->addElement('hidden', 'minvalue', '0');
$counter = 1;
// Setting the default values
if (is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) {
$this->setDefaults(
[
'endscore['.$counter.']' => $customdisplay['score'],
'displaytext['.$counter.']' => $customdisplay['display'],
]
);
$counter++;
}
}
// Settings for the colored score
$this->addElement('header', get_lang('Skills ranking'));
if ($displayscore->is_coloring_enabled()) {
$this->addElement('html', ''.get_lang('Competence thresholds colouring').'');
$this->addElement(
'text',
'scorecolpercent',
[get_lang('Below'), get_lang('The mark will be coloured in red'), '%'],
[
'size' => 5,
'maxlength' => 5,
'input-size' => 2,
]
);
if (api_get_setting('teachers_can_change_score_settings') != 'true') {
$this->freeze('scorecolpercent');
}
$this->addRule('scorecolpercent', get_lang('Only numbers'), 'numeric');
$this->addRule(['scorecolpercent', 'maxvalue'], get_lang('Over 100'), 'compare', '<=');
$this->addRule(['scorecolpercent', 'minvalue'], get_lang('Under the minimum.'), 'compare', '>');
}
// Settings for the scoring system
if ($displayscore->is_custom()) {
$this->addElement('html', '
'.get_lang('Skills ranking').'');
$this->addElement('static', null, null, get_lang('Score info'));
$this->setDefaults([
'beginscore' => '0',
]);
$this->addElement('text', 'beginscore', [get_lang('Between'), null, '%'], [
'size' => 5,
'maxlength' => 5,
'disabled' => 'disabled',
'input-size' => 2,
]);
for ($counter = 1; $counter <= 20; $counter++) {
$renderer = &$this->defaultRenderer();
$elementTemplateTwoLabel =
'