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
@@ -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 tool_analytics/evaluation_options
Evaluation selector.
The purpose of this template is to render the evaluation mode options.
Classes required for JS:
* none
Data attributes required for JS:
* none
Example context (json):
{
"trainedexternally": "1",
"timesplittingmethods": [
{
"id": "ou",
"name": "Quarters"
}, {
"id": "yeah",
"name": "Tenths"
}
]
}
}}
{{#trainedexternally}}
<div class="box mb-4">{{#str}} evaluationmodeinfo, tool_analytics {{/str}}</div>
<div class="custom-control custom-radio">
<input class="custom-control-input" type="radio" name="evaluationmode" id="id-mode-trainedmodel" value="trainedmodel" checked>
<label class="custom-control-label" for="id-mode-trainedmodel">{{#str}} evaluationmodetrainedmodel, tool_analytics {{/str}}</label>
</div>
<div class="custom-control custom-radio">
<input class="custom-control-input" type="radio" name="evaluationmode" id="id-mode-configuration" value="configuration">
<label class="custom-control-label" for="id-mode-configuration">{{#str}} evaluationmodeconfiguration, tool_analytics {{/str}}</label>
</div>
{{/trainedexternally}}
{{! Hidden by default if #trainedexternally as the default option is trainedmodel in this case.}}
<div id="id-evaluation-timesplitting-container" class="mt-3 {{#trainedexternally}}hidden{{/trainedexternally}}">
{{#str}} selecttimesplittingforevaluation, tool_analytics {{/str}}
<div>
<select id="id-evaluation-timesplitting" name="timesplitting" class="custom-select mt-3">
{{#timesplittingmethods}}
<option value="{{id}}">{{text}}</option>
{{/timesplittingmethods}}
</select>
</div>
</div>
{{#js}}
require(['jquery'], function($) {
$("input[name='evaluationmode']:radio").change(function() {
if ($(this).val() == 'configuration') {
$('#id-evaluation-timesplitting-container').show();
} else {
$('#id-evaluation-timesplitting-container').hide();
}
});
});
{{/js}}
@@ -0,0 +1,57 @@
{{!
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_analytics/export_options
Export options.
The purpose of this template is to render the exporting options.
Classes required for JS:
* none
Data attributes required for JS:
* none
Example context (json):
{
}
}}
<div class="custom-control custom-radio">
<input class="custom-control-input" type="radio" name="exportoption" id="id-mode-exportdata" value="exportdata">
<label class="custom-control-label" for="id-mode-exportdata">{{#str}} exporttrainingdata, tool_analytics {{/str}}</label>
</div>
<div class="custom-control custom-radio">
<input class="custom-control-input" type="radio" name="exportoption" id="id-mode-exportmodel" value="exportmodel" checked>
<label class="custom-control-label" for="id-mode-exportmodel">{{#str}} exportmodel, tool_analytics {{/str}}</label>
</div>
<div class="custom-control custom-checkbox ml-5" id="id-includeweights-container">
<input class="custom-control-input" type="checkbox" id="id-includeweights" value="1" checked>
<label class="custom-control-label" for="id-includeweights">{{#str}} exportincludeweights, tool_analytics {{/str}}</label>
</div>
{{#js}}
require(['jquery'], function($) {
$("input[name='exportoption']:radio").change(function() {
if ($(this).val() == 'exportdata') {
$('#id-includeweights-container').hide();
} else {
$('#id-includeweights-container').show();
}
});
});
{{/js}}
@@ -0,0 +1,65 @@
{{!
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_analytics/insights_report
Template for the insights report.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* none
Example context (json):
{
"modelname": "Not engaging courses",
"noactions": {
"message": "Users have not executed any actions on the generated insights.",
"announce": "true"
}
}
}}
<div class="box">
<h3>{{#str}}actionsexecutedbyusersfor, tool_analytics, {{modelname}}{{/str}}</h3>
{{#contextselect}}
<div class="mt-3">
{{> core/single_select }}
</div>
{{/contextselect}}
{{#noactions}}
<div class="mt-3 mb-1">
{{> core/notification_info}}
</div>
{{/noactions}}
{{^noanalysables}}
<div class="row">
<div class="col-xl-6">
{{{separatedchart}}}
</div>
<div class="col-xl-6">
{{{groupedchart}}}
</div>
</div>
{{/noanalysables}}
</div>
@@ -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/>.
}}
{{!
@template tool_analytics/invalid_analysables
Template for invalid analysables.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* none
Example context (json):
{
"modelname": "Not engaging courses",
"analysables": [
{
"url": "<a href=\"#\">Maths</a>",
"validtraining": "Ongoing course",
"validprediction": "Not enough students activity"
}, {
"url": "<a href=\"#\">Psichology</a>",
"validtraining": "No students",
"validprediction": "No students"
}
]
}
}}
<div class="box">
<h3>{{#str}}modelinvalidanalysables, tool_analytics, {{modelname}}{{/str}}</h3>
<div>{{#str}}invalidanalysablesinfo, tool_analytics{{/str}}</div>
{{#noanalysables}}
<div class="mt-2 mb-1">
{{> core/notification_info}}
</div>
{{/noanalysables}}
{{^noanalysables}}
<div class="mt-2 mb-1">
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
</div>
<table class="generaltable fullwidth">
<caption class="accesshide">{{#str}}invalidanalysablestable, tool_analytics{{/str}}</caption>
<thead>
<tr>
<th scope="col">{{#str}}name{{/str}}</th>
<th scope="col">{{#str}}invalidtraining, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}invalidprediction, tool_analytics{{/str}}</th>
</tr>
</thead>
<tbody>
{{#analysables}}
<tr>
<td>{{{url}}}</td>
<td>{{validtraining}}</td>
<td>{{validprediction}}</td>
</tr>
{{/analysables}}
</tbody>
</table>
<div class="mt-1 mb-2">
<span>{{#prev}}{{> core/single_button}}{{/prev}}</span>
<span>{{#next}}{{> core/single_button}}{{/next}}</span>
</div>
{{/noanalysables}}
</div>
@@ -0,0 +1,260 @@
{{!
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_analytics/models_list
Template for models list.
Classes required for JS:
* The list od models wrapped within a id="predictionmodelslist" element.
Data attributes required for JS:
* [data-widget="toggle"] indicates the clickable element for expanding/collapsing
the list of indicators used by the given model.
* [data-model-name="..."] should be provided by an element wrapping the model's actions menu
and contain the plain text name of the model.
Context variables required for this template:
* models: array - list of models to display
- id: int - model unique identifier
- modelname: string - name of the model
- name: object - data for the inplace editable element template
- target: string - name of the target associated with the model
- targetclass: string - fully qualified name of the target class
- targethelp: object - data for the help tooltip template
- enabled: bool - is the model enabled
- indicatorsnum: int - number of indicators
- indicators: array - list of indicators used by the model
+ name: string - name of the indicator
+ help: object - data for the help tooltip template
- insights: object - data for the single select template
- noinsights: string - text to display instead of insights
* warnings: array - list of data for notification warning template
* infos: array - list of data for notification info template
* createmodelurl: string - URL to create a new model
* importmodelurl: string - URL to import a model
Example context (json):
{
"models": [
{
"id": 11,
"modelname": "Prevent devs at risk",
"name": {
"component": "local_analyticsdemo",
"itemtype": "modelname",
"itemid": 42,
"displayvalue": "Prevent devs at risk",
"value": ""
},
"target": "Prevent devs at risk",
"targetclass": "\\local_analyticsdemo\\analytics\\target\\dev_risk",
"targethelp": {
"title": "Help with Prevent devs at risk",
"text": "This target blah blah ...",
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
}
},
"enabled": 1,
"indicatorsnum": 2,
"indicators": [
{
"name": "Indicator 1",
"help": {
"text": "This indicator blah blah ...",
"title": "Help with Indicator 1",
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
}
}
},
{
"name": "Indicator 2",
"help": {
"text": "This indicator blah blah ...",
"title": "Help with Indicator 2",
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
}
}
}
],
"timesplitting": "Quarters",
"timesplittinghelp": {
"text": "This time splitting methof blah blah ...",
"title": "Help with Quarters",
"url": "http://example.org/help",
"linktext": "",
"icon": {
"extraclasses": "iconhelp",
"attributes": [
{"name": "src", "value": "../../../pix/help.svg"},
{"name": "alt", "value": "Help icon"}
]
}
},
"noinsights": "No insights available yet"
}
],
"warnings": [
{
"message": "Be ware, this is just an example!"
}
],
"createmodelurl": "#",
"importmodelurl": "#"
}
}}
{{#warnings}}
{{> core/notification_warning}}
{{/warnings}}
{{#infos}}
{{> core/notification_info}}
{{/infos}}
<div class="box">
<div class="top-nav d-flex">
{{#newmodelmenu}}
{{>core/action_menu}}
{{/newmodelmenu}}
</div>
<table id="predictionmodelslist" class="generaltable fullwidth">
<caption>{{#str}}analyticmodels, tool_analytics{{/str}}</caption>
<thead>
<tr>
<th scope="col">{{#str}}modelname, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}enabled, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}indicators, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}modeltimesplitting, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}insights, tool_analytics{{/str}}</th>
<th scope="col">{{#str}}actions{{/str}}</th>
</tr>
</thead>
<tbody>
{{#models}}
<tr data-model-name="{{modelname}}">
<td>
{{#name}}
<span class="model-name">{{>core/inplace_editable}}</span>
{{/name}}
<div>
<small class="target-class">{{targetclass}}</small>
{{#targethelp}}
{{>core/help_icon}}
{{/targethelp}}
</div>
</td>
<td>
{{#enabled}}
{{#pix}}i/checked, core, {{#str}}yes{{/str}}{{/pix}}
{{/enabled}}
{{^enabled}}
{{#str}}no{{/str}}
{{/enabled}}
</td>
<td>
<a data-widget="toggle"
title="{{#str}} clicktohideshow {{/str}}"
aria-expanded="false"
aria-controls="indicators-{{id}}"
role="button"
href="">
{{#str}} indicatorsnum, tool_analytics, {{indicatorsnum}} {{/str}}
</a>
<ul class="hidden" id="indicators-{{id}}">
{{#indicators}}
<li>
{{name}}
{{#help}}
{{>core/help_icon}}
{{/help}}
</li>
{{/indicators}}
</ul>
</td>
<td>
{{#timesplitting}}
{{timesplitting}}
{{#timesplittinghelp}}
{{>core/help_icon}}
{{/timesplittinghelp}}
{{/timesplitting}}
{{^timesplitting}}
{{#str}}notdefined, tool_analytics{{/str}}
{{#timesplittinghelp}}
{{>core/help_icon}}
{{/timesplittinghelp}}
{{/timesplitting}}
</td>
<td>
{{! models_list renderer is responsible of sending one or the other}}
{{#insights}}
{{> core/single_select }}
{{/insights}}
{{#noinsights}}
{{.}}
{{/noinsights}}
</td>
<td>
{{#actions}}
{{> core/action_menu}}
{{/actions}}
</td>
</tr>
{{/models}}
</tbody>
</table>
</div>
{{#js}}
require(['jquery'], function($) {
// Toggle the visibility of the indicators list.
$('#predictionmodelslist').on('click', '[data-widget="toggle"]', function(e) {
e.preventDefault();
var toggle = $(e.currentTarget);
var listid = toggle.attr('aria-controls');
$(document.getElementById(listid)).toggle();
if (toggle.attr('aria-expanded') == 'false') {
toggle.attr('aria-expanded', 'true');
} else {
toggle.attr('aria-expanded', 'false');
}
});
});
{{/js}}
@@ -0,0 +1,225 @@
{{!
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_analytics/restorable_models
Displays the list of missing prediction models that can be restored.
Classes required for JS:
* The list should be wrapped within a id="restorablemodelslist" element.
Data attributes required for JS:
* [data-widget="toggle"] indicates the clickable element for expanding/collapsing
the list of indicators used by the given model.
* [data-select] indicates a clickable element used for selecting multiple checkboxes.
* [data-component] should be set for checkboxes that select the particular model.
Context variables required for this template:
* hasdata: boolean - do we have data to display
* submiturl: string - URL where the form should be submitted
* backurl: string - URL where the user should be sent without making any changes
* sesskey: string
* components: array - list of components to display
- name: string - human readable name of the component
- component: string - frankenstyle name of the component
- models: array - list of restorable models provided by the component
+ defid: string - model definition identifier
+ targetname: string - human readable name of the target
+ targetclass: string - fully qualified classname of the target
+ indicatorsnum: int - number of indicators
+ indicators: array - list of indicators
~ name: string - human readable name of the indicator
~ classname: string - fully qualified classname of the indicator
Example context (json):
{
"hasdata": true,
"submiturl": "https://example.com/moodle/admin/tool/analytics/restoredefault.php",
"backurl": "https://example.com/moodle/admin/tool/analytics/index.php",
"sesskey": "abcdefg123456",
"components": [
{
"name": "Core",
"component": "core",
"models": [
{
"defid": "id24680aceg",
"targetname": "Courses at risk of not starting",
"targetclass": "\\core\\analytics\\target\\no_teaching",
"indicatorsnum": 2,
"indicators": [
{
"name": "There are no teachers",
"classname": "\\core\\analytics\\indicator\\no_teacher"
},
{
"name": "There are no students",
"classname": "\\core\\analytics\\indicator\\no_students"
}
]
},
{
"defid": "id13579bdfi",
"targetname": "Students at risk of dropping out",
"targetclass": "\\core\\analytics\\target\\course_dropout",
"indicatorsnum": 1,
"indicators": [
{
"name": "Read actions amount",
"classname": "\\core\\analytics\\indicator\\read_actions"
}
]
}
]
},
{
"name": "Custom analytics plugin",
"component": "tool_customanalytics",
"models": [
{
"defid": "id566dsgffg655",
"targetname": "Cheater",
"targetclass": "\\tool_customanalytics\\analytics\\target\\cheater",
"indicatorsnum": 1,
"indicators": [
{
"name": "Copy-pasted submissions",
"classname": "\\tool_customanalytics\\analytics\\indicator\\copy_paster_submissions"
}
]
}
]
}
]
}
}}
<div class="box">
{{^hasdata}}
<p>{{#str}} restoredefaultnone, tool_analytics {{/str}}</p>
<div><a href="{{backurl}}" class="btn btn-secondary">{{#str}} back {{/str}}</a></div>
{{/hasdata}}
{{#hasdata}}
<p>{{#str}} restoredefaultinfo, tool_analytics {{/str}}</p>
<form method="post" action="{{submiturl}}">
<table id="restorablemodelslist" class="generaltable fullwidth">
<colgroup>
<col width="10%">
<col width="45%">
<col width="45%">
</colgroup>
<thead>
<tr>
<th scope="col"><a href="" data-select="*">{{#str}} selectall {{/str}}</a></th>
<th scope="col">{{#str}} target, tool_analytics {{/str}}</th>
<th scope="col">{{#str}} indicators, tool_analytics {{/str}}</th>
</tr>
</thead>
<tbody>
{{#components}}
<tr>
<th scope="rowgroup" colspan="3">
<span class="component-name">
<a href=""
title="{{#str}} componentselect, tool_analytics, {{name}} {{/str}}"
data-select="{{component}}">
{{name}}
</a>
</span>
<div><small class="component-frankenstyle">{{component}}</small></div>
</th>
</tr>
{{#models}}
<tr>
<td>
<input data-component="{{component}}" type="checkbox" name="restoreid[]" value="{{defid}}">
</td>
<td>
<span class="target-name">{{targetname}}</span>
{{#targethelp}}
{{>core/help_icon}}
{{/targethelp}}
<div><small class="target-class">{{targetclass}}</small></div>
</td>
<td>
<a data-widget="toggle"
title="{{#str}} clicktohideshow {{/str}}"
aria-expanded="false"
aria-controls="indicators-{{defid}}"
role="button"
href="">
{{#str}} indicatorsnum, tool_analytics, {{indicatorsnum}} {{/str}}
</a>
<ul class="hidden listunstyled" id="indicators-{{defid}}">
{{#indicators}}
<li>
{{name}}
{{#indicatorhelp}}
{{>core/help_icon}}
{{/indicatorhelp}}
<div><small>{{classname}}</small></div>
</li>
{{/indicators}}
</ul>
</td>
</tr>
{{/models}}
{{/components}}
</tbody>
</table>
<div>
<input class="btn btn-primary" type="submit" value="{{#str}} restoredefaultsubmit, tool_analytics {{/str}}">
<input class="btn btn-secondary" type="reset" value="{{#str}} componentselectnone, tool_analytics {{/str}}">
<a href="{{backurl}}" class="btn btn-secondary">{{#str}} back {{/str}}</a>
<input type="hidden" name="sesskey" value="{{sesskey}}">
</div>
</form>
{{/hasdata}}
</div>
{{#js}}
require(['jquery'], function($) {
// Toggle the visibility of the indicators list.
$('#restorablemodelslist').on('click', '[data-widget="toggle"]', function(e) {
e.preventDefault();
var toggle = $(e.currentTarget);
var listid = toggle.attr('aria-controls');
$(document.getElementById(listid)).toggle();
if (toggle.attr('aria-expanded') == 'false') {
toggle.attr('aria-expanded', 'true');
} else {
toggle.attr('aria-expanded', 'false');
}
});
// Selecting all / all in component checkboxes.
$('#restorablemodelslist').on('click', '[data-select]', function(e) {
e.preventDefault();
var handler = $(e.currentTarget);
var component = handler.attr('data-select');
if (component == '*') {
$('input[data-component]').prop('checked', true);
} else {
$('input[data-component="' + component + '"]').prop('checked', true);
}
});
});
{{/js}}