MDL-53720 tool_lp: Cannot grade competency in breakdown report

This commit is contained in:
Issam Taboubi
2016-04-18 11:06:01 +08:00
committed by Frederic Massart
parent b14311b2cd
commit e0c2d7c02e
4 changed files with 14 additions and 22 deletions
@@ -30,6 +30,7 @@ use core_competency\external\comment_area_exporter;
use core_competency\external\evidence_exporter;
use core_competency\external\user_competency_exporter;
use core_competency\external\user_competency_plan_exporter;
use core_competency\external\user_competency_course_exporter;
use core_competency\external\user_summary_exporter;
use core_competency\user_competency;
@@ -48,6 +49,7 @@ class user_competency_summary_exporter extends \core_competency\external\exporte
'user' => '\\stdClass',
'usercompetency' => '\\core_competency\\user_competency?',
'usercompetencyplan' => '\\core_competency\\user_competency_plan?',
'usercompetencycourse' => '\\core_competency\\user_competency_course?',
'evidence' => '\\core_competency\\evidence[]');
}
@@ -73,6 +75,10 @@ class user_competency_summary_exporter extends \core_competency\external\exporte
'type' => user_competency_exporter::read_properties_definition(),
'optional' => true
),
'usercompetencycourse' => array(
'type' => user_competency_course_exporter::read_properties_definition(),
'optional' => true
),
'evidence' => array(
'type' => evidence_exporter::read_properties_definition(),
'multiple' => true
@@ -114,6 +120,10 @@ class user_competency_summary_exporter extends \core_competency\external\exporte
$exporter = new user_competency_plan_exporter($this->related['usercompetencyplan'], $related);
$result->usercompetencyplan = $exporter->export($output);
}
if ($this->related['usercompetencycourse']) {
$exporter = new user_competency_course_exporter($this->related['usercompetencycourse'], $related);
$result->usercompetencycourse = $exporter->export($output);
}
$allevidence = array();
$usercache = array();
@@ -52,18 +52,6 @@ class user_competency_summary_in_course_exporter extends \core_competency\extern
'usercompetencysummary' => array(
'type' => user_competency_summary_exporter::read_properties_definition()
),
'proficiency' => array(
'type' => PARAM_BOOL,
),
'proficiencyname' => array(
'type' => PARAM_TEXT
),
'grade' => array(
'type' => PARAM_INT
),
'gradename' => array(
'type' => PARAM_TEXT
),
'course' => array(
'type' => course_summary_exporter::read_properties_definition(),
),
@@ -85,16 +73,6 @@ class user_competency_summary_in_course_exporter extends \core_competency\extern
$exporter = new user_competency_summary_exporter(null, $related);
$result->usercompetencysummary = $exporter->export($output);
$result->gradename = '-';
if ($this->related['usercompetencycourse']) {
$result->proficiency = $this->related['usercompetencycourse']->get_proficiency();
$result->proficiencyname = $result->proficiency ? get_string('yes') : get_string('no');
$result->grade = $this->related['usercompetencycourse']->get_grade();
if ($result->grade) {
$result->gradename = $this->related['scale']->scale_items[$result->grade - 1];
}
}
$context = context_course::instance($this->related['course']->id);
$exporter = new course_summary_exporter($this->related['course'], array('context' => $context));
$result->course = $exporter->export($output);
@@ -63,6 +63,8 @@ class user_competency_summary_in_plan_exporter extends \core_competency\external
$related = $this->related;
// Remove plan from related as it is not wanted by the user_competency_summary_exporter.
unset($related['plan']);
// We do not need user_competency_course in user_competency_summary_exporter.
$related['usercompetencycourse'] = null;
$exporter = new user_competency_summary_exporter(null, $related);
$result = new stdClass();
$result->usercompetencysummary = $exporter->export($output);
@@ -65,6 +65,7 @@
</dd>
{{/user}}
{{/displayuser}}
{{#usercompetencycourse}}
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
<dd>
<span class="label{{^proficiency}} label-important{{/proficiency}} pull-left">
@@ -77,6 +78,7 @@
<buttn class="btn" id="rate_{{uniqid}}">{{#str}}rate, tool_lp{{/str}}</button>
{{/cangrade}}
</dd>
{{/usercompetencycourse}}
{{#js}}
require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info'], function($, mod, info) {