MDL-51040 cbe: New user_competency_in_course page
This commit is contained in:
committed by
Frederic Massart
parent
476a98d0fb
commit
9f422dc2e9
@@ -0,0 +1 @@
|
||||
define(["jquery"],function(a){var b=function(b,c,d,e,f,g){this._baseUrl=d,this._userId=e+"",this._competencyId=f+"",this._courseId=g,this._ignoreFirstUser=!0,this._ignoreFirstCompetency=!0,a(b).on("change",this._userChanged.bind(this)),a(c).on("change",this._competencyChanged.bind(this))};return b.prototype._userChanged=function(b){if(this._ignoreFirstUser)return void(this._ignoreFirstUser=!1);var c=a(b.target).val(),d="?userid="+c+"&courseid="+this._courseId+"&competencyid="+this._competencyId;document.location=this._baseUrl+d},b.prototype._competencyChanged=function(b){if(this._ignoreFirstCompetency)return void(this._ignoreFirstCompetency=!1);var c=a(b.target).val(),d="?userid="+this._userId+"&courseid="+this._courseId+"&competencyid="+c;document.location=this._baseUrl+d},b.prototype._competencyId=null,b.prototype._userId=null,b.prototype._courseId=null,b.prototype._baseUrl=null,b.prototype._ignoreFirstUser=null,b.prototype._ignoreFirstCompetency=null,b});
|
||||
@@ -0,0 +1,96 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Module to enable inline editing of a comptency grade.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define(['jquery'], function($) {
|
||||
|
||||
/**
|
||||
* UserCompetencyCourseNavigation
|
||||
*
|
||||
* @param {String} The selector of the user element.
|
||||
* @param {String} The selector of the competency element.
|
||||
* @param {String} The base url for the page (no params).
|
||||
* @param {Number} The course id
|
||||
* @param {Number} The user id
|
||||
* @param {Number} The competency id
|
||||
*/
|
||||
var UserCompetencyCourseNavigation = function(userSelector, competencySelector, baseUrl, userId, competencyId, courseId) {
|
||||
this._baseUrl = baseUrl;
|
||||
this._userId = userId + '';
|
||||
this._competencyId = competencyId + '';
|
||||
this._courseId = courseId;
|
||||
this._ignoreFirstUser = true;
|
||||
this._ignoreFirstCompetency = true;
|
||||
|
||||
$(userSelector).on('change', this._userChanged.bind(this));
|
||||
$(competencySelector).on('change', this._competencyChanged.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* The user was changed in the select list.
|
||||
*
|
||||
* @method _userChanged
|
||||
* @param {Event} e
|
||||
*/
|
||||
UserCompetencyCourseNavigation.prototype._userChanged = function(e) {
|
||||
if (this._ignoreFirstUser) {
|
||||
this._ignoreFirstUser = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var newUserId = $(e.target).val();
|
||||
var queryStr = '?userid=' + newUserId + '&courseid=' + this._courseId + '&competencyid=' + this._competencyId;
|
||||
document.location = this._baseUrl + queryStr;
|
||||
};
|
||||
|
||||
/**
|
||||
* The competency was changed in the select list.
|
||||
*
|
||||
* @method _competencyChanged
|
||||
* @param {Event} e
|
||||
*/
|
||||
UserCompetencyCourseNavigation.prototype._competencyChanged = function(e) {
|
||||
if (this._ignoreFirstCompetency) {
|
||||
this._ignoreFirstCompetency = false;
|
||||
return;
|
||||
}
|
||||
var newCompetencyId = $(e.target).val();
|
||||
var queryStr = '?userid=' + this._userId + '&courseid=' + this._courseId + '&competencyid=' + newCompetencyId;
|
||||
document.location = this._baseUrl + queryStr;
|
||||
};
|
||||
|
||||
/** @type {Number} The id of the competency. */
|
||||
UserCompetencyCourseNavigation.prototype._competencyId = null;
|
||||
/** @type {Number} The id of the user. */
|
||||
UserCompetencyCourseNavigation.prototype._userId = null;
|
||||
/** @type {Number} The id of the course. */
|
||||
UserCompetencyCourseNavigation.prototype._courseId = null;
|
||||
/** @type {String} Plugin base url. */
|
||||
UserCompetencyCourseNavigation.prototype._baseUrl = null;
|
||||
/** @type {Boolean} Ignore the first change event for users. */
|
||||
UserCompetencyCourseNavigation.prototype._ignoreFirstUser = null;
|
||||
/** @type {Boolean} Ignore the first change event for competencies. */
|
||||
UserCompetencyCourseNavigation.prototype._ignoreFirstCompetency = null;
|
||||
|
||||
return /** @alias module:tool_lp/user_competency_course_navigation */ UserCompetencyCourseNavigation;
|
||||
|
||||
});
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Class for exporting user competency data with all the evidence in a course
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_lp\external;
|
||||
|
||||
use context_course;
|
||||
use renderer_base;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* Class for exporting user competency data with additional related data in a plan.
|
||||
*
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class user_competency_summary_in_course_exporter extends exporter {
|
||||
|
||||
protected static function define_related() {
|
||||
// We cache the context so it does not need to be retrieved from the framework every time.
|
||||
return array('competency' => '\\tool_lp\\competency',
|
||||
'relatedcompetencies' => '\\tool_lp\\competency[]',
|
||||
'user' => '\\stdClass',
|
||||
'course' => '\\stdClass',
|
||||
'usercompetency' => '\\tool_lp\\user_competency?',
|
||||
'evidence' => '\\tool_lp\\evidence[]');
|
||||
}
|
||||
|
||||
protected static function define_other_properties() {
|
||||
return array(
|
||||
'usercompetencysummary' => array(
|
||||
'type' => user_competency_summary_exporter::read_properties_definition()
|
||||
),
|
||||
'course' => array(
|
||||
'type' => course_summary_exporter::read_properties_definition(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function get_other_values(renderer_base $output) {
|
||||
// Arrays are copy on assign.
|
||||
$related = $this->related;
|
||||
// Remove course from related as it is not wanted by the user_competency_summary_exporter.
|
||||
unset($related['course']);
|
||||
$related['usercompetencyplan'] = null;
|
||||
$exporter = new user_competency_summary_exporter(null, $related);
|
||||
$result = new stdClass();
|
||||
$result->usercompetencysummary = $exporter->export($output);
|
||||
|
||||
$context = context_course::instance($this->related['course']->id);
|
||||
$exporter = new course_summary_exporter($this->related['course'], array('context' => $context));
|
||||
$result->course = $exporter->export($output);
|
||||
|
||||
return (array) $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* User competency page class.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_lp\output;
|
||||
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
use context_course;
|
||||
use \tool_lp\external\user_summary_exporter;
|
||||
use \tool_lp\external\competency_exporter;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* User competency course navigation class.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class user_competency_course_navigation implements renderable, templatable {
|
||||
|
||||
/** @var userid */
|
||||
protected $userid;
|
||||
|
||||
/** @var competencyid */
|
||||
protected $competencyid;
|
||||
|
||||
/** @var courseid */
|
||||
protected $courseid;
|
||||
|
||||
/** @var baseurl */
|
||||
protected $baseurl;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param $userid
|
||||
* @param $competencyid
|
||||
* @param $courseid
|
||||
*/
|
||||
public function __construct($userid, $competencyid, $courseid, $baseurl) {
|
||||
$this->userid = $userid;
|
||||
$this->competencyid = $competencyid;
|
||||
$this->courseid = $courseid;
|
||||
$this->baseurl = $baseurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the data.
|
||||
*
|
||||
* @param renderer_base $output
|
||||
* @return stdClass
|
||||
*/
|
||||
public function export_for_template(renderer_base $output) {
|
||||
global $CFG, $DB, $SESSION, $PAGE;
|
||||
|
||||
$context = context_course::instance($this->courseid);
|
||||
|
||||
$data = new stdClass();
|
||||
$data->userid = $this->userid;
|
||||
$data->competencyid = $this->competencyid;
|
||||
$data->courseid = $this->courseid;
|
||||
$data->baseurl = $this->baseurl;
|
||||
|
||||
if (has_capability('tool/lp:coursecompetencyread', $context)) {
|
||||
$course = $DB->get_record('course', array('id' => $this->courseid));
|
||||
$currentgroup = optional_param('group', null, PARAM_INT);
|
||||
$select = groups_allgroups_course_menu($course, $PAGE->url, true, $currentgroup);
|
||||
// Fetch showactive.
|
||||
$defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
|
||||
$showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
|
||||
$showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context);
|
||||
|
||||
// Fetch current active group.
|
||||
$groupmode = groups_get_course_groupmode($course);
|
||||
$currentgroup = $SESSION->activegroup[$course->id][$groupmode][$course->defaultgroupingid];
|
||||
|
||||
$users = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup,
|
||||
'u.*', null, 0, 0, $showonlyactiveenrol);
|
||||
|
||||
$data->users = array();
|
||||
foreach ($users as $user) {
|
||||
$exporter = new user_summary_exporter($user);
|
||||
$user = $exporter->export($output);
|
||||
if ($user->id == $this->userid) {
|
||||
$user->selected = true;
|
||||
}
|
||||
$data->users[] = $user;
|
||||
}
|
||||
$data->hasusers = true;
|
||||
} else {
|
||||
$data->users = array();
|
||||
$data->hasusers = false;
|
||||
}
|
||||
|
||||
$coursecompetencies = \tool_lp\api::list_course_competencies($this->courseid);
|
||||
$data->competencies = array();
|
||||
foreach ($coursecompetencies as $coursecompetency) {
|
||||
$coursecompetencycontext = $coursecompetency['competency']->get_context();
|
||||
$exporter = new competency_exporter($coursecompetency['competency'], array('context' => $coursecompetencycontext));
|
||||
$competency = $exporter->export($output);
|
||||
if ($competency->id == $this->competencyid) {
|
||||
$competency->selected = true;
|
||||
}
|
||||
$data->competencies[] = $competency;
|
||||
}
|
||||
$data->hascompetencies = count($data->competencies);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* User competency page class.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_lp\output;
|
||||
|
||||
use renderable;
|
||||
use renderer_base;
|
||||
use templatable;
|
||||
|
||||
/**
|
||||
* User competency page class.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class user_competency_summary_in_course_page implements renderable, templatable {
|
||||
|
||||
/** @var userid */
|
||||
protected $userid;
|
||||
|
||||
/** @var competencyid */
|
||||
protected $competencyid;
|
||||
|
||||
/** @var courseid */
|
||||
protected $courseid;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param $userid
|
||||
* @param $competencyid
|
||||
* @param $courseid
|
||||
*/
|
||||
public function __construct($userid, $competencyid, $courseid) {
|
||||
$this->userid = $userid;
|
||||
$this->competencyid = $competencyid;
|
||||
$this->courseid = $courseid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the data.
|
||||
*
|
||||
* @param renderer_base $output
|
||||
* @return stdClass
|
||||
*/
|
||||
public function export_for_template(renderer_base $output) {
|
||||
return \tool_lp\external::data_for_user_competency_summary_in_course($this->userid, $this->competencyid, $this->courseid);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ use context;
|
||||
use moodle_url;
|
||||
use core_user;
|
||||
use context_user;
|
||||
use context_course;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* Page helper.
|
||||
@@ -40,6 +42,53 @@ use context_user;
|
||||
*/
|
||||
class page_helper {
|
||||
|
||||
/**
|
||||
* Set-up a course page.
|
||||
*
|
||||
* Example:
|
||||
* list($title, $subtitle) = page_helper::setup_for_course($pagecontextid, $url, $course, $pagetitle);
|
||||
* echo $OUTPUT->heading($title);
|
||||
* echo $OUTPUT->heading($subtitle, 3);
|
||||
*
|
||||
* @param int $pagecontextid The page context ID.
|
||||
* @param moodle_url $url The current page.
|
||||
* @param \stdClass $couse The course.
|
||||
* @param string $subpage The title of the subpage, if any.
|
||||
* @return array With the following:
|
||||
* - Page title
|
||||
* - Page sub title
|
||||
* - Return URL (course competencies page)
|
||||
*/
|
||||
public static function setup_for_course(moodle_url $url, $course, $subtitle = '') {
|
||||
global $PAGE, $SITE;
|
||||
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
$PAGE->set_course($course);
|
||||
|
||||
if (!empty($subtitle)) {
|
||||
$title = $subtitle;
|
||||
} else {
|
||||
$title = get_string('coursecompetencies', 'tool_lp');
|
||||
}
|
||||
|
||||
$returnurl = new moodle_url('/admin/tool/lp/coursecompetencies.php', array('courseid' => 2));
|
||||
|
||||
$heading = $context->get_context_name();
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($heading);
|
||||
|
||||
if (!empty($subtitle)) {
|
||||
$PAGE->navbar->add(get_string('coursecompetencies', 'tool_lp'), $returnurl);
|
||||
// We're in a sub page without a specific template.
|
||||
$PAGE->navbar->add($subtitle, $url);
|
||||
}
|
||||
|
||||
return array($title, $subtitle, $returnurl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set-up a template page.
|
||||
*
|
||||
|
||||
@@ -295,7 +295,7 @@ class user_competency extends persistent {
|
||||
$sql = "competencyid $insql";
|
||||
}
|
||||
|
||||
return parent::get_records_select("userid = :userid AND $sql", $params);
|
||||
return self::get_records_select("userid = :userid AND $sql", $params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,17 +33,14 @@ $context = context_course::instance($course->id);
|
||||
$urlparams = array('courseid' => $id);
|
||||
|
||||
$url = new moodle_url('/admin/tool/lp/coursecompetencies.php', $urlparams);
|
||||
$title = get_string('coursecompetencies', 'tool_lp');
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_title($title);
|
||||
$coursename = format_text($course->fullname, false, array('context' => $context));
|
||||
$PAGE->set_heading($coursename);
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_course($url, $course);
|
||||
|
||||
$output = $PAGE->get_renderer('tool_lp');
|
||||
echo $output->header();
|
||||
echo $output->heading($title);
|
||||
|
||||
|
||||
$page = new \tool_lp\output\course_competencies_page($course->id);
|
||||
echo $output->render($page);
|
||||
|
||||
|
||||
@@ -681,5 +681,23 @@ $functions = array(
|
||||
'capabilities' => 'tool/lp:planview',
|
||||
'ajax' => true,
|
||||
),
|
||||
'tool_lp_grade_competency_in_course' => array(
|
||||
'classname' => 'tool_lp\external',
|
||||
'methodname' => 'grade_competency_in_course',
|
||||
'classpath' => '',
|
||||
'description' => 'Grade a competency from the course page.',
|
||||
'type' => 'write',
|
||||
'capabilities' => 'tool/lp:competencygrade',
|
||||
'ajax' => true,
|
||||
),
|
||||
'tool_lp_data_for_user_competency_summary_in_course' => array(
|
||||
'classname' => 'tool_lp\external',
|
||||
'methodname' => 'data_for_user_competency_summary_in_course',
|
||||
'classpath' => '',
|
||||
'description' => 'Load a summary of a user competency.',
|
||||
'type' => 'read',
|
||||
'capabilities' => 'tool/lp:coursecompetencyread',
|
||||
'ajax' => true,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ $string['aplanswerecreated'] = '{$a} plans were created';
|
||||
$string['assigncohorts'] = 'Assign cohorts';
|
||||
$string['cannotaddrules'] = 'This competency cannot be configured.';
|
||||
$string['cannotcreateuserplanswhentemplatehidden'] = 'New user plans can not be created while this template is hidden.';
|
||||
$string['chooserating'] = 'Choose a rating...';
|
||||
$string['cohortssyncedtotemplate'] = 'Cohorts synced to this template';
|
||||
$string['competencies'] = 'Competencies';
|
||||
$string['competenciesforframework'] = 'Competencies for {$a}';
|
||||
@@ -91,7 +92,9 @@ $string['evidence_competencyrule'] = 'The rule of the competency was met.';
|
||||
$string['evidence_coursecompleted'] = 'The course \'{$a}\' was completed.';
|
||||
$string['evidence_evidenceofpriorlearninglinked'] = 'The evidence of prior learning \'{$a}\' was linked.';
|
||||
$string['evidence_evidenceofpriorlearningunlinked'] = 'The evidence of prior learning \'{$a}\' was unlinked.';
|
||||
$string['evidence_manualoverrideincourse'] = 'The competency grade was manually set in the course \'{$a}\'.';
|
||||
$string['evidence_manualoverrideinplan'] = 'The competency grade was manually set in the plan \'{$a}\'.';
|
||||
$string['evidence_manualsuggestincourse'] = 'The competency grade was manually suggested in the course \'{$a}\'.';
|
||||
$string['evidence_manualsuggestinplan'] = 'The competency grade was manually suggested in the plan \'{$a}\'.';
|
||||
$string['errorcannotsetduedateinthepast'] = 'The due date cannot be set in the past.';
|
||||
$string['errorcannotchangeapastduedate'] = 'The due date has passed, it cannot be changed.';
|
||||
@@ -110,6 +113,8 @@ $string['invalidplan'] = 'Invalid learning plan';
|
||||
$string['invalidtaxonomy'] = 'Invalid taxonomy: {$a}';
|
||||
$string['invalidurl'] = 'The URL is not valid.';
|
||||
$string['itemstoadd'] = 'Items to add';
|
||||
$string['jumptouser'] = 'Jump to user';
|
||||
$string['jumptocompetency'] = 'Jump to competency';
|
||||
$string['learningplancompetencies'] = 'Learning plan competencies';
|
||||
$string['learningplans'] = 'Learning plans';
|
||||
$string['levela'] = 'Level {$a}';
|
||||
@@ -282,6 +287,7 @@ $string['userevidencesummary'] = 'Summary';
|
||||
$string['userevidenceupdated'] = 'Evidence of prior learning updated';
|
||||
$string['userevidenceurl'] = 'URL';
|
||||
$string['userplans'] = 'User plans';
|
||||
$string['viewdetails'] = 'View details';
|
||||
$string['visible'] = 'Visible';
|
||||
$string['visible_help'] = 'A competency framework can be hidden from teachers. This could be useful if a framework is still in the process of being developed.';
|
||||
$string['when'] = 'When';
|
||||
|
||||
@@ -184,3 +184,14 @@ input[type="checkbox"].tool_lp_scale_proficient {
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.user-competency-course-navigation select {
|
||||
display: none;
|
||||
}
|
||||
.user-competency-course-navigation {
|
||||
width: 240px;
|
||||
height: 80px;
|
||||
}
|
||||
.user-competency-course-navigation .form-autocomplete-selection {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -32,9 +32,15 @@
|
||||
</a>
|
||||
</div>
|
||||
{{/canmanagecoursecompetencies}}
|
||||
<a href="{{pluginbaseurl}}user_competency_in_course.php?courseid={{courseid}}&competencyid={{competency.id}}&userid={{gradableuserid}}"
|
||||
title="{{#str}}viewdetails, tool_lp{{/str}}" style="text-decoration: none; color: #333;">
|
||||
{{#competency}}
|
||||
{{> tool_lp/competency_summary }}
|
||||
{{/competency}}
|
||||
</a>
|
||||
{{#usercompetency}}
|
||||
<span class="label {{^proficiency}}label-important{{/proficiency}}">{{gradename}}</span>
|
||||
{{/usercompetency}}
|
||||
{{#canmanagecoursecompetencies}}
|
||||
<div data-region="coursecompetency-ruleoutcome">
|
||||
<label>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<div class="well well-small evidence">
|
||||
{{#actionuser}}
|
||||
<div>
|
||||
{{> tool_lp/form-user-selector-suggestion }}
|
||||
{{> tool_lp/user_summary }}
|
||||
</div>
|
||||
{{/actionuser}}
|
||||
<strong><time datetime="{{userdate}}">{{userdate}}</time></strong>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<form class="pull-right well user-competency-course-navigation">
|
||||
{{#hasusers}}
|
||||
<span>
|
||||
<label for="user-nav-{{uniqid}}" class="accesshide">{{#str}}jumptouser, tool_lp{{/str}}</label>
|
||||
<select id="user-nav-{{uniqid}}">
|
||||
{{#users}}
|
||||
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{fullname}}</option>
|
||||
{{/users}}
|
||||
</select>
|
||||
</span>
|
||||
{{/hasusers}}
|
||||
<br>
|
||||
{{#hascompetencies}}
|
||||
<span>
|
||||
<label for="competency-nav-{{uniqid}}" class="accesshide">{{#str}}jumptocompetency, tool_lp{{/str}}</label>
|
||||
<select id="competency-nav-{{uniqid}}">
|
||||
{{#competencies}}
|
||||
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{shortname}} {{idnumber}}</option>
|
||||
{{/competencies}}
|
||||
</select>
|
||||
</span>
|
||||
{{/hascompetencies}}
|
||||
</form>
|
||||
{{#js}}
|
||||
require(['core/form-autocomplete', 'tool_lp/user_competency_course_navigation'], function(autocomplete, nav) {
|
||||
{{#hasusers}}
|
||||
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, '{{#str}}jumptouser, tool_lp{{/str}}');
|
||||
{{/hasusers}}
|
||||
(new nav('#user-nav-{{uniqid}}', '#competency-nav-{{uniqid}}', '{{baseurl}}', {{userid}}, {{competencyid}}, {{courseid}}));
|
||||
{{#hascompetencies}}
|
||||
autocomplete.enhance('#competency-nav-{{uniqid}}', false, false, '{{#str}}jumptocompetency, tool_lp{{/str}}');
|
||||
{{/hascompetencies}}
|
||||
|
||||
});
|
||||
{{/js}}
|
||||
@@ -0,0 +1,123 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template tool_lp/user_competency_summary_in_course
|
||||
|
||||
Moodle template for the the summary of a user competency
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* usercompetencysummary - object containing:
|
||||
* showrelatedcompetencies - boolean
|
||||
* cangrade - boolean
|
||||
* cansuggest - boolean
|
||||
* cangradeorsuggest - boolean
|
||||
* competency - competency summary record
|
||||
* user - user record
|
||||
* usercompetency - user competency record
|
||||
* evidence - array of evidence
|
||||
* course - course summary record
|
||||
|
||||
This template does not have an example context because it includes ajax functionality.
|
||||
}}
|
||||
{{#usercompetencysummary}}
|
||||
<div data-region="user-competency-full-info" >
|
||||
<div data-region="competency-summary">
|
||||
{{#competency}}
|
||||
{{> tool_lp/competency_summary }}
|
||||
{{/competency}}
|
||||
<dl>
|
||||
{{#usercompetency}}
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="label{{^proficiency}} label-important{{/proficiency}} pull-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
<dt>{{#str}}rating, tool_lp{{/str}}</dt>
|
||||
<dd>{{gradename}}
|
||||
{{#cangradeorsuggest}}
|
||||
<p>
|
||||
<form class="form-inline pull-left" id="grade-competency-form-{{uniqid}}">
|
||||
<select></select>
|
||||
<div class="btn-group">
|
||||
{{#cangrade}}
|
||||
<button class="btn btn-primary" data-action="grade">{{#str}}rate, tool_lp{{/str}}</button>
|
||||
{{/cangrade}}
|
||||
{{#cansuggest}}
|
||||
<button class="btn btn-inverse" data-action="suggest">{{#str}}suggest, tool_lp{{/str}}</button>
|
||||
{{/cansuggest}}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<br><br>
|
||||
</p>
|
||||
</dd>
|
||||
{{#js}}
|
||||
require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info'], function($, mod, info) {
|
||||
var scaleConfig = JSON.parse('{{{competency.scaleconfiguration}}}');
|
||||
|
||||
var inlineGrader = new mod('grade-competency-form-{{uniqid}}', scaleConfig, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', '{{#str}}chooserating, tool_lp{{/str}}');
|
||||
var competencyElement = $(document.getElementById('grade-competency-form-{{uniqid}}')).closest('[data-region=user-competency-full-info]');
|
||||
var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}');
|
||||
|
||||
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
|
||||
});
|
||||
|
||||
{{/js}}
|
||||
{{/cangradeorsuggest}}
|
||||
{{/usercompetency}}
|
||||
{{#usercompetencyplan}}
|
||||
<dd>{{gradename}} - {{#str}}plancompleted, tool_lp{{/str}}</dd>
|
||||
{{#cangradeorsuggest}}
|
||||
{{$gradeform}}
|
||||
<!-- Grading a user competency is specific to the context you are in. -->
|
||||
{{/gradeform}}
|
||||
{{/cangradeorsuggest}}
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="label{{^proficiency}} label-important{{/proficiency}} pull-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
{{/usercompetencyplan}}
|
||||
</dl>
|
||||
<dl data-region="evidence-listing">
|
||||
<dt>{{#str}}evidence, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
{{#evidence}}
|
||||
{{> tool_lp/evidence_summary }}
|
||||
{{/evidence}}
|
||||
{{^evidence}}
|
||||
<p>{{#str}}noevidence, tool_lp{{/str}}</p>
|
||||
{{/evidence}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
{{/usercompetencysummary}}
|
||||
|
||||
{{#js}}
|
||||
require(['tool_lp/competencydialogue'], function(Compdialogue) {
|
||||
var competencydialogue = new Compdialogue({includerelated : true});
|
||||
competencydialogue.watch('[data-region="competency-summary"]');
|
||||
});
|
||||
{{/js}}
|
||||
@@ -48,11 +48,17 @@
|
||||
<dl>
|
||||
<dt>{{#str}}rating, tool_lp{{/str}}</dt>
|
||||
{{#usercompetency}}
|
||||
<dd>{{gradename}}</dd>
|
||||
{{#cangradeorsuggest}}
|
||||
<dt>{{#str}}editrating, tool_lp{{/str}}</dt>
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<form class="form-inline pull-left" id="grade-competency-form-{{uniqid}}">
|
||||
<span class="label{{^proficiency}} label-important{{/proficiency}} pull-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
<dt>{{#str}}rating, tool_lp{{/str}}</dt>
|
||||
<dd>{{gradename}}
|
||||
{{#cangradeorsuggest}}
|
||||
<p>
|
||||
<form class="form-inline pull-left" id="grade-competency-form-{{uniqid}}">
|
||||
<select></select>
|
||||
<div class="btn-group">
|
||||
{{#cangrade}}
|
||||
@@ -64,31 +70,25 @@
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<br><br>
|
||||
</p>
|
||||
</dd>
|
||||
{{#js}}
|
||||
require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info'], function($, mod, info) {
|
||||
var scaleConfig = JSON.parse('{{{competency.scaleconfiguration}}}');
|
||||
|
||||
var inlineGrader = new mod('grade-competency-form-{{uniqid}}', scaleConfig, '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}');
|
||||
var inlineGrader = new mod('grade-competency-form-{{uniqid}}', scaleConfig, '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}', '', '{{#str}}chooserating, tool_lp{{/str}}');
|
||||
var competencyElement = $(document.getElementById('grade-competency-form-{{uniqid}}')).closest('[data-region=user-competency-full-info]');
|
||||
var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}');
|
||||
|
||||
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
|
||||
});
|
||||
|
||||
{{/js}}
|
||||
{{/cangradeorsuggest}}
|
||||
<dt>{{#str}}proficient, tool_lp{{/str}}</dt>
|
||||
<dd>
|
||||
<span class="label{{^proficiency}} label-important{{/proficiency}} pull-left">
|
||||
{{proficiencyname}}
|
||||
</span>
|
||||
</dd>
|
||||
{{/usercompetency}}
|
||||
{{#usercompetencyplan}}
|
||||
<dd>{{gradename}} - {{#str}}plancompleted, tool_lp{{/str}}</dd>
|
||||
{{#cangradeorsuggest}}
|
||||
Hi
|
||||
{{$gradeform}}
|
||||
<!-- Grading a user competency is specific to the context you are in. -->
|
||||
{{/gradeform}}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template tool_lp/user-summary
|
||||
|
||||
Moodle template for the list of valid options in an autocomplate form element.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* profileimageurlsmall Url to a small profile image.
|
||||
* profileimageurl Url to a profile image.
|
||||
* fullname Users full name
|
||||
* hasidentity boolean to say if there are identity fields to show
|
||||
* identity concatenated list of identity fields.
|
||||
* id user id field
|
||||
* email user email field
|
||||
* idnumber user idnumber field
|
||||
* phone1 user phone1 field
|
||||
* phone2 user phone2 field
|
||||
* department user department field
|
||||
* institution user institution field
|
||||
|
||||
Example context (json):
|
||||
{ "id": "1",
|
||||
"fullname": "Admin",
|
||||
"hasidentity": true,
|
||||
"identity": "Admin User, 0144114141",
|
||||
"profileimageurl": "invalid url",
|
||||
"profileimageurlsmall": "invalid url"
|
||||
}
|
||||
}}
|
||||
<span>
|
||||
<a href="{{profileurl}}" title="{{#str}}viewprofile{{/str}}">
|
||||
<img height="18" src="{{profileimageurlsmall}}" alt="" role="presentation">
|
||||
<span>{{fullname}}</span>
|
||||
{{#hasidentity}}
|
||||
<span><small>{{identity}}</small></span>
|
||||
{{/hasidentity}}
|
||||
</a>
|
||||
</span>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* User competency page. Lists everything known about a user competency.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
|
||||
$userid = optional_param('userid', 0, PARAM_INT);
|
||||
$competencyid = required_param('competencyid', PARAM_INT);
|
||||
$courseid = required_param('courseid', PARAM_INT);
|
||||
|
||||
require_login(null, false);
|
||||
if (isguestuser()) {
|
||||
throw new require_login_exception('Guests are not allowed here.');
|
||||
}
|
||||
|
||||
if (empty($userid)) {
|
||||
$context = context_course::instance($courseid);
|
||||
$gradable = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', 0, 'u.id', null, 0, 1);
|
||||
if (empty($gradable)) {
|
||||
print_error('noparticipants');
|
||||
}
|
||||
$userid = array_pop($gradable)->id;
|
||||
}
|
||||
|
||||
$params = array('userid' => $userid, 'competencyid' => $competencyid, 'courseid' => $courseid);
|
||||
$course = $DB->get_record('course', array('id' => $courseid));
|
||||
$url = new moodle_url('/admin/tool/lp/user_competency_in_course.php', $params);
|
||||
|
||||
$usercontext = context_user::instance($userid);
|
||||
$user = $DB->get_record('user', array('id' => $userid));
|
||||
$competency = new \tool_lp\competency($competencyid);
|
||||
|
||||
// Does a permissions check for us.
|
||||
$usercompetencies = \tool_lp\api::list_user_competencies_in_course($courseid, $userid);
|
||||
$subtitle = $competency->get_shortname() . ' <em>' . $competency->get_idnumber() . '</em>';
|
||||
|
||||
list($title, $subtitle) = \tool_lp\page_helper::setup_for_course($url, $course, $subtitle);
|
||||
|
||||
$output = $PAGE->get_renderer('tool_lp');
|
||||
$userheading = array(
|
||||
'heading' => fullname($user),
|
||||
'user' => $user,
|
||||
'usercontext' => $usercontext
|
||||
);
|
||||
echo $output->header();
|
||||
echo $OUTPUT->context_header($userheading, 3);
|
||||
//echo $output->heading($title, 3);
|
||||
|
||||
$baseurl = new moodle_url('/admin/tool/lp/user_competency_in_course.php');
|
||||
$nav = new \tool_lp\output\user_competency_course_navigation($userid, $competencyid, $courseid, $baseurl);
|
||||
echo $output->render($nav);
|
||||
$page = new \tool_lp\output\user_competency_summary_in_course_page($userid, $competencyid, $courseid);
|
||||
echo $output->render($page);
|
||||
|
||||
echo $output->footer();
|
||||
@@ -36,7 +36,7 @@ if (isguestuser()) {
|
||||
$params = array('userid' => $userid, 'competencyid' => $competencyid);
|
||||
$params['planid'] = $planid;
|
||||
$plan = \tool_lp\api::read_plan($planid);
|
||||
$url = new moodle_url('/admin/tool/lp/usercompetencyplan.php', $params);
|
||||
$url = new moodle_url('/admin/tool/lp/user_competency_in_plan.php', $params);
|
||||
$competency = new \tool_lp\competency($competencyid);
|
||||
$framework = $competency->get_framework();
|
||||
$subtitle = $competency->get_shortname();
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$plugin->version = 2015111032; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2015111033; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
Reference in New Issue
Block a user