0% found this document useful (0 votes)
16 views

LMS

The UK Innovation LMS Project is a virtual learning environment that integrates with Moodle to provide features such as document reading, video streaming, and quizzes. It involves configuring Moodle for web services, developing a mobile platform in Unreal Engine, and utilizing various Moodle APIs for course and quiz management. Additionally, a NodeJS server is deployed for processing documents and images, enhancing the overall functionality of the LMS.

Uploaded by

simcentric360
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

LMS

The UK Innovation LMS Project is a virtual learning environment that integrates with Moodle to provide features such as document reading, video streaming, and quizzes. It involves configuring Moodle for web services, developing a mobile platform in Unreal Engine, and utilizing various Moodle APIs for course and quiz management. Additionally, a NodeJS server is deployed for processing documents and images, enhancing the overall functionality of the LMS.

Uploaded by

simcentric360
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

UK Innovation LMS Project

UK Innovation LMS is a virtual learning environment which provide user the ability of reading
document, streaming videos, participating in tests and basic VR handling. Also, it should have the
ability of retrieving data from the Moodle.

Moodle.
Moodle is a Learning Platform or course management system (CMS) - a free Open Source software
package designed to help educators create effective online learning material.

Configuring Moodle For The Project.


Enabling Web Services.
In order to use Moodle’s REST API, first you should enable web services. Login to Moodle with
administrative privileges, then select Site administration from Home page. You will see a list of options
you can select. From that list, choose Plugins, and then select Web services. From that screen, enable
both web services and REST protocol.

Enable web services and REST protocol.


Enrolling To Courses.
To retrieve data using Moodle API , you should first enroll into the courses you want to retrieve data
from. Otherwise you will see empty data fields when using API. For example, if you want to retrieve
details about a course named Basics, you have to enroll into that course first. To enroll into a course, go
to Moodle site home, select the course you want to enroll into, then select Participants. From that
screen, click on Enroll users button. From the popup screen, select users you want to enroll into that
course.

Enrolling users.

Generating Token.
Generating a token is required to use any of Moodle REST APIs. That token should passed along with
other parameters when you make a GET/POST calls to Moodle web services. To generate a token,
login to Moodle with administrative privileges, go to Site administration, Web services and Manage
tokens. From the Manage tokens screen, click add button. Select the user you want and click Save
changes button.

Adding tokens.
Development.
Setting up Unreal project.
Unreal version 4.23 was used for the development of UK Innovation LMS. Since this product is developed
for Oculus Quest, the project template used in Ureal is mobile platform template. In order to launch this on
a Oculus Quest you should install and setup Android SDK. We have used Android Studio 3.5.3. And we have
used VaRest(https://www.unrealengine.com/marketplace/en-US/product/varest-plugin) Unreal plugin for
Json related developments. Also, you should enable Oculus Quest plugin in Unreal as well.

Android setup in Unreal project settings.


Moodle APIs.

Following Moodle APIs were used for the development.

core_course_get_courses_by_field – Used to fetch available courses from Moodle.


Input parameters
wstoken – user authentication token.
moodlewsrestformat – string format.
wsfunction – function to call.
Example -
https://moodle.simct.com/webservice/rest/server.php?
wstoken=8ecc2188e0d4c7591ee89f04a37c6755&moodlewsrestformat=json&wsfunction=core_course_get_courses_by_field

Return values -
It returns a json array of courses with their ids and other relevant data.

core_course_get_contents – Used to fetch lessons and contents data of a selected course.


Input parameters
wstoken – user authentication token.
moodlewsrestformat – string format.
wsfunction – function to call.
courseid – id of the course.
Example -
https://moodle.simct.com/webservice/rest/server.php?
wstoken=8ecc2188e0d4c7591ee89f04a37c6755&moodlewsrestformat=json&wsfunction=core_course_get_contents&coursei
d=1

Return values -
It returns a json array of lessons available and it’s relevant data.
mod_quiz_get_quizzes_by_courses – Used to fetch available quizzes.
Input parameters
wstoken – user authentication token.
moodlewsrestformat – string format.
wsfunction – function to call.
Example -
https://moodle.simct.com/webservice/rest/server.php?
wstoken=8ecc2188e0d4c7591ee89f04a37c6755&moodlewsrestformat=json&wsfunction=mod_quiz_get_quizzes_by_course
s

Return values -
It returns a json array of available quizzes.

mod_quiz_get_user_attempts – Used to fetch questions of a selected quiz.


Input parameters
wstoken – user authentication token.
moodlewsrestformat – string format.
wsfunction – function to call.
quizid - quiz id
Example -
https://moodle.simct.com/webservice/rest/server.php?
wstoken=8ecc2188e0d4c7591ee89f04a37c6755&moodlewsrestformat=json&wsfunction=mod_quiz_get_user_attempts&quiz
id=7

Return values -
It returns a json array of set of questions from the quiz provided.

mod_quiz_get_attempt_review – Used to fetch more data on question. Including answer choices


and correct answer.
Input parameters
wstoken – user authentication token.
moodlewsrestformat – string format.
wsfunction – function to call.
attemptid – id of the user attempt.
Example -
https://moodle.simct.com/webservice/rest/server.php?
wstoken=8ecc2188e0d4c7591ee89f04a37c6755&moodlewsrestformat=json&wsfunction=mod_quiz_get_attempt_review&att
emptid=47

Return values -
It returns a json array of questions and their choices,the correct answer and other relevant data.

Note – Use Postman when experimenting with those APIs.

UI Widgets.
WBP_Courses - Display available courses, also user can select a course.
It fetch available courses from Moodle using GetCourses function. That function is written in C++ and
available for blueprints via MoodleData actor class.
WBP_Lessons - Display lessons of a selected course.
It will fetch lessons data based on the selected course by the user. It uses C++ function GetLessons
which is available for blueprints via MoodleData actor class.

WBP_LContents - Display contents of a selected lesson.

WBP_VidStream - Play a selected video from lesson contents.


It uses media play widget provided by Unreal to stream video contents.
WBP_PinBoard - Display pin board items.
It uses a blueprint driven by SaveGame class to save and retrieve pin board item data . Async Save
Game to Slot blueprint node to save data and Async Load Game from Slot blueprint node to retrieve
data.

WBP_Quiz - Display available quizzes.


It uses VaREST plugin to process JSON data fetched from Moodle.
WBP_QuizViwer - Display questions of a selected quiz.
It uses GetQuizs C++ function to process HTML data returned by Moodle API to extract questions and
answer choices, further it will also store the correct answer as well. It is using regular expressions to
process data and it is accessible to blueprints via MoodleData actor class.

WBP_QuizResults - Display results of a submitted quiz session.


WBP_PinVidStream - Play selected video from Pin Board.
Same as WBP_VidStream widget but customized to work properly with the Pin Board widget.

C++ Development.
In order to provide seamless integration with Moodle, we have developed several functions and data
structures in C++.

Data Structures.
FcourseInfo – Holds data returns by GetCourses function.
struct FCourseInfo

FString courseName;

FString courseImage;

FString courseID;

int row;

int col;

};
FLessonInfo – Holds data returns from GetLessons function.
struct FLessonInfo

FString LessonName;

TArray<FString> ContentName;

TArray<FString> ContentUrl;

TArray<FString> ContentType;

TArray<FString> FileUrl;

int row;

int col;

};

FquizInfo – Holds data returns from GetQuizs function.


struct FQuizInfo

TArray<FString> Questions;

TArray<FString> Answers;

FString CorrectAnswer;

};

Functions.
GetCourses – It calls Moodle API core_course_get_courses_by_field to retrieve course data. And it’s
callback function will process all the json data returned by the Moodle API.

GetLessons - It calls Moodle API core_course_get_contents to retrieve lessons data. And it’s callback
function will process all the json data returned by the Moodle API.

GetQuizs - It will take a set of html data as an input which is retrieved by calling Moodle API
mod_quiz_get_attempt_review and will process it’s data by using regular expressions (regex).
Extracting questions, choices and correct answer.
Use of REGEX – Regular expressions were used in GetQuizs function to extract questions, choices
and correct answer. Following expressions were used for that purpose.
To extract questions
std::regex rgx_for_question{ "<p dir=\\\"ltr\\\" style=\\\"text-align: left;\\\">(.*?)<\\/p>" };
To extract answer choices of a question.
std::regex rgx_for_answers{ "class=\\\"ml-1\\\">(.*?)<\\/label>" };
To extract correct answer for a multiple-choice question.
std::regex rgx_multi_correct_answer{ "The correct answer is: <p dir=\\\"ltr\\\" style=\\\"text-align:
left;\\\">(.*?)<\\/div>" };
To extract correct answer for a true or false question.
std::regex rgx_bool_correct_answer{ "The correct answer is '(.*?)'" };

Back-end Development.
Purpose.
We have deployed a NodeJS server as an intermediate platform to convert different type of documents
to images. It will generate a unique URL and pass it back to application and loads it as a texture in
Ureal side. Also, it will store those images in a unique folder for faster loading.

Nodejs Configuration.
NodeJS version 14.5.0 was used for the back-end in an Ubuntu 20.04.1 server. And following npm
packages are required for the back-end to run.

Express version 4.17.1


Hashids version 2.2.1
Node-download-file version 0.1.5
Node-downloader-helper version 1.0.13
Nodejs-file-downloader vresion 1.2.2
Uuid version 8.3.1
Available end-points.
http://moodle.simct.com:8000/downloadimage – To process image files.
http://moodle.simct.com:8000/convert – To process PDF files.
http://moodle.simct.com:8000/convertodp – To process ODP files.

Design and Implementation of Intermediate server.

Generating unique folder names.


For caching downloaded/converted files, we had to used a unique folder for each and every file in order
to avoid conflicts and to avoid re generation of same file. For that purpose we used a node package
called Uuid.

var MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';


var urlTkn = uuidv5(url, MY_NAMESPACE);

Content Download.
For the process of downloading files, we used a node package called nodejs-file-downloader.
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
const downloader = new Downloader({
url: url,
directory: dir,//This folder will be created, if it doesn't exist.
fileName:'file.jpeg'
});
await downloader.download();
console.log('All done');
var sendUrl='http://localhost:8000/'+urlTkn+'/file.jpeg';
//global.hostname+':8000/'+urlTkn+'/ file.jpeg';
//send file url back here
res.send(sendUrl);
}
Conversion.
To convert pdf/odt/opd files into images, we used a command line tools set called magick which is
available for free.
var ex = 'magick convert -verbose -density 150 -alpha off '+ dir+'/file.pdf'+' quality 100 -sharpen
0x1.0 '+ dir+'/page.png';
var child = exec(ex);

Design.

You might also like