diff --git a/admin/tool/lp/classes/api.php b/admin/tool/lp/classes/api.php index ea2855d779e..d2c44c19a1a 100644 --- a/admin/tool/lp/classes/api.php +++ b/admin/tool/lp/classes/api.php @@ -30,6 +30,7 @@ use context_system; use context_course; use context_user; use coding_exception; +use moodle_url; use required_capability_exception; /** @@ -632,8 +633,7 @@ class api { unset($courses[$id]); continue; } - $course->fullnameformatted = format_text($course->fullname, array('context' => $context)); - $course->shortnameformatted = format_text($course->shortname, array('context' => $context)); + $course->viewurl = new moodle_url('/course/view.php', array('id' => $course->id)); array_push($result, $course); } diff --git a/admin/tool/lp/classes/output/template_competencies_page.php b/admin/tool/lp/classes/output/template_competencies_page.php index 6560f58374a..aa96d81e3cd 100644 --- a/admin/tool/lp/classes/output/template_competencies_page.php +++ b/admin/tool/lp/classes/output/template_competencies_page.php @@ -30,6 +30,7 @@ use stdClass; use moodle_url; use context; use context_system; +use context_course; use tool_lp\api; use tool_lp\external\competency_exporter; @@ -94,6 +95,14 @@ class template_competencies_page implements renderable, templatable { $exporter = new competency_exporter($competency, array('context' => $context)); $record = $exporter->export($output); + $courses = api::list_courses_using_competency($competency->get_id()); + foreach ($courses as $course) { + $coursecontext = context_course::instance($course->id); + $course->fullname = external_format_string($course->fullname, $coursecontext->id); + $course->shortname = external_format_string($course->shortname, $coursecontext->id); + } + $record->linkedcourses = $courses; + $record->hascourses = count($courses) > 0; array_push($data->competencies, $record); } $data->canmanagecompetencyframeworks = $this->canmanagecompetencyframeworks; diff --git a/admin/tool/lp/lang/en/tool_lp.php b/admin/tool/lp/lang/en/tool_lp.php index 8b32a0e26ad..7de37e34465 100644 --- a/admin/tool/lp/lang/en/tool_lp.php +++ b/admin/tool/lp/lang/en/tool_lp.php @@ -54,7 +54,8 @@ $string['completeplanconfirm'] = 'Set the plan \'{$a}\' to completed? The curren $string['completeplanstask'] = 'Complete plans which are due'; $string['configurescale'] = 'Configure scales'; $string['coursecompetencies'] = 'Course competencies'; -$string['coursesusingthiscompetency'] = 'Courses using this competency'; +$string['coursesusingthiscompetency'] = 'Courses linked to this competency'; +$string['coveragesummary'] = '{$a->competenciescoveredcount} of {$a->competenciescount} competencies are covered ( {$a->coveragepercentage} % )'; $string['default'] = 'Default'; $string['deletecompetency'] = 'Delete competency \'{$a}\'?'; $string['deletecompetencyframework'] = 'Delete competency framework \'{$a}\'?'; @@ -89,7 +90,7 @@ $string['aisrequired'] = '\'{$a}\' is required'; $string['learningplans'] = 'Learning plans'; $string['levela'] = 'Level {$a}'; $string['linkcoursecompetencies'] = 'Link course competencies'; -$string['linkedcourses'] = 'Linked courses'; +$string['linkedcourses'] = 'Linked courses:'; $string['linktemplatecompetencies'] = 'Link template competencies'; $string['listcompetencyframeworkscaption'] = 'List of competency frameworks'; $string['listplanscaption'] = 'List of learning plans'; @@ -122,7 +123,7 @@ $string['nocompetenciesincourse'] = 'No competencies have been linked to this co $string['nocompetenciesintemplate'] = 'No competencies have been linked to this template.'; $string['nocompetencyframeworks'] = 'No competency frameworks have been created yet.'; $string['nocompetencyselected'] = 'No competency selected'; -$string['nolinkedcourses'] = 'No courses are using this competency'; +$string['nolinkedcourses'] = 'No courses are linked to this competency'; $string['norelatedcompetencies'] = 'No other competencies have been related to this competency.'; $string['notemplates'] = 'No learning plan templates have been created yet.'; $string['nouserplans'] = 'No learning plans have been created yet.'; diff --git a/admin/tool/lp/templates/template_competencies_page.mustache b/admin/tool/lp/templates/template_competencies_page.mustache index 13ca52cd904..3d49149333d 100644 --- a/admin/tool/lp/templates/template_competencies_page.mustache +++ b/admin/tool/lp/templates/template_competencies_page.mustache @@ -19,21 +19,34 @@ }}
- - +
+
{{#competencies}} -
- - + {{#str}}linkedcourses, tool_lp{{/str}} + {{#hascourses}} + + {{/hascourses}} + {{^hascourses}} + {{#str}}nolinkedcourses, tool_lp{{/str}} + {{/hascourses}} + + {{/competencies}} - -
+
+
+ {{#canmanagetemplatecompetencies}} + {{/canmanagetemplatecompetencies}} {{> tool_lp/competency_summary }} -
+
+
{{^competencies}}

{{#str}}nocompetenciesintemplate, tool_lp{{/str}}