Implemented student list in viewer grouped by cohort
This commit is contained in:
parent
2967f4a5bb
commit
9fe71f1800
2
amd/build/page-view-plan.min.js
vendored
2
amd/build/page-view-plan.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/report-viewer-components.min.js
vendored
2
amd/build/report-viewer-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/treestudyplan-components.min.js
vendored
2
amd/build/treestudyplan-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -159,7 +159,7 @@ export function init(contextid,categoryid) {
|
|||
app.loadingstudyplan = false;
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_all_associated',
|
||||
methodname: 'local_treestudyplan_all_associated_grouped',
|
||||
args: { studyplan_id: studyplan.id}
|
||||
}])[0].then(function(response){
|
||||
app.associatedstudents = response;
|
||||
|
|
|
@ -524,7 +524,6 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
debug.info(`Counted ${maxLayer+1} layers for ${page.shortname}/${line.name}`);
|
||||
return (maxLayer >= 0)?(maxLayer+1):1;
|
||||
},
|
||||
showslot(page,line,index, layeridx, type){
|
||||
|
|
|
@ -458,8 +458,8 @@ export default {
|
|||
if (this.grouped) {
|
||||
for ( const gix in this.options) {
|
||||
const group = this.options[gix];
|
||||
for ( const ix in group) {
|
||||
const v = this.options[ix];
|
||||
for ( const ix in group[this.optionsfield]) {
|
||||
const v = group[this.optionsfield][ix];
|
||||
f.push(v);
|
||||
}
|
||||
}
|
||||
|
@ -528,17 +528,18 @@ export default {
|
|||
><slot name="defaultlabel">{{text.select}}</slot></b-form-select-option>
|
||||
</b-form-select-option-group>
|
||||
<template v-if="grouped">
|
||||
<b-form-select-option-group
|
||||
v-for="(g,gi) in this.options"
|
||||
:key="gi"
|
||||
:label="g[grouptitlefield]"
|
||||
>
|
||||
<b-form-select-option
|
||||
v-for="(o,i) in g[grouplistfield]"
|
||||
:key="i"
|
||||
:value="o"
|
||||
><slot :value="o">{{o[titlefield]}}</slot></b-form-select-option>
|
||||
</b-form-select-option-group>
|
||||
<template v-for="(g,gi) in this.options">
|
||||
<b-form-select-option-group
|
||||
v-if="g[optionsfield] && g[optionsfield].length > 0"
|
||||
:label="g[labelfield]"
|
||||
>
|
||||
<b-form-select-option
|
||||
v-for="(o,i) in g[optionsfield]"
|
||||
:key="i"
|
||||
:value="o"
|
||||
><slot :value="o">{{o[titlefield]}}</slot></b-form-select-option>
|
||||
</b-form-select-option-group>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<b-form-select-option
|
||||
|
|
|
@ -450,7 +450,8 @@ class associationservice extends \external_api {
|
|||
webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context());
|
||||
|
||||
$sql = "SELECT DISTINCT u.* FROM {user} u INNER JOIN {local_treestudyplan_user} j ON j.user_id = u.id
|
||||
WHERE j.studyplan_id = :studyplan_id";
|
||||
WHERE j.studyplan_id = :studyplan_id
|
||||
ORDER BY u.lastname, u.firstname";
|
||||
$rs = $DB->get_recordset_sql($sql, ['studyplan_id' => $studyplanid]);
|
||||
|
||||
$users = [];
|
||||
|
@ -548,6 +549,71 @@ class associationservice extends \external_api {
|
|||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameter description for webservice function all_associated
|
||||
*/
|
||||
public static function all_associated_grouped_parameters() : \external_function_parameters {
|
||||
return new \external_function_parameters( [
|
||||
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return value description for webservice function all_associated
|
||||
*/
|
||||
public static function all_associated_grouped_returns() : \external_description {
|
||||
return new \external_multiple_structure(new \external_single_structure([
|
||||
'label' => new \external_value(PARAM_TEXT,'group label'),
|
||||
'users' => new \external_multiple_structure(self::user_structure()),
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* List all users associated to a studyplan through either a cohort or directly
|
||||
* @param mixed $studyplanid Id of studyplan
|
||||
* @return array
|
||||
*/
|
||||
public static function all_associated_grouped($studyplanid) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$studyplan = studyplan::find_by_id($studyplanid);
|
||||
webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context());
|
||||
|
||||
$userlist = [
|
||||
[
|
||||
'label' => get_string("individuals",'local_treestudyplan'),
|
||||
'users' => self::associated_users($studyplanid),
|
||||
]
|
||||
];
|
||||
|
||||
$sql = "SELECT DISTINCT c.* FROM {cohort} c INNER JOIN {local_treestudyplan_cohort} j ON j.cohort_id = c.id
|
||||
WHERE j.studyplan_id = :studyplan_id";
|
||||
$crs = $DB->get_recordset_sql($sql, ['studyplan_id' => $studyplanid]);
|
||||
foreach ($crs as $c) {
|
||||
$users = [];
|
||||
$sql = "SELECT DISTINCT u.id, u.username, u.firstname, u.lastname, u.idnumber, u.email
|
||||
FROM {user} u
|
||||
LEFT JOIN {cohort_members} cm ON u.id = cm.userid
|
||||
WHERE cm.cohortid = :cohortid
|
||||
ORDER BY u.lastname, u.firstname";
|
||||
$rs = $DB->get_recordset_sql($sql, ["cohortid" => $c->id]);
|
||||
|
||||
foreach ($rs as $u) {
|
||||
$users[] = self::make_user_model($u);
|
||||
}
|
||||
$rs->close();
|
||||
|
||||
$userlist[] = [
|
||||
'label' => $c->name,
|
||||
'users' => $users,
|
||||
];
|
||||
}
|
||||
$crs->close();
|
||||
|
||||
return $userlist;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort a list of user models by firstname->lastname
|
||||
* @param array $list Reference to list of user models
|
||||
|
|
|
@ -359,6 +359,15 @@ $functions = [
|
|||
'capabilities' => 'local/treestudyplan:viewuserreports',
|
||||
'loginrequired' => true,
|
||||
],
|
||||
'local_treestudyplan_all_associated_grouped' => [ // Web service function name.
|
||||
'classname' => '\local_treestudyplan\associationservice', // Class containing the external function.
|
||||
'methodname' => 'all_associated_grouped', // External function name.
|
||||
'description' => 'List associated users by group',
|
||||
'type' => 'read', // Database rights of the web service function (read, write).
|
||||
'ajax' => true,
|
||||
'capabilities' => 'local/treestudyplan:viewuserreports',
|
||||
'loginrequired' => true,
|
||||
],
|
||||
'local_treestudyplan_list_aggregators' => [ // Web service function name.
|
||||
'classname' => '\local_treestudyplan\studyplanservice', // Class containing the external function.
|
||||
'methodname' => 'list_aggregators', // External function name.
|
||||
|
|
|
@ -427,4 +427,5 @@ $string["not_enrolled"] = "Not enrolled";
|
|||
$string["warning_incomplete_pass"] = 'Completion data was reset for this activity, causing your passing grade not to be registered. Ask your teacher to re-grade this grade to remedy this.';
|
||||
$string["warning_incomplete_nograderq"] = 'Because the grade is not marked as a requirement, your passing grade is not registering completion.';
|
||||
|
||||
$string["error:nosuchcompetency"] = 'Warning: This competency no longer exists';
|
||||
$string["error:nosuchcompetency"] = 'Warning: This competency no longer exists';
|
||||
$string["individuals"] = 'Individuals';
|
|
@ -428,4 +428,5 @@ $string["not_enrolled"] = "Niet ingeschreven";
|
|||
$string["warning_incomplete_pass"] = 'Door een storing wordt je voldoende resultaat niet als voltooid meegenomen. Vraag je docent om opnieuw je beoordeling vast te stellen. ';
|
||||
$string["warning_incomplete_nograderq"] = 'Omdat het behalen van een cijfer niet als voorwaarde is aangegeven, telt het behalen van een voldoende resultaat niet mee voor voitooiing';
|
||||
|
||||
$string["error:nosuchcompetency"] = 'Waarschuwing: deze competentie is niet langer beschikbaar. ';
|
||||
$string["error:nosuchcompetency"] = 'Waarschuwing: deze competentie is niet langer beschikbaar. ';
|
||||
$string["individuals"] = 'Individueel';
|
|
@ -22,7 +22,7 @@
|
|||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
||||
$plugin->version = 2024011900; // YYYYMMDDHH (year, month, day, iteration).
|
||||
$plugin->version = 2024012800; // YYYYMMDDHH (year, month, day, iteration).
|
||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||
|
||||
$plugin->release = "1.1.0";
|
||||
|
|
|
@ -138,11 +138,12 @@ print $OUTPUT->header();
|
|||
<div v-if="displayedstudyplan && displayedstudyplan.description">
|
||||
<span><?php t('selectstudent_btn') ?></span>
|
||||
<s-prevnext-selector
|
||||
|
||||
:options="associatedstudents"
|
||||
title="firstname"
|
||||
v-model="selectedstudent"
|
||||
defaultselectable
|
||||
grouped
|
||||
optionsfield='users'
|
||||
arrows
|
||||
@change="showStudentView"
|
||||
class="ml-2"
|
||||
|
|
Loading…
Reference in New Issue
Block a user