diff --git a/admin/tool/lp/classes/competency.php b/admin/tool/lp/classes/competency.php index f1c5df7a932..200822be9b2 100644 --- a/admin/tool/lp/classes/competency.php +++ b/admin/tool/lp/classes/competency.php @@ -255,6 +255,33 @@ class competency extends persistent { return new $rule($this); } + /** + * Return the scale. + * + * @return \grade_scale + */ + public function get_scale() { + $scaleid = $this->get_scaleid(); + if ($scaleid === null) { + return $this->get_framework()->get_scale(); + } + $scale = \grade_scale::fetch(array('id' => $scaleid)); + $scale->load_items(); + return $scale; + } + + /** + * Return the scale ID. + * + * Here we pretend that the scale ID can be read from the competency, however it + * only serves as a placeholder in case we want to support competency scales later on. + * + * @return int|null + */ + public function get_scaleid() { + return null; + } + /** * Check if the competency is the parent of passed competencies. * diff --git a/admin/tool/lp/classes/output/plan_page.php b/admin/tool/lp/classes/output/plan_page.php index 3cf786829d2..86be6041107 100644 --- a/admin/tool/lp/classes/output/plan_page.php +++ b/admin/tool/lp/classes/output/plan_page.php @@ -83,10 +83,17 @@ class plan_page implements renderable, templatable { $comp = $pc->competency; $usercomp = $pc->$ucproperty; + // Get the framework. if (!isset($frameworks[$comp->get_competencyframeworkid()])) { $frameworks[$comp->get_competencyframeworkid()] = $comp->get_framework(); } $framework = $frameworks[$comp->get_competencyframeworkid()]; + + // Get the scale. + $scaleid = $comp->get_scaleid(); + if ($scaleid === null) { + $scaleid = $framework->get_scaleid(); + } if (!isset($scales[$framework->get_scaleid()])) { $scales[$framework->get_scaleid()] = $framework->get_scale(); }