2024-06-03 23:24:16 +02:00
|
|
|
/* eslint no-var: "error"*/
|
|
|
|
/* eslint no-console: "off"*/
|
|
|
|
/* eslint no-unused-vars: warn */
|
|
|
|
/* eslint max-len: ["error", { "code": 160 }] */
|
2024-07-19 17:48:21 +02:00
|
|
|
/* eslint promise/no-nesting: "off" */
|
2024-06-05 22:22:19 +02:00
|
|
|
/* eslint max-depth: ["error", 6] */
|
2024-06-05 23:27:00 +02:00
|
|
|
/* eslint no-trailing-spaces: warn */
|
2024-06-03 23:24:16 +02:00
|
|
|
/* eslint-env es6*/
|
2023-05-17 21:19:14 +02:00
|
|
|
|
2023-08-19 17:54:40 +02:00
|
|
|
import {SimpleLine} from './simpleline/simpleline';
|
2024-06-03 23:24:16 +02:00
|
|
|
import {loadStrings} from './util/string-helper';
|
2024-06-05 23:27:00 +02:00
|
|
|
import {formatDate, formatDatetime, studyplanPageTiming, studyplanTiming} from './util/date-helper';
|
2024-06-02 17:21:30 +02:00
|
|
|
import {addBrowserButtonEvent} from './util/browserbuttonevents';
|
2023-05-17 21:19:14 +02:00
|
|
|
import {call} from 'core/ajax';
|
|
|
|
import notification from 'core/notification';
|
2023-08-22 23:12:33 +02:00
|
|
|
import {svgarcpath} from './util/svgarc';
|
2023-08-19 17:54:40 +02:00
|
|
|
import Debugger from './util/debugger';
|
|
|
|
import Config from 'core/config';
|
2024-06-05 23:27:00 +02:00
|
|
|
import {processStudyplan, objCopy} from './studyplan-processor';
|
2023-09-01 12:27:56 +02:00
|
|
|
import TSComponents from './treestudyplan-components';
|
2024-03-08 17:05:07 +01:00
|
|
|
import FitTextVue from './util/fittext-vue';
|
|
|
|
|
2023-09-01 12:27:56 +02:00
|
|
|
|
2023-05-20 17:36:00 +02:00
|
|
|
// Make π available as a constant
|
|
|
|
const π = Math.PI;
|
2023-08-09 14:18:05 +02:00
|
|
|
// Gravity value for arrow lines - determines how much a line is pulled in the direction of the start/end before changing direction
|
2023-08-04 22:54:32 +02:00
|
|
|
const LINE_GRAVITY = 1.3;
|
2023-05-20 17:36:00 +02:00
|
|
|
|
2024-03-04 22:39:29 +01:00
|
|
|
/**
|
|
|
|
* Studyline is not enrollable
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
const ENROLLABLE_NONE = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Studyline can be enrolled into by the student
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
const ENROLLABLE_SELF = 1;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Studyline can be enrolled into by specific role(s)
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
const ENROLLABLE_ROLE = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Studyline can be enrolled by user and/or role
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
const ENROLLABLE_SELF_ROLE = 3;
|
|
|
|
|
2023-11-12 23:49:50 +01:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
export default {
|
2024-06-05 23:27:00 +02:00
|
|
|
install(Vue/* ,options */) {
|
2023-09-01 12:27:56 +02:00
|
|
|
Vue.use(TSComponents);
|
2024-03-08 17:05:07 +01:00
|
|
|
Vue.use(FitTextVue);
|
2023-06-16 23:12:17 +02:00
|
|
|
let debug = new Debugger("treestudyplan-viewer");
|
2024-03-08 17:05:07 +01:00
|
|
|
|
2023-08-04 19:59:28 +02:00
|
|
|
let lastCaller = null;
|
|
|
|
/**
|
|
|
|
* Scroll current period into view
|
|
|
|
* @param {*} handle A key to pass so subsequent calls with the same key won't trigger (always triggers when null or undefined)
|
|
|
|
*/
|
2024-06-05 23:27:00 +02:00
|
|
|
function scrollCurrentIntoView(handle) {
|
2023-08-04 19:59:28 +02:00
|
|
|
const elScrollContainer = document.querySelector(".r-studyplan-scrollable");
|
|
|
|
const elCurrentHeader = elScrollContainer.querySelector(".s-studyline-header-period.current");
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
if (elCurrentHeader && ((!handle) || (handle != lastCaller))) {
|
2023-08-04 19:59:28 +02:00
|
|
|
lastCaller = handle;
|
|
|
|
elCurrentHeader.scrollIntoView({
|
|
|
|
behavior: "smooth",
|
|
|
|
block: "start",
|
|
|
|
inline: "center",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-03 23:24:16 +02:00
|
|
|
let strings = loadStrings({
|
2023-11-12 23:49:50 +01:00
|
|
|
report: {
|
|
|
|
loading: "loadinghelp@core",
|
2024-06-05 23:27:00 +02:00
|
|
|
'studyplan_past': "studyplan_past",
|
|
|
|
'studyplan_present': "studyplan_present",
|
|
|
|
'studyplan_future': "studyplan_future",
|
2023-11-12 23:49:50 +01:00
|
|
|
back: "back",
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
invalid: {
|
|
|
|
error: 'error',
|
|
|
|
},
|
|
|
|
grading: {
|
|
|
|
ungraded: "ungraded",
|
|
|
|
graded: "graded",
|
|
|
|
allgraded: "allgraded",
|
|
|
|
unsubmitted: "unsubmitted",
|
|
|
|
nogrades: "nogrades",
|
|
|
|
unknown: "unknown",
|
2023-06-03 00:01:18 +02:00
|
|
|
},
|
|
|
|
completion: {
|
2023-06-16 23:12:17 +02:00
|
|
|
completed: "completion_completed",
|
|
|
|
incomplete: "completion_incomplete",
|
2024-06-05 23:27:00 +02:00
|
|
|
'completed_pass': "completion_passed",
|
|
|
|
'completed_fail': "completion_failed",
|
2023-06-16 23:12:17 +02:00
|
|
|
ungraded: "ungraded",
|
2024-06-05 23:27:00 +02:00
|
|
|
'aggregation_all': "aggregation_all",
|
|
|
|
'aggregation_any': "aggregation_any",
|
|
|
|
'aggregation_one': "aggregation_one",
|
|
|
|
'aggregation_overall_all': "aggregation_overall_all",
|
|
|
|
'aggregation_overall_any': "aggregation_overall_any",
|
|
|
|
'aggregation_overall_one': "aggregation_overall_one",
|
|
|
|
'completion_not_configured': "completion_not_configured",
|
|
|
|
'configure_completion': "configure_completion",
|
|
|
|
'view_completion_report': "view_completion_report",
|
|
|
|
'completion_incomplete': "completion_incomplete",
|
|
|
|
'completion_failed': "completion_failed",
|
|
|
|
'completion_pending': "completion_pending",
|
|
|
|
'completion_progress': "completion_progress",
|
|
|
|
'completion_completed': "completion_completed",
|
|
|
|
'completion_good': "completion_good",
|
|
|
|
'completion_excellent': "completion_excellent",
|
|
|
|
'view_feedback': "view_feedback",
|
|
|
|
'coursetiming_past': "coursetiming_past",
|
|
|
|
'coursetiming_present': "coursetiming_present",
|
|
|
|
'coursetiming_future': "coursetiming_future",
|
|
|
|
'required_goal': "required_goal",
|
|
|
|
'student_not_tracked': "student_not_tracked",
|
|
|
|
'completion_not_enabled': "completion_not_enabled",
|
2023-06-03 00:01:18 +02:00
|
|
|
},
|
|
|
|
badge: {
|
2024-06-05 23:27:00 +02:00
|
|
|
'share_badge': "share_badge",
|
2023-06-03 00:01:18 +02:00
|
|
|
dateissued: "dateissued",
|
|
|
|
dateexpire: "dateexpire",
|
|
|
|
badgeinfo: "badgeinfo",
|
2023-06-16 23:12:17 +02:00
|
|
|
badgeissuedstats: "badgeissuedstats",
|
2024-06-05 23:27:00 +02:00
|
|
|
'completion_incomplete': "completion_incomplete_badge",
|
|
|
|
'completion_completed': "completion_completed_badge",
|
2023-11-02 07:18:37 +01:00
|
|
|
badgedisabled: "badgedisabled"
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
course: {
|
2024-06-05 23:27:00 +02:00
|
|
|
'completion_incomplete': "completion_incomplete",
|
|
|
|
'completion_failed': "completion_failed",
|
|
|
|
'completion_pending': "completion_pending",
|
|
|
|
'completion_progress': "completion_progress",
|
|
|
|
'completion_completed': "completion_completed",
|
|
|
|
'completion_good': "completion_good",
|
|
|
|
'completion_excellent': "completion_excellent",
|
|
|
|
'view_feedback': "view_feedback",
|
|
|
|
'coursetiming_past': "coursetiming_past",
|
|
|
|
'coursetiming_present': "coursetiming_present",
|
|
|
|
'coursetiming_future': "coursetiming_future",
|
|
|
|
'required_goal': "required_goal",
|
|
|
|
'student_not_tracked': "student_not_tracked",
|
|
|
|
'not_enrolled': "not_enrolled",
|
2024-05-10 15:22:52 +02:00
|
|
|
noenddate: "noenddate",
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2023-06-30 17:03:10 +02:00
|
|
|
teachercourse: {
|
2024-06-05 23:27:00 +02:00
|
|
|
'select_conditions': "select_conditions",
|
|
|
|
'select_grades': "select_grades",
|
|
|
|
'coursetiming_past': "coursetiming_past",
|
|
|
|
'coursetiming_present': "coursetiming_present",
|
|
|
|
'coursetiming_future': "coursetiming_future",
|
|
|
|
'grade_include': "grade_include",
|
|
|
|
'grade_require': "grade_require",
|
|
|
|
'required_goal': "required_goal",
|
|
|
|
'student_from_plan_enrolled': "student_from_plan_enrolled",
|
|
|
|
'students_from_plan_enrolled': "students_from_plan_enrolled",
|
2024-05-10 15:22:52 +02:00
|
|
|
noenddate: "noenddate",
|
2023-11-05 22:33:57 +01:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
competency: {
|
2024-06-05 23:27:00 +02:00
|
|
|
'competency_not_configured': "competency_not_configured",
|
|
|
|
'configure_competency': "configure_competency",
|
2023-11-26 22:58:26 +01:00
|
|
|
when: "when",
|
|
|
|
required: "required",
|
|
|
|
points: "points@core_grades",
|
|
|
|
heading: "competency_heading",
|
|
|
|
details: "competency_details",
|
|
|
|
results: "results",
|
|
|
|
unrated: "unrated",
|
|
|
|
progress: "completion_progress",
|
2024-06-05 23:27:00 +02:00
|
|
|
'view_feedback': "view_feedback",
|
|
|
|
},
|
2023-11-05 22:33:57 +01:00
|
|
|
pageinfo: {
|
|
|
|
edit: 'period_edit',
|
|
|
|
fullname: 'studyplan_name',
|
|
|
|
shortname: 'studyplan_shortname',
|
|
|
|
startdate: 'studyplan_startdate',
|
|
|
|
enddate: 'studyplan_enddate',
|
|
|
|
description: 'studyplan_description',
|
2023-11-12 23:49:50 +01:00
|
|
|
duration: 'studyplan_duration',
|
|
|
|
details: 'studyplan_details',
|
2024-02-24 23:42:01 +01:00
|
|
|
overview: 'overviewreport:all',
|
|
|
|
oveviewperiod: 'overviewreport:period'
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
|
|
|
lineheader: {
|
2024-06-05 23:27:00 +02:00
|
|
|
'cannot_enrol': 'line_cannot_enrol',
|
|
|
|
'can_enrol': 'line_can_enrol',
|
|
|
|
'is_enrolled': 'line_is_enrolled',
|
2024-03-04 22:39:29 +01:00
|
|
|
enrol: 'line_enrol',
|
2024-03-06 23:49:50 +01:00
|
|
|
unenrol: 'line_unenrol',
|
2024-03-04 22:39:29 +01:00
|
|
|
enrolled: 'line_enrolled',
|
|
|
|
notenrolled: 'line_notenrolled',
|
2024-06-05 23:27:00 +02:00
|
|
|
'enrol_question': 'line_enrol_question',
|
2024-03-04 22:39:29 +01:00
|
|
|
enrollments: 'line_enrollments',
|
|
|
|
enrollment: 'line_enrollment',
|
|
|
|
info: 'info@core',
|
|
|
|
confirm: 'confirm@core',
|
|
|
|
yes: 'yes@core',
|
|
|
|
no: 'no@core',
|
2024-06-05 23:27:00 +02:00
|
|
|
'enrolled_in': 'line_enrolled_in',
|
2024-03-04 22:39:29 +01:00
|
|
|
since: 'since@core',
|
|
|
|
byname: 'byname@core',
|
2024-03-06 23:49:50 +01:00
|
|
|
students: 'students@core',
|
|
|
|
firstname: 'firstname@core',
|
|
|
|
lastname: 'lastname@core',
|
|
|
|
email: 'email@core',
|
2024-06-05 23:27:00 +02:00
|
|
|
'enrol_student_question': 'line_enrol_student_question',
|
|
|
|
'unenrol_student_question': 'line_unenrol_student_question',
|
|
|
|
|
2023-06-30 17:03:10 +02:00
|
|
|
}
|
2023-06-03 00:01:18 +02:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
/* **********************************
|
2023-05-17 21:19:14 +02:00
|
|
|
* *
|
2023-05-20 17:36:00 +02:00
|
|
|
* Treestudyplan Viewer components *
|
2023-05-17 21:19:14 +02:00
|
|
|
* *
|
|
|
|
************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if element is visible
|
|
|
|
* @param {Object} elem The element to check
|
|
|
|
* @returns {boolean} True if visible
|
|
|
|
*/
|
2024-06-05 23:27:00 +02:00
|
|
|
function isVisible(elem) {
|
|
|
|
return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
|
2023-07-27 15:07:14 +02:00
|
|
|
// Create new eventbus for interaction between item components
|
|
|
|
const ItemEventBus = new Vue();
|
|
|
|
|
2024-03-22 22:01:42 +01:00
|
|
|
/*
|
2023-11-27 23:11:17 +01:00
|
|
|
// Add event listener for the edit mode event so we can react to it, or at the very least ignore it
|
|
|
|
document.addEventListener(editSwEventTypes.editModeSet,(e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
ItemEventBus.$emit('editModeSet',e.detail.editMode);
|
|
|
|
});
|
2024-03-22 22:01:42 +01:00
|
|
|
*/
|
2023-11-27 23:11:17 +01:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-progress-circle', {
|
2023-05-20 17:36:00 +02:00
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: Number,
|
|
|
|
},
|
|
|
|
max: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 100,
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
|
|
|
min: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 0,
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
|
|
|
stroke: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 0.2,
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
|
|
|
bgopacity: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 0.2,
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
2023-05-20 18:25:22 +02:00
|
|
|
title: {
|
|
|
|
type: String,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': "",
|
2023-05-20 18:25:22 +02:00
|
|
|
},
|
2023-08-09 14:18:05 +02:00
|
|
|
icon: {
|
|
|
|
type: String,
|
|
|
|
}
|
2023-05-20 18:25:22 +02:00
|
|
|
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedstudyplan: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
range() {
|
|
|
|
return this.max - this.min;
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fraction() {
|
|
|
|
if (this.max - this.min == 0) {
|
2023-05-20 18:25:22 +02:00
|
|
|
return 0;
|
|
|
|
// 0 size is always empty :)
|
2023-05-20 17:36:00 +02:00
|
|
|
} else {
|
2024-06-05 23:27:00 +02:00
|
|
|
return (this.value - this.min) / (this.max - this.min);
|
2023-05-20 17:36:00 +02:00
|
|
|
}
|
|
|
|
},
|
2023-05-20 18:25:22 +02:00
|
|
|
radius() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return 50 - (50 * this.stroke);
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
2023-05-20 18:25:22 +02:00
|
|
|
arcpath() {
|
2023-09-08 12:47:29 +02:00
|
|
|
let fraction = 0;
|
2024-06-05 23:27:00 +02:00
|
|
|
const r = 50 - (50 * this.stroke);
|
|
|
|
if (this.max - this.min != 0) {
|
|
|
|
fraction = (this.value - this.min) / (this.max - this.min);
|
2023-05-20 17:36:00 +02:00
|
|
|
}
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
const Δ = fraction * 2 * π;
|
|
|
|
return svgarcpath([50, 50], [r, r], [0, Δ], 1.5 * π);
|
2023-05-20 17:36:00 +02:00
|
|
|
},
|
|
|
|
},
|
2023-05-20 18:25:22 +02:00
|
|
|
methods: {
|
|
|
|
},
|
2023-05-20 17:36:00 +02:00
|
|
|
template: `
|
2023-08-09 14:18:05 +02:00
|
|
|
<div style="display: inline-block; width: 1em; height: 1em; position:relative; padding: 0;">
|
|
|
|
<svg width="1em" height="1em" viewBox="0 0 100 100"
|
|
|
|
style="position: absolute;top: 0;left: 0;">
|
|
|
|
<title>{{title}}</title>
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle v-if="fraction >= 1.0" cx="50" cy="50" :r="radius"
|
2023-08-09 14:18:05 +02:00
|
|
|
:style="'opacity: 1; stroke-width: '+ (stroke*100)+'; stroke: currentcolor; fill: none;'"/>
|
|
|
|
<g v-else>
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle cx="50" cy="50" :r="radius"
|
2023-08-09 14:18:05 +02:00
|
|
|
:style="'opacity: ' + bgopacity + ';stroke-width: '+ (stroke*100)+'; stroke: currentcolor; fill: none;'"/>
|
2023-09-08 12:47:29 +02:00
|
|
|
<path :d="arcpath"
|
2023-08-09 14:18:05 +02:00
|
|
|
:style="'stroke-width: ' + (stroke*100) +'; stroke: currentcolor; fill: none;'"/>
|
|
|
|
</g>
|
|
|
|
</svg>
|
2023-09-08 12:47:29 +02:00
|
|
|
<i v-if='icon' :class="'fa fa-'+icon"
|
|
|
|
style=" position: absolute; top: 0.42em; left: 0.43em; text-align:center; display: inline-block;
|
2023-08-09 14:18:05 +02:00
|
|
|
width:1em; font-size: 0.55em; "
|
|
|
|
></i>
|
|
|
|
</div>
|
2023-05-20 17:36:00 +02:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
Vue.component('r-report', {
|
|
|
|
props: {
|
2023-11-12 23:49:50 +01:00
|
|
|
invitekey: {
|
|
|
|
type: String,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2023-11-12 23:49:50 +01:00
|
|
|
userid: {
|
|
|
|
type: Number,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return 0;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2023-11-12 23:49:50 +01:00
|
|
|
type: {
|
|
|
|
type: String,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return "own";
|
|
|
|
},
|
2023-11-27 23:18:55 +01:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-11-12 23:49:50 +01:00
|
|
|
text: strings.report,
|
|
|
|
studyplans: {
|
|
|
|
past: [],
|
|
|
|
present: [],
|
|
|
|
future: [],
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
selectedstudyplan: null,
|
2023-11-12 23:49:50 +01:00
|
|
|
loadingstudyplan: false,
|
|
|
|
loading: true,
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2023-11-12 23:49:50 +01:00
|
|
|
teachermode() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return (this.type == "teaching");
|
2023-11-12 23:49:50 +01:00
|
|
|
},
|
|
|
|
guestmode() {
|
|
|
|
return (this.type == "invited");
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
verifiedType() {
|
|
|
|
if (!["invited", "other", "teaching", "own"].includes(this.type)) {
|
2023-11-12 23:49:50 +01:00
|
|
|
return "own";
|
2023-05-17 21:19:14 +02:00
|
|
|
} else {
|
2023-11-12 23:49:50 +01:00
|
|
|
return this.type;
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
2023-11-12 23:49:50 +01:00
|
|
|
},
|
|
|
|
studyplancount() {
|
|
|
|
return this.studyplans.past.length + this.studyplans.present.length + this.studyplans.future.length;
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
2023-11-12 23:49:50 +01:00
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.loadStudyplans();
|
2024-06-02 17:21:30 +02:00
|
|
|
addBrowserButtonEvent(this.backPressed);
|
2023-11-12 23:49:50 +01:00
|
|
|
},
|
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
methods: {
|
2024-06-02 17:21:30 +02:00
|
|
|
backPressed() {
|
|
|
|
debug.log("Back button pressed");
|
|
|
|
if (this.selectedstudyplan) {
|
|
|
|
debug.log("Closing studyplan");
|
|
|
|
this.deselectStudyplan();
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
callArgs(o) {
|
2023-11-12 23:49:50 +01:00
|
|
|
const args = {};
|
|
|
|
if (typeof o == 'object' && !Array.isArray(o) && o !== null) {
|
2024-06-05 23:27:00 +02:00
|
|
|
objCopy(args, o);
|
2023-11-12 23:49:50 +01:00
|
|
|
}
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.verifiedType == "invited") {
|
|
|
|
args.invitekey = this.invitekey;
|
|
|
|
} else if (this.verifiedType == "other") {
|
|
|
|
args.userid = this.userid;
|
|
|
|
}
|
2023-11-12 23:49:50 +01:00
|
|
|
return args;
|
2023-08-15 22:52:43 +02:00
|
|
|
},
|
2023-11-12 23:49:50 +01:00
|
|
|
loadStudyplans() {
|
|
|
|
const self = this;
|
|
|
|
this.loading = true;
|
2024-06-05 23:27:00 +02:00
|
|
|
|
2023-11-12 23:49:50 +01:00
|
|
|
call([{
|
2024-06-05 23:27:00 +02:00
|
|
|
methodname: `local_treestudyplan_list_${this.verifiedType}_studyplans`,
|
|
|
|
args: this.callArgs(),
|
|
|
|
}])[0].then(function(response) {
|
|
|
|
console.info("Loaded: plans", response);
|
|
|
|
const plans = {future: [], present: [], past: []};
|
2023-11-12 23:49:50 +01:00
|
|
|
|
|
|
|
for (const ix in response) {
|
|
|
|
const plan = response[ix];
|
2023-11-13 22:18:28 +01:00
|
|
|
const timing = studyplanTiming(plan);
|
2023-11-12 23:49:50 +01:00
|
|
|
plans[timing].push(plan);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const ix in plans) {
|
2024-06-05 23:27:00 +02:00
|
|
|
plans[ix].sort((a, b) => {
|
2024-07-19 17:48:21 +02:00
|
|
|
let t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();
|
2023-11-12 23:49:50 +01:00
|
|
|
if (t == 0) {
|
2024-06-05 23:27:00 +02:00
|
|
|
// Sort by name if timing is equal
|
2023-11-12 23:49:50 +01:00
|
|
|
t = a.name.localeCompare(b.name);
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
self.studyplans = plans;
|
|
|
|
self.loading = false;
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// Load studyplan from hash if applicable
|
|
|
|
const hash = window.location.hash.replace('#', '');
|
2024-03-07 22:44:29 +01:00
|
|
|
const parts = hash.split("-");
|
|
|
|
|
|
|
|
if (!!parts && parts.length > 0) {
|
|
|
|
for (const k in self.studyplans) {
|
|
|
|
const list = self.studyplans[k];
|
|
|
|
for (const idx in list) {
|
|
|
|
const plan = list[idx];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (plan.id == parts[0] && !plan.suspended) {
|
2024-03-07 22:44:29 +01:00
|
|
|
self.selectStudyplan(plan);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-19 16:46:30 +02:00
|
|
|
// If there is but a single studyplan, select it anyway, even if it is not current...
|
|
|
|
if (this.studyplancount == 1) {
|
|
|
|
if (self.studyplans.present.length > 0) {
|
|
|
|
// Directly show the current study plan if it's the only current one
|
|
|
|
const plan = self.studyplans.present[0];
|
|
|
|
if (!plan.suspended) {
|
|
|
|
self.selectStudyplan(plan);
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (self.studyplans.future.lengh > 0) {
|
2024-04-19 16:46:30 +02:00
|
|
|
const plan = self.studyplans.future[0];
|
|
|
|
if (!plan.suspended) {
|
|
|
|
self.selectStudyplan(plan);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
const plan = self.studyplans.past[0];
|
|
|
|
if (!plan.suspended) {
|
|
|
|
self.selectStudyplan(plan);
|
2023-11-12 23:49:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
return;
|
2023-12-13 23:49:06 +01:00
|
|
|
}).catch(notification.exception);
|
2023-11-12 23:49:50 +01:00
|
|
|
},
|
|
|
|
selectStudyplan(plan) {
|
|
|
|
const self = this;
|
|
|
|
this.loadingstudyplan = true;
|
|
|
|
call([{
|
2024-06-05 23:27:00 +02:00
|
|
|
methodname: `local_treestudyplan_get_${this.verifiedType}_studyplan`,
|
|
|
|
args: this.callArgs({
|
2023-11-12 23:49:50 +01:00
|
|
|
studyplanid: plan.id,
|
|
|
|
}),
|
2024-06-05 23:27:00 +02:00
|
|
|
}])[0].then(function(response) {
|
2024-06-03 23:24:16 +02:00
|
|
|
self.selectedstudyplan = processStudyplan(response);
|
2023-11-12 23:49:50 +01:00
|
|
|
self.loadingstudyplan = false;
|
2024-03-07 22:44:29 +01:00
|
|
|
window.location.hash = self.selectedstudyplan.id;
|
2024-06-05 23:27:00 +02:00
|
|
|
return;
|
2023-12-13 23:49:06 +01:00
|
|
|
}).catch(notification.exception);
|
2023-11-12 23:49:50 +01:00
|
|
|
},
|
|
|
|
deselectStudyplan() {
|
|
|
|
this.selectedstudyplan = null;
|
|
|
|
this.loadStudyplans(); // Reload the list of studyplans.
|
2024-03-07 22:44:29 +01:00
|
|
|
window.location.hash = '';
|
2023-11-12 23:49:50 +01:00
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
template: `
|
2023-09-08 12:47:29 +02:00
|
|
|
<div class='t-studyplan-container r-report-tabs'>
|
2023-11-12 23:49:50 +01:00
|
|
|
<div v-if='loading' class="vue-loader spinner-border text-primary" role="status"></div>
|
|
|
|
<template v-else>
|
|
|
|
<div v-if='!loadingstudyplan && selectedstudyplan'>
|
|
|
|
<div class="mb-2">
|
|
|
|
<a href='#' @click='deselectStudyplan'><h5 class="d-inline"><i class="fa fa-chevron-left"></i> {{ text.back }}</h5></a>
|
|
|
|
<h4 class="d-inline ml-3">{{ selectedstudyplan.name}}
|
2024-06-05 23:27:00 +02:00
|
|
|
<s-studyplan-details
|
2023-11-12 23:49:50 +01:00
|
|
|
class="mb-2"
|
|
|
|
size="sm"
|
2024-06-05 23:27:00 +02:00
|
|
|
v-model="selectedstudyplan"
|
2023-11-12 23:49:50 +01:00
|
|
|
v-if="selectedstudyplan.description"
|
|
|
|
><i class='fa fa-info-circle'></i></s-studyplan-details></h4>
|
|
|
|
</div>
|
|
|
|
<r-studyplan
|
|
|
|
v-model='selectedstudyplan'
|
|
|
|
:guestmode='guestmode'
|
|
|
|
:teachermode='teachermode'
|
|
|
|
></r-studyplan>
|
|
|
|
</div>
|
|
|
|
<div v-else-if='loadingstudyplan' class="vue-loader spinner-border text-primary" role="status">
|
|
|
|
<span class="sr-only">{{ text.loading }}</span>
|
|
|
|
</div>
|
|
|
|
<div v-else class='t-studyplan-notselected'>
|
|
|
|
<template v-for="timing in ['present', 'past', 'future']">
|
|
|
|
<template v-if="studyplans[timing].length > 0">
|
|
|
|
<h4>{{ text["studyplan_"+timing]}}:</h4>
|
|
|
|
<b-card-group deck>
|
|
|
|
<s-studyplan-card
|
|
|
|
v-for='(studyplan, planindex) in studyplans[timing]'
|
|
|
|
:key='studyplan.id'
|
|
|
|
v-model='studyplans[timing][planindex]'
|
|
|
|
open
|
|
|
|
@open='selectStudyplan(studyplan)'
|
|
|
|
></s-studyplan-card>
|
|
|
|
</b-card-group>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.component('r-studyplan', {
|
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: Object,
|
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-11-27 23:18:55 +01:00
|
|
|
},
|
2024-03-09 22:51:34 +01:00
|
|
|
coaching: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2024-03-09 22:51:34 +01:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-11-13 22:18:28 +01:00
|
|
|
selectedpageindex: -1,
|
2023-11-05 22:33:57 +01:00
|
|
|
text: strings.pageinfo,
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2023-11-05 22:33:57 +01:00
|
|
|
|
|
|
|
selectedpage() {
|
|
|
|
return this.value.pages[this.selectedpageindex];
|
|
|
|
},
|
2023-11-13 22:18:28 +01:00
|
|
|
startpageindex() {
|
|
|
|
let startpageindex = 0;
|
|
|
|
let firststart = null;
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in this.value.pages) {
|
2023-11-13 22:18:28 +01:00
|
|
|
const page = this.value.pages[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (studyplanPageTiming(page) == "present") {
|
2023-11-13 22:18:28 +01:00
|
|
|
const s = new Date(page.startdate);
|
2024-06-05 23:27:00 +02:00
|
|
|
if ((!firststart) || firststart > s) {
|
2023-11-13 22:18:28 +01:00
|
|
|
startpageindex = ix;
|
|
|
|
firststart = s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return startpageindex;
|
2024-02-23 09:20:10 +01:00
|
|
|
},
|
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
|
|
|
},
|
2023-11-05 22:33:57 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
pageduration(page) {
|
|
|
|
return formatDate(page.startdate, false) + " - " + formatDate(page.enddate, false);
|
2023-11-05 22:33:57 +01:00
|
|
|
},
|
|
|
|
columns(page) {
|
2024-06-05 23:27:00 +02:00
|
|
|
return 1 + (page.periods * 2);
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
columnsStylerule(page) {
|
2023-07-27 15:07:14 +02:00
|
|
|
// Uses css variables, so width for slots and filters can be configured in css
|
2024-06-05 23:27:00 +02:00
|
|
|
let s = "grid-template-columns: var(--studyplan-filter-width)"; // Ese css variable here
|
|
|
|
for (let i = 0; i < page.periods; i++) {
|
|
|
|
s += " var(--studyplan-course-width) var(--studyplan-filter-width)";
|
2023-07-27 15:07:14 +02:00
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
return s + ";";
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
countLineLayers(line, page) {
|
2023-07-27 15:07:14 +02:00
|
|
|
let maxLayer = -1;
|
2024-06-05 23:27:00 +02:00
|
|
|
for (let i = 0; i <= page.periods; i++) {
|
2024-01-28 14:41:35 +01:00
|
|
|
// Determine the amount of used layers in a studyline slot
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in line.slots[i].courses) {
|
2023-08-28 11:26:14 +02:00
|
|
|
const item = line.slots[i].courses[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (item.layer > maxLayer) {
|
2023-07-27 15:07:14 +02:00
|
|
|
maxLayer = item.layer;
|
|
|
|
}
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in line.slots[i].filters) {
|
2023-07-27 15:07:14 +02:00
|
|
|
const item = line.slots[i].filters[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (item.layer > maxLayer) {
|
2023-07-27 15:07:14 +02:00
|
|
|
maxLayer = item.layer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
return (maxLayer >= 0) ? (maxLayer + 1) : 1;
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
showslot(page, line, index, layeridx, type) {
|
|
|
|
// Check if the slot should be hidden because a previous slot has an item with a span
|
2023-08-04 14:57:23 +02:00
|
|
|
// so big that it hides this slot
|
2024-06-05 23:27:00 +02:00
|
|
|
const forGradable = (type == 'gradable') ? true : false;
|
2023-11-05 22:33:57 +01:00
|
|
|
const periods = page.periods;
|
2023-08-04 14:57:23 +02:00
|
|
|
let show = true;
|
2024-06-05 23:27:00 +02:00
|
|
|
for (let i = 0; i < periods; i++) {
|
|
|
|
if (line.slots[index - i] && line.slots[index - i].courses) {
|
|
|
|
const list = line.slots[index - i].courses;
|
|
|
|
for (const ix in list) {
|
2023-08-04 14:57:23 +02:00
|
|
|
const item = list[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (item.layer == layeridx) {
|
|
|
|
if (forGradable) {
|
|
|
|
if (i > 0 && (item.span - i) > 0) {
|
2023-08-04 14:57:23 +02:00
|
|
|
show = false;
|
|
|
|
}
|
|
|
|
} else {
|
2024-06-05 23:27:00 +02:00
|
|
|
if ((item.span - i) > 1) {
|
2023-08-04 14:57:23 +02:00
|
|
|
show = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-09-08 12:47:29 +02:00
|
|
|
|
2023-08-04 14:57:23 +02:00
|
|
|
return show;
|
2023-11-05 22:33:57 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
selectedpageChanged(/* Params: newTabIndex, prevTabIndex */) {
|
|
|
|
|
2023-11-11 20:18:05 +01:00
|
|
|
ItemEventBus.$emit('redrawLines', null);
|
2023-11-13 22:18:28 +01:00
|
|
|
scrollCurrentIntoView(this.selectedpage.id);
|
2024-02-23 09:20:10 +01:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2023-08-04 19:59:28 +02:00
|
|
|
mounted() {
|
2023-11-11 20:18:05 +01:00
|
|
|
this.$root.$emit('redrawLines');
|
2023-08-04 19:59:28 +02:00
|
|
|
},
|
|
|
|
updated() {
|
2023-11-13 22:18:28 +01:00
|
|
|
|
|
|
|
scrollCurrentIntoView(this.selectedpage.id);
|
2023-08-15 22:52:43 +02:00
|
|
|
ItemEventBus.$emit('lineHeightChange', null);
|
2023-11-11 20:18:05 +01:00
|
|
|
this.$root.$emit('redrawLines');
|
|
|
|
ItemEventBus.$emit('redrawLines');
|
2023-08-04 19:59:28 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
template: `
|
2023-11-05 22:33:57 +01:00
|
|
|
<div>
|
|
|
|
<b-card no-body>
|
2024-06-05 23:27:00 +02:00
|
|
|
<b-tabs
|
|
|
|
v-model='selectedpageindex'
|
2023-11-05 22:33:57 +01:00
|
|
|
@activate-tab='selectedpageChanged'
|
|
|
|
content-class="mt-1">
|
|
|
|
<b-tab
|
|
|
|
v-for="(page,pageindex) in value.pages"
|
2023-11-13 22:18:28 +01:00
|
|
|
:active="(pageindex == startpageindex)"
|
2023-11-05 22:33:57 +01:00
|
|
|
:key="page.id"
|
|
|
|
:title-item-class="'s-studyplanpage-tab '+ page.timing"
|
|
|
|
><template #title>
|
|
|
|
<span v-b-tooltip.hover :title='page.fullname'>{{page.shortname}}</span>
|
2023-11-12 23:49:50 +01:00
|
|
|
<a href="#" v-b-modal="'studyplanpage-info-'+page.id" class='text-info'
|
2023-11-05 22:33:57 +01:00
|
|
|
v-if='pageindex == selectedpageindex'
|
|
|
|
><i class='fa fa-info-circle'></i></a>
|
2023-07-29 12:21:30 +02:00
|
|
|
</template>
|
2024-06-05 23:27:00 +02:00
|
|
|
|
2023-11-05 22:33:57 +01:00
|
|
|
<b-modal
|
|
|
|
:id="'studyplanpage-info-'+page.id"
|
|
|
|
scrollable
|
|
|
|
ok-only
|
|
|
|
>
|
|
|
|
<template #modal-title>
|
|
|
|
{{page.fullname}}
|
|
|
|
</template>
|
|
|
|
<b-container>
|
|
|
|
<b-row>
|
|
|
|
<b-col cols="4"><b>{{ text.shortname}}</b></b-col>
|
|
|
|
<b-col cols="8">
|
|
|
|
{{ page.shortname }}
|
|
|
|
</b-col>
|
|
|
|
</b-row>
|
2024-03-10 23:11:54 +01:00
|
|
|
<b-row v-if="!page.timeless">
|
2023-11-05 22:33:57 +01:00
|
|
|
<b-col cols="4"><b>{{ text.duration}}</b></b-col>
|
|
|
|
<b-col cols="8">
|
|
|
|
{{ pageduration(page) }}
|
|
|
|
</b-col>
|
|
|
|
</b-row>
|
|
|
|
<b-row v-if="page.description">
|
|
|
|
<b-col cols="12"><b>{{ text.description}}</b></b-col>
|
|
|
|
</b-row>
|
|
|
|
<b-row v-if="page.description">
|
|
|
|
<b-col cols="12">
|
|
|
|
<span v-html="page.description"></span>
|
|
|
|
</b-col>
|
|
|
|
</b-row>
|
|
|
|
</b-container>
|
|
|
|
</b-modal>
|
|
|
|
<div v-if="page.studylines.length > 0" class='r-studyplan-content'>
|
|
|
|
<!-- First paint the headings-->
|
|
|
|
<div class='r-studyplan-headings'
|
2024-02-23 09:20:10 +01:00
|
|
|
><s-studyline-header-heading :identifier="Number(page.id)"
|
2024-03-09 22:51:34 +01:00
|
|
|
><a v-if="teachermode && selectedpage && !coaching" class="ml-2"
|
2024-02-24 23:43:57 +01:00
|
|
|
:href="wwwroot+'//local/treestudyplan/result-overview.php?page='+selectedpage.id"
|
2024-06-05 23:27:00 +02:00
|
|
|
|
2024-02-24 23:42:01 +01:00
|
|
|
target='_blank'><i class='fa fa-list-ul'></i> {{text.overview}}</a
|
2024-02-23 09:20:10 +01:00
|
|
|
></s-studyline-header-heading>
|
2023-11-05 22:33:57 +01:00
|
|
|
<r-studyline-heading v-for="(line,lineindex) in page.studylines"
|
|
|
|
:key="line.id"
|
2024-03-04 22:39:29 +01:00
|
|
|
:teachermode="teachermode"
|
|
|
|
:guestmode="guestmode"
|
2023-11-05 22:33:57 +01:00
|
|
|
v-model="page.studylines[lineindex]"
|
2024-01-28 14:41:35 +01:00
|
|
|
:layers='countLineLayers(line,page)+1'
|
2024-03-04 22:39:29 +01:00
|
|
|
:studentid="value.userid"
|
|
|
|
@enrolupdate="page.studylines[lineindex].enrol = $event"
|
2023-11-05 22:33:57 +01:00
|
|
|
:class=" 't-studyline' + ((lineindex%2==0)?' odd ' :' even ' )
|
|
|
|
+ ((lineindex==0)?' first ':' ')
|
|
|
|
+ ((lineindex==page.studylines.length-1)?' last ':' ')"
|
|
|
|
></r-studyline-heading
|
|
|
|
></div>
|
|
|
|
<!-- Next, paint all the cells in the scrollable -->
|
|
|
|
<div class="r-studyplan-scrollable" >
|
2024-06-05 23:27:00 +02:00
|
|
|
<div class="r-studyplan-timeline" :style="columnsStylerule(page)">
|
2023-11-05 22:33:57 +01:00
|
|
|
<!-- add period information -->
|
|
|
|
<template v-for="(n,index) in (page.periods+1)">
|
|
|
|
<s-studyline-header-period
|
|
|
|
v-if="index > 0"
|
|
|
|
v-model="page.perioddesc[index-1]"
|
|
|
|
:identifier="Number(page.id)"
|
2024-03-09 22:51:34 +01:00
|
|
|
><a v-if="teachermode && selectedpage && !coaching"
|
2024-02-24 23:42:01 +01:00
|
|
|
v-b-tooltip.hover
|
2024-02-24 23:43:57 +01:00
|
|
|
:href="wwwroot+'//local/treestudyplan/result-overview.php?page='+selectedpage.id
|
2024-02-23 09:20:10 +01:00
|
|
|
+'&firstperiod='+index+'&lastperiod='+index"
|
2024-02-24 23:42:01 +01:00
|
|
|
target='_blank'
|
|
|
|
:title="text.overviewperiod"><i class='fa fa-list-ul'></i></a
|
2024-02-23 09:20:10 +01:00
|
|
|
></s-studyline-header-period>
|
2023-11-05 22:33:57 +01:00
|
|
|
<div class="s-studyline-header-filter"></div>
|
|
|
|
</template>
|
2023-09-08 12:47:29 +02:00
|
|
|
|
2023-11-05 22:33:57 +01:00
|
|
|
<!-- Line by line add the items -->
|
|
|
|
<!-- The grid layout handles putting it in rows and columns -->
|
|
|
|
<template v-for="(line,lineindex) in page.studylines"
|
2024-01-28 14:41:35 +01:00
|
|
|
><template v-for="(layernr,layeridx) in countLineLayers(line,page)"
|
2023-11-05 22:33:57 +01:00
|
|
|
><template v-for="(n,index) in (page.periods+1)"
|
|
|
|
><r-studyline-slot
|
|
|
|
v-if="index > 0 && showslot(page,line, index, layeridx, 'gradable')"
|
|
|
|
type='gradable'
|
|
|
|
v-model="line.slots[index].courses"
|
|
|
|
:key="'c-'+lineindex+'-'+index+'-'+layernr"
|
|
|
|
:slotindex="index"
|
|
|
|
:line="line"
|
|
|
|
:plan="value"
|
|
|
|
:page="page"
|
|
|
|
:period="page.perioddesc[index-1]"
|
|
|
|
:guestmode='guestmode'
|
|
|
|
:teachermode='teachermode'
|
|
|
|
:layer="layeridx"
|
|
|
|
:class="'t-studyline ' + ((lineindex%2==0)?' odd ':' even ')
|
|
|
|
+ ((lineindex==0 && layernr==1)?' first ':' ')
|
2024-01-28 14:41:35 +01:00
|
|
|
+ ((lineindex==page.studylines.length-1)?' last ':' ')
|
|
|
|
+ ((layernr == countLineLayers(line,page))?' lastlyr ':' ')"
|
2023-11-05 22:33:57 +01:00
|
|
|
></r-studyline-slot
|
|
|
|
><r-studyline-slot
|
2024-01-27 16:21:04 +01:00
|
|
|
v-if="showslot(page,line, index, layeridx, 'filter')"
|
2023-11-05 22:33:57 +01:00
|
|
|
type='filter'
|
|
|
|
v-model="line.slots[index].filters"
|
|
|
|
:teachermode='teachermode'
|
|
|
|
:key="'f-'+lineindex+'-'+index+'-'+layernr"
|
|
|
|
:slotindex="index"
|
|
|
|
:line="line"
|
|
|
|
:plan="value"
|
|
|
|
:page="page"
|
|
|
|
:layer="layeridx"
|
|
|
|
:class="'t-studyline ' + ((lineindex%2==0)?' odd ':' even ')
|
|
|
|
+ ((lineindex==0 && layernr==1)?' first ':'')
|
|
|
|
+ ((lineindex==page.studylines.length-1)?' last ':' ')
|
2024-01-28 14:41:35 +01:00
|
|
|
+ ((index==page.periods)?' rightmost':'')
|
|
|
|
+ ((layernr == countLineLayers(line,page))?' lastlyr ':' ')"
|
2023-11-05 22:33:57 +01:00
|
|
|
>
|
|
|
|
</r-studyline-slot
|
|
|
|
></template
|
|
|
|
></template
|
2023-07-27 15:07:14 +02:00
|
|
|
></template
|
2023-11-05 22:33:57 +01:00
|
|
|
></div
|
|
|
|
></div
|
|
|
|
></div>
|
|
|
|
</b-tab>
|
|
|
|
</b-tabs>
|
|
|
|
</b-card>
|
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
2023-07-27 15:07:14 +02:00
|
|
|
* R-STUDYLINE-HEADER
|
2023-05-17 21:19:14 +02:00
|
|
|
*/
|
2023-07-27 15:07:14 +02:00
|
|
|
Vue.component('r-studyline-heading', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-07-27 15:07:14 +02:00
|
|
|
type: Object, // Studyline
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2024-03-04 22:39:29 +01:00
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
layers: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 1,
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2024-03-04 22:39:29 +01:00
|
|
|
studentid: {
|
|
|
|
type: Number,
|
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
data() {
|
|
|
|
return {
|
2024-03-04 22:39:29 +01:00
|
|
|
layerHeights: {},
|
|
|
|
text: strings.lineheader,
|
|
|
|
students: null,
|
2024-06-05 23:27:00 +02:00
|
|
|
canUnenrol: false,
|
2024-03-04 23:03:18 +01:00
|
|
|
sorting: {
|
2024-03-06 23:49:50 +01:00
|
|
|
asc: false,
|
|
|
|
field: 'enrolled_time'
|
2024-03-04 23:03:18 +01:00
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
created() {
|
|
|
|
// Listener for the signal that a new connection was made and needs to be drawn
|
|
|
|
// Sent by the incoming item - By convention, outgoing items are responsible for drawing the lines
|
|
|
|
ItemEventBus.$on('lineHeightChange', this.onLineHeightChange);
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
computed: {
|
2024-03-04 22:39:29 +01:00
|
|
|
enrollable() {
|
|
|
|
return this.value.enrol.enrollable > ENROLLABLE_NONE;
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enrollableSelf() {
|
|
|
|
return [ENROLLABLE_SELF, ENROLLABLE_SELF_ROLE].includes(this.value.enrol.enrollable);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enrollableRole() {
|
|
|
|
return [ENROLLABLE_ROLE, ENROLLABLE_SELF_ROLE].includes(this.value.enrol.enrollable);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
|
|
|
enrolled() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return this.value.enrol.enrolled ? true : false;
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
canEnrol() {
|
|
|
|
return this.value.enrol.can_enrol ? true : false;
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enrolQuestion() {
|
|
|
|
return this.text.enrol_question.replace('{$a}', this.value.name);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enrolledIn() {
|
|
|
|
return this.text.enrolled_in.replace('{$a}', this.value.name);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
|
|
|
by() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return this.text.byname.replace('{$a}', '');
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
|
|
|
enrolldate() {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDatetime(this.value.enrol.enrolled_time);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
sortedStudents() {
|
|
|
|
const self = this;
|
|
|
|
const list = Array.isArray(this.students) ? this.students : [];
|
|
|
|
list.sort((a, b) => {
|
2024-03-04 23:03:18 +01:00
|
|
|
let d = a;
|
|
|
|
let e = b;
|
|
|
|
if (!self.sorting.asc) {
|
|
|
|
d = b;
|
|
|
|
e = a;
|
2024-06-05 23:27:00 +02:00
|
|
|
}
|
2024-03-04 23:03:18 +01:00
|
|
|
let df = d;
|
|
|
|
let ef = e;
|
|
|
|
const field = self.sorting.field;
|
|
|
|
if (d.user && d.user.hasOwnProperty(field)) {
|
|
|
|
df = d.user;
|
|
|
|
ef = e.user;
|
|
|
|
} else if (d.enrol && d.enrol.hasOwnProperty(field)) {
|
|
|
|
df = d.enrol;
|
|
|
|
ef = e.enrol;
|
2024-03-04 22:39:29 +01:00
|
|
|
}
|
2024-03-04 23:03:18 +01:00
|
|
|
if (field == 'enrolled') {
|
2024-06-05 23:27:00 +02:00
|
|
|
return ((df.enrolled) ? 1 : 0) - ((ef.enrolled) ? 1 : 0);
|
2024-03-04 23:05:01 +01:00
|
|
|
} else if (field == "enrolled_time") {
|
2024-06-05 23:27:00 +02:00
|
|
|
const dvalue = (df[field] && d.enrol.enrolled) ? df[field] : 0;
|
|
|
|
const evalue = (ef[field] && e.enrol.enrolled) ? ef[field] : 0;
|
2024-03-04 23:05:01 +01:00
|
|
|
return dvalue - evalue;
|
2024-03-04 23:03:18 +01:00
|
|
|
} else {
|
2024-03-06 23:49:50 +01:00
|
|
|
return String(df[this.sorting.field]).localeCompare(String(ef[this.sorting.field]));
|
2024-03-04 23:03:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|
2024-03-04 22:39:29 +01:00
|
|
|
return list;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-03 23:24:16 +02:00
|
|
|
formatDatetime,
|
2024-06-05 23:27:00 +02:00
|
|
|
onLineHeightChange(lineid) {
|
2023-07-27 15:07:14 +02:00
|
|
|
// All layers for this line have the first slot send an update message on layer height change.
|
2023-09-08 12:47:29 +02:00
|
|
|
// When one of those updates is received, record the height and recalculate the total height of the
|
2023-07-27 15:07:14 +02:00
|
|
|
// header
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.$refs.mainEl && (lineid == this.value.id || lineid === null)) {
|
2023-07-27 15:07:14 +02:00
|
|
|
const items = document.querySelectorAll(
|
|
|
|
`.r-studyline-slot-0[data-studyline='${this.value.id}']`);
|
2024-06-05 23:27:00 +02:00
|
|
|
// Determine the height of all the lines and add them up.
|
2023-07-27 15:07:14 +02:00
|
|
|
let heightSum = 0;
|
|
|
|
items.forEach((el) => {
|
2024-06-05 23:27:00 +02:00
|
|
|
// Function getBoundingClientRect() Gets the actual fractional height instead of rounded to integer pixels
|
2023-07-27 15:07:14 +02:00
|
|
|
const r = el.getBoundingClientRect();
|
|
|
|
const height = r.height;
|
|
|
|
heightSum += height;
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
const heightStyle = `${heightSum}px`;
|
2023-07-27 15:07:14 +02:00
|
|
|
this.$refs.mainEl.style.height = heightStyle;
|
|
|
|
}
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enrolSelf() {
|
|
|
|
const self = this;
|
2024-03-04 22:39:29 +01:00
|
|
|
call([{
|
|
|
|
methodname: 'local_treestudyplan_line_enrol_self',
|
2024-06-05 23:27:00 +02:00
|
|
|
args: {
|
|
|
|
id: self.value.id,
|
|
|
|
},
|
|
|
|
}])[0].then(function(response) {
|
|
|
|
self.$emit('enrolupdate', response);
|
|
|
|
return;
|
2024-03-04 22:39:29 +01:00
|
|
|
}).catch(notification.exception);
|
|
|
|
},
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
enrolStudent(student) {
|
|
|
|
const self = this;
|
2024-03-06 23:49:50 +01:00
|
|
|
const user = student.user;
|
2024-06-05 23:27:00 +02:00
|
|
|
let question = self.text.enrol_student_question.replace('{$a}', `${user.firstname} ${user.lastname}`);
|
2024-03-06 23:49:50 +01:00
|
|
|
const options = {
|
|
|
|
okTitle: self.text.yes,
|
|
|
|
cancelTitle: self.text.no,
|
|
|
|
okVariant: "success",
|
|
|
|
cancelVariant: "danger",
|
|
|
|
};
|
|
|
|
this.$bvModal.msgBoxConfirm(question, options).then(reply => {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (reply) {
|
2024-03-06 23:49:50 +01:00
|
|
|
call([{
|
|
|
|
methodname: 'local_treestudyplan_line_enrol_students',
|
2024-06-05 23:27:00 +02:00
|
|
|
args: {
|
|
|
|
id: self.value.id,
|
|
|
|
users: [user.id],
|
|
|
|
},
|
|
|
|
}])[0].then(function(response) {
|
2024-03-06 23:49:50 +01:00
|
|
|
student.enrol = response[0].enrol;
|
2024-06-05 23:27:00 +02:00
|
|
|
return;
|
2024-03-06 23:49:50 +01:00
|
|
|
}).catch(notification.exception);
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
return;
|
|
|
|
}).catch(notification.exception);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
unenrolStudent(student) {
|
|
|
|
const self = this;
|
2024-03-06 23:49:50 +01:00
|
|
|
const user = student.user;
|
2024-06-05 23:27:00 +02:00
|
|
|
let question = self.text.unenrol_student_question.replace('{$a}', `${user.firstname} ${user.lastname}`);
|
2024-03-06 23:49:50 +01:00
|
|
|
const options = {
|
|
|
|
okTitle: self.text.yes,
|
|
|
|
cancelTitle: self.text.no,
|
|
|
|
okVariant: "success",
|
|
|
|
cancelVariant: "danger",
|
|
|
|
};
|
|
|
|
this.$bvModal.msgBoxConfirm(question, options).then(reply => {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (reply) {
|
2024-03-06 23:49:50 +01:00
|
|
|
call([{
|
|
|
|
methodname: 'local_treestudyplan_line_unenrol_students',
|
2024-06-05 23:27:00 +02:00
|
|
|
args: {
|
|
|
|
id: self.value.id,
|
|
|
|
users: [user.id],
|
|
|
|
},
|
|
|
|
}])[0].then(function(response) {
|
2024-03-06 23:49:50 +01:00
|
|
|
student.enrol = response[0].enrol;
|
2024-06-05 23:27:00 +02:00
|
|
|
return;
|
2024-03-06 23:49:50 +01:00
|
|
|
}).catch(notification.exception);
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
return;
|
|
|
|
}).catch(notification.exception);
|
2024-03-04 22:39:29 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
loadStudents() {
|
|
|
|
const self = this;
|
|
|
|
self.students = null;
|
|
|
|
self.canUnenrol = false;
|
2024-03-04 22:39:29 +01:00
|
|
|
call([{
|
|
|
|
methodname: 'local_treestudyplan_list_line_enrolled_students',
|
2024-06-05 23:27:00 +02:00
|
|
|
args: {
|
|
|
|
id: self.value.id,
|
|
|
|
},
|
|
|
|
}])[0].then(function(response) {
|
2024-03-04 22:39:29 +01:00
|
|
|
self.students = response.userinfo;
|
2024-06-05 23:27:00 +02:00
|
|
|
self.canUnenrol = response.can_unenrol;
|
|
|
|
return;
|
2024-03-04 22:39:29 +01:00
|
|
|
}).catch(notification.exception);
|
2024-03-06 23:49:50 +01:00
|
|
|
},
|
|
|
|
toggleSort(header) {
|
|
|
|
if (this.sorting.field == header) {
|
|
|
|
this.sorting.asc = !this.sorting.asc;
|
|
|
|
} else {
|
|
|
|
this.sorting.field = header;
|
|
|
|
this.sorting.asc = true;
|
|
|
|
}
|
|
|
|
},
|
2024-03-04 22:39:29 +01:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
template: `
|
2023-09-08 12:47:29 +02:00
|
|
|
<div class="r-studyline r-studyline-heading "
|
2023-07-27 15:07:14 +02:00
|
|
|
:data-studyline="value.id" ref="mainEl"
|
|
|
|
><div class="r-studyline-handle" :style="'background-color: ' + value.color"></div>
|
2024-03-04 22:39:29 +01:00
|
|
|
<div class="r-studyline-title"><div>
|
2024-03-08 17:05:07 +01:00
|
|
|
<abbr v-b-tooltip.hover :title="value.name">{{ value.shortname }}</abbr>
|
2024-07-19 17:41:49 +02:00
|
|
|
<template v-if="enrollable">
|
2024-03-04 22:39:29 +01:00
|
|
|
<template v-if="teachermode">
|
2024-03-08 17:05:07 +01:00
|
|
|
<br>
|
2024-06-05 23:27:00 +02:00
|
|
|
<a v-if="!canEnrol"
|
2024-03-04 22:39:29 +01:00
|
|
|
href='#' @click.prevent=""
|
|
|
|
v-b-modal="'r-enrollments-'+value.id"
|
|
|
|
:title="text.cannot_enrol"
|
|
|
|
><i class='fa fa-lock text-danger'></i> {{text.enrollments}}</a>
|
|
|
|
<a v-else
|
|
|
|
href='#' @click.prevent=""
|
|
|
|
v-b-modal="'r-enrollments-'+value.id"
|
|
|
|
:title="text.can_enrol"
|
|
|
|
><i class='fa fa-unlock-alt text-success'></i> {{text.enrollments}}</a>
|
|
|
|
<b-modal
|
|
|
|
:id="'r-enrollments-'+value.id"
|
2024-06-05 23:27:00 +02:00
|
|
|
@show="loadStudents"
|
2024-03-06 23:49:50 +01:00
|
|
|
size="xl"
|
2024-03-04 22:39:29 +01:00
|
|
|
ok-only
|
|
|
|
scrollable
|
2024-03-06 23:49:50 +01:00
|
|
|
:title="value.name"
|
2024-03-04 22:39:29 +01:00
|
|
|
>
|
2024-03-06 23:49:50 +01:00
|
|
|
<table class="r-line-enroll-userlist">
|
|
|
|
<thead>
|
|
|
|
<th><a href='#' @click.prevent="toggleSort('firstname')"
|
|
|
|
>{{text.firstname}}</a>
|
|
|
|
<i v-if="sorting.field=='firstname' && sorting.asc" class='fa fa-sort-asc fa-fw'></i
|
|
|
|
><i v-else-if="sorting.field=='firstname' && !sorting.asc" class='fa fa-sort-desc fa-fw'></i>
|
|
|
|
</th>
|
|
|
|
<th><a href='#' @click.prevent="toggleSort('lastname')"
|
|
|
|
>{{text.lastname}}</a>
|
|
|
|
<i v-if="sorting.field=='lastname' && sorting.asc" class='fa fa-sort-asc fa-fw'></i
|
|
|
|
><i v-else-if="sorting.field=='lastname' && !sorting.asc" class='fa fa-sort-desc fa-fw'></i>
|
|
|
|
</th>
|
|
|
|
<th><a href='#' @click.prevent="toggleSort('enrolled')"
|
|
|
|
>{{text.enrolled}}</a>
|
|
|
|
<i v-if="sorting.field=='enrolled' && sorting.asc" class='fa fa-sort-asc fa-fw'></i
|
|
|
|
><i v-else-if="sorting.field=='enrolled' && !sorting.asc" class='fa fa-sort-desc fa-fw'></i>
|
|
|
|
</th>
|
|
|
|
<th><a href='#' @click.prevent="toggleSort('enrolled_time')"
|
|
|
|
>{{text.since}}</a>
|
|
|
|
<i v-if="sorting.field=='enrolled_time' && sorting.asc" class='fa fa-sort-asc fa-fw'></i
|
|
|
|
><i v-else-if="sorting.field=='enrolled_time' && !sorting.asc" class='fa fa-sort-desc fa-fw'></i>
|
|
|
|
</th>
|
|
|
|
<th><a href='#' @click.prevent="toggleSort('enrolled_by')"
|
|
|
|
>{{by}}</a>
|
|
|
|
<i v-if="sorting.field=='enrolled_by' && sorting.asc" class='fa fa-sort-asc fa-fw'></i
|
|
|
|
><i v-else-if="sorting.field=='enrolled_by' && !sorting.asc" class='fa fa-sort-desc fa-fw'></i>
|
|
|
|
</th>
|
2024-06-05 23:27:00 +02:00
|
|
|
<th v-if="canEnrol || canUnenrol">{{text.enrol}}</th>
|
2024-03-06 23:49:50 +01:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-06-05 23:27:00 +02:00
|
|
|
<tr v-if="students == null"><td
|
|
|
|
:colspan="4+(canEnrol?1:0)">
|
2024-03-04 22:39:29 +01:00
|
|
|
<div class="spinner-border spinner-border-sm text-info" role="status"></div>
|
|
|
|
</td></tr>
|
2024-03-06 23:49:50 +01:00
|
|
|
<template v-else>
|
2024-06-05 23:27:00 +02:00
|
|
|
<tr v-for="student in sortedStudents">
|
2024-03-06 23:49:50 +01:00
|
|
|
<td>{{student.user.firstname}}</td>
|
|
|
|
<td>{{student.user.lastname}}</td>
|
|
|
|
<td><span v-if="student.enrol.enrolled" class="text-success">{{text.enrolled}}</span
|
|
|
|
><span v-else class="text-danger">{{text.notenrolled}}</span></td>
|
|
|
|
<td><span v-if="student.enrol.enrolled"
|
2024-06-03 23:24:16 +02:00
|
|
|
>{{formatDatetime(student.enrol.enrolled_time)}}</span></td>
|
2024-03-06 23:49:50 +01:00
|
|
|
<td><span v-if="student.enrol.enrolled"
|
|
|
|
>{{student.enrol.enrolled_by}}</span></td>
|
2024-06-05 23:27:00 +02:00
|
|
|
<td ><b-button v-if="!student.enrol.enrolled && (canEnrol || canUnenrol)"
|
2024-03-06 23:49:50 +01:00
|
|
|
variant="success"
|
|
|
|
size="sm"
|
2024-06-05 23:27:00 +02:00
|
|
|
@click="enrolStudent(student)"
|
2024-03-06 23:49:50 +01:00
|
|
|
>{{text.enrol}}</b-button
|
2024-06-05 23:27:00 +02:00
|
|
|
><b-button v-else-if="student.enrol.enrolled && canUnenrol"
|
2024-03-06 23:49:50 +01:00
|
|
|
variant="danger"
|
|
|
|
size="sm"
|
2024-06-05 23:27:00 +02:00
|
|
|
@click="unenrolStudent(student)"
|
2024-03-06 23:49:50 +01:00
|
|
|
>{{text.unenrol}}</b-button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</tbody>
|
2024-03-04 22:39:29 +01:00
|
|
|
</table>
|
|
|
|
</b-modal>
|
|
|
|
</template>
|
2024-03-08 17:05:07 +01:00
|
|
|
<template v-else-if="value.enrol.selfview">
|
|
|
|
<br>
|
2024-06-05 23:27:00 +02:00
|
|
|
<a v-if="!enrolled && !canEnrol"
|
2024-03-08 17:05:07 +01:00
|
|
|
@click.prevent=""
|
|
|
|
href='#'
|
2024-03-04 22:39:29 +01:00
|
|
|
v-b-tooltip.focus
|
|
|
|
:title="text.cannot_enrol"
|
2024-03-08 17:05:07 +01:00
|
|
|
><fittext maxsize="12pt"><i class='fa fa-lock text-danger'></i> {{text.cannot_enrol}}</fittext></a>
|
2024-06-05 23:27:00 +02:00
|
|
|
<a v-else-if="!enrolled && canEnrol"
|
2024-03-08 17:05:07 +01:00
|
|
|
@click.prevent=""
|
|
|
|
href='#'
|
2024-03-04 22:39:29 +01:00
|
|
|
v-b-modal="'r-enrol-'+value.id"
|
|
|
|
:title="text.can_enrol"
|
2024-03-08 17:05:07 +01:00
|
|
|
><fittext maxsize="12pt"><i class='fa fa-unlock-alt text-info'></i> {{text.enrol}}</fittext></a>
|
2024-03-04 22:39:29 +01:00
|
|
|
<a v-else-if="enrolled"
|
2024-03-08 17:05:07 +01:00
|
|
|
@click.prevent=""
|
|
|
|
href='#'
|
2024-03-04 22:39:29 +01:00
|
|
|
v-b-modal="'r-enrollment-'+value.id"
|
|
|
|
:title="text.enrolled"
|
2024-03-08 17:05:07 +01:00
|
|
|
><fittext maxsize="12pt"><i class='fa fa-unlock text-success'></i> {{text.enrolled}}</fittext></a>
|
2024-03-04 22:39:29 +01:00
|
|
|
<b-modal
|
|
|
|
:id="'r-enrol-'+value.id"
|
|
|
|
:title="text.confirm"
|
|
|
|
:ok-title="text.yes"
|
|
|
|
:cancel-title="text.no"
|
|
|
|
ok-variant="success"
|
|
|
|
cancel-variant="danger"
|
2024-06-05 23:27:00 +02:00
|
|
|
@ok="enrolSelf"
|
2024-03-04 22:39:29 +01:00
|
|
|
>
|
2024-06-05 23:27:00 +02:00
|
|
|
<p>{{enrolQuestion}}</p>
|
2024-03-04 22:39:29 +01:00
|
|
|
</b-modal>
|
|
|
|
<b-modal
|
|
|
|
:id="'r-enrollment-'+value.id"
|
|
|
|
ok-only
|
|
|
|
:title="text.enrollment"
|
|
|
|
>
|
2024-06-05 23:27:00 +02:00
|
|
|
<p>{{enrolledIn}}<p>
|
2024-03-04 22:39:29 +01:00
|
|
|
<p><b>{{text.since}}</b> {{enrolldate}}<br>
|
|
|
|
<b>{{by}}</b> {{this.value.enrol.enrolled_by}}</p>
|
2024-06-05 23:27:00 +02:00
|
|
|
</b-modal>
|
2024-03-04 22:39:29 +01:00
|
|
|
</template>
|
2024-03-08 17:05:07 +01:00
|
|
|
<template v-else>
|
|
|
|
|
|
|
|
<i v-if="!enrolled" class='fa fa-lock text-danger'></i>
|
|
|
|
<i v-else class='fa fa-unlock text-success'></i>
|
|
|
|
</template>
|
2024-03-04 22:39:29 +01:00
|
|
|
</template>
|
|
|
|
</div></div>
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.component('r-studyline-slot', {
|
|
|
|
props: {
|
2023-07-27 15:07:14 +02:00
|
|
|
value: {
|
2024-06-05 23:27:00 +02:00
|
|
|
type: Array, // Item to display
|
|
|
|
default() {
|
|
|
|
return [];
|
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
type: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: String,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 'gradable',
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
slotindex: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 0,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
line: {
|
2023-07-27 15:07:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
layer: {
|
2023-07-27 15:07:14 +02:00
|
|
|
type: Number,
|
2023-09-08 12:47:29 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
plan: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2023-08-07 16:11:14 +02:00
|
|
|
page: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-09-08 12:47:29 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-08-03 18:44:57 +02:00
|
|
|
},
|
2023-09-08 12:47:29 +02:00
|
|
|
period: {
|
2023-08-03 18:44:57 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
mounted() {
|
2024-06-05 23:27:00 +02:00
|
|
|
const self = this;
|
|
|
|
if (self.type == "gradable" && self.slotindex == 1) {
|
2023-07-27 15:07:14 +02:00
|
|
|
self.resizeListener = new ResizeObserver(() => {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (self.$refs.sizeElement) {
|
2023-07-27 15:07:14 +02:00
|
|
|
const height = self.$refs.sizeElement.getBoundingClientRect().height;
|
|
|
|
ItemEventBus.$emit('lineHeightChange', self.line.id, self.layer, height);
|
|
|
|
}
|
|
|
|
}).observe(self.$refs.sizeElement);
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
2023-07-27 15:07:14 +02:00
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
item() {
|
|
|
|
for (const ix in this.value) {
|
2023-07-27 15:07:14 +02:00
|
|
|
const itm = this.value[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (itm.layer == this.layer) {
|
2023-07-27 15:07:14 +02:00
|
|
|
return itm;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
spanCss() {
|
|
|
|
if (this.item && this.item.span > 1) {
|
2023-08-04 14:57:23 +02:00
|
|
|
const span = (2 * this.item.span) - 1;
|
|
|
|
return `width: 100%; grid-column: span ${span};`;
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
2024-03-07 22:44:29 +01:00
|
|
|
},
|
|
|
|
cloud() {
|
|
|
|
const enrol = this.line.enrol;
|
|
|
|
return (!this.teachermode) && (enrol.enrollable > 0) && (!enrol.enrolled);
|
2023-08-03 18:44:57 +02:00
|
|
|
}
|
2023-07-27 15:07:14 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
2023-09-08 12:47:29 +02:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
template: `
|
2024-01-27 16:21:04 +01:00
|
|
|
<div :class=" 'r-studyline-slot ' + type + ' '
|
2023-09-08 12:47:29 +02:00
|
|
|
+ 'r-studyline-slot-' + slotindex + ' '
|
2024-08-15 15:10:54 +02:00
|
|
|
+ 'periodcount-' + page.periods + ' '
|
2023-07-27 15:07:14 +02:00
|
|
|
+ ((slotindex==0)?'r-studyline-firstcolumn ':' ')"
|
|
|
|
:data-studyline="line.id" ref="sizeElement"
|
2023-08-04 14:57:23 +02:00
|
|
|
:style='spanCss'
|
|
|
|
><div class="r-slot-item" v-if="item"
|
2023-09-08 12:47:29 +02:00
|
|
|
><r-item
|
|
|
|
v-model="item"
|
2024-03-07 22:44:29 +01:00
|
|
|
:cloud="cloud"
|
2023-07-27 15:07:14 +02:00
|
|
|
:plan="plan"
|
|
|
|
:guestmode='guestmode'
|
|
|
|
:teachermode='teachermode'></r-item
|
|
|
|
></div
|
|
|
|
></r-item
|
|
|
|
></div>
|
2023-05-17 21:19:14 +02:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Vue.component('r-item', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-09-08 12:47:29 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
plan: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2024-03-07 22:44:29 +01:00
|
|
|
},
|
|
|
|
cloud: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
lines: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
lineColor() {
|
|
|
|
if (this.teachermode) {
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--gray)";
|
2024-03-07 22:44:29 +01:00
|
|
|
} else if (this.cloud) {
|
|
|
|
return "#ccc";
|
|
|
|
} else {
|
2024-06-05 23:27:00 +02:00
|
|
|
switch (this.value.completion) {
|
2023-05-17 21:19:14 +02:00
|
|
|
default: // "incomplete"
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--gray)";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "failed":
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--danger)";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "progress":
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--warning)";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "completed":
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--success)";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "good":
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--info)";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "excellent":
|
2023-07-27 15:07:14 +02:00
|
|
|
return "var(--blue)";
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
redrawLine(conn) {
|
2023-05-17 21:19:14 +02:00
|
|
|
let lineColor = this.lineColor();
|
2024-06-05 23:27:00 +02:00
|
|
|
// Draw new line...
|
|
|
|
let start = document.getElementById('studyitem-' + conn.from_id);
|
|
|
|
let end = document.getElementById('studyitem-' + conn.to_id);
|
2023-11-11 20:18:05 +01:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// Delete old line
|
|
|
|
if (this.lines[conn.to_id]) {
|
2023-11-11 20:18:05 +01:00
|
|
|
this.lines[conn.to_id].remove();
|
|
|
|
delete this.lines[conn.to_id];
|
|
|
|
}
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
if (start !== null && end !== null && isVisible(start) && isVisible(end)) {
|
|
|
|
this.lines[conn.to_id] = new SimpleLine(start, end, {
|
2023-05-17 21:19:14 +02:00
|
|
|
color: lineColor,
|
2023-08-04 22:54:32 +02:00
|
|
|
gravity: {
|
|
|
|
start: LINE_GRAVITY,
|
|
|
|
end: LINE_GRAVITY,
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
'class': (this.cloud ? "r-dummy-line" : ""),
|
2023-05-17 21:19:14 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
redrawLines() {
|
2023-08-15 22:52:43 +02:00
|
|
|
// Clean all old lines
|
2024-06-05 23:27:00 +02:00
|
|
|
for (let ix in this.lines) {
|
2023-08-15 22:52:43 +02:00
|
|
|
let lineinfo = this.lines[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (lineinfo && lineinfo.line) {
|
2023-08-15 22:52:43 +02:00
|
|
|
lineinfo.line.remove();
|
|
|
|
lineinfo.line = undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create new lines
|
2024-06-05 23:27:00 +02:00
|
|
|
for (let i in this.value.connections.out) {
|
2023-05-17 21:19:14 +02:00
|
|
|
let conn = this.value.connections.out[i];
|
|
|
|
this.redrawLine(conn);
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
onWindowResize() {
|
2023-05-17 21:19:14 +02:00
|
|
|
this.redrawLines();
|
2023-11-11 20:18:05 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
onRedrawLines() {
|
2023-11-11 20:18:05 +01:00
|
|
|
this.redrawLines();
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
removeLine(conn) {
|
|
|
|
if (this.lines[conn.to_id]) {
|
2023-11-11 21:13:07 +01:00
|
|
|
this.lines[conn.to_id].remove();
|
|
|
|
delete this.lines[conn.to_id];
|
|
|
|
}
|
|
|
|
},
|
2023-11-11 20:18:05 +01:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasConnectionsOut() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return !(["finish"].includes(this.value.type));
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
hasConnectionsIn() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return !(["start"].includes(this.value.type));
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
hasContext() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return ['start', 'junction', 'finish'].includes(this.value.type);
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
created() {
|
2023-11-11 20:18:05 +01:00
|
|
|
ItemEventBus.$on('redrawLines', this.onRedrawLines);
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
mounted() {
|
2023-05-17 21:19:14 +02:00
|
|
|
// Initialize connection lines when mounting
|
|
|
|
|
|
|
|
this.redrawLines();
|
|
|
|
setTimeout(()=>{
|
|
|
|
this.redrawLines();
|
2024-06-05 23:27:00 +02:00
|
|
|
}, 50);
|
2023-05-17 21:19:14 +02:00
|
|
|
|
|
|
|
// Add resize event listener
|
2024-06-05 23:27:00 +02:00
|
|
|
window.addEventListener('resize', this.onWindowResize);
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
beforeDestroy() {
|
|
|
|
for (let i in this.value.connections.out) {
|
2023-05-17 21:19:14 +02:00
|
|
|
let conn = this.value.connections.out[i];
|
2023-11-11 20:18:05 +01:00
|
|
|
this.removeLine(conn);
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
// Remove resize event listener
|
2024-06-05 23:27:00 +02:00
|
|
|
window.removeEventListener('resize', this.onWindowResize);
|
2023-11-11 20:18:05 +01:00
|
|
|
ItemEventBus.$off('redrawLines', this.onRedrawLines);
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
updated() {
|
|
|
|
if (!this.dummy) {
|
2023-05-17 21:19:14 +02:00
|
|
|
this.redrawLines();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div class="r-item-base" :id="'studyitem-'+value.id" :data-x='value.type'>
|
2024-03-07 22:44:29 +01:00
|
|
|
<template v-if="cloud">
|
|
|
|
<r-item-dummy-course v-if="value.type == 'course'"></r-item-dummy-course>
|
|
|
|
<r-item-dummy-badge v-else-if="value.type == 'badge'"></r-item-dummy-badge>
|
|
|
|
<r-item-dummy-filter v-else></r-item-dummy-filter>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
2023-05-17 21:19:14 +02:00
|
|
|
<r-item-course v-if="value.type == 'course' && !teachermode" :plan="plan"
|
|
|
|
v-model="value" :guestmode="guestmode" :teachermode="teachermode" ></r-item-course>
|
|
|
|
<r-item-teachercourse v-if="value.type == 'course' && teachermode" :plan="plan"
|
|
|
|
v-model="value" :guestmode="guestmode" :teachermode="teachermode" ></r-item-teachercourse>
|
|
|
|
<r-item-junction v-if="value.type == 'junction'"
|
|
|
|
v-model="value" :guestmode="guestmode" :teachermode="teachermode" ></r-item-junction>
|
|
|
|
<r-item-start v-if="value.type == 'start'"
|
|
|
|
v-model="value" :guestmode="guestmode" :teachermode="teachermode" ></r-item-start>
|
|
|
|
<r-item-finish v-if="value.type == 'finish'"
|
|
|
|
v-model="value" :guestmode="guestmode" :teachermode="teachermode" ></r-item-finish>
|
|
|
|
<r-item-badge v-if="value.type == 'badge'"
|
|
|
|
v-model="value" :guestmode="guestmode" :teachermode="teachermode" ></r-item-badge>
|
2023-09-08 12:47:29 +02:00
|
|
|
<r-item-invalid v-if="value.type == 'invalid' && teachermode"
|
2023-05-17 21:19:14 +02:00
|
|
|
v-model="value" ></r-item-invalid>
|
2024-03-07 22:44:29 +01:00
|
|
|
</template>
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
Vue.component('r-item-invalid', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
'value': {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.invalid,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
},
|
|
|
|
template: `
|
2023-08-22 16:47:37 +02:00
|
|
|
<div class="r-item-invalid">
|
2023-05-17 21:19:14 +02:00
|
|
|
<b-card no-body class="r-item-invalid">
|
|
|
|
<b-row no-gutters>
|
|
|
|
<b-col md="1">
|
|
|
|
<span class="r-timing-indicator timing-invalid"></span>
|
|
|
|
</b-col>
|
|
|
|
<b-col md="11">
|
|
|
|
<b-card-body class="align-items-center">
|
|
|
|
<i class="fa fa-exclamation"></i> {{ text.error }}
|
|
|
|
</b-card-body>
|
|
|
|
</b-col>
|
|
|
|
</b-row>
|
|
|
|
</b-card>
|
2023-08-22 16:47:37 +02:00
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// TAG: Item Course
|
2023-05-17 21:19:14 +02:00
|
|
|
Vue.component('r-item-course', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2023-09-08 12:47:29 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
plan: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-06-16 23:12:17 +02:00
|
|
|
text: strings.course,
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
startdate() {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDate(this.value.course.startdate);
|
2023-07-28 23:43:11 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enddate() {
|
|
|
|
if (this.value.course.enddate > 0) {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDate(this.value.course.enddate);
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2023-07-28 23:43:11 +02:00
|
|
|
return this.text.noenddate;
|
|
|
|
}
|
2023-12-11 22:30:30 +01:00
|
|
|
},
|
|
|
|
courseprogress() {
|
|
|
|
if (!this.value.course.enrolled) {
|
|
|
|
return 0;
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (this.value.course.completion) {
|
|
|
|
return (this.value.course.completion.progress / this.value.course.completion.count);
|
|
|
|
} else if (this.value.course.competency) {
|
|
|
|
return (this.value.course.competency.progress / this.value.course.competency.count);
|
|
|
|
} else if (this.value.course.grades) {
|
|
|
|
return (this.gradeprogress(this.value.course.grades) / this.value.course.grades.length);
|
2023-12-11 22:30:30 +01:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
hasprogressinfo() {
|
|
|
|
if (!this.value.course.enrolled) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return (this.value.course.completion || this.value.course.competency || this.value.course.grades);
|
|
|
|
}
|
2024-02-07 22:33:16 +01:00
|
|
|
},
|
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
2023-07-28 23:43:11 +02:00
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIcon(completion) {
|
|
|
|
switch (completion) {
|
2024-06-03 23:24:16 +02:00
|
|
|
default: // Case "incomplete"
|
2023-05-17 21:19:14 +02:00
|
|
|
return "circle-o";
|
|
|
|
case "pending":
|
|
|
|
return "question-circle";
|
|
|
|
case "failed":
|
2023-09-08 12:47:29 +02:00
|
|
|
return "times-circle";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "progress":
|
|
|
|
return "exclamation-circle";
|
|
|
|
case "completed":
|
|
|
|
return "check-circle";
|
|
|
|
case "good":
|
|
|
|
return "check-circle";
|
|
|
|
case "excellent":
|
|
|
|
return "check-circle";
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
circleIcon(completion) {
|
|
|
|
switch (completion) {
|
2024-06-03 23:24:16 +02:00
|
|
|
default: // Case "incomplete"
|
2023-08-09 14:18:05 +02:00
|
|
|
return null;
|
|
|
|
case "failed":
|
2023-09-08 12:47:29 +02:00
|
|
|
return "times";
|
2023-08-09 14:18:05 +02:00
|
|
|
case "progress":
|
2023-12-11 22:56:59 +01:00
|
|
|
return "";
|
2023-08-09 14:18:05 +02:00
|
|
|
case "completed":
|
|
|
|
return "check";
|
|
|
|
case "good":
|
|
|
|
return "check";
|
|
|
|
case "excellent":
|
|
|
|
return "check";
|
|
|
|
}
|
|
|
|
},
|
2023-12-11 22:30:30 +01:00
|
|
|
gradeprogress(grades) {
|
|
|
|
let progress = 0;
|
|
|
|
for (const ix in grades) {
|
|
|
|
const g = grades[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (["completed", "excellent", "good"].includes(g.completion)) {
|
2023-12-11 22:30:30 +01:00
|
|
|
progress++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return progress;
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
template: `
|
2024-05-23 23:32:59 +02:00
|
|
|
<div :class="'r-item-course card completion-'+value.completion">
|
|
|
|
<div class='r-item-course-cardwrapper mr-0 ml-0 h-100 '>
|
|
|
|
<div
|
|
|
|
:title="text['coursetiming_'+value.course.timing]"
|
|
|
|
v-b-popover.hover.top="startdate+' - '+enddate"
|
|
|
|
:class="'r-timing-indicator timing-'+value.course.timing"
|
|
|
|
></div>
|
|
|
|
<div class="r-item-course-title card-body h-100">
|
|
|
|
<fittext maxsize="12pt" minsize="9pt">
|
|
|
|
<a v-b-modal="'r-item-course-details-'+value.id"
|
|
|
|
:href="(!guestmode)?(wwwroot+'/course/view.php?id='+value.course.id):'#'"
|
|
|
|
@click.prevent.stop=''
|
|
|
|
>{{ value.course.displayname }}</a>
|
|
|
|
</fittext>
|
|
|
|
</div>
|
|
|
|
<div class="h-100 r-item-course-indicator ">
|
|
|
|
<template v-if='!value.course.enrolled'>
|
|
|
|
<i v-b-popover.top
|
|
|
|
class="r-course-result fa fa-exclamation-triangle t-not-enrolled-alert"
|
|
|
|
:title="text.student_not_tracked"></i>
|
|
|
|
</template>
|
|
|
|
<template v-else-if='hasprogressinfo'>
|
|
|
|
<r-progress-circle v-if='["failed", "progress","incomplete"].includes(value.completion)'
|
|
|
|
:value='courseprogress'
|
|
|
|
:max='1'
|
|
|
|
:min='0'
|
|
|
|
:class="'r-course-result r-completion-'+value.completion"
|
2024-06-05 23:27:00 +02:00
|
|
|
:icon='circleIcon(value.completion)'
|
2024-05-23 23:32:59 +02:00
|
|
|
:title="text['completion_'+value.completion]"
|
|
|
|
></r-progress-circle>
|
|
|
|
<i v-else v-b-popover.top
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'r-course-result fa fa-'+completionIcon(value.completion)+
|
2024-05-23 23:32:59 +02:00
|
|
|
' r-completion-'+value.completion"
|
|
|
|
:title="text['completion_'+value.completion]"></i>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<i v-b-popover.top
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'r-course-result fa fa-'+completionIcon(value.completion)+
|
2024-05-23 23:32:59 +02:00
|
|
|
' r-completion-'+value.completion"
|
|
|
|
:title="text['completion_'+value.completion]"></i>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
<b-modal
|
2023-09-08 12:47:29 +02:00
|
|
|
:id="'r-item-course-details-'+value.id"
|
|
|
|
:title="value.course.displayname + ' - ' + value.course.fullname"
|
2023-05-17 21:19:14 +02:00
|
|
|
size="lg"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
2023-12-11 22:30:30 +01:00
|
|
|
header-class="r-item-course-header"
|
2023-05-17 21:19:14 +02:00
|
|
|
>
|
2023-12-11 22:30:30 +01:00
|
|
|
<template #modal-header >
|
|
|
|
<div class="r-item-course-header-details">
|
|
|
|
<div>
|
2024-02-07 22:33:16 +01:00
|
|
|
<h1><a :href="(!guestmode)?(wwwroot+'/course/view.php?id='+value.course.id):undefined" target="_blank"
|
2023-12-11 22:30:30 +01:00
|
|
|
><i class="fa fa-graduation-cap"></i> {{ value.course.fullname }}</a></h1>
|
|
|
|
{{ value.course.context.path.join(" / ")}}
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
2023-12-11 22:30:30 +01:00
|
|
|
<div class="r-course-detail-header-right">
|
|
|
|
<div class="r-completion-detail-header">
|
|
|
|
<template v-if='!value.course.enrolled'>
|
|
|
|
{{text.not_enrolled}}
|
|
|
|
<i v-b-popover.top
|
2023-12-11 22:56:59 +01:00
|
|
|
class="fa fa-exclamation-triangle t-not-enrolled-alert"
|
2023-12-11 22:30:30 +01:00
|
|
|
:title="text.student_not_tracked"></i>
|
|
|
|
</template>
|
2023-12-11 22:56:59 +01:00
|
|
|
<template v-else-if='hasprogressinfo && !value.course.showprogressbar'>
|
|
|
|
{{text['completion_'+value.completion]}}
|
2023-12-11 22:30:30 +01:00
|
|
|
<r-progress-circle v-if='["failed", "progress","incomplete"].includes(value.completion)'
|
|
|
|
:value='courseprogress'
|
|
|
|
:max='1'
|
|
|
|
:min='0'
|
2023-12-11 22:56:59 +01:00
|
|
|
:class="'r-progress-circle-popup r-completion-'+value.completion"
|
2024-06-05 23:27:00 +02:00
|
|
|
:icon='circleIcon(value.completion)'
|
2023-12-11 22:30:30 +01:00
|
|
|
:title="text['completion_'+value.completion]"
|
|
|
|
></r-progress-circle>
|
|
|
|
<i v-else v-b-popover.top
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'fa fa-'+completionIcon(value.completion)+
|
2023-12-11 22:30:30 +01:00
|
|
|
' r-completion-'+value.completion"
|
|
|
|
:title="text['completion_'+value.completion]"></i>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
{{text['completion_'+value.completion]}}
|
2024-06-05 23:27:00 +02:00
|
|
|
<i :class="'fa fa-'+completionIcon(value.completion)+' r-completion-'+value.completion"
|
2023-12-11 22:30:30 +01:00
|
|
|
:title="text['completion_'+value.completion]"></i>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<div :class="'r-timing-'+value.course.timing">
|
|
|
|
{{text['coursetiming_'+value.course.timing]}}<br>
|
|
|
|
{{ startdate }} - {{ enddate }}
|
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2024-06-05 23:27:00 +02:00
|
|
|
<s-progress-bar
|
2023-12-11 22:30:30 +01:00
|
|
|
v-if='value.course.showprogressbar && hasprogressinfo'
|
|
|
|
v-model="courseprogress"
|
|
|
|
></s-progress-bar>
|
2023-05-17 21:19:14 +02:00
|
|
|
</template>
|
2024-06-05 23:27:00 +02:00
|
|
|
<s-course-extrafields
|
|
|
|
v-if="value.course.extrafields"
|
2023-12-11 22:30:30 +01:00
|
|
|
v-model="value.course.extrafields"
|
|
|
|
position="above"
|
|
|
|
></s-course-extrafields>
|
2023-09-08 12:47:29 +02:00
|
|
|
<r-item-studentgrades
|
|
|
|
v-if='!!value.course.grades && value.course.grades.length > 0'
|
2023-05-17 21:19:14 +02:00
|
|
|
v-model='value'
|
|
|
|
:guestmode='guestmode'></r-item-studentgrades>
|
2023-05-19 19:24:10 +02:00
|
|
|
<r-item-studentcompletion
|
2023-09-08 12:47:29 +02:00
|
|
|
v-if='!!value.course.completion'
|
2023-05-17 21:19:14 +02:00
|
|
|
v-model='value.course.completion'
|
|
|
|
:course='value.course'
|
|
|
|
:guestmode='guestmode'></r-item-studentcompletion>
|
2023-11-26 22:58:26 +01:00
|
|
|
<r-item-student-course-competency
|
|
|
|
v-if='!!value.course.competency'
|
|
|
|
v-model='value.course.competency'
|
|
|
|
:item='value'
|
|
|
|
></r-item-student-course-competency>
|
2024-06-05 23:27:00 +02:00
|
|
|
<s-course-extrafields
|
|
|
|
v-if="value.course.extrafields"
|
2023-12-11 22:30:30 +01:00
|
|
|
v-model="value.course.extrafields"
|
|
|
|
position="below"
|
|
|
|
></s-course-extrafields>
|
2023-09-08 12:47:29 +02:00
|
|
|
</b-modal>
|
2024-05-23 23:32:59 +02:00
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// Selected activities dispaly
|
|
|
|
Vue.component('r-item-studentgrades', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-06-16 23:12:17 +02:00
|
|
|
text: strings.course,
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
pendingsubmission() {
|
2023-05-17 21:19:14 +02:00
|
|
|
let result = false;
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in this.value.course.grades) {
|
2023-05-17 21:19:14 +02:00
|
|
|
const g = this.value.course.grades[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (g.pendingsubmission) {
|
2023-05-17 21:19:14 +02:00
|
|
|
result = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
},
|
|
|
|
useRequiredGrades() {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.plan && this.plan.aggregation_info && this.plan.aggregation_info.useRequiredGrades !== undefined) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.plan.aggregation_info.useRequiredGrades;
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2023-05-17 21:19:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
2023-09-08 12:47:29 +02:00
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIcon(completion) {
|
|
|
|
switch (completion) {
|
2024-06-03 23:24:16 +02:00
|
|
|
default: // Case "incomplete"
|
2023-05-17 21:19:14 +02:00
|
|
|
return "circle-o";
|
|
|
|
case "pending":
|
|
|
|
return "question-circle";
|
|
|
|
case "failed":
|
2023-09-08 12:47:29 +02:00
|
|
|
return "times-circle";
|
2023-05-17 21:19:14 +02:00
|
|
|
case "progress":
|
|
|
|
return "exclamation-circle";
|
|
|
|
case "completed":
|
|
|
|
return "check-circle";
|
|
|
|
case "good":
|
|
|
|
return "check-circle";
|
|
|
|
case "excellent":
|
|
|
|
return "check-circle";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<table class="r-item-course-grade-details">
|
|
|
|
<tr v-for="g in value.course.grades">
|
|
|
|
<td><span class="r-activity-icon" :title="g.typename" v-html="g.icon"></span
|
|
|
|
><a
|
2023-10-07 23:19:54 +02:00
|
|
|
:href="(!guestmode)?(g.link):undefined" target="_blank"><span v-html="g.name"></span></a>
|
2023-05-17 21:19:14 +02:00
|
|
|
<abbr v-if="useRequiredGrades && g.required" :title="text.required_goal"
|
|
|
|
:class="'s-required ' + g.completion"
|
|
|
|
><i class='fa fa-asterisk' ></i
|
|
|
|
></abbr>
|
|
|
|
</td>
|
|
|
|
<td><span :class="' r-completion-'+g.completion">{{g.grade}}</span></td>
|
2024-06-05 23:27:00 +02:00
|
|
|
<td><i :class="'fa fa-'+completionIcon(g.completion)+' r-completion-'+g.completion"
|
2023-05-17 21:19:14 +02:00
|
|
|
:title="text['completion_'+g.completion]"></i>
|
2023-09-08 12:47:29 +02:00
|
|
|
<i v-if='g.pendingsubmission' :title="text['completion_pending']"
|
2023-05-17 21:19:14 +02:00
|
|
|
class="r-pendingsubmission fa fa-clock-o"></i></td>
|
|
|
|
<td v-if="g.feedback">
|
2023-09-08 12:47:29 +02:00
|
|
|
<a v-b-modal="'r-grade-feedback-'+g.id"
|
|
|
|
href="#"
|
2024-06-05 23:38:38 +02:00
|
|
|
@click.prevent.stop=""
|
2023-05-17 21:19:14 +02:00
|
|
|
>{{ text["view_feedback"]}}</a>
|
|
|
|
<b-modal
|
2023-09-08 12:47:29 +02:00
|
|
|
:id="'r-grade-feedback-'+g.id"
|
2023-05-17 21:19:14 +02:00
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
2024-06-05 23:38:38 +02:00
|
|
|
<div>
|
|
|
|
<h3><i class="fa fa-graduation-cap"></i>{{ value.course.fullname }}</h3><br>
|
|
|
|
<span class="r-activity-icon" :title="g.typename" v-html="g.icon + g.name"></span>
|
|
|
|
</div>
|
2023-09-08 12:47:29 +02:00
|
|
|
</template>
|
2023-05-17 21:19:14 +02:00
|
|
|
<span v-html="g.feedback"></span>
|
|
|
|
</b-modal>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2023-11-26 22:58:26 +01:00
|
|
|
// Core completion version of student course info
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-studentcompletion', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
course: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-09-01 12:27:56 +02:00
|
|
|
text: strings.completion,
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIcon(completion) {
|
|
|
|
switch (completion) {
|
2023-05-17 21:19:14 +02:00
|
|
|
case "progress":
|
|
|
|
return "exclamation-circle";
|
2023-05-19 22:12:18 +02:00
|
|
|
case "complete":
|
2023-05-17 21:19:14 +02:00
|
|
|
return "check-circle";
|
2023-05-19 22:12:18 +02:00
|
|
|
case "complete-pass":
|
2023-05-17 21:19:14 +02:00
|
|
|
return "check-circle";
|
2023-05-19 22:12:18 +02:00
|
|
|
case "complete-fail":
|
|
|
|
return "times-circle";
|
2024-06-05 23:27:00 +02:00
|
|
|
default: // Case "incomplete"
|
2023-05-19 22:12:18 +02:00
|
|
|
return "circle-o";
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
completionTag(cgroup) {
|
|
|
|
return cgroup.completion ? 'completed' : 'incomplete';
|
2023-09-01 12:27:56 +02:00
|
|
|
},
|
|
|
|
hasCompletions() {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.value.conditions) {
|
|
|
|
for (const cgroup of this.value.conditions) {
|
|
|
|
if (cgroup.items && cgroup.items.length > 0) {
|
2023-09-01 12:27:56 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2023-09-01 23:13:50 +02:00
|
|
|
requirementHTML(requirements) {
|
|
|
|
const rqs = requirements.split(/, */);
|
|
|
|
let html = "";
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in rqs) {
|
2023-09-01 23:13:50 +02:00
|
|
|
const rq = rqs[ix];
|
|
|
|
html += `${rq}<br>`;
|
|
|
|
}
|
|
|
|
return html;
|
|
|
|
},
|
|
|
|
addTargetBlank(html) {
|
2024-06-05 23:27:00 +02:00
|
|
|
const m = /^([^<]*< *a +)(.*)/.exec(html);
|
|
|
|
if (m) {
|
2023-09-01 23:13:50 +02:00
|
|
|
return `${m[1]} target="_blank" ${m[2]}`;
|
|
|
|
} else {
|
|
|
|
return html;
|
|
|
|
}
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<table class="r-item-course-grade-details">
|
2023-09-01 12:27:56 +02:00
|
|
|
<tr v-if="hasCompletions">
|
|
|
|
<td colspan='2'
|
|
|
|
><span v-if="value.conditions.length <= 1">{{ text.aggregation_overall_one }}</span
|
|
|
|
><span v-else if="value.aggregation == 'all'">{{ text.aggregation_overall_all}}</span
|
|
|
|
><span v-else>{{ text.aggregation_overall_any }}</span
|
|
|
|
></td>
|
|
|
|
</tr>
|
|
|
|
<tr v-else>
|
|
|
|
<td colspan='2'>{{text.completion_not_configured}}!
|
|
|
|
</td>
|
|
|
|
</tr>
|
2023-08-31 07:40:55 +02:00
|
|
|
<template v-for='cgroup in value.conditions' v-if='value.enabled && value.tracked'>
|
2023-05-17 21:19:14 +02:00
|
|
|
<tr>
|
2023-09-01 12:27:56 +02:00
|
|
|
<th colspan='2'><span v-if="cgroup.items.length > 1"
|
|
|
|
><span v-if="cgroup.aggregation == 'all'">{{ text.aggregation_all}}</span
|
|
|
|
><span v-else>{{ text.aggregation_any}}</span></span
|
|
|
|
><span v-else>{{ text.aggregation_one }}</span>
|
|
|
|
{{ cgroup.title.toLowerCase() }}:
|
|
|
|
</th>
|
2023-07-04 23:38:08 +02:00
|
|
|
<th><r-progress-circle v-if="cgroup.progress < cgroup.count"
|
2023-05-20 18:25:22 +02:00
|
|
|
:value='cgroup.progress'
|
|
|
|
:max='cgroup.count'
|
|
|
|
:class="'r-completion-'+cgroup.status"
|
|
|
|
:title="text['completion_'+cgroup.status]"
|
2023-07-04 23:38:08 +02:00
|
|
|
></r-progress-circle>
|
|
|
|
<i v-else :class="'fa fa-check-circle r-completion-'+cgroup.status"></i>
|
|
|
|
</th>
|
2023-05-17 21:19:14 +02:00
|
|
|
</tr>
|
|
|
|
<tr v-for='ci in cgroup.items'>
|
2023-12-11 23:41:03 +01:00
|
|
|
<td><span v-if='guestmode'><span v-html="ci.title"></span></span>
|
2023-09-01 23:13:50 +02:00
|
|
|
<span v-else v-html='addTargetBlank(ci.details.criteria)'></span>
|
|
|
|
<a href="#" v-b-tooltip.click.hover.right.html="{ customClass: 'r-tooltip ' + ci.status}"
|
|
|
|
:title="requirementHTML(ci.details.requirement)"
|
2023-09-08 12:47:29 +02:00
|
|
|
class="text-primary"><i v-if="ci.details.requirement"
|
|
|
|
class='fa fa-question-circle'
|
2023-06-16 23:12:17 +02:00
|
|
|
></i></a>
|
2023-09-01 23:13:50 +02:00
|
|
|
<td
|
|
|
|
><span :class="' r-completion-'+ci.status">{{ci.grade}}</span>
|
|
|
|
<span v-if="ci.warning"
|
2023-09-08 12:47:29 +02:00
|
|
|
><i class="text-primary fa fa-exclamation-triangle"
|
2023-09-01 23:13:50 +02:00
|
|
|
v-b-tooltip.hover.right.click="{ customClass: 'r-tooltip info' }"
|
|
|
|
:title="ci.warning"
|
|
|
|
></i
|
|
|
|
></span
|
|
|
|
></td>
|
2024-06-05 23:27:00 +02:00
|
|
|
<td><i :class="'fa fa-'+completionIcon(ci.status)+' r-completion-'+ci.status"
|
2023-05-19 19:24:10 +02:00
|
|
|
:title="text['completion_'+ci.status]"></i>
|
2023-09-08 12:47:29 +02:00
|
|
|
<i v-if='ci.pending' :title="text['completion_pending']"
|
2023-05-17 21:19:14 +02:00
|
|
|
class="r-pendingsubmission fa fa-clock-o"></i>
|
|
|
|
</td>
|
|
|
|
<td v-if="ci.feedback">
|
2023-09-08 12:47:29 +02:00
|
|
|
<a v-b-modal="'r-grade-feedback-'+ci.id"
|
|
|
|
href="#"
|
2024-06-05 23:38:38 +02:00
|
|
|
@click.prevent.stop=""
|
2023-05-17 21:19:14 +02:00
|
|
|
>{{ text["view_feedback"]}}</a>
|
|
|
|
<b-modal
|
2023-09-08 12:47:29 +02:00
|
|
|
:id="'r-grade-feedback-'+ci.id"
|
2023-05-17 21:19:14 +02:00
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
2024-06-05 23:38:38 +02:00
|
|
|
<div>
|
|
|
|
<h3><i class="fa fa-graduation-cap"></i>{{ course.fullname }}</h3>
|
|
|
|
<span class="r-activity-icon" :title="ci.typename" v-html="ci.icon + ci.name"></span>
|
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
</template>
|
2023-05-19 19:24:10 +02:00
|
|
|
<span v-html="ci.feedback"></span>
|
2023-05-17 21:19:14 +02:00
|
|
|
</b-modal>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
2023-08-31 07:40:55 +02:00
|
|
|
<template v-else>
|
|
|
|
<tr v-if='! value.enabled'>
|
|
|
|
<td colspan='4'>{{text.completion_not_enabled}}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-else>
|
|
|
|
<td colspan='4'>{{text.student_not_tracked}}</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
2023-05-17 21:19:14 +02:00
|
|
|
</table>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// TAG: STUDENT Course competency
|
|
|
|
Vue.component('r-item-student-course-competency', {
|
2023-11-26 22:58:26 +01:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-11-26 22:58:26 +01:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
item: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {id: null};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.competency,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasCompletions() {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.value.conditions) {
|
|
|
|
for (const cgroup of this.value.conditions) {
|
|
|
|
if (cgroup.items && cgroup.items.length > 0) {
|
2023-11-26 22:58:26 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2024-02-07 22:33:16 +01:00
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIcon(competency) {
|
2023-11-26 22:58:26 +01:00
|
|
|
if (competency.proficient && competency.courseproficient) {
|
|
|
|
return "check-circle";
|
|
|
|
} else if (competency.proficient) {
|
|
|
|
return "check";
|
|
|
|
} else if (competency.proficient === false) {
|
|
|
|
return "times-circle";
|
|
|
|
} else {
|
|
|
|
return "circle-o";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
completionTag(competency) {
|
2023-11-26 22:58:26 +01:00
|
|
|
if (competency.proficient && competency.courseproficient) {
|
|
|
|
return "completed";
|
|
|
|
} else if (competency.proficient) {
|
|
|
|
return "completed";
|
|
|
|
} else if (competency.proficient === false) {
|
|
|
|
return "failed";
|
|
|
|
} else if (competency.progress) {
|
|
|
|
return "progress";
|
|
|
|
} else {
|
|
|
|
return "incomplete";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
pathtags(competency) {
|
|
|
|
const path = competency.path;
|
|
|
|
let s = "";
|
|
|
|
for (const ix in path) {
|
|
|
|
const p = path[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (ix > 0) {
|
2023-11-26 22:58:26 +01:00
|
|
|
s += " / ";
|
|
|
|
}
|
|
|
|
let url;
|
2024-06-05 23:27:00 +02:00
|
|
|
if (p.type == 'competency') {
|
|
|
|
url = Config.wwwroot + `/admin/tool/lp/user_competency_in_course.php?courseid=${this.item.course.id}&competencyid=${p.id}`;
|
2023-11-26 22:58:26 +01:00
|
|
|
} else {
|
|
|
|
url = this.competencyurl(p);
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
|
2023-11-26 22:58:26 +01:00
|
|
|
s += `<a href="${url}" target="_blank">${p.title}</a>`;
|
|
|
|
}
|
|
|
|
return s;
|
|
|
|
},
|
|
|
|
competencyurl(c) {
|
2024-06-05 23:27:00 +02:00
|
|
|
return Config.wwwroot + `/admin/tool/lp/user_competency_in_course.php?courseid=${this.item.course.id}&competencyid=${c.id}`;
|
2023-12-13 00:13:07 +01:00
|
|
|
},
|
|
|
|
usercompetencyurl(c) {
|
2024-06-05 23:27:00 +02:00
|
|
|
return Config.wwwroot + `/admin/tool/lp/user_competency.php?id=${c.ucid}`;
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<table class="r-item-course-competency-list">
|
|
|
|
<tr v-if="value.competencies.length == 0">
|
|
|
|
<td colspan='2'>{{text.competencies_not_configured}}!
|
2024-02-07 22:33:16 +01:00
|
|
|
<br><a :href="wwwroot+'/admin/tool/lp/coursecompetencies.php?courseid='+item.course.id" target='_blank'>{{text.configure_competencies}}</a>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<template v-else>
|
|
|
|
<tr v-for='c in value.competencies'>
|
2023-11-27 23:11:17 +01:00
|
|
|
<td>
|
2023-12-13 00:13:07 +01:00
|
|
|
<a href="#" v-b-modal="'modal-competency-id-'+c.id" @click.prevent.stop=''><span v-html='c.title' ></span></a>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
2023-11-27 23:11:17 +01:00
|
|
|
<td class='details' >
|
2023-12-13 00:13:07 +01:00
|
|
|
<a v-if="c.details" href="#" v-b-modal="'modal-competency-id-'+c.id" @click.prevent.stop='' ><span v-html='c.details'></span></a>
|
2023-11-27 23:11:17 +01:00
|
|
|
<abbr v-if="c.required" :title="text.required"
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'s-required ' + + completionTag(c)"
|
2023-11-27 23:11:17 +01:00
|
|
|
><i class='fa fa-asterisk' ></i
|
2024-06-05 23:27:00 +02:00
|
|
|
></abbr>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
|
|
|
<td :colspan="(c.required)?1:2">
|
2024-06-05 23:27:00 +02:00
|
|
|
<span :class="'r-completion-'+completionTag(c)">
|
2023-11-26 22:58:26 +01:00
|
|
|
<template v-if="!c.progress && !c.count">
|
2024-06-05 23:27:00 +02:00
|
|
|
<i :class="'fa fa-'+completionIcon(c)" :title="text['completion_'+completionTag(c)]"></i>
|
2023-11-26 22:58:26 +01:00
|
|
|
{{ (c.proficient === null)?text.unrated:c.grade }}
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
2023-12-13 00:13:07 +01:00
|
|
|
<r-progress-circle v-if='!c.proficient'
|
2023-11-26 22:58:26 +01:00
|
|
|
:value='c.progress'
|
|
|
|
:max='c.count'
|
|
|
|
:min='0'
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'r-completion-'+completionTag(c)"
|
|
|
|
:title="text['completion_'+completionTag(c)]"
|
2023-11-26 22:58:26 +01:00
|
|
|
></r-progress-circle>
|
2024-06-05 23:27:00 +02:00
|
|
|
<i v-else :class="'fa fa-'+completionIcon(c)" :title="text['completion_'+completionTag(c)]"></i>
|
2023-11-26 22:58:26 +01:00
|
|
|
{{ (c.proficient === null)?((c.progress)?text.progress:text.unrated):c.grade }}
|
|
|
|
</template>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
<td v-if="c.feedback">
|
|
|
|
<a v-b-modal="'r-competency-feedback-'+c.id"
|
2023-12-13 00:13:07 +01:00
|
|
|
@click.prevent.stop=''
|
2023-11-26 22:58:26 +01:00
|
|
|
href="#"
|
|
|
|
>{{ text["view_feedback"]}}</a>
|
|
|
|
<b-modal
|
|
|
|
:id="'r-competency-feedback-'+c.id"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
2024-06-05 23:38:38 +02:00
|
|
|
<div>
|
|
|
|
<h3><i class="fa fa-puzzle-piece"></i>{{ c.title }}</h3>
|
|
|
|
</div>
|
2023-11-26 22:58:26 +01:00
|
|
|
</template>
|
|
|
|
<span v-html="c.feedback"></span>
|
|
|
|
</b-modal>
|
|
|
|
</td>
|
|
|
|
<b-modal :id="'modal-competency-id-'+c.id"
|
|
|
|
size="lg"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
|
|
|
<div>
|
|
|
|
<h1><i class="fa fa-puzzle-piece"></i>
|
2024-02-07 22:33:16 +01:00
|
|
|
<a :href="wwwroot+'/admin/tool/lp/competencies.php?competencyid='+c.id" target="_blank"
|
2023-11-26 22:58:26 +01:00
|
|
|
>{{c.title}} {{c.details}} </a
|
|
|
|
></h1>
|
|
|
|
<div><span v-html="pathtags(c)"></span></div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<div class="mb-2" v-if="c.description"><span v-html='c.description'></span></div>
|
|
|
|
|
|
|
|
<template v-if="c.rule && c.children">
|
|
|
|
<div>{{ c.ruleoutcome }} {{ text.when}} <span v-html="c.rule.toLocaleLowerCase()"></span></div>
|
|
|
|
<table v-if="c.children" class='r-item-course-competency-list'>
|
|
|
|
<tr class='t-item-course-competency-headers'>
|
|
|
|
<th colspan="2">{{text.heading}}</th>
|
|
|
|
<th colspan="3">{{text.results}}</th>
|
|
|
|
</tr>
|
|
|
|
<tr v-for="cc in c.children">
|
2023-11-27 23:11:17 +01:00
|
|
|
<td >
|
2023-12-13 00:13:07 +01:00
|
|
|
<a :href='usercompetencyurl(cc)' target="_blank"><span v-html='cc.title'></span></a>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
2023-11-27 23:11:17 +01:00
|
|
|
<td class='details'>
|
2023-12-13 00:13:07 +01:00
|
|
|
<a v-if="cc.details" :href='usercompetencyurl(cc)' target="_blank"><span v-html='cc.details'></span></a>
|
2023-11-27 23:11:17 +01:00
|
|
|
<abbr v-if="c.required" :title="text.required"
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'s-required ' + + completionTag(cc)"
|
2023-11-27 23:11:17 +01:00
|
|
|
><i class='fa fa-asterisk' ></i
|
|
|
|
></abbr>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
2024-06-05 23:27:00 +02:00
|
|
|
<td><span :class="'r-completion-'+completionTag(cc)"
|
|
|
|
><i :class="'fa fa-'+completionIcon(cc)" :title="text['completion_'+completionTag(cc)]"></i>
|
2023-11-26 22:58:26 +01:00
|
|
|
{{ (cc.proficient === null)?text.unrated:cc.grade }}</span></td>
|
|
|
|
<td><span class="text-info">{{ cc.points }} {{ text.points }}</span></td>
|
2023-11-27 23:11:17 +01:00
|
|
|
<td>
|
|
|
|
</td>
|
2023-11-26 22:58:26 +01:00
|
|
|
<td v-if="cc.feedback">
|
|
|
|
<a v-b-modal="'r-competency-feedback-'+cc.id"
|
|
|
|
href="#"
|
2024-06-05 23:38:38 +02:00
|
|
|
@click.prevent.stop=""
|
2023-11-26 22:58:26 +01:00
|
|
|
>{{ text["view_feedback"]}}</a>
|
|
|
|
<b-modal
|
|
|
|
:id="'r-competency-feedback-'+cc.id"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
2024-06-05 23:38:38 +02:00
|
|
|
<div>
|
|
|
|
<h3><i class="fa fa-puzzle-piece"></i>{{ cc.title }}</h3><br>
|
|
|
|
</div>
|
2023-11-26 22:58:26 +01:00
|
|
|
</template>
|
|
|
|
<span v-html="cc.feedback"></span>
|
|
|
|
</b-modal>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</template>
|
|
|
|
</b-modal>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</table>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// TAG: Teacher course
|
2023-05-17 21:19:14 +02:00
|
|
|
Vue.component('r-item-teachercourse', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return false;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
plan: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-06-30 17:03:10 +02:00
|
|
|
text: strings.teachercourse,
|
2023-05-17 21:19:14 +02:00
|
|
|
txt: {
|
|
|
|
grading: strings.grading,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
courseGradingNeeded() {
|
|
|
|
return this.courseGradingState();
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
courseGradingIcon() {
|
|
|
|
return this.determineGradingIcon(this.courseGradingState());
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
filteredGrades() {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.value.course.grades.filter(g => g.selected);
|
|
|
|
},
|
|
|
|
useRequiredGrades() {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.plan && this.plan.aggregation_info && this.plan.aggregation_info.useRequiredGrades !== undefined) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.plan.aggregation_info.useRequiredGrades;
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2023-05-17 21:19:14 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
2023-06-16 23:12:17 +02:00
|
|
|
isCompletable() {
|
|
|
|
let completable = false;
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.value.course.completion) {
|
|
|
|
if (this.value.course.completion.conditions.length > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
completable = true;
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (this.value.course.grades) {
|
|
|
|
if (this.value.course.grades.length > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
completable = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return completable;
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
progressCircle() {
|
2023-06-16 23:12:17 +02:00
|
|
|
const status = {
|
|
|
|
students: 0,
|
|
|
|
completed: 0,
|
2024-06-05 23:27:00 +02:00
|
|
|
completedPass: 0,
|
|
|
|
completedFail: 0,
|
2023-06-16 23:12:17 +02:00
|
|
|
ungraded: 0,
|
|
|
|
};
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.value.course.completion) {
|
|
|
|
for (const cond of this.value.course.completion.conditions) {
|
|
|
|
for (const itm of cond.items) {
|
|
|
|
if (itm.progress) {
|
2023-06-16 23:12:17 +02:00
|
|
|
status.students += itm.progress.students;
|
|
|
|
status.completed += itm.progress.completed;
|
2024-06-05 23:27:00 +02:00
|
|
|
status.completedPass += itm.progress.completed_pass;
|
|
|
|
status.completedFail += itm.progress.completed_fail;
|
2023-09-01 23:13:50 +02:00
|
|
|
status.ungraded += itm.progress.ungraded;
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-27 23:11:17 +01:00
|
|
|
} else if (this.value.course.competency) {
|
|
|
|
status.students = this.value.course.competency.total;
|
|
|
|
status.completed = this.value.course.competency.proficient;
|
|
|
|
} else if (this.value.course.grades) {
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const g of this.value.course.grades) {
|
|
|
|
if (g.grading) {
|
2023-06-16 23:12:17 +02:00
|
|
|
status.students += g.grading.students;
|
|
|
|
status.completed += g.grading.completed;
|
2024-06-05 23:27:00 +02:00
|
|
|
status.completedPass += g.grading.completed_pass;
|
|
|
|
status.completedFail += g.grading.completed_fail;
|
2023-06-16 23:12:17 +02:00
|
|
|
status.ungraded += g.grading.ungraded;
|
|
|
|
}
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
}
|
2023-06-16 23:12:17 +02:00
|
|
|
|
|
|
|
return status;
|
2023-07-28 23:43:11 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
startdate() {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDate(this.value.course.startdate);
|
2023-07-28 23:43:11 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enddate() {
|
|
|
|
if (this.value.course.enddate > 0) {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDate(this.value.course.enddate);
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2023-07-28 23:43:11 +02:00
|
|
|
return this.text.noenddate;
|
|
|
|
}
|
2024-02-07 22:33:16 +01:00
|
|
|
},
|
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
2024-02-07 22:33:16 +01:00
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
courseGradingState() {
|
2023-05-17 21:19:14 +02:00
|
|
|
let ungraded = 0;
|
|
|
|
let unknown = 0;
|
|
|
|
let graded = 0;
|
|
|
|
let allgraded = 0;
|
2024-06-05 23:27:00 +02:00
|
|
|
const grades = this.filteredGrades;
|
2023-05-17 21:19:14 +02:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
if (!Array.isArray(grades) || grades == 0) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return 'nogrades';
|
|
|
|
}
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in grades) {
|
2023-05-17 21:19:14 +02:00
|
|
|
const grade = grades[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (grade.grading) {
|
|
|
|
if (Number(grade.grading.ungraded) > 0) {
|
2023-05-17 21:19:14 +02:00
|
|
|
ungraded++;
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (Number(grade.grading.graded) > 0) {
|
|
|
|
if (Number(grade.grading.graded) == Number(grade.grading.students)) {
|
2023-09-08 12:47:29 +02:00
|
|
|
allgraded++;
|
2023-05-17 21:19:14 +02:00
|
|
|
} else {
|
|
|
|
graded++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
unknown = true;
|
|
|
|
}
|
|
|
|
}
|
2023-09-08 12:47:29 +02:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
if (ungraded > 0) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return 'ungraded';
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (unknown) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return 'unknown';
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (graded) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return 'graded';
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (allgraded) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return 'allgraded';
|
|
|
|
} else {
|
|
|
|
return 'unsubmitted';
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
determineGradingIcon(gradingstate) {
|
|
|
|
switch (gradingstate) {
|
2023-05-17 21:19:14 +02:00
|
|
|
default: // "nogrades":
|
|
|
|
return "circle-o";
|
|
|
|
case "ungraded":
|
|
|
|
return "exclamation-circle";
|
|
|
|
case "unknown":
|
|
|
|
return "question-circle-o";
|
|
|
|
case "graded":
|
|
|
|
return "check";
|
|
|
|
case "allgraded":
|
|
|
|
return "check";
|
|
|
|
case "unsubmitted":
|
|
|
|
return "dot-circle-o";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
2024-05-23 23:32:59 +02:00
|
|
|
<div :class="'r-item-course card '+ (value.course.amteacher?'r-course-am-teacher':'')">
|
|
|
|
<div class='r-item-course-cardwrapper mr-0 ml-0 h-100 '>
|
|
|
|
<div
|
|
|
|
:title="text['coursetiming_'+value.course.timing]"
|
|
|
|
v-b-popover.hover.top="startdate+' - '+enddate"
|
|
|
|
:class="'r-timing-indicator timing-'+value.course.timing"
|
|
|
|
></div>
|
|
|
|
<div class="r-item-course-title card-body h-100">
|
|
|
|
<fittext maxsize="12pt" minsize="9pt">
|
|
|
|
<a v-b-modal="'r-item-course-details-'+value.id"
|
|
|
|
:href="(!guestmode)?(wwwroot+'/course/view.php?id='+value.course.id):'#'"
|
|
|
|
@click.prevent.stop=''
|
|
|
|
>{{ value.course.displayname }}</a>
|
|
|
|
</fittext>
|
2023-08-04 16:54:41 +02:00
|
|
|
</div>
|
2024-05-23 23:32:59 +02:00
|
|
|
<div class="h-100 r-item-course-indicator ">
|
|
|
|
<r-completion-circle class="r-course-graded" :disabled="!isCompletable"
|
2024-06-05 23:27:00 +02:00
|
|
|
v-model="progressCircle"></r-completion-circle>
|
2023-08-04 16:54:41 +02:00
|
|
|
</div>
|
2023-08-04 17:46:34 +02:00
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
<b-modal
|
|
|
|
v-if="true"
|
2023-09-08 12:47:29 +02:00
|
|
|
:id="'r-item-course-details-'+value.id"
|
|
|
|
:title="value.course.displayname + ' - ' + value.course.fullname"
|
2023-05-17 21:19:14 +02:00
|
|
|
size="lg"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
|
|
|
<div>
|
2024-02-07 22:33:16 +01:00
|
|
|
<h1><a :href="(!guestmode)?(wwwroot+'/course/view.php?id='+value.course.id):undefined" target="_blank"
|
2023-05-17 21:19:14 +02:00
|
|
|
><i class="fa fa-graduation-cap"></i> {{ value.course.fullname }}</a>
|
2023-08-18 19:22:57 +02:00
|
|
|
<r-item-teacher-gradepicker v-model="value"
|
2023-05-29 23:00:45 +02:00
|
|
|
v-if="value.course.grades && value.course.grades.length > 0"
|
|
|
|
:useRequiredGrades="useRequiredGrades"
|
|
|
|
:plan="plan"
|
|
|
|
></r-item-teacher-gradepicker>
|
2023-09-08 12:47:29 +02:00
|
|
|
<a v-if='!!value.course.completion && value.course.amteacher'
|
2024-02-07 22:33:16 +01:00
|
|
|
:href="wwwroot+'/course/completion.php?id='+value.course.id" target="_blank"
|
2023-06-16 23:12:17 +02:00
|
|
|
:title="text.configure_completion"><i class="fa fa-gear"></i></a>
|
2023-05-17 21:19:14 +02:00
|
|
|
</h1>
|
2023-08-31 21:09:57 +02:00
|
|
|
{{ value.course.context.path.join(" / ") }}
|
2023-08-31 07:40:55 +02:00
|
|
|
<div class='mt-1 text-info'>
|
|
|
|
<span v-if='value.course.numenrolled != 1'>{{ value.course.numenrolled }} {{ text.students_from_plan_enrolled }}</span>
|
|
|
|
<span v-else> 1 {{ text.student_from_plan_enrolled }} </span>
|
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
<div class="r-course-detail-header-right">
|
|
|
|
<div class="r-completion-detail-header">
|
2023-06-16 23:12:17 +02:00
|
|
|
<r-completion-circle class="r-progress-circle-popup" :disabled="!isCompletable"
|
2024-06-05 23:27:00 +02:00
|
|
|
v-model="progressCircle"></r-completion-circle>
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
<div :class="'r-timing-'+value.course.timing">
|
|
|
|
{{ text['coursetiming_'+value.course.timing] }}<br>
|
2023-07-28 23:43:11 +02:00
|
|
|
{{ startdate }} - {{ enddate }}
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-06-05 23:27:00 +02:00
|
|
|
<s-course-extrafields
|
|
|
|
v-if="value.course.extrafields"
|
2023-12-11 22:30:30 +01:00
|
|
|
v-model="value.course.extrafields"
|
|
|
|
position="above"
|
|
|
|
></s-course-extrafields>
|
2023-09-08 12:47:29 +02:00
|
|
|
<r-item-teachergrades
|
|
|
|
v-if='!!value.course.grades && value.course.grades.length > 0'
|
2023-05-29 23:00:45 +02:00
|
|
|
v-model='value.course'
|
|
|
|
:useRequiredGrades="useRequiredGrades"
|
|
|
|
></r-item-teachergrades>
|
|
|
|
<r-item-teachercompletion
|
2023-09-08 12:47:29 +02:00
|
|
|
v-if='!!value.course.completion'
|
2023-05-29 23:00:45 +02:00
|
|
|
v-model='value.course.completion'
|
|
|
|
:course='value.course'
|
|
|
|
></r-item-teachercompletion>
|
2023-11-26 22:58:26 +01:00
|
|
|
<r-item-teacher-course-competency
|
|
|
|
v-if='!!value.course.competency'
|
|
|
|
v-model='value.course.competency'
|
|
|
|
:item='value'
|
|
|
|
></r-item-teacher-course-competency>
|
2024-06-05 23:27:00 +02:00
|
|
|
<s-course-extrafields
|
|
|
|
v-if="value.course.extrafields"
|
2023-12-11 22:30:30 +01:00
|
|
|
v-model="value.course.extrafields"
|
|
|
|
position="below"
|
|
|
|
></s-course-extrafields>
|
2023-05-17 21:19:14 +02:00
|
|
|
</b-modal>
|
2023-09-08 12:47:29 +02:00
|
|
|
|
2023-05-29 23:00:45 +02:00
|
|
|
</b-card>
|
2023-08-22 16:47:37 +02:00
|
|
|
</div>
|
2023-05-29 23:00:45 +02:00
|
|
|
`,
|
|
|
|
});
|
2023-05-17 21:19:14 +02:00
|
|
|
|
2023-05-29 23:00:45 +02:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// Select activities to use in grade overview
|
2023-11-26 22:58:26 +01:00
|
|
|
Vue.component('r-item-teacher-gradepicker', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-11-26 22:58:26 +01:00
|
|
|
type: Object, // Item
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
useRequiredGrades: {
|
|
|
|
type: Boolean,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
2023-05-29 23:00:45 +02:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.teachercourse,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
startdate() {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDate(this.value.course.startdate);
|
2024-05-10 15:22:52 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
enddate() {
|
|
|
|
if (this.value.course.enddate > 0) {
|
2024-06-03 23:24:16 +02:00
|
|
|
return formatDate(this.value.course.enddate);
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2024-05-10 15:22:52 +02:00
|
|
|
return this.text.noenddate;
|
|
|
|
}
|
|
|
|
},
|
2024-02-07 22:33:16 +01:00
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
includeChanged(newValue, g) {
|
2023-11-26 22:58:26 +01:00
|
|
|
call([{
|
|
|
|
methodname: 'local_treestudyplan_include_grade',
|
2024-06-05 23:27:00 +02:00
|
|
|
args: {
|
|
|
|
'grade_id': g.id,
|
|
|
|
'item_id': this.value.id,
|
|
|
|
'include': newValue,
|
|
|
|
'required': g.required,
|
|
|
|
}
|
2023-12-13 23:49:06 +01:00
|
|
|
}])[0].catch(notification.exception);
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
requiredChanged(newValue, g) {
|
2023-11-26 22:58:26 +01:00
|
|
|
call([{
|
|
|
|
methodname: 'local_treestudyplan_include_grade',
|
2024-06-05 23:27:00 +02:00
|
|
|
args: {
|
|
|
|
'grade_id': g.id,
|
|
|
|
'item_id': this.value.id,
|
|
|
|
'include': g.selected,
|
|
|
|
'required': newValue,
|
|
|
|
}
|
2023-12-13 23:49:06 +01:00
|
|
|
}])[0].catch(notification.exception);
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<a v-if="value.course.canselectgradables" href='#'
|
|
|
|
v-b-modal="'r-item-course-config-'+value.id"
|
|
|
|
@click.prevent.stop=''
|
|
|
|
><i class='fa fa-cog'></i>
|
|
|
|
<b-modal v-if='value.course.canselectgradables'
|
|
|
|
:id="'r-item-course-config-'+value.id"
|
|
|
|
:title="value.course.displayname + ' - ' + value.course.fullname"
|
|
|
|
ok-only
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
|
|
|
<div>
|
2024-02-07 22:33:16 +01:00
|
|
|
<h1><a :href="wwwroot+'/course/view.php?id='+value.course.id" target="_blank"
|
2023-11-26 22:58:26 +01:00
|
|
|
><i class="fa fa-graduation-cap"></i> {{ value.course.fullname }}</a></h1>
|
|
|
|
{{ value.course.context.path.join(" / ")}} / {{value.course.displayname}}
|
2023-05-17 21:19:14 +02:00
|
|
|
</div>
|
2023-11-26 22:58:26 +01:00
|
|
|
<div class="r-course-detail-header-right">
|
|
|
|
<div :class="'r-timing-'+value.course.timing">
|
|
|
|
{{text['coursetiming_'+value.course.timing]}}<br>
|
2024-05-10 15:22:52 +02:00
|
|
|
{{ startdate }} - {{ enddate }}
|
2023-11-26 22:58:26 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<b-form-group
|
|
|
|
:label="text.select_grades"
|
|
|
|
><ul class="t-item-module-children">
|
|
|
|
<li class="t-item-course-gradeinfo">
|
|
|
|
<span class='t-item-course-chk-lbl'>{{text.grade_include}}</span
|
|
|
|
><span v-if="useRequiredGrades" class='t-item-course-chk-lbl'>{{text.grade_require}}</span>
|
|
|
|
</li>
|
|
|
|
<li class="t-item-course-gradeinfo" v-for="g in value.course.grades">
|
|
|
|
<b-form-checkbox inline
|
|
|
|
@change="includeChanged($event,g)" v-model="g.selected"
|
|
|
|
></b-form-checkbox>
|
|
|
|
<b-form-checkbox v-if="useRequiredGrades" inline :disabled="!g.selected"
|
|
|
|
@change="requiredChanged($event,g)" v-model="g.required"
|
|
|
|
></b-form-checkbox>
|
|
|
|
<span :title="g.typename" v-html="g.icon"></span><a
|
|
|
|
:href="g.link" target="_blank">{{g.name}}</a>
|
|
|
|
<s-edit-mod
|
|
|
|
:title="value.course.fullname"
|
|
|
|
@saved="(fd) => g.name = fd.get('name')"
|
|
|
|
v-if="g.cmid > 0"
|
|
|
|
:cmid="g.cmid"
|
|
|
|
:coursectxid="value.course.ctxid"
|
|
|
|
genericonly></s-edit-mod>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</b-form-group>
|
|
|
|
</b-modal>
|
|
|
|
</a>
|
|
|
|
`,
|
|
|
|
});
|
2023-05-29 23:00:45 +02:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// Selected activities dispaly
|
|
|
|
Vue.component('r-item-teachergrades', {
|
2023-11-26 22:58:26 +01:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-11-26 22:58:26 +01:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
useRequiredGrades: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
2023-05-29 23:00:45 +02:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.teachercourse,
|
|
|
|
txt: {
|
|
|
|
grading: strings.grading,
|
2023-05-29 23:00:45 +02:00
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
};
|
2023-05-29 23:00:45 +02:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
pendingsubmission() {
|
2023-11-26 22:58:26 +01:00
|
|
|
let result = false;
|
2024-06-05 23:27:00 +02:00
|
|
|
for (const ix in this.value.grades) {
|
2023-11-26 22:58:26 +01:00
|
|
|
const g = this.value.grades[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (g.pendingsubmission) {
|
2023-11-26 22:58:26 +01:00
|
|
|
result = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
filteredGrades() {
|
2023-11-26 22:58:26 +01:00
|
|
|
return this.value.grades.filter(g => g.selected);
|
|
|
|
},
|
2023-05-29 23:00:45 +02:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
determineGradingIcon(gradingstate) {
|
|
|
|
switch (gradingstate) {
|
2023-11-26 22:58:26 +01:00
|
|
|
default: // "nogrades":
|
|
|
|
return "circle-o";
|
|
|
|
case "ungraded":
|
|
|
|
return "exclamation-circle";
|
|
|
|
case "unknown":
|
|
|
|
return "question-circle-o";
|
|
|
|
case "graded":
|
|
|
|
return "check";
|
|
|
|
case "allgraded":
|
|
|
|
return "check";
|
|
|
|
case "unsubmitted":
|
|
|
|
return "dot-circle-o";
|
2023-09-08 12:47:29 +02:00
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
gradingIcon(grade) {
|
|
|
|
return this.determineGradingIcon(this.isGradingNeeded(grade));
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
isGradingNeeded(grade) {
|
|
|
|
if (grade.grading) {
|
|
|
|
if (grade.grading.ungraded) {
|
2023-11-26 22:58:26 +01:00
|
|
|
return 'ungraded';
|
2024-06-05 23:27:00 +02:00
|
|
|
} else if (grade.grading.completed_pass || grade.grading.completed || grade.grading.completed_fail) {
|
|
|
|
if (Number(grade.grading.completed) + Number(grade.grading.completed_pass)
|
2023-11-26 22:58:26 +01:00
|
|
|
+ Number(grade.grading.completed_fail)
|
2024-06-05 23:27:00 +02:00
|
|
|
== Number(grade.grading.students)) {
|
2023-11-26 22:58:26 +01:00
|
|
|
return 'allgraded';
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2023-11-26 22:58:26 +01:00
|
|
|
return 'graded';
|
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
} else {
|
2023-11-26 22:58:26 +01:00
|
|
|
return 'unsubmitted';
|
2023-05-29 23:00:45 +02:00
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
} else {
|
|
|
|
return 'unknown';
|
2023-05-29 23:00:45 +02:00
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div>
|
|
|
|
<table class="r-item-course-grade-details">
|
2024-06-05 23:27:00 +02:00
|
|
|
<tr v-for="g in filteredGrades">
|
2023-11-26 22:58:26 +01:00
|
|
|
<td><span class="r-activity-icon" :title="g.typename" v-html="g.icon"></span
|
|
|
|
><a
|
|
|
|
:href="g.gradinglink"
|
|
|
|
target="_blank" :title="g.name"><span v-html="g.name"></span></a>
|
|
|
|
<s-edit-mod
|
|
|
|
:title="value.fullname"
|
|
|
|
@saved="(fd) => g.name = fd.get('name')"
|
|
|
|
v-if="g.cmid > 0"
|
|
|
|
:cmid="g.cmid"
|
|
|
|
:coursectxid="value.ctxid"
|
|
|
|
genericonly></s-edit-mod>
|
|
|
|
<abbr v-if="useRequiredGrades && g.required" :title="text.required_goal"
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'s-required ' + isGradingNeeded(g)"
|
2023-11-26 22:58:26 +01:00
|
|
|
><i class='fa fa-asterisk' ></i
|
|
|
|
></abbr>
|
|
|
|
</td>
|
|
|
|
<td v-if='g.grading'
|
2024-06-05 23:27:00 +02:00
|
|
|
><i :class="'r-course-grading fa fa-'+gradingIcon(g)+' r-graded-'+isGradingNeeded(g)"
|
|
|
|
:title="txt.grading[isGradingNeeded(g)]"></i>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
|
|
|
<td v-if='g.grading'>
|
|
|
|
<r-completion-bar v-model="g.grading" :width="150" :height="15"></r-completion-bar>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Core completion version of student course info
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-teachercompletion', {
|
2023-11-26 22:58:26 +01:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-11-26 22:58:26 +01:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
course: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.completion,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completionreport() {
|
2023-11-26 22:58:26 +01:00
|
|
|
return `${Config.wwwroot}/report/completion/index.php?course=${this.course.id}`;
|
2024-02-07 22:33:16 +01:00
|
|
|
},
|
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
2023-05-29 23:00:45 +02:00
|
|
|
}
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
methods: {
|
|
|
|
hasCompletions() {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.value.conditions) {
|
|
|
|
for (const cgroup of this.value.conditions) {
|
|
|
|
if (cgroup.items && cgroup.items.length > 0) {
|
2023-11-26 22:58:26 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
2023-05-29 23:00:45 +02:00
|
|
|
<table class="r-item-course-grade-details">
|
2023-11-26 22:58:26 +01:00
|
|
|
<tr v-if="hasCompletions">
|
|
|
|
<td colspan='2'
|
|
|
|
><span v-if="value.conditions.length <= 1">{{ text.aggregation_overall_one }}</span
|
|
|
|
><span v-else if="value.aggregation == 'all'">{{ text.aggregation_overall_all}}</span
|
|
|
|
><span v-else>{{ text.aggregation_overall_any }}</span
|
|
|
|
></td>
|
|
|
|
</tr>
|
|
|
|
<tr v-else>
|
|
|
|
<td colspan='2'>{{text.completion_not_configured}}!
|
|
|
|
<span v-if="course.amteacher">
|
2024-02-07 22:33:16 +01:00
|
|
|
<br><a :href="wwwroot+'/course/completion.php?id='+course.id" target='_blank'>{{text.configure_completion}}</a>
|
2023-11-26 22:58:26 +01:00
|
|
|
</span>
|
2023-05-29 23:00:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2023-11-26 22:58:26 +01:00
|
|
|
<template v-for='cgroup in value.conditions'>
|
|
|
|
<tr>
|
|
|
|
<th colspan='2'><span v-if="cgroup.items.length > 1"
|
|
|
|
><span v-if="cgroup.aggregation == 'all'">{{ text.aggregation_all}}</span
|
|
|
|
><span v-else>{{ text.aggregation_any}}</span></span
|
|
|
|
><span v-else>{{ text.aggregation_one }}</span>
|
|
|
|
{{ cgroup.title.toLowerCase() }}:
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
<tr v-for='ci in cgroup.items'>
|
|
|
|
<td><span v-html='ci.details.criteria'></span>
|
|
|
|
<a href="#" v-b-tooltip.click
|
|
|
|
:title="ci.details.requirement"
|
|
|
|
class='text-info'><i v-if="ci.details.requirement"
|
|
|
|
class='fa fa-question-circle'
|
|
|
|
></i></a>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<r-completion-bar v-model="ci.progress" :width="150" :height="15"></r-completion-bar>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
<tr><td colspan='2' class='pt-2'>
|
|
|
|
<a target="_blank" :href='completionreport'>{{ text.view_completion_report}}
|
|
|
|
<i class='fa fa-external-link'></i></a></td></tr>
|
2023-05-29 23:00:45 +02:00
|
|
|
</table>
|
2023-11-26 22:58:26 +01:00
|
|
|
`,
|
|
|
|
});
|
2023-05-29 23:00:45 +02:00
|
|
|
|
2023-11-26 22:58:26 +01:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
// TAG: Teacher Course competency
|
|
|
|
Vue.component('r-item-teacher-course-competency', {
|
2023-11-26 22:58:26 +01:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-11-26 22:58:26 +01:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
item: {
|
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {id: null};
|
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
2023-05-29 23:00:45 +02:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.competency,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasCompletions() {
|
2024-06-05 23:27:00 +02:00
|
|
|
if (this.value.conditions) {
|
|
|
|
for (const cgroup of this.value.conditions) {
|
|
|
|
if (cgroup.items && cgroup.items.length > 0) {
|
2023-11-26 22:58:26 +01:00
|
|
|
return true;
|
|
|
|
}
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
return false;
|
|
|
|
},
|
2024-02-07 22:33:16 +01:00
|
|
|
wwwroot() {
|
|
|
|
return Config.wwwroot;
|
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIcon(competency) {
|
2023-11-27 23:11:17 +01:00
|
|
|
if (competency.proficient && competency.courseproficient) {
|
|
|
|
return "check-circle";
|
|
|
|
} else if (competency.proficient) {
|
|
|
|
return "check";
|
|
|
|
} else if (competency.proficient === false) {
|
|
|
|
return "times-circle";
|
|
|
|
} else {
|
|
|
|
return "circle-o";
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
completionTag(competency) {
|
2023-11-27 23:11:17 +01:00
|
|
|
if (competency.proficient && competency.courseproficient) {
|
|
|
|
return "completed";
|
|
|
|
} else if (competency.proficient) {
|
|
|
|
return "completed";
|
|
|
|
} else if (competency.proficient === false) {
|
|
|
|
return "failed";
|
|
|
|
} else if (competency.progress) {
|
|
|
|
return "progress";
|
|
|
|
} else {
|
|
|
|
return "incomplete";
|
|
|
|
}
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
pathtags(competency) {
|
|
|
|
const path = competency.path;
|
|
|
|
let s = "";
|
|
|
|
for (const ix in path) {
|
|
|
|
const p = path[ix];
|
2024-06-05 23:27:00 +02:00
|
|
|
if (ix > 0) {
|
2023-11-26 22:58:26 +01:00
|
|
|
s += " / ";
|
|
|
|
}
|
|
|
|
let url;
|
2024-06-05 23:27:00 +02:00
|
|
|
if (p.type == 'competency') {
|
|
|
|
url = Config.wwwroot + `/admin/tool/lp/user_competency_in_course.php?courseid=${this.item.course.id}&competencyid=${p.id}`;
|
2023-11-26 22:58:26 +01:00
|
|
|
} else {
|
2023-11-27 23:11:17 +01:00
|
|
|
url = this.competencyurl(p);
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
2024-06-05 23:27:00 +02:00
|
|
|
|
2023-11-27 23:11:17 +01:00
|
|
|
s += `<a href="${url}" target="_blank">${p.title}</a>`;
|
2023-11-26 22:58:26 +01:00
|
|
|
}
|
|
|
|
return s;
|
|
|
|
},
|
2023-11-27 23:11:17 +01:00
|
|
|
competencyurl(c) {
|
2024-06-05 23:27:00 +02:00
|
|
|
return Config.wwwroot + `/admin/tool/lp/user_competency_in_course.php?courseid=${this.item.course.id}&competencyid=${c.id}`;
|
2023-12-13 00:13:07 +01:00
|
|
|
},
|
2023-11-26 22:58:26 +01:00
|
|
|
},
|
|
|
|
template: `
|
2023-11-27 23:11:17 +01:00
|
|
|
<table class="r-item-course-competency-list">
|
2023-11-26 22:58:26 +01:00
|
|
|
<tr v-if="value.competencies.length == 0">
|
|
|
|
<td colspan='2'>{{text.competencies_not_configured}}!
|
2024-02-07 22:33:16 +01:00
|
|
|
<br><a :href="wwwroot+'/admin/tool/lp/coursecompetencies.php?courseid='+item.course.id" target='_blank'>{{text.configure_competencies}}</a>
|
2023-05-29 23:00:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2023-11-26 22:58:26 +01:00
|
|
|
<template v-else>
|
|
|
|
<tr v-for='c in value.competencies'>
|
|
|
|
<td>
|
2023-11-27 23:11:17 +01:00
|
|
|
<a href="#" v-b-modal="'modal-competency-id-'+c.id"><span v-html='c.title'></span></a>
|
|
|
|
</td>
|
|
|
|
<td class='details'>
|
|
|
|
<a v-if="c.details" href="#" v-b-modal="'modal-competency-id-'+c.id"><span v-html='c.details'></span></a>
|
|
|
|
<abbr v-if="c.required" :title="text.required"
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'s-required ' + + completionTag(c)"
|
2023-11-27 23:11:17 +01:00
|
|
|
><i class='fa fa-asterisk' ></i
|
2024-06-05 23:27:00 +02:00
|
|
|
></abbr>
|
2023-11-27 23:11:17 +01:00
|
|
|
</td>
|
2024-06-12 21:12:00 +02:00
|
|
|
<td><r-completion-bar v-model="c.completionstats" :width="150" :height="15"></r-completion-bar></td>
|
2023-11-27 23:11:17 +01:00
|
|
|
<td v-if="c.feedback">
|
|
|
|
<a v-b-modal="'r-competency-feedback-'+c.id"
|
|
|
|
href="#"
|
2024-06-05 23:38:38 +02:00
|
|
|
@click.prevent.stop=""
|
2023-11-27 23:11:17 +01:00
|
|
|
>{{ text["view_feedback"]}}</a>
|
|
|
|
<b-modal
|
|
|
|
:id="'r-competency-feedback-'+c.id"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
2024-06-05 23:38:38 +02:00
|
|
|
<div>
|
|
|
|
<h3><i class="fa fa-puzzle-piece"></i>{{ c.title }}</h3><br>
|
|
|
|
</div>
|
2023-11-27 23:11:17 +01:00
|
|
|
</template>
|
|
|
|
<span v-html="c.feedback"></span>
|
|
|
|
</b-modal>
|
2023-11-26 22:58:26 +01:00
|
|
|
</td>
|
|
|
|
<b-modal :id="'modal-competency-id-'+c.id"
|
|
|
|
size="lg"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
|
|
|
<div>
|
|
|
|
<h1><i class="fa fa-puzzle-piece"></i>
|
2024-02-07 22:33:16 +01:00
|
|
|
<a :href="wwwroot+'/admin/tool/lp/competencies.php?competencyid='+c.id" target="_blank"
|
2023-11-26 22:58:26 +01:00
|
|
|
>{{c.title}} {{c.details}} </a
|
|
|
|
></h1>
|
|
|
|
<div><span v-html="pathtags(c)"></span></div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<div class="mb-2" v-if="c.description"><span v-html='c.description'></span></div>
|
|
|
|
|
|
|
|
<template v-if="c.rule && c.children">
|
|
|
|
<div>{{ c.ruleoutcome }} {{ text.when}} <span v-html="c.rule.toLocaleLowerCase()"></span></div>
|
2023-11-27 23:11:17 +01:00
|
|
|
<table v-if="c.children" class='r-item-course-competency-list'>
|
2023-11-26 22:58:26 +01:00
|
|
|
<tr class='t-item-course-competency-headers'>
|
2023-11-27 23:11:17 +01:00
|
|
|
<th colspan="2">{{text.heading}}</th>
|
|
|
|
<th colspan="3">{{text.results}}</th>
|
2023-11-26 22:58:26 +01:00
|
|
|
</tr>
|
|
|
|
<tr v-for="cc in c.children">
|
2023-11-27 23:11:17 +01:00
|
|
|
<td>
|
2023-12-13 00:13:07 +01:00
|
|
|
<a :href='competencyurl(cc)' target="_blank"><span v-html='cc.title'></span></a>
|
2023-11-27 23:11:17 +01:00
|
|
|
</td>
|
|
|
|
<td class='details'>
|
2023-12-13 00:13:07 +01:00
|
|
|
<a v-if="cc.details" :href='competencyurl(cc)' target="_blank"><span v-html='cc.details'></span></a>
|
2023-11-27 23:11:17 +01:00
|
|
|
<abbr v-if="c.required" :title="text.required"
|
2024-06-05 23:27:00 +02:00
|
|
|
:class="'s-required ' + completionTag(cc)"
|
2023-11-27 23:11:17 +01:00
|
|
|
><i class='fa fa-asterisk' ></i
|
|
|
|
></abbr>
|
|
|
|
</td>
|
|
|
|
<td><r-completion-bar v-model="cc.completionstats" :width="150" :height="15"></r-completion-bar></td>
|
2023-11-26 22:58:26 +01:00
|
|
|
<td><span class="text-info">{{ cc.points }} {{ text.points }}</span></td>
|
2023-11-27 23:11:17 +01:00
|
|
|
<td v-if="cc.feedback">
|
|
|
|
<a v-b-modal="'r-competency-feedback-'+cc.id"
|
|
|
|
href="#"
|
2024-06-05 23:38:38 +02:00
|
|
|
@click.prevent.stop=""
|
2023-11-27 23:11:17 +01:00
|
|
|
>{{ text["view_feedback"]}}</a>
|
|
|
|
<b-modal
|
|
|
|
:id="'r-competency-feedback-'+cc.id"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
2024-06-05 23:38:38 +02:00
|
|
|
<div>
|
|
|
|
<h3><i class="fa fa-puzzle-piece"></i>{{ cc.title }}</h3><br>
|
|
|
|
</div>
|
2023-11-27 23:11:17 +01:00
|
|
|
</template>
|
|
|
|
<span v-html="cc.feedback"></span>
|
|
|
|
</b-modal>
|
|
|
|
</td>
|
2023-11-26 22:58:26 +01:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</template>
|
|
|
|
</b-modal>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</table>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2023-05-17 21:19:14 +02:00
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-grading-bar', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
width: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 150,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
height: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 15,
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.grading,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
widthUnsubmitted() {
|
|
|
|
return this.width * this.fractionUnsubmitted();
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
widthGraded() {
|
|
|
|
return this.width * this.fractionGraded();
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
widthUngraded() {
|
|
|
|
return this.width * this.fractionUngraded();
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
countUnsubmitted() {
|
2023-05-17 21:19:14 +02:00
|
|
|
return (this.value.students - this.value.graded - this.value.ungraded);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionUnsubmitted() {
|
|
|
|
if (this.value.students > 0) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return 1 - ((this.value.graded + this.value.ungraded) / this.value.students);
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionGraded() {
|
|
|
|
if (this.value.students > 0) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.value.graded / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionUngraded() {
|
|
|
|
if (this.value.students > 0) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.value.ungraded / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<span class="r-grading-bar" :style="{height: height+'px'}"
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthUngraded+'px'}"
|
2023-05-17 21:19:14 +02:00
|
|
|
class='r-grading-bar-segment r-grading-bar-ungraded'
|
|
|
|
:title="text.ungraded + ' (' + this.value.ungraded + ')'" v-b-popover.hover.top
|
|
|
|
></span
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthGraded+'px'}"
|
2023-05-17 21:19:14 +02:00
|
|
|
class='r-grading-bar-segment r-grading-bar-graded'
|
|
|
|
:title="text.graded+ ' (' + this.value.graded + ')'" v-b-popover.hover.top
|
|
|
|
></span
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthUnsubmitted+'px'}"
|
2023-05-17 21:19:14 +02:00
|
|
|
class='r-grading-bar-segment r-grading-bar-unsubmitted'
|
2024-06-05 23:27:00 +02:00
|
|
|
:title="text.unsubmitted + ' (' + countUnsubmitted + ')'" v-b-popover.hover.top
|
2023-05-17 21:19:14 +02:00
|
|
|
></span
|
|
|
|
></span>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-completion-bar', {
|
2023-06-16 23:12:17 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-06-16 23:12:17 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {
|
|
|
|
students: 0,
|
|
|
|
completed: 0,
|
|
|
|
'completed_pass': 0,
|
|
|
|
'completed_fail': 0,
|
|
|
|
ungraded: 0,
|
|
|
|
};
|
|
|
|
},
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
width: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 150,
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
height: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 15,
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.completion,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
widthIncomplete() {
|
|
|
|
return this.width * this.fractionIncomplete();
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
widthCompleted() {
|
|
|
|
return this.width * this.fractionCompleted();
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
widthCompletedPass() {
|
|
|
|
return this.width * this.fractionCompletedPass();
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
widthCompletedFail() {
|
|
|
|
return this.width * this.fractionCompletedFail();
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
widthUngraded() {
|
|
|
|
return this.width * this.fractionUngraded();
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
countIncomplete() {
|
2023-06-16 23:12:17 +02:00
|
|
|
return (this.value.students - this.value.completed - this.value.completed_pass
|
|
|
|
- this.value.completed_fail - this.value.ungraded);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionIncomplete() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return 1 - (
|
|
|
|
(this.value.completed + this.value.completed_pass +
|
|
|
|
this.value.completed_fail + this.value.ungraded) / this.value.students);
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionCompleted() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return this.value.completed / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionCompletedPass() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return this.value.completed_pass / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionCompletedFail() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return this.value.completed_fail / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionUngraded() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return this.value.ungraded / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<span class="r-grading-bar" :style="{height: height+'px'}"
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthUngraded+'px'}"
|
2023-06-16 23:12:17 +02:00
|
|
|
class='r-grading-bar-segment r-completion-bar-ungraded'
|
|
|
|
:title="text.ungraded + ' (' + this.value.ungraded + ')'" v-b-popover.hover.top
|
|
|
|
></span
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthCompleted+'px'}"
|
2023-06-16 23:12:17 +02:00
|
|
|
class='r-grading-bar-segment r-completion-bar-completed'
|
|
|
|
:title="text.completed + ' (' + this.value.completed + ')'" v-b-popover.hover.top
|
|
|
|
></span
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthCompletedPass+'px'}"
|
2023-06-16 23:12:17 +02:00
|
|
|
class='r-grading-bar-segment r-completion-bar-completed-pass'
|
|
|
|
:title="text.completed_pass + ' (' + this.value.completed_pass + ')'" v-b-popover.hover.top
|
|
|
|
></span
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthCompletedFail+'px'}"
|
2023-06-16 23:12:17 +02:00
|
|
|
class='r-grading-bar-segment r-completion-bar-completed-fail'
|
|
|
|
:title="text.completed_fail + ' (' + this.value.completed_fail + ')'" v-b-popover.hover.top
|
|
|
|
></span
|
2024-06-05 23:27:00 +02:00
|
|
|
><span :style="{height: height+'px', width: widthIncomplete+'px'}"
|
2023-06-16 23:12:17 +02:00
|
|
|
class='r-grading-bar-segment r-completion-bar-incomplete'
|
2024-06-05 23:27:00 +02:00
|
|
|
:title="text.incomplete + ' (' + countIncomplete + ')'" v-b-popover.hover.top
|
2023-06-16 23:12:17 +02:00
|
|
|
></span
|
|
|
|
></span>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-completion-circle', {
|
2023-06-16 23:12:17 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-06-16 23:12:17 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {
|
|
|
|
students: 10,
|
|
|
|
completed: 2,
|
2024-06-28 17:27:56 +02:00
|
|
|
completedPass: 2,
|
|
|
|
completedFail: 2,
|
2024-06-05 23:27:00 +02:00
|
|
|
ungraded: 2,
|
|
|
|
};
|
|
|
|
},
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
stroke: {
|
|
|
|
type: Number,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': 0.2,
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
disabled: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: String,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': "",
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-28 17:27:56 +02:00
|
|
|
completedPass() {
|
|
|
|
if (this.value.completed_pass) {
|
|
|
|
return this.value.completed_pass;
|
|
|
|
} else {
|
|
|
|
return this.value.completedPass;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
completedFail() {
|
|
|
|
if (this.value.completed_fail) {
|
|
|
|
return this.value.completed_fail;
|
|
|
|
} else {
|
|
|
|
return this.value.completedFail;
|
|
|
|
}
|
|
|
|
},
|
2023-06-16 23:12:17 +02:00
|
|
|
radius() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return 50 - (50 * this.stroke);
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathUngraded() {
|
2023-06-16 23:12:17 +02:00
|
|
|
const begin = 0;
|
2024-06-05 23:27:00 +02:00
|
|
|
return this.arcpath(begin, this.fractionUngraded());
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathCompleted() {
|
|
|
|
const begin = this.fractionUngraded();
|
|
|
|
return this.arcpath(begin, this.fractionCompleted());
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathCompletedPass() {
|
|
|
|
const begin = this.fractionUngraded()
|
|
|
|
+ this.fractionCompleted();
|
|
|
|
return this.arcpath(begin, this.fractionCompletedPass());
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathCompletedFail() {
|
|
|
|
const begin = this.fractionUngraded()
|
|
|
|
+ this.fractionCompleted()
|
|
|
|
+ this.fractionCompletedPass();
|
|
|
|
return this.arcpath(begin, this.fractionCompletedFail());
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathIncomplete() {
|
|
|
|
const begin = this.fractionUngraded()
|
|
|
|
+ this.fractionCompleted()
|
|
|
|
+ this.fractionCompletedPass()
|
|
|
|
+ this.fractionCompletedFail();
|
|
|
|
return this.arcpath(begin, this.fractionIncomplete());
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
arcpath(start, end) {
|
2024-06-05 23:27:00 +02:00
|
|
|
const r = 50 - (50 * this.stroke);
|
|
|
|
const t1 = start * 2 * π;
|
|
|
|
const Δ = end * 2 * π;
|
|
|
|
return svgarcpath([50, 50], [r, r], [t1, Δ], 1.5 * π);
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionIncomplete() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return 1 - (
|
2024-06-28 17:27:56 +02:00
|
|
|
(this.value.completed + this.completedPass +
|
|
|
|
this.completedFail + this.value.ungraded) / this.value.students);
|
2023-06-16 23:12:17 +02:00
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionCompleted() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return this.value.completed / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionCompletedPass() {
|
|
|
|
if (this.value.students > 0) {
|
2024-06-28 17:27:56 +02:00
|
|
|
return this.completedPass / this.value.students;
|
2023-06-16 23:12:17 +02:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionCompletedFail() {
|
|
|
|
if (this.value.students > 0) {
|
2024-06-28 17:27:56 +02:00
|
|
|
return this.completedFail / this.value.students;
|
2023-06-16 23:12:17 +02:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
fractionUngraded() {
|
|
|
|
if (this.value.students > 0) {
|
2023-06-16 23:12:17 +02:00
|
|
|
return this.value.ungraded / this.value.students;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<svg width="1em" height="1em" viewBox="0 0 100 100">
|
|
|
|
<title>{{title}}</title>
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle cx="50" cy="50" :r="radius"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'stroke-width: ' + (stroke*100)+'; stroke: #ccc; fill: none;'"/>
|
2024-06-05 23:27:00 +02:00
|
|
|
<path :d="arcpathUngraded"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'stroke-width: ' + (stroke*100) +'; stroke: var(--warning); fill: none;'"/>
|
2024-06-05 23:27:00 +02:00
|
|
|
<path :d="arcpathCompleted"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'stroke-width: ' + (stroke*100) +'; stroke: var(--info); fill: none;'"/>
|
2024-06-05 23:27:00 +02:00
|
|
|
<path :d="arcpathCompletedPass"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'stroke-width: ' + (stroke*100) +'; stroke: var(--success); fill: none;'"/>
|
2024-06-05 23:27:00 +02:00
|
|
|
<path :d="arcpathCompletedFail"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'stroke-width: ' + (stroke*100) +'; stroke: var(--danger); fill: none;'"/>
|
2023-09-08 12:47:29 +02:00
|
|
|
|
|
|
|
<circle v-if="disabled" cx="50" cy="50" :r="radius/2"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'fill: var(--dark);'"/>
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle v-else-if="value.ungraded > 0" cx="50" cy="50" :r="radius/2"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'fill: var(--warning);'"/>
|
|
|
|
</g>
|
|
|
|
</svg>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-junction', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completion() {
|
|
|
|
if (this.value.completion) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.value.completion;
|
|
|
|
} else {
|
|
|
|
return "incomplete";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
},
|
|
|
|
template: `
|
2023-09-08 12:47:29 +02:00
|
|
|
<div :class="'r-item-junction r-item-filter completion-'+completion">
|
2023-05-17 21:19:14 +02:00
|
|
|
<i v-if="value.completion=='incomplete'" class="fa fa-circle-o"></i>
|
|
|
|
<i v-else-if="value.completion=='failed'" class="fa fa-times-circle"></i>
|
|
|
|
<i v-else-if="value.completion=='progress'" class="fa fa-exclamation-circle"></i>
|
|
|
|
<i v-else class="fa fa-check-circle"></i>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-finish', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completion() {
|
|
|
|
if (this.value.completion) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.value.completion;
|
|
|
|
} else {
|
|
|
|
return "incomplete";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
},
|
|
|
|
template: `
|
2023-09-08 12:47:29 +02:00
|
|
|
<div :class="'r-item-finish r-item-filter completion-'+completion">
|
2023-05-17 21:19:14 +02:00
|
|
|
<i class="fa fa-stop-circle"></i>
|
2023-09-08 12:47:29 +02:00
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-start', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2024-06-05 23:27:00 +02:00
|
|
|
completion() {
|
|
|
|
if (this.value.completion) {
|
2023-05-17 21:19:14 +02:00
|
|
|
return this.value.completion;
|
|
|
|
} else {
|
|
|
|
return "incomplete";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div :class="'r-item-start r-item-filter completion-'+completion">
|
|
|
|
<i class="fa fa-play-circle"></i>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-badge', {
|
2023-05-17 21:19:14 +02:00
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2023-05-17 21:19:14 +02:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return {};
|
|
|
|
},
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
guestmode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
teachermode: {
|
|
|
|
type: Boolean,
|
2024-06-03 23:24:16 +02:00
|
|
|
'default': false,
|
2023-05-17 21:19:14 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2023-11-01 23:47:54 +01:00
|
|
|
text: strings.badge,
|
2023-05-17 21:19:14 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
completion() {
|
2024-06-05 23:27:00 +02:00
|
|
|
return this.value.badge.issued ? "completed" : "incomplete";
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
issuedIcon() {
|
|
|
|
switch (this.value.badge.issued) {
|
2023-06-03 00:01:18 +02:00
|
|
|
default: // "nogrades":
|
|
|
|
return "circle-o";
|
|
|
|
case true:
|
|
|
|
return "check";
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
issuestats() {
|
|
|
|
// So the r-completion-bar can be used to show issuing stats
|
2023-06-16 23:12:17 +02:00
|
|
|
return {
|
2024-06-05 23:27:00 +02:00
|
|
|
students: (this.value.badge.studentcount) ? this.value.badge.studentcount : 0,
|
|
|
|
completed: (this.value.badge.issuedcount) ? this.value.badge.issuedcount : 0,
|
|
|
|
'completed_pass': 0,
|
|
|
|
'completed_fail': 0,
|
2023-06-16 23:12:17 +02:00
|
|
|
ungraded: 0,
|
|
|
|
};
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathIssued() {
|
|
|
|
if (this.value.badge.studentcount) {
|
|
|
|
const fraction = this.value.badge.issuedcount / this.value.badge.studentcount;
|
|
|
|
return this.arcpath(0, fraction);
|
2023-06-16 23:12:17 +02:00
|
|
|
} else {
|
2024-06-05 23:27:00 +02:00
|
|
|
return ""; // No path
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
2023-11-01 23:47:54 +01:00
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
arcpathProgress() {
|
|
|
|
if (this.value.badge.completion) {
|
|
|
|
const fraction = this.value.badge.completion.progress / this.value.badge.completion.count;
|
|
|
|
return this.arcpath(0, fraction);
|
2023-11-01 23:47:54 +01:00
|
|
|
} else {
|
2024-06-05 23:27:00 +02:00
|
|
|
return ""; // No path
|
2023-11-01 23:47:54 +01:00
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
badgeinprogress() {
|
|
|
|
return (
|
|
|
|
this.value.badge.issued || this.teachermode ||
|
|
|
|
(
|
|
|
|
this.value.badge.completion
|
|
|
|
&& this.value.badge.completion.progress >= this.value.badge.completion.count
|
|
|
|
)
|
2023-11-01 23:47:54 +01:00
|
|
|
);
|
2023-06-16 23:12:17 +02:00
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
methods: {
|
2023-06-16 23:12:17 +02:00
|
|
|
arcpath(start, end) {
|
|
|
|
const r = 44;
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
const t1 = start * 2 * π;
|
|
|
|
const Δ = (end * 2 * π - 0.01);
|
|
|
|
return svgarcpath([50, 50], [r, r], [t1, Δ], 1.5 * π);
|
2023-06-16 23:12:17 +02:00
|
|
|
},
|
2023-11-01 23:47:54 +01:00
|
|
|
addTargetBlank(html) {
|
2024-06-05 23:27:00 +02:00
|
|
|
const m = /^([^<]*< *a +)(.*)/.exec(html);
|
|
|
|
if (m) {
|
2023-11-01 23:47:54 +01:00
|
|
|
return `${m[1]} target="_blank" ${m[2]}`;
|
|
|
|
} else {
|
|
|
|
return html;
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIconRq(complete) {
|
2023-11-01 23:47:54 +01:00
|
|
|
if (complete) {
|
|
|
|
return "check-square-o";
|
|
|
|
} else {
|
|
|
|
return "square-o";
|
|
|
|
}
|
|
|
|
},
|
2024-06-05 23:27:00 +02:00
|
|
|
completionIcon(complete) {
|
2023-11-01 23:47:54 +01:00
|
|
|
if (complete) {
|
|
|
|
return "check-circle";
|
|
|
|
} else {
|
|
|
|
return "times-circle";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
status(complete) {
|
|
|
|
if (complete) {
|
|
|
|
return "complete";
|
|
|
|
} else {
|
|
|
|
return "incomplete";
|
|
|
|
}
|
|
|
|
}
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
template: `
|
2023-09-08 12:47:29 +02:00
|
|
|
<div :class="'r-item-badge r-item-filter r-completion-'+completion" v-b-tooltip.hover :title="value.badge.name">
|
|
|
|
<a v-b-modal="'r-item-badge-details-'+value.id"
|
2023-06-03 00:01:18 +02:00
|
|
|
><svg class="r-badge-backdrop " width='50px' height='50px' viewBox="0 0 100 100">
|
|
|
|
<title>{{value.badge.name}}</title>
|
2023-06-16 23:12:17 +02:00
|
|
|
<template v-if="teachermode">
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle cx="50" cy="50" r="44"
|
2023-06-16 23:12:17 +02:00
|
|
|
style="stroke: #ccc; stroke-width: 8; fill: #ddd; fill-opacity: 0.8;"/>
|
2024-06-05 23:27:00 +02:00
|
|
|
<path :d="arcpathIssued"
|
2023-06-16 23:12:17 +02:00
|
|
|
:style="'stroke-width: 8; stroke: var(--info); fill: none;'"/>
|
|
|
|
</template>
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle v-else-if="value.badge.issued" cx="50" cy="50" r="46"
|
2023-06-03 00:01:18 +02:00
|
|
|
style="stroke: currentcolor; stroke-width: 4; fill: currentcolor; fill-opacity: 0.5;"/>
|
2023-11-01 23:47:54 +01:00
|
|
|
<template v-else-if="value.badge.completion">
|
|
|
|
<circle cx="50" cy="50" r="44"
|
|
|
|
style="stroke: #ccc; stroke-width: 8; fill: #ddd; fill-opacity: 0.8;"/>
|
2024-06-05 23:27:00 +02:00
|
|
|
<path :d="arcpathProgress"
|
2023-11-01 23:47:54 +01:00
|
|
|
:style="'stroke-width: 8; stroke: var(--info); fill: none;'"/>
|
|
|
|
</template>
|
2023-09-08 12:47:29 +02:00
|
|
|
<circle v-else cx="50" cy="50" r="46"
|
2023-06-03 00:01:18 +02:00
|
|
|
stroke-dasharray="6 9"
|
|
|
|
style="stroke: #999; stroke-width: 6; fill: #ddd; fill-opacity: 0.8;"/>
|
|
|
|
<image class="badge-image" clip-path="circle() fill-box"
|
|
|
|
:href="value.badge.imageurl" x="12" y="12" width="76" height="76"
|
2023-11-01 23:47:54 +01:00
|
|
|
:style="(badgeinprogress)?'':'opacity: 0.4;'" />
|
2023-06-03 00:01:18 +02:00
|
|
|
</svg></a>
|
|
|
|
|
|
|
|
<b-modal
|
2023-09-08 12:47:29 +02:00
|
|
|
:id="'r-item-badge-details-'+value.id"
|
|
|
|
:title="value.badge.name"
|
2023-06-03 00:01:18 +02:00
|
|
|
size="lg"
|
|
|
|
ok-only
|
|
|
|
centered
|
|
|
|
scrollable
|
|
|
|
>
|
|
|
|
<template #modal-header>
|
|
|
|
<div>
|
|
|
|
<h1><i class="fa fa-certificate"></i>
|
|
|
|
<a :href="(!guestmode)?(value.badge.infolink):undefined" target="_blank"
|
|
|
|
>{{ value.badge.name }}</a
|
|
|
|
></h1>
|
|
|
|
</div>
|
2023-06-16 23:12:17 +02:00
|
|
|
<div class="r-course-detail-header-right" v-if="!teachermode">
|
2023-06-03 00:01:18 +02:00
|
|
|
<div class="r-completion-detail-header">
|
2023-11-01 23:47:54 +01:00
|
|
|
{{ text['completion_'+completion] }}
|
2024-06-05 23:27:00 +02:00
|
|
|
<i v-b-popover.hover :class="'fa fa-'+issuedIcon+' r-completion-'+completion"
|
2023-11-01 23:47:54 +01:00
|
|
|
:title="text['completion_'+completion]"></i>
|
2023-06-03 00:01:18 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<b-container fluid>
|
|
|
|
<b-row><b-col cols="3">
|
|
|
|
<img :src="value.badge.imageurl"/>
|
|
|
|
</b-col><b-col cols="9">
|
|
|
|
<p>{{value.badge.description}}</p>
|
|
|
|
<ul v-if="value.badge.issued" class="list-unstyled pt-1 mb-1 border-grey border-top">
|
2023-11-01 23:47:54 +01:00
|
|
|
<li><strong><i class="fa fa-calendar-check-o r-completion-complete-pass"></i>
|
|
|
|
{{text.dateissued}}:</strong> {{ value.badge.dateissued }}</li>
|
|
|
|
<li v-if='value.badge.dateexpired'
|
|
|
|
><strong><i class="fa fa-calendar-times-o r-completion-complete"></i>
|
|
|
|
{{text.dateexpired}}:</strong> {{ value.badge.dateexpired }}</li>
|
|
|
|
<li><strong><i class="fa fa-share-alt r-completion-complete-pass"></i>
|
|
|
|
<a :href="value.badge.issuedlink">{{text.share_badge}}</a></strong> </li>
|
2023-06-03 00:01:18 +02:00
|
|
|
</ul>
|
2023-11-01 23:47:54 +01:00
|
|
|
<table v-if='value.badge.completion && !value.badge.issued' class="r-item-course-grade-details mb-2">
|
|
|
|
<tr v-if="value.badge.completion.types.length > 1">
|
|
|
|
<th colspan="2"><span v-html="value.badge.completion.title"></span></th>
|
|
|
|
</tr>
|
|
|
|
<template v-for='cgroup in value.badge.completion.types' >
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" v-if="value.badge.completion.types.length > 1"
|
|
|
|
><span v-html="cgroup.title"></span></td>
|
|
|
|
<th colspan="2" v-else><span v-html="cgroup.title"></span></th>
|
|
|
|
</tr>
|
|
|
|
<template v-for='ci in cgroup.criteria'>
|
|
|
|
<tr>
|
|
|
|
<td class="pl-3"><span v-if='guestmode'><span v-html="ci.title"></span></span>
|
|
|
|
<a target='_blank' v-else-if='ci.link' :href='ci.link'
|
|
|
|
><span v-html="ci.title"></span></a>
|
|
|
|
<span v-else><span v-html="ci.title"></span></span>
|
2024-06-05 23:27:00 +02:00
|
|
|
<td><i :class="'fa fa-'+completionIcon(ci.completed)+' r-completion-'+status(ci.completed)"
|
2023-11-01 23:47:54 +01:00
|
|
|
:title="text['completion_'+status(ci.completed)]"></i>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<template v-if="ci.requirements.length > 1">
|
|
|
|
<tr v-for="rq in ci.requirements">
|
|
|
|
<td class="pl-4" colspan="2"
|
2024-06-05 23:27:00 +02:00
|
|
|
><i :class="'fa fa-'+completionIconRq(rq.completed)+' r-completion-incomplete'"
|
2023-11-01 23:47:54 +01:00
|
|
|
:title="text['completion_'+status(rq.completed)]"></i>
|
|
|
|
<span class="t-badge-criteria-requirement"><span v-html="rq.title"></span></span></td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</template>
|
2023-11-02 07:18:37 +01:00
|
|
|
<tr v-if="!value.badge.active" class="mt-1">
|
|
|
|
<td colspan="2" class="alert alert-warning alert-block">{{text.badgedisabled}}</td>
|
|
|
|
</tr>
|
2023-11-01 23:47:54 +01:00
|
|
|
</table>
|
2023-06-03 00:01:18 +02:00
|
|
|
<ul class="list-unstyled w-100 border-grey border-top border-bottom pt-1 pb-1 mb-1"
|
|
|
|
v-if="value.badge.criteria"><li v-for="crit in value.badge.criteria"
|
|
|
|
><span v-html='crit'></span></li></ul>
|
|
|
|
<p v-if="(!guestmode)"><strong><i class="fa fa-link"></i>
|
2023-06-16 23:12:17 +02:00
|
|
|
<a :href="value.badge.infolink" target="_blank"
|
2023-11-01 23:47:54 +01:00
|
|
|
>{{ text.badgeinfo }}</a></strong></p>
|
2023-06-16 23:12:17 +02:00
|
|
|
<p v-if="teachermode && !guestmode"
|
2023-11-01 23:47:54 +01:00
|
|
|
>{{text.badgeissuedstats}}:<br>
|
2023-06-16 23:12:17 +02:00
|
|
|
<r-completion-bar v-model="issuestats" :width="150" :height="15"></r-completion-bar>
|
|
|
|
</p>
|
2023-06-03 00:01:18 +02:00
|
|
|
</b-col></b-row>
|
|
|
|
</b-container>
|
|
|
|
</b-modal>
|
2023-09-08 12:47:29 +02:00
|
|
|
</div>
|
2023-05-17 21:19:14 +02:00
|
|
|
`,
|
|
|
|
});
|
2024-03-07 22:44:29 +01:00
|
|
|
|
|
|
|
Vue.component('r-item-dummy-course', {
|
|
|
|
props: {
|
2024-06-05 23:27:00 +02:00
|
|
|
value: {
|
2024-03-07 22:44:29 +01:00
|
|
|
type: Object,
|
2024-06-05 23:27:00 +02:00
|
|
|
default() {
|
|
|
|
return null;
|
|
|
|
},
|
2024-03-07 22:44:29 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
text: strings.invalid,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div class="r-item-dummy-course">
|
|
|
|
<b-card no-body class="r-item-course">
|
|
|
|
<b-row no-gutters>
|
|
|
|
<b-col md="1">
|
|
|
|
<span class="r-timing-indicator timing-dummy"></span>
|
|
|
|
</b-col>
|
|
|
|
<b-col md="11">
|
|
|
|
<b-card-body class="align-items-center">
|
|
|
|
|
|
|
|
</b-card-body>
|
|
|
|
</b-col>
|
|
|
|
</b-row>
|
|
|
|
</b-card>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-dummy-filter', {
|
2024-03-07 22:44:29 +01:00
|
|
|
props: {
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div :class="'r-item-dummy-filter'">
|
|
|
|
<i class="fa fa-circle"></i>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
|
2024-06-05 23:27:00 +02:00
|
|
|
Vue.component('r-item-dummy-badge', {
|
2024-03-07 22:44:29 +01:00
|
|
|
props: {
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div :class="'r-item-dummy-badge'" >
|
|
|
|
<i class="fa fa-circle"></i>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
2023-05-17 21:19:14 +02:00
|
|
|
},
|
|
|
|
};
|