first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/**
* Module to enable inline editing of a comptency grade.
*
* @module report_competency/grading_popup
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("report_competency/grading_popup",["jquery","core/notification","core/str","core/ajax","core/log","core/templates","tool_lp/dialogue"],(function($,notification,str,ajax,log,templates,Dialogue){var GradingPopup=function(regionSelector,userCompetencySelector){this._regionSelector=regionSelector,this._userCompetencySelector=userCompetencySelector,$(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return GradingPopup.prototype._handleClick=function(e){var cell=$(e.target).closest(this._userCompetencySelector),competencyId=$(cell).data("competencyid"),courseId=$(cell).data("courseid"),userId=$(cell).data("userid");log.debug("Clicked on cell: competencyId="+competencyId+", courseId="+courseId+", userId="+userId);var requests=ajax.call([{methodname:"tool_lp_data_for_user_competency_summary_in_course",args:{userid:userId,competencyid:competencyId,courseid:courseId}},{methodname:"core_competency_user_competency_viewed_in_course",args:{userid:userId,competencyid:competencyId,courseid:courseId}}]);$.when(requests[0],requests[1]).then(this._contextLoaded.bind(this)).catch(notification.exception)},GradingPopup.prototype._contextLoaded=function(context){return context.displayuser=!0,M.util.js_pending("report_competency/grading_popup:_contextLoaded"),$.when(str.get_string("usercompetencysummary","report_competency"),templates.render("tool_lp/user_competency_summary_in_course",context)).then(function(title,templateData){return new Dialogue(title,templateData[0],(function(){templates.runTemplateJS(templateData[1]),M.util.js_complete("report_competency/grading_popup:_contextLoaded")}),this._refresh.bind(this),!0)}.bind(this))},GradingPopup.prototype._refresh=function(){var region=$(this._regionSelector),courseId=region.data("courseid"),moduleId=region.data("moduleid"),userId=region.data("userid");return""===moduleId&&(moduleId=0),ajax.call([{methodname:"report_competency_data_for_report",args:{courseid:courseId,userid:userId,moduleid:moduleId},done:this._pageContextLoaded.bind(this),fail:notification.exception}])},GradingPopup.prototype._pageContextLoaded=function(context){templates.render("report_competency/report",context).then(function(html,js){templates.replaceNode(this._regionSelector,html,js)}.bind(this)).catch(notification.exception)},GradingPopup.prototype._regionSelector=null,GradingPopup.prototype._userCompetencySelector=null,GradingPopup}));
//# sourceMappingURL=grading_popup.min.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
/**
* Module to navigation between users in a course.
*
* @module report_competency/user_course_navigation
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("report_competency/user_course_navigation",["jquery"],(function($){var UserCourseNavigation=function(userSelector,moduleSelector,baseUrl,userId,courseId,moduleId){this._baseUrl=baseUrl,this._userId=userId+"",this._courseId=courseId,this._moduleId=moduleId,$(userSelector).on("change",this._userChanged.bind(this)),$(moduleSelector).on("change",this._moduleChanged.bind(this))};return UserCourseNavigation.prototype._userChanged=function(e){M.util.js_pending("report_competency/user_course_navigation:_userChanged");var queryStr="?user="+$(e.target).val()+"&id="+this._courseId+"&mod="+this._moduleId;document.location=this._baseUrl+queryStr},UserCourseNavigation.prototype._moduleChanged=function(e){M.util.js_pending("report_competency/user_course_navigation:_moduleChanged");var queryStr="?mod="+$(e.target).val()+"&id="+this._courseId+"&user="+this._userId;document.location=this._baseUrl+queryStr},UserCourseNavigation.prototype._userId=null,UserCourseNavigation.prototype._moduleId=null,UserCourseNavigation.prototype._courseId=null,UserCourseNavigation.prototype._baseUrl=null,UserCourseNavigation}));
//# sourceMappingURL=user_course_navigation.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user_course_navigation.min.js","sources":["../src/user_course_navigation.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to navigation between users in a course.\n *\n * @module report_competency/user_course_navigation\n * @copyright 2015 Damyon Wiese\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n\n /**\n * UserCourseNavigation\n *\n * @class report_competency/user_course_navigation\n * @param {String} userSelector The selector of the user element.\n * @param {String} moduleSelector The selector of the module element.\n * @param {String} baseUrl The base url for the page (no params).\n * @param {Number} userId The course id\n * @param {Number} courseId The user id\n * @param {Number} moduleId The activity module (filter)\n */\n var UserCourseNavigation = function(userSelector, moduleSelector, baseUrl, userId, courseId, moduleId) {\n this._baseUrl = baseUrl;\n this._userId = userId + '';\n this._courseId = courseId;\n this._moduleId = moduleId;\n\n $(userSelector).on('change', this._userChanged.bind(this));\n $(moduleSelector).on('change', this._moduleChanged.bind(this));\n };\n\n /**\n * The user was changed in the select list.\n *\n * @method _userChanged\n * @param {Event} e the event\n */\n UserCourseNavigation.prototype._userChanged = function(e) {\n // Note: This change causes a page reload and is intentionally not paired with a js_complete call.\n M.util.js_pending('report_competency/user_course_navigation:_userChanged');\n var newUserId = $(e.target).val();\n var queryStr = '?user=' + newUserId + '&id=' + this._courseId + '&mod=' + this._moduleId;\n document.location = this._baseUrl + queryStr;\n };\n\n /**\n * The module was changed in the select list.\n *\n * @method _moduleChanged\n * @param {Event} e the event\n */\n UserCourseNavigation.prototype._moduleChanged = function(e) {\n // Note: This change causes a page reload and is intentionally not paired with a js_complete call.\n M.util.js_pending('report_competency/user_course_navigation:_moduleChanged');\n var newModuleId = $(e.target).val();\n var queryStr = '?mod=' + newModuleId + '&id=' + this._courseId + '&user=' + this._userId;\n document.location = this._baseUrl + queryStr;\n };\n\n /** @property {Number} The id of the user. */\n UserCourseNavigation.prototype._userId = null;\n /** @property {Number} The id of the module. */\n UserCourseNavigation.prototype._moduleId = null;\n /** @property {Number} The id of the course. */\n UserCourseNavigation.prototype._courseId = null;\n /** @property {String} Plugin base url. */\n UserCourseNavigation.prototype._baseUrl = null;\n\n return UserCourseNavigation;\n});\n"],"names":["define","$","UserCourseNavigation","userSelector","moduleSelector","baseUrl","userId","courseId","moduleId","_baseUrl","_userId","_courseId","_moduleId","on","this","_userChanged","bind","_moduleChanged","prototype","e","M","util","js_pending","queryStr","target","val","document","location"],"mappings":";;;;;;;AAuBAA,kDAAO,CAAC,WAAW,SAASC,OAapBC,qBAAuB,SAASC,aAAcC,eAAgBC,QAASC,OAAQC,SAAUC,eACpFC,SAAWJ,aACXK,QAAUJ,OAAS,QACnBK,UAAYJ,cACZK,UAAYJ,SAEjBP,EAAEE,cAAcU,GAAG,SAAUC,KAAKC,aAAaC,KAAKF,OACpDb,EAAEG,gBAAgBS,GAAG,SAAUC,KAAKG,eAAeD,KAAKF,eAS5DZ,qBAAqBgB,UAAUH,aAAe,SAASI,GAEnDC,EAAEC,KAAKC,WAAW,6DAEdC,SAAW,SADCtB,EAAEkB,EAAEK,QAAQC,MACU,OAASX,KAAKH,UAAY,QAAUG,KAAKF,UAC/Ec,SAASC,SAAWb,KAAKL,SAAWc,UASxCrB,qBAAqBgB,UAAUD,eAAiB,SAASE,GAErDC,EAAEC,KAAKC,WAAW,+DAEdC,SAAW,QADGtB,EAAEkB,EAAEK,QAAQC,MACS,OAASX,KAAKH,UAAY,SAAWG,KAAKJ,QACjFgB,SAASC,SAAWb,KAAKL,SAAWc,UAIxCrB,qBAAqBgB,UAAUR,QAAU,KAEzCR,qBAAqBgB,UAAUN,UAAY,KAE3CV,qBAAqBgB,UAAUP,UAAY,KAE3CT,qBAAqBgB,UAAUT,SAAW,KAEnCP"}
+146
View File
@@ -0,0 +1,146 @@
// 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.
*
* @module report_competency/grading_popup
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'core/templates', 'tool_lp/dialogue'],
function($, notification, str, ajax, log, templates, Dialogue) {
/**
* GradingPopup
*
* @class report_competency/grading_popup
* @param {String} regionSelector The regionSelector
* @param {String} userCompetencySelector The userCompetencySelector
*/
var GradingPopup = function(regionSelector, userCompetencySelector) {
this._regionSelector = regionSelector;
this._userCompetencySelector = userCompetencySelector;
$(this._regionSelector).on('click', this._userCompetencySelector, this._handleClick.bind(this));
};
/**
* Get the data from the clicked cell and open the popup.
*
* @method _handleClick
* @param {Event} e The event
*/
GradingPopup.prototype._handleClick = function(e) {
var cell = $(e.target).closest(this._userCompetencySelector);
var competencyId = $(cell).data('competencyid');
var courseId = $(cell).data('courseid');
var userId = $(cell).data('userid');
log.debug('Clicked on cell: competencyId=' + competencyId + ', courseId=' + courseId + ', userId=' + userId);
var requests = ajax.call([{
methodname: 'tool_lp_data_for_user_competency_summary_in_course',
args: {userid: userId, competencyid: competencyId, courseid: courseId},
}, {
methodname: 'core_competency_user_competency_viewed_in_course',
args: {userid: userId, competencyid: competencyId, courseid: courseId},
}]);
$.when(requests[0], requests[1])
.then(this._contextLoaded.bind(this))
.catch(notification.exception);
};
/**
* We loaded the context, now render the template.
*
* @method _contextLoaded
* @param {Object} context
* @returns {Promise}
*/
GradingPopup.prototype._contextLoaded = function(context) {
// We have to display user info in popup.
context.displayuser = true;
M.util.js_pending('report_competency/grading_popup:_contextLoaded');
return $.when(
str.get_string('usercompetencysummary', 'report_competency'),
templates.render('tool_lp/user_competency_summary_in_course', context)
)
.then(function(title, templateData) {
return new Dialogue(
title,
templateData[0],
function() {
templates.runTemplateJS(templateData[1]);
M.util.js_complete('report_competency/grading_popup:_contextLoaded');
},
this._refresh.bind(this),
true
);
}.bind(this));
};
/**
* Refresh the page.
*
* @method _refresh
* @returns {Promise}
*/
GradingPopup.prototype._refresh = function() {
var region = $(this._regionSelector);
var courseId = region.data('courseid');
var moduleId = region.data('moduleid');
var userId = region.data('userid');
// The module id is expected to be an integer, so don't pass empty string.
if (moduleId === '') {
moduleId = 0;
}
return ajax.call([{
methodname: 'report_competency_data_for_report',
args: {courseid: courseId, userid: userId, moduleid: moduleId},
done: this._pageContextLoaded.bind(this),
fail: notification.exception
}]);
};
/**
* We loaded the context, now render the template.
*
* @method _pageContextLoaded
* @param {Object} context
*/
GradingPopup.prototype._pageContextLoaded = function(context) {
templates.render('report_competency/report', context)
.then(function(html, js) {
templates.replaceNode(this._regionSelector, html, js);
return;
}.bind(this))
.catch(notification.exception);
};
/** @property {String} The selector for the region with the user competencies */
GradingPopup.prototype._regionSelector = null;
/** @property {String} The selector for the region with a single user competencies */
GradingPopup.prototype._userCompetencySelector = null;
return GradingPopup;
});
@@ -0,0 +1,85 @@
// 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 navigation between users in a course.
*
* @module report_competency/user_course_navigation
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery'], function($) {
/**
* UserCourseNavigation
*
* @class report_competency/user_course_navigation
* @param {String} userSelector The selector of the user element.
* @param {String} moduleSelector The selector of the module element.
* @param {String} baseUrl The base url for the page (no params).
* @param {Number} userId The course id
* @param {Number} courseId The user id
* @param {Number} moduleId The activity module (filter)
*/
var UserCourseNavigation = function(userSelector, moduleSelector, baseUrl, userId, courseId, moduleId) {
this._baseUrl = baseUrl;
this._userId = userId + '';
this._courseId = courseId;
this._moduleId = moduleId;
$(userSelector).on('change', this._userChanged.bind(this));
$(moduleSelector).on('change', this._moduleChanged.bind(this));
};
/**
* The user was changed in the select list.
*
* @method _userChanged
* @param {Event} e the event
*/
UserCourseNavigation.prototype._userChanged = function(e) {
// Note: This change causes a page reload and is intentionally not paired with a js_complete call.
M.util.js_pending('report_competency/user_course_navigation:_userChanged');
var newUserId = $(e.target).val();
var queryStr = '?user=' + newUserId + '&id=' + this._courseId + '&mod=' + this._moduleId;
document.location = this._baseUrl + queryStr;
};
/**
* The module was changed in the select list.
*
* @method _moduleChanged
* @param {Event} e the event
*/
UserCourseNavigation.prototype._moduleChanged = function(e) {
// Note: This change causes a page reload and is intentionally not paired with a js_complete call.
M.util.js_pending('report_competency/user_course_navigation:_moduleChanged');
var newModuleId = $(e.target).val();
var queryStr = '?mod=' + newModuleId + '&id=' + this._courseId + '&user=' + this._userId;
document.location = this._baseUrl + queryStr;
};
/** @property {Number} The id of the user. */
UserCourseNavigation.prototype._userId = null;
/** @property {Number} The id of the module. */
UserCourseNavigation.prototype._moduleId = null;
/** @property {Number} The id of the course. */
UserCourseNavigation.prototype._courseId = null;
/** @property {String} Plugin base url. */
UserCourseNavigation.prototype._baseUrl = null;
return UserCourseNavigation;
});
+121
View File
@@ -0,0 +1,121 @@
<?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/>.
namespace report_competency;
use context_course;
use core_competency\external\user_competency_course_exporter;
use core_course\external\course_summary_exporter;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_multiple_structure;
use core_external\external_single_structure;
use core_external\external_value;
use core_user\external\user_summary_exporter;
use tool_lp\external\competency_summary_exporter;
/**
* This is the external API for this report.
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class external extends external_api {
/**
* Returns description of data_for_competency_frameworks_manage_page() parameters.
*
* @return external_function_parameters
*/
public static function data_for_report_parameters() {
$courseid = new external_value(
PARAM_INT,
'The course id',
VALUE_REQUIRED
);
$userid = new external_value(
PARAM_INT,
'The user id',
VALUE_REQUIRED
);
$moduleid = new external_value(
PARAM_INT,
'The module id',
VALUE_REQUIRED
);
$params = array(
'courseid' => $courseid,
'userid' => $userid,
'moduleid' => $moduleid,
);
return new external_function_parameters($params);
}
/**
* Loads the data required to render the report.
*
* @param int $courseid The course id
* @param int $userid The user id
* @param int $moduleid The module id
* @return \stdClass
*/
public static function data_for_report($courseid, $userid, $moduleid) {
global $PAGE;
$params = self::validate_parameters(
self::data_for_report_parameters(),
array(
'courseid' => $courseid,
'userid' => $userid,
'moduleid' => $moduleid
)
);
$context = context_course::instance($params['courseid']);
self::validate_context($context);
if (!is_enrolled($context, $params['userid'], 'moodle/competency:coursecompetencygradable')) {
throw new coding_exception('invaliduser');
}
$renderable = new output\report($params['courseid'], $params['userid'], $params['moduleid']);
$renderer = $PAGE->get_renderer('report_competency');
$data = $renderable->export_for_template($renderer);
return $data;
}
/**
* Returns description of data_for_report() result value.
*
* @return external_description
*/
public static function data_for_report_returns() {
return new external_single_structure(array (
'courseid' => new external_value(PARAM_INT, 'Course id'),
'user' => user_summary_exporter::get_read_structure(),
'course' => course_summary_exporter::get_read_structure(),
'usercompetencies' => new external_multiple_structure(
new external_single_structure(array(
'usercompetencycourse' => user_competency_course_exporter::get_read_structure(),
'competency' => competency_summary_exporter::get_read_structure()
))
),
'pushratingstouserplans' => new external_value(PARAM_BOOL, 'True if rating is push to user plans')
));
}
}
@@ -0,0 +1,98 @@
<?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/>.
/**
* Renderer class for report_competency
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace report_competency\output;
defined('MOODLE_INTERNAL') || die;
use plugin_renderer_base;
use renderable;
/**
* Renderer class for competency breakdown report
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends plugin_renderer_base {
/**
* Defer to template.
*
* @param report $page
* @return string html for the page
*/
public function render_report(report $page) {
$data = $page->export_for_template($this);
return parent::render_from_template('report_competency/report', $data);
}
/**
* Defer to template.
*
* @param user_course_navigation $nav
* @return string
*/
public function render_user_course_navigation(user_course_navigation $nav) {
$data = $nav->export_for_template($this);
return parent::render_from_template('report_competency/user_course_navigation', $data);
}
/**
* Output a nofication.
*
* @param string $message the message to print out
* @return string HTML fragment.
* @see \core\output\notification
*/
public function notify_message($message) {
$n = new \core\output\notification($message, \core\output\notification::NOTIFY_INFO);
return $this->render($n);
}
/**
* Output an error notification.
*
* @param string $message the message to print out
* @return string HTML fragment.
* @see \core\output\notification
*/
public function notify_problem($message) {
$n = new \core\output\notification($message, \core\output\notification::NOTIFY_ERROR);
return $this->render($n);
}
/**
* Output a success notification.
*
* @param string $message the message to print out
* @return string HTML fragment.
* @see \core\output\notification
*/
public function notify_success($message) {
$n = new \core\output\notification($message, \core\output\notification::NOTIFY_SUCCESS);
return $this->render($n);
}
}
+157
View File
@@ -0,0 +1,157 @@
<?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 containing data for learning plan template competencies page
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace report_competency\output;
use context_course;
use renderable;
use core_user;
use templatable;
use renderer_base;
use moodle_url;
use stdClass;
use core_competency\api;
use core_competency\external\user_competency_course_exporter;
use core_user\external\user_summary_exporter;
use core_competency\external\performance_helper;
use core_competency\url;
use core_competency\user_competency;
use tool_lp\external\competency_summary_exporter;
use core_course\external\course_summary_exporter;
/**
* Class containing data for learning plan template competencies page
*
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class report implements renderable, templatable {
/** @var context $context */
protected $context;
/** @var int $courseid */
protected $courseid;
/** @var int $moduleid */
protected $moduleid;
/** @var array $competencies */
protected $competencies;
/** @var int The user id */
protected $userid;
/**
* Construct this renderable.
*
* @param int $courseid The course id
* @param int $userid The user id
* @param int $moduleid The module id
*/
public function __construct($courseid, $userid, $moduleid) {
$this->courseid = $courseid;
$this->userid = $userid;
$this->moduleid = $moduleid;
$this->context = context_course::instance($courseid);
}
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param \renderer_base $output
* @return stdClass
*/
public function export_for_template(renderer_base $output) {
global $DB;
$data = new stdClass();
$data->courseid = $this->courseid;
$data->moduleid = $this->moduleid;
if (empty($data->moduleid)) {
$data->moduleid = 0;
}
$course = $DB->get_record('course', array('id' => $this->courseid));
$coursecontext = context_course::instance($course->id);
$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->usercompetencies = array();
$user = core_user::get_user($this->userid);
$exporter = new user_summary_exporter($user);
$data->user = $exporter->export($output);
$data->usercompetencies = array();
$coursecompetencies = api::list_course_competencies($this->courseid);
$usercompetencycourses = api::list_user_competencies_in_course($this->courseid, $user->id);
if ($this->moduleid > 0) {
$modulecompetencies = api::list_course_module_competencies_in_course_module($this->moduleid);
foreach ($usercompetencycourses as $ucid => $usercompetency) {
$found = false;
foreach ($modulecompetencies as $mcid => $modulecompetency) {
if ($modulecompetency->get('competencyid') == $usercompetency->get('competencyid')) {
$found = true;
break;
}
}
if (!$found) {
// We need to filter out this competency.
unset($usercompetencycourses[$ucid]);
}
}
}
$helper = new performance_helper();
foreach ($usercompetencycourses as $usercompetencycourse) {
$onerow = new stdClass();
$competency = null;
foreach ($coursecompetencies as $coursecompetency) {
if ($coursecompetency['competency']->get('id') == $usercompetencycourse->get('competencyid')) {
$competency = $coursecompetency['competency'];
break;
}
}
if (!$competency) {
continue;
}
$framework = $helper->get_framework_from_competency($competency);
$scale = $helper->get_scale_from_competency($competency);
$exporter = new user_competency_course_exporter($usercompetencycourse, array('scale' => $scale));
$record = $exporter->export($output);
$onerow->usercompetencycourse = $record;
$exporter = new competency_summary_exporter(null, array(
'competency' => $competency,
'framework' => $framework,
'context' => $framework->get_context(),
'relatedcompetencies' => array(),
'linkedcourses' => array()
));
$onerow->competency = $exporter->export($output);
array_push($data->usercompetencies, $onerow);
}
return $data;
}
}
@@ -0,0 +1,146 @@
<?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 navigation class.
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace report_competency\output;
use renderable;
use renderer_base;
use templatable;
use context_course;
use core_user\external\user_summary_exporter;
use core_course\external\course_module_summary_exporter;
use stdClass;
/**
* User course navigation class.
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_course_navigation implements renderable, templatable {
/** @var userid */
protected $userid;
/** @var courseid */
protected $courseid;
/** @var moduleid */
protected $moduleid;
/** @var baseurl */
protected $baseurl;
/**
* Construct.
*
* @param int $userid
* @param int $courseid
* @param int $moduleid
* @param string $baseurl
*/
public function __construct($userid, $courseid, $baseurl, $moduleid) {
$this->userid = $userid;
$this->courseid = $courseid;
$this->moduleid = $moduleid;
$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->courseid = $this->courseid;
$data->moduleid = $this->moduleid;
if (empty($data->moduleid)) {
// Moduleid is optional.
$data->moduleid = 0;
}
$data->baseurl = $this->baseurl;
$data->groupselector = '';
if (has_any_capability(array('moodle/competency:usercompetencyview', 'moodle/competency:coursecompetencymanage'),
$context)) {
$course = $DB->get_record('course', array('id' => $this->courseid));
$currentgroup = groups_get_course_group($course, true);
if ($currentgroup !== false) {
$select = groups_allgroups_course_menu($course, $PAGE->url, true, $currentgroup);
$data->groupselector = $select;
}
// 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);
$users = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup,
'u.*', null, 0, 0, $showonlyactiveenrol);
$data->users = array();
foreach ($users as $user) {
$data->users[] = (object)[
'id' => $user->id,
'fullname' => fullname($user, has_capability('moodle/site:viewfullnames', $context)),
'selected' => $user->id == $this->userid
];
}
$data->hasusers = true;
$data->hasmodules = true;
$data->modules = array();
$empty = (object)['id' => 0, 'name' => get_string('nofiltersapplied')];
$data->modules[] = $empty;
$modinfo = get_fast_modinfo($this->courseid);
foreach ($modinfo->get_cms() as $cm) {
if ($cm->uservisible) {
$exporter = new course_module_summary_exporter(null, ['cm' => $cm]);
$module = $exporter->export($output);
if ($module->id == $this->moduleid) {
$module->selected = true;
}
$data->modules[] = $module;
$data->hasmodules = true;
}
}
} else {
$data->users = array();
$data->hasusers = false;
}
return $data;
}
}
@@ -0,0 +1,46 @@
<?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/>.
/**
* Privacy Subsystem implementation for report_competency.
*
* @package report_competency
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace report_competency\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for report_competency implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
+43
View File
@@ -0,0 +1,43 @@
<?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/>.
/**
* Competency report webservice functions
*
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$functions = array(
// Learning plan related functions.
'report_competency_data_for_report' => array(
'classname' => 'report_competency\external',
'methodname' => 'data_for_report',
'classpath' => '',
'description' => 'Load the data for the competency report in a course.',
'type' => 'read',
'capabilities' => 'moodle/competency:coursecompetencyview',
'ajax' => true,
)
);
+107
View File
@@ -0,0 +1,107 @@
<?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/>.
/**
* This page lets users to manage site wide competencies.
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use core\report_helper;
require_once(__DIR__ . '/../../config.php');
$id = required_param('id', PARAM_INT);
$params = array('id' => $id);
$course = $DB->get_record('course', $params, '*', MUST_EXIST);
require_login($course);
$context = context_course::instance($course->id);
$currentuser = optional_param('user', null, PARAM_INT);
$currentmodule = optional_param('mod', null, PARAM_INT);
if ($currentmodule > 0) {
$cm = get_coursemodule_from_id('', $currentmodule, 0, false, MUST_EXIST);
$context = context_module::instance($cm->id);
}
// Fetch current active group.
$groupmode = groups_get_course_groupmode($course);
$currentgroup = groups_get_course_group($course, true);
if (empty($currentuser)) {
$gradable = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.id', null, 0, 1);
if (empty($gradable)) {
$currentuser = 0;
} else {
$currentuser = array_pop($gradable)->id;
}
} else {
$gradable = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.id');
if (count($gradable) == 0) {
$currentuser = 0;
} else if (!in_array($currentuser, array_keys($gradable))) {
$currentuser = array_shift($gradable)->id;
}
}
$urlparams = array('id' => $id);
$navurl = new moodle_url('/report/competency/index.php', $urlparams);
$urlparams['user'] = $currentuser;
$urlparams['mod'] = $currentmodule;
$url = new moodle_url('/report/competency/index.php', $urlparams);
$title = get_string('pluginname', 'report_competency');
$coursename = format_string($course->fullname, true, array('context' => $context));
$PAGE->navigation->override_active_url($navurl);
$PAGE->set_url($url);
$PAGE->set_title($title);
$PAGE->set_heading($coursename);
$PAGE->set_pagelayout('incourse');
$output = $PAGE->get_renderer('report_competency');
echo $output->header();
$pluginname = get_string('pluginname', 'report_competency');
report_helper::print_report_selector($pluginname);
$baseurl = new moodle_url('/report/competency/index.php');
$nav = new \report_competency\output\user_course_navigation($currentuser, $course->id, $baseurl, $currentmodule);
$top = $output->render($nav);
if ($currentuser > 0) {
$user = core_user::get_user($currentuser);
$usercontext = context_user::instance($currentuser);
$userheading = array(
'heading' => fullname($user, has_capability('moodle/site:viewfullnames', $context)),
'user' => $user,
'usercontext' => $usercontext
);
if ($currentmodule > 0) {
$title = get_string('filtermodule', 'report_competency', format_string($cm->name));
}
$top .= $output->context_header($userheading, 3);
}
echo $output->container($top, 'clearfix');
if ($currentuser > 0) {
$page = new \report_competency\output\report($course->id, $currentuser, $currentmodule);
echo $output->render($page);
} else {
echo $output->container('', 'clearfix');
echo $output->notify_problem(get_string('noparticipants', 'tool_lp'));
}
echo $output->footer();
@@ -0,0 +1,32 @@
<?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/>.
/**
* Strings for component 'report_competency', language 'en'
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['competency'] = 'Competency';
$string['coursecompetencybreakdownsummary'] = 'A report of all the students in the course, and their progress towards the course competencies';
$string['notrated'] = 'Not rated';
$string['pluginname'] = 'Competency breakdown';
$string['rating'] = 'Rating';
$string['filtermodule'] = 'Competencies linked to "{$a}"';
$string['usercompetencysummary'] = 'User competency summary';
$string['privacy:metadata'] = 'The Competency breakdown plugin does not store any personal data.';
+66
View File
@@ -0,0 +1,66 @@
<?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/>.
/**
* Public API of the competency report.
*
* Defines the APIs used by competency reports
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
/**
* This function extends the navigation with the report items
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $course The course to object for the report
* @param stdClass $context The context of the course
*/
function report_competency_extend_navigation_course($navigation, $course, $context) {
if (!get_config('core_competency', 'enabled')) {
return;
}
if (has_capability('moodle/competency:coursecompetencyview', $context)) {
$url = new moodle_url('/report/competency/index.php', array('id' => $course->id));
$name = get_string('pluginname', 'report_competency');
$navigation->add($name, $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
}
}
/**
* This function extends the navigation with the report items
*
* @param navigation_node $navigation The navigation node to extend
* @param cminfo $cm The course module.
*/
function report_competency_extend_navigation_module($navigation, $cm) {
if (!get_config('core_competency', 'enabled')) {
return;
}
if (has_any_capability(array('moodle/competency:usercompetencyview', 'moodle/competency:coursecompetencymanage'),
context_course::instance($cm->course))) {
$url = new moodle_url('/report/competency/index.php', array('id' => $cm->course, 'mod' => $cm->id));
$name = get_string('pluginname', 'report_competency');
$navigation->add($name, $url, navigation_node::TYPE_SETTING, null, 'competencybreakdown',
new pix_icon('i/competencies', ''))->set_show_in_secondary_navigation(false);
}
}
@@ -0,0 +1,82 @@
{{!
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 report_competency/report
Moodle template competency breakdown report.
This template includes ajax functionality, so it cannot be shown in the template library.
}}
<div data-region="competency-breakdown-report" data-courseid="{{course.id}}" data-userid="{{user.id}}" data-moduleid="{{moduleid}}">
<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 class="row">
<span class="col-md-6">
<table class="table table-bordered">
<summary class="accesshide">
<p>{{#str}}coursecompetencybreakdownsummary, report_competency{{/str}}</p>
</summary>
<tr>
<th scope="col">
<span>{{#str}}competency, report_competency{{/str}}</span>
</th>
<th scope="col">
<span>{{#str}}rating, report_competency{{/str}}</span>
</th>
</tr>
{{#usercompetencies}}
<tr>
{{#competency}}
<td>
<a href="#" data-action="competency-dialogue" data-id="{{competency.id}}">
{{{competency.shortname}}} <em data-id="{{competency.id}}">{{competency.idnumber}}</em>
</a>
</td>
{{/competency}}
{{#usercompetencycourse}}
<td class="alert {{#proficiency}}alert-success{{/proficiency}}"
data-user-competency="true"
data-userid="{{user.id}}"
data-competencyid="{{competencyid}}"
data-courseid="{{course.id}}">
{{> report_competency/user_competency_summary}}
</td>
{{/usercompetencycourse}}
</tr>
{{/usercompetencies}}
</table>
</span>
</div>
</div>
{{#js}}
require(['tool_lp/competencydialogue'], function(Compdialogue) {
Compdialogue.init();
});
require(['report_competency/grading_popup'], function(Popup) {
(new Popup('[data-region=competency-breakdown-report]', '[data-user-competency=true]'));
});
{{/js}}
@@ -0,0 +1,4 @@
<a href="#" title="{{#str}}usercompetencysummary, report_competency{{/str}}">
{{#grade}}{{gradename}}{{/grade}}
{{^grade}}{{#str}}notrated, report_competency{{/str}}{{/grade}}
</a>
@@ -0,0 +1,64 @@
{{!
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 report_competency/user_course_navigation
Moodle navigation control allowing to jump to a user or filter to an activity.
Example context (json):
{ "hasusers": false, "hasmodules": false}
}}
<div class="float-right border p-2 mb-2">
<p>{{{groupselector}}}</p>
<form class="user-competency-course-navigation">
<input type="hidden" name="user" value="{{userid}}"/>
<input type="hidden" name="id" value="{{courseid}}"/>
<input type="hidden" name="mod" value="{{moduleid}}"/>
{{#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}}
{{#hasmodules}}
<span>
<label for="module-nav-{{uniqid}}" class="accesshide">{{#str}}filterbyactivity, tool_lp{{/str}}</label>
<select id="module-nav-{{uniqid}}">
{{#modules}}
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{name}}</option>
{{/modules}}
</select>
</span>
{{/hasmodules}}
</form>
</div>
{{#js}}
require(['core/form-autocomplete', 'report_competency/user_course_navigation'], function(autocomplete, nav) {
(new nav('#user-nav-{{uniqid}}', '#module-nav-{{uniqid}}', '{{baseurl}}', {{userid}}, {{courseid}}, {{moduleid}}));
{{#hasusers}}
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, {{# quote }}{{# str }}jumptouser, tool_lp{{/ str }}{{/ quote }});
{{/hasusers}}
{{#hasmodules}}
autocomplete.enhance('#module-nav-{{uniqid}}', false, false, {{# quote }}{{# str }}filterbyactivity, tool_lp{{/ str }}{{/ quote }});
{{/hasmodules}}
});
{{/js}}
@@ -0,0 +1,79 @@
<?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/>.
/**
* Behat competency report definitions.
*
* @package report_competency
* @category test
* @copyright 2022 Noel De Martin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
/**
* Competency report definitions.
*
* @package report_competency
* @category test
* @copyright 2022 Noel De Martin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_report_competency extends behat_base {
/**
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
*
* Recognised page names are:
* | pagetype | name meaning | description |
* | Breakdown | Course name | The course competencies breakdown page |
*
* @param string $page identifies which type of page this is, e.g. 'Breakdown'.
* @param string $identifier identifies the particular page, e.g. 'C1'.
* @return moodle_url the corresponding URL.
* @throws Exception with a meaningful error message if the specified page cannot be found.
*/
protected function resolve_page_instance_url(string $page, string $identifier): moodle_url {
switch (strtolower($page)) {
case 'breakdown':
$courseid = $this->get_course_id($identifier);
return new moodle_url('/report/competency/index.php', [
'id' => $courseid,
]);
default:
throw new Exception("Unrecognised page type '{$page}'");
}
}
/**
* Return a list of the exact named selectors for the component.
*
* @return behat_component_named_selector[]
*/
public static function get_exact_named_selectors(): array {
return [
new behat_component_named_selector('breakdown', [
"//*[@data-region='competency-breakdown-report']//table".
"//tr[contains(., //a[@data-action='competency-dialogue'][contains(., %locator%)])]",
]),
new behat_component_named_selector('breakdown rating', [
"//td[position()=2][contains(., //a[@title='User competency summary'][contains(., %locator%)])]",
]),
];
}
}
@@ -0,0 +1,74 @@
@report @javascript @report_competency
Feature: See the competencies for an activity
As a competency grader
In order to perform mark all competencies for an activity
I need to see the competencies linked to one activity in the breakdown report.
Background:
Given the following lp "frameworks" exist:
| shortname | idnumber |
| Test-Framework | ID-FW1 |
And the following lp "competencies" exist:
| shortname | framework |
| Test-Comp1 | ID-FW1 |
| Test-Comp2 | ID-FW1 |
Given the following "courses" exist:
| shortname | fullname |
| C1 | Course 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
| student1 | Grainne | Beauchamp | student1@example.com | s1 | Ann | Jill | Gronya | Beecham |
| student2 | Niamh | Cholmondely | student2@example.com | s2 | Jane | Nina | Nee | Chumlee |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber |
| page | PageName1 | PageDesc1 | C1 | PAGE1 |
And the following config values are set as admin:
| fullnamedisplay | firstname |
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Competencies" in current page administration
And I press "Add competencies to course"
And "Competency picker" "dialogue" should be visible
And I select "Test-Comp1" of the competency tree
And I click on "Add" "button" in the "Competency picker" "dialogue"
And I press "Add competencies to course"
And "Competency picker" "dialogue" should be visible
And I select "Test-Comp2" of the competency tree
And I click on "Add" "button" in the "Competency picker" "dialogue"
And I am on the PageName1 "page activity editing" page
And I click on "Expand all" "link" in the "region-main" "region"
And I set the field "Course competencies" to "Test-Comp1"
And I press "Save and return to course"
@javascript
Scenario: Go to the competency breakdown report
When I navigate to "Reports" in current page administration
And I click on "Competency breakdown" "link"
And I set the field "Filter competencies by resource or activity" to "PageName1"
Then I should see "Test-Comp1"
And I should not see "Test-Comp2"
And I should see "Ann, Jill, Grainne, Beauchamp"
And I should see "Ann, Jill, Grainne, Beauchamp" in the ".form-autocomplete-selection" "css_element"
And I open the autocomplete suggestions list
And I should see "Jane, Nina, Niamh, Cholmondely" in the ".form-autocomplete-suggestions" "css_element"
And I click on "Not rated" "link"
And I click on "Rate" "button"
And I set the field "Rating" to "A"
And I click on "Rate" "button" in the ".competency-grader" "css_element"
And I click on "Close" "button" in the "User competency summary" "dialogue"
And I click on "PageName1" "autocomplete_selection"
And I should see "Test-Comp1"
And I should see "Test-Comp2"
@accessibility
Scenario: Evaluate the accessibility of the user competency summary dialogue
Given I navigate to "Reports" in current page administration
When I click on "Competency breakdown" "link"
And I click on "Not rated" "link"
And the page should meet accessibility standards
@@ -0,0 +1,26 @@
@report @report_competency
Feature: In a course administration page, navigate through report page, test for course competency page
In order to navigate through report page
As an admin
Go to course administration -> reports -> competency breackdown
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| admin | C1 | editingteacher |
| student1 | C1 | student |
@javascript
Scenario: Selector should be available in the course competency page
Given I log in as "admin"
And I am on "Course 1" course homepage
When I navigate to "Reports" in current page administration
And I click on "Competency breakdown" "link"
Then "Report" "field" should exist in the "tertiary-navigation" "region"
And I should see "Competency breakdown" in the "tertiary-navigation" "region"
+33
View File
@@ -0,0 +1,33 @@
<?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/>.
/**
* Plugin version info
*
* @package report_competency
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2024042200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'report_competency'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = [
'tool_lp' => ANY_VERSION,
];