LMS
LMS
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.
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.
Return values -
It returns a json array of courses with their ids and other relevant data.
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.
Return values -
It returns a json array of set of questions from the quiz provided.
Return values -
It returns a json array of questions and their choices,the correct answer and other relevant data.
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.
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;
};
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.
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.