Levels now start at level 0 instead of level 1.

This commit is contained in:
PM 2019-08-25 20:46:59 +02:00
parent e46f7e2d30
commit 1623e0c9c6
3 changed files with 6 additions and 6 deletions

View File

@ -44,5 +44,5 @@ print block_gradelevel_skillmgmtservice::render_leveltable($skill_id);
// add back button to return to skill management page // add back button to return to skill management page
$cfg_skills_url = $CFG->wwwroot."/blocks/gradelevel/cfg_skills.php"; $cfg_skills_url = $CFG->wwwroot."/blocks/gradelevel/cfg_skills.php";
print "<button onclick='window.location=\"{$cfg_skills_url}\";'>".get_string('back','core')."</button>"; print "<button class='btn' onclick='window.location=\"{$cfg_skills_url}\";'>".get_string('back','core')."</button>";
print $OUTPUT->footer(); print $OUTPUT->footer();

View File

@ -6,7 +6,7 @@ require_once($CFG->dirroot.'/grade/querylib.php');
class block_gradelevel_levelset { class block_gradelevel_levelset {
const UNDEFINED_BADGE_COLOR="#3F3F3F"; const UNDEFINED_BADGE_COLOR="#3F3F3F";
const NULL_BADGE_COLOR = "#320000"; const NULL_BADGE_COLOR = "000000";
const DEFAULT_ICON = "/blocks/gradelevel/pix/undefinedskill.svg"; const DEFAULT_ICON = "/blocks/gradelevel/pix/undefinedskill.svg";
const GLOBAL_DEFAULTS = array( const GLOBAL_DEFAULTS = array(
@ -346,7 +346,7 @@ class block_gradelevel_levelset {
$levels = $this->badgelevels(); $levels = $this->badgelevels();
$level = 0; $level = -1;
$badge_color = static::NULL_BADGE_COLOR; $badge_color = static::NULL_BADGE_COLOR;
$current_at = 0; $current_at = 0;
$next_at = 0; $next_at = 0;
@ -489,7 +489,7 @@ class block_gradelevel_levelset {
} }
else else
{ {
$points = array_keys($levels)[$level - 1]; $points = array_keys($levels)[$level];
} }
return $this->render_badge($points, $size); return $this->render_badge($points, $size);

View File

@ -400,10 +400,10 @@ class block_gradelevel_skillmgmtservice extends external_api
$s .= "</tbody>"; $s .= "</tbody>";
$s .= "<tfoot><tr><td class='block_gradelevel_addlevel' colspan='2'><a data-action='addlevel' href='#' onclick='return false;'>".get_string("levelcfg_addlevel",'block_gradelevel')."</a></td></td></tfoot>"; $s .= "<tfoot><tr><td class='block_gradelevel_addlevel' colspan='2'><a data-action='addlevel' href='#' onclick='return false;'>".get_string("levelcfg_addlevel",'block_gradelevel')."</a></td></td></tfoot>";
$s .= "</table>"; $s .= "</table>";
$s .= "<p><button data-action='savechanges'>".get_string('savechanges','core')."</button>"; $s .= "<br><p><button class='btn btn-primary' data-action='savechanges'>".get_string('savechanges','core')."</button>";
if($skill_id > 0) if($skill_id > 0)
{ {
$s .= " <button data-action='resetlevels'>".get_string('cfg_resetlevels','block_gradelevel')."</button>"; $s .= " <button class='btn' data-action='resetlevels'>".get_string('cfg_resetlevels','block_gradelevel')."</button>";
} }
$s .= "</p>"; $s .= "</p>";