aboutsummaryrefslogtreecommitdiff
path: root/cockpit/js/config.js
blob: 545c57959a3d852728dd9e539bcf27bbdea6b0a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const GRADUATION_DB_ID = 262744;
const GRADUATION_ACTIVITY_ID = 92663494;
const GRADUATION_DB_PARAMS_MAP = {
	id: "f_1133275",
	name: "f_1130848",
	group: "f_1130869",
	change: "f_1133254",
	reason: "f_1130860",
	date: (date) => {
		return {
			f_1130863_d: date.getDate(),
			f_1130863_m: date.getMonth(),
			f_1130863_y: date.getFullYear(),
			f_1130863_z: 1,
		};
	},
	coach: "f_1130866",
}

const courseId = 2466361;
function getCourseId() {
	return courseId;
}

function getCourseParticipantsUrl() {
	return `https://lernplattform.bycs.de/user/index.php?id=${courseId}`;
}

async function getUserIconUrl(userId) {
	const userRes = await fetch(`https://lernplattform.bycs.de/user/profile.php?id=${userId}`)
	const userDoc = new DOMParser().parseFromString(await userRes.text(), 'text/html')
	return userDoc.querySelector(".userpicture").src;
}

export {
	GRADUATION_DB_ID, GRADUATION_ACTIVITY_ID, GRADUATION_DB_PARAMS_MAP,
	getCourseId,
	getUserIconUrl,
	getCourseParticipantsUrl
};