mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-53452 competencies: Backup/restore new course setting.
Also add push ratings info to competency breakdown report. Also - improved lang strings and set colors of notices.
This commit is contained in:
parent
644ff55b3a
commit
c2f55d2931
@ -49,6 +49,17 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
|
|||||||
$coursecompetencies = new backup_nested_element('course_competencies');
|
$coursecompetencies = new backup_nested_element('course_competencies');
|
||||||
$pluginwrapper->add_child($coursecompetencies);
|
$pluginwrapper->add_child($coursecompetencies);
|
||||||
|
|
||||||
|
$coursecompetencysettings = new backup_nested_element('course_competency_settings',
|
||||||
|
array('id'), array('pushratingstouserplans'));
|
||||||
|
|
||||||
|
$pluginwrapper->add_child($coursecompetencysettings);
|
||||||
|
|
||||||
|
$sql = 'SELECT s.pushratingstouserplans
|
||||||
|
FROM {' . \tool_lp\course_competency_settings::TABLE . '} s
|
||||||
|
WHERE s.courseid = :courseid';
|
||||||
|
$coursecompetencysettings->set_source_sql($sql, array('courseid' => backup::VAR_COURSEID));
|
||||||
|
|
||||||
|
|
||||||
$competency = new backup_nested_element('competency', null, array('idnumber', 'ruleoutcome',
|
$competency = new backup_nested_element('competency', null, array('idnumber', 'ruleoutcome',
|
||||||
'sortorder', 'frameworkidnumber'));
|
'sortorder', 'frameworkidnumber'));
|
||||||
$coursecompetencies->add_child($competency);
|
$coursecompetencies->add_child($competency);
|
||||||
@ -94,7 +105,7 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a condition for whether we include this report in the backup or not.
|
* Returns a condition for whether we include this plugin in the backup or not.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -42,7 +42,8 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
|
|||||||
*/
|
*/
|
||||||
protected function define_course_plugin_structure() {
|
protected function define_course_plugin_structure() {
|
||||||
$paths = array(
|
$paths = array(
|
||||||
new restore_path_element('course_competency', $this->get_pathfor('/course_competencies/competency'))
|
new restore_path_element('course_competency', $this->get_pathfor('/course_competencies/competency')),
|
||||||
|
new restore_path_element('course_competency_settings', $this->get_pathfor('/course_competency_settings'))
|
||||||
);
|
);
|
||||||
return $paths;
|
return $paths;
|
||||||
}
|
}
|
||||||
@ -59,6 +60,30 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
|
|||||||
return $paths;
|
return $paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process a course competency settings.
|
||||||
|
*
|
||||||
|
* @param array $data The data.
|
||||||
|
*/
|
||||||
|
public function process_course_competency_settings($data) {
|
||||||
|
global $DB;
|
||||||
|
|
||||||
|
$data = (object) $data;
|
||||||
|
$courseid = $this->task->get_courseid();
|
||||||
|
$exists = \tool_lp\course_competency_settings::get_record(array('courseid' => $courseid));
|
||||||
|
|
||||||
|
// Now update or insert.
|
||||||
|
if ($exists) {
|
||||||
|
$settings = $exists;
|
||||||
|
$settings->set_pushratingstouserplans($data->pushratingstouserplans);
|
||||||
|
return $settings->update();
|
||||||
|
} else {
|
||||||
|
$data = (object) array('courseid' => $courseid, 'pushratingstouserplans' => $data->pushratingstouserplans);
|
||||||
|
$settings = new \tool_lp\course_competency_settings(0, $data);
|
||||||
|
return !empty($settings->create());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a course competency.
|
* Process a course competency.
|
||||||
*
|
*
|
||||||
|
@ -78,8 +78,8 @@ $string['coursecompetencyoutcome_evidence'] = 'Attach an evidence';
|
|||||||
$string['coursecompetencyoutcome_none'] = 'Do nothing';
|
$string['coursecompetencyoutcome_none'] = 'Do nothing';
|
||||||
$string['coursecompetencyoutcome_recommend'] = 'Send for review';
|
$string['coursecompetencyoutcome_recommend'] = 'Send for review';
|
||||||
$string['coursecompetencyratingsquestion'] = 'When a course competency is rated, does the rating update the competency in the users learning plans, or is it only applied to the course?';
|
$string['coursecompetencyratingsquestion'] = 'When a course competency is rated, does the rating update the competency in the users learning plans, or is it only applied to the course?';
|
||||||
$string['coursecompetencyratingsarepushedtouserplans'] = 'Competency ratings in this course are immediately updated in user learning plans.';
|
$string['coursecompetencyratingsarepushedtouserplans'] = 'Competency ratings in this course are updated immediately in individual learning plans.';
|
||||||
$string['coursecompetencyratingsarenotpushedtouserplans'] = 'Competency ratings in this course are not updated in user learning plans.';
|
$string['coursecompetencyratingsarenotpushedtouserplans'] = 'Competency ratings in this course do not affect individual learning plans.';
|
||||||
$string['coursemodulecompetencyoutcome_complete'] = 'Complete the competency';
|
$string['coursemodulecompetencyoutcome_complete'] = 'Complete the competency';
|
||||||
$string['coursemodulecompetencyoutcome_evidence'] = 'Attach an evidence';
|
$string['coursemodulecompetencyoutcome_evidence'] = 'Attach an evidence';
|
||||||
$string['coursemodulecompetencyoutcome_none'] = 'Do nothing';
|
$string['coursemodulecompetencyoutcome_none'] = 'Do nothing';
|
||||||
@ -284,8 +284,8 @@ $string['points'] = 'Points';
|
|||||||
$string['pointsgivenfor'] = 'Points given for \'{$a}\'';
|
$string['pointsgivenfor'] = 'Points given for \'{$a}\'';
|
||||||
$string['pointsrequiredaremet'] = 'Points required are met';
|
$string['pointsrequiredaremet'] = 'Points required are met';
|
||||||
$string['proficient'] = 'Proficient';
|
$string['proficient'] = 'Proficient';
|
||||||
$string['pushcourseratingstouserplans'] = 'Push course ratings to user learning plans';
|
$string['pushcourseratingstouserplans'] = 'Push course ratings to individual learning plans';
|
||||||
$string['pushcourseratingstouserplans_desc'] = 'Default value for the course setting to update user learning plans when course competencies are rated.';
|
$string['pushcourseratingstouserplans_desc'] = 'Default value for the course setting to update individual learning plans when course competencies are rated.';
|
||||||
$string['rate'] = 'Rate';
|
$string['rate'] = 'Rate';
|
||||||
$string['ratecomment'] = 'Evidence notes';
|
$string['ratecomment'] = 'Evidence notes';
|
||||||
$string['rating'] = 'Rating';
|
$string['rating'] = 'Rating';
|
||||||
|
@ -25,23 +25,24 @@
|
|||||||
{{/canmanagecoursecompetencies}}
|
{{/canmanagecoursecompetencies}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#canconfigurecoursecompetencies}}
|
|
||||||
<div data-region="configurecoursecompetencies">
|
<div data-region="configurecoursecompetencies">
|
||||||
<p class="alert">
|
|
||||||
{{#pushratingstouserplans}}
|
{{#pushratingstouserplans}}
|
||||||
|
<p class="alert">
|
||||||
{{#str}}coursecompetencyratingsarepushedtouserplans, tool_lp{{/str}}
|
{{#str}}coursecompetencyratingsarepushedtouserplans, tool_lp{{/str}}
|
||||||
{{/pushratingstouserplans}}
|
{{/pushratingstouserplans}}
|
||||||
{{^pushratingstouserplans}}
|
{{^pushratingstouserplans}}
|
||||||
|
<p class="alert alert-info">
|
||||||
{{#str}}coursecompetencyratingsarenotpushedtouserplans, tool_lp{{/str}}
|
{{#str}}coursecompetencyratingsarenotpushedtouserplans, tool_lp{{/str}}
|
||||||
{{/pushratingstouserplans}}
|
{{/pushratingstouserplans}}
|
||||||
|
{{#canconfigurecoursecompetencies}}
|
||||||
<a href="#"
|
<a href="#"
|
||||||
data-action="configure-course-competency-settings"
|
data-action="configure-course-competency-settings"
|
||||||
data-courseid="{{courseid}}"
|
data-courseid="{{courseid}}"
|
||||||
data-pushratingstouserplans="{{pushratingstouserplans}}"
|
data-pushratingstouserplans="{{pushratingstouserplans}}"
|
||||||
>{{#pix}}t/edit, core, {{#str}}edit{{/str}}{{/pix}}</a>
|
>{{#pix}}t/edit, core, {{#str}}edit{{/str}}{{/pix}}</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
|
||||||
{{/canconfigurecoursecompetencies}}
|
{{/canconfigurecoursecompetencies}}
|
||||||
|
</div>
|
||||||
<div data-region="coursecompetencies">
|
<div data-region="coursecompetencies">
|
||||||
<table class="generaltable fullwidth managecompetencies">
|
<table class="generaltable fullwidth managecompetencies">
|
||||||
<tbody class="drag-parentnode">
|
<tbody class="drag-parentnode">
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
|
||||||
$plugin->version = 2016020921; // The current plugin version (Date: YYYYMMDDXX).
|
$plugin->version = 2016020922; // The current plugin version (Date: YYYYMMDDXX).
|
||||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||||
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
|
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
|
||||||
|
@ -79,6 +79,8 @@ class report implements renderable, templatable {
|
|||||||
$course = $DB->get_record('course', array('id' => $this->courseid));
|
$course = $DB->get_record('course', array('id' => $this->courseid));
|
||||||
$coursecontext = context_course::instance($course->id);
|
$coursecontext = context_course::instance($course->id);
|
||||||
$exporter = new course_summary_exporter($course, array('context' => $coursecontext));
|
$exporter = new course_summary_exporter($course, array('context' => $coursecontext));
|
||||||
|
$coursecompetencysettings = api::read_course_competency_settings($course->id);
|
||||||
|
$data->pushratingstouserplans = $coursecompetencysettings->get_pushratingstouserplans();
|
||||||
$data->course = $exporter->export($output);
|
$data->course = $exporter->export($output);
|
||||||
|
|
||||||
$data->pluginbaseurl = (new moodle_url('/admin/tool/lp/'))->out(false);
|
$data->pluginbaseurl = (new moodle_url('/admin/tool/lp/'))->out(false);
|
||||||
|
@ -64,6 +64,9 @@ $PAGE->set_pagelayout('incourse');
|
|||||||
$output = $PAGE->get_renderer('report_competency');
|
$output = $PAGE->get_renderer('report_competency');
|
||||||
|
|
||||||
echo $output->header();
|
echo $output->header();
|
||||||
|
$baseurl = new moodle_url('/report/competency/index.php');
|
||||||
|
$nav = new \report_competency\output\user_course_navigation($currentuser, $course->id, $baseurl);
|
||||||
|
echo $output->render($nav);
|
||||||
if ($currentuser > 0) {
|
if ($currentuser > 0) {
|
||||||
$user = core_user::get_user($currentuser);
|
$user = core_user::get_user($currentuser);
|
||||||
$usercontext = context_user::instance($currentuser);
|
$usercontext = context_user::instance($currentuser);
|
||||||
@ -76,9 +79,6 @@ if ($currentuser > 0) {
|
|||||||
}
|
}
|
||||||
echo $output->heading($title, 3);
|
echo $output->heading($title, 3);
|
||||||
|
|
||||||
$baseurl = new moodle_url('/report/competency/index.php');
|
|
||||||
$nav = new \report_competency\output\user_course_navigation($currentuser, $course->id, $baseurl);
|
|
||||||
echo $output->render($nav);
|
|
||||||
if ($currentuser > 0) {
|
if ($currentuser > 0) {
|
||||||
$page = new \report_competency\output\report($course->id, $currentuser);
|
$page = new \report_competency\output\report($course->id, $currentuser);
|
||||||
echo $output->render($page);
|
echo $output->render($page);
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
<div data-region="configurecoursecompetencies">
|
||||||
|
{{#pushratingstouserplans}}
|
||||||
|
<p class="alert">
|
||||||
|
{{#str}}coursecompetencyratingsarepushedtouserplans, tool_lp{{/str}}
|
||||||
|
</p>
|
||||||
|
{{/pushratingstouserplans}}
|
||||||
|
{{^pushratingstouserplans}}
|
||||||
|
<p class="alert alert-info">
|
||||||
|
{{#str}}coursecompetencyratingsarenotpushedtouserplans, tool_lp{{/str}}
|
||||||
|
</p>
|
||||||
|
{{/pushratingstouserplans}}
|
||||||
|
</div>
|
||||||
<div data-region="competency-breakdown-report" data-courseid="{{course.id}}" data-userid="{{user.id}}">
|
<div data-region="competency-breakdown-report" data-courseid="{{course.id}}" data-userid="{{user.id}}">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<span class="span6">
|
<span class="span6">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user