Moodle and Converting Programmes...

Moodle and Converting Programmes...

by Fionn Kelly -
Number of replies: 10

I've written a programme in Visual Basic which is being used to help students practice their problem-solving and diagnostic skills gained during classroom and practical training in a health care curriculum.

Currently the only way for students to try the programme is to download it onto their computers and run it from there. The College has recently transitioned to moodle and I would like to enable the programme to be hosted online and run via moodle as an interactive web-based programme.

Initially I thought I might be able to slightly modify the Visual Basic code and add a few hooks for APIs and get it running in moodle with minimum changes but as I have investigated this it seems it won't be possible. So my questions to you, much more experienced folk here, are as follows:

1. Is there any way I can get a Visual Basic programme to hook into moodle and be run from the College's Servers? I've written quite a few programmes which have been used professionally before but never one which had any server-side components.

2. It seems to me that I might have to rewrite the programme in PHP for it to work within moodle. Is that correct?

 I wouldn't mind learning PHP and adding another string to my bow as it were but I just want to be sure there isn't some plugin or something which allows moodle to communicate with VB programmes and allow me to port this without having to go through the hassle of learning a new language.

Many thanks for any replies and apologies for my relative cluelesness re: getting programmes to work within moodle. I have read the FAQs and they all lead me to believe that rewriting the programme in PHP is the way forward.

Average of ratings: -
In reply to Fionn Kelly

Re: Moodle and Converting Programmes...

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Fionn,

VB and PHP are completely different technologies so getting them to commicate is going to be a challenge. VB is a proprietary language primarily designed for Windows GUI applications, wheras PHP is an open source language primarily designed for Web Applications.  Also, you might find that the web server Moodle runs on is a platform that VB doesn't support (Linux, *BSD, etc).

There may be some milage in getting the desktop application to talk to the Moodle database, or to the Moodle 2 web service APIs, but to get it running "on the server" you'll probably find you have to rewrite it to run as a .NET web application anyway - there's no way of running a VB application in the browser in the same way as you might, say, a Java applet.

If you're likely to be doing work with Moodle, my simple advice would be to learn PHP.  It's a handy (if quirky) little language smile

In reply to Mark Johnson

Re: Moodle and Converting Programmes...

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Also just to note - if your program has no need for server-side communication, i.e. it doesn't need to store data or provide a way to work collaboratively or anything like that (for example a simple simulation or something like that), then you might want to consider implementing your program in three other possible ways:

1. As a Java applet (this is most like normal desktop GUI programming).

2. Entirely in JavaScript in an HTML page.

3. As a Flash applet (this is most suitable for animations).

These all run client-side and don't require any server changes, which means you can't so easily cause security problems or server performance problems etc.

However, that said, there are obvious advantages to using server functionality (for example, if you let people save data on the server, they can use it from whatever computer - or their mobile phone - and still have access to their saved work) so using PHP within Moodle, or code in any server-side language that's linked to from Moodle, might well be the best option.

--sam

In reply to sam marshall

Re: Moodle and Converting Programmes...

by Fionn Kelly -

Thanks all for the excellent advice.

My view for this programme was to allow it to be downloaded and run on students' computers. But the course organisers are looking for it to be integrated into moodle so scores can be kept on the server side ( presumably for various bits of number crunching etc they are interested in ).


Hence the rather unanticipated swerve from VB 2010 to PHP which it looks like I'm going to have to make.

 

So, my understanding from a quick look into PHP is that it can do pretty much everything VB did in the programme I created ( generate random numbers, apply those numbers to variables ( e.g. age, gender etc ), print a paragraph or two of text with these variables inserted - e.g A " $year" old " $gender " presented to " $location" with.... " etc etc and then allow me to see what diagnosis or investigation students think is most appropriate, store the information of what they choose into a database and then check that against what they should have picked and then generating a webpage of feedback for them to use to learn where they went wrong and where ( within the moodle VLE ) they can go to get the right information.

So, basically, PHP can do everything that VB did except PHP can do it within web pages which can run within a frame of Moodle, correct?

Sorry, I know that's basic but I just want to be sure I'm not missing something really basic. I've never touched php or server-side stuff before.

 

One other question:

Apart from normal good coding practices is there anywhere I can go to find out what problems there are in integrating php programmes into moodle? I'm quite wary of making a programme which works within my moodle test environment on my home computer and then finding out it won't work on the college's servers.

In reply to Fionn Kelly

Re: Moodle and Converting Programmes...

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You should start by (at least) skimming over this...

http://docs.moodle.org/en/Development:Developer_documentation#Guidelines (and maybe some more stuff on that page)

If you have never written code for web applications before then you may have a bit of a learning curve there. There are loads of introductory PHP tutorials on the web which should cover the basics.

Other than that... looking at how existing parts of Moodle do what they do can save a lot of time and stress. Don't be afraid to ask here if you get lost of confused.

In reply to Fionn Kelly

Re: Moodle and Converting Programmes...

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There may be some mileage in investigating whether this could be written as a 'question type' plugin and integrated into the quiz module (which would take care of managing grades, retries and a certain amount of the feedback for you).

The other thing to be aware of with PHP vs VB (I hope I'm not stating the obvious here), is that programs written in VB are directly interactive (user does something, computer can respond straight away), whereas PHP works by generating finished web pages which are then sent across to the user, the user fills in any form fields on the page then sends that data back to the server. When the server gets data from the user, it then looks up information in its local database and generates a fresh page to send back to the user. By default, it is 'stateless', in that the server does not track the interaction with the user from one page to the next (although Moodle already uses a combination of cookies and server database entries to maintain some continuity between each of these separate page request cycles).

In reply to Davo Smith

Re: Moodle and Converting Programmes...

by Fionn Kelly -

Thanks.... I believe that would be fine...

 

Basically the server generates the clinical vignette and sends the page to the user with the paragraph of text representing the "virtual patient" in situ. The user then selects what tests they would like to do.

This then goes back to the server which evaluates that info and then sends a new page back to the student listing the outcomes of the tests and asking for a diagnosis.


Student selects the diagnosis which fits, this gets sent to the server which compares it to the diagnosis it used to generate the virtual patient and it then either:

a) sends back an "Attaboy page" saying well done or

b) sends back a page saying what the right answer was and why and linking to the lecture in moodle which contains the info the student didn't know.

That is how I'm visualising this working based on my current ( poor ) level of understanding of PHP. Thanks for the help everyone. It is really useful.


So far it looks like this is very much doable.... I just need to figure out how to integrate a PHP page into moodle... I'm reading the development guideline documents linked above. I'm sure the info is in there.

In reply to Fionn Kelly

Re: Moodle and Converting Programmes...

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Sorry to interrupt what is obviously a very technical discussion about php and VB both of which I know nothing about - but the scenario you describe above does sound very much like the kind of thing the Moodle Lesson module is meant for -and it would involve a lot smaller learning curve?

In reply to Mary Cooch

Re: Moodle and Converting Programmes...

by Fionn Kelly -

Mary, I looked into that - I'm not one to do more work than necessary wink.

The problem is that if I were to go with the lesson module any "vignettes" would have to be pre-typed. I couldn't randomly generate them on the fly. What I have set up in VB is basically a method of generating an infinite number of patient characteristics so that the student need never come across the same case twice - much as they won't come across the same presentation twice once they are qualified.

If I could get away with using the Lesson Module I would but, sadly, I don't see that it provides the functionality for generating variables on the fly that I'm after.

If I'm wrong please do tell me as that'd save me a fair few hours of work.

 

Again, thanks to the community for the prompt replies. They've really put me on the track to some good documents and I can see how this could come together now.

In reply to Fionn Kelly

Re: Moodle and Converting Programmes...

by Bernard Boucher -

Hi Fionn,
first welcome to Moodle!

As a Visual Basic ( VB ) developper you stand in the Dark Side of Moodle evil, like me wink

It is sure that using the same developping environnement that Moodle use, in mid term, is the best way to go.


In meantime, before erasing your VB application wink you may consider others alternatives.

Your generation on the fly of your vignettes is an excellent way of reducing the authoring time of activities and it is not very often considered in Moodle.

Your diagnosis step(s) is less clear for me : is it a multi interrelated steps diagnosis or a go no go one?

That information is important to help choose the existing Moodle activity that can meet yours needs.

I think that Mary suggestion for the lesson module is appropriate if we make an assumption about the term "Infinte" on the student side. For example is 10, 100 or 1000 differents "Clinical Vignettes" may be considered as infinite for a particular student? If in average your students try 10 times your VB program then 100 will be probably more than sufficient.

To see if it works for you, try a small lesson with 3 branches ( 3 vignettes ) and with the appropriate options, you should be able to force the execution of one different branch at each student attempt.

If it works fine then the authoring process could be as follow:

Modify you VB program to generate as many branches as you need ( 10, 100, 1000 ) of your questions in XML similar to the lesson backup format.

Import that generated lesson in Moodle and that sould work without modifying Moodle.

There are other tricks to let VB, with the webBrowser control, to drive Moodle directly, but later.

I hope I have understood correctly your problem!

Salutations from Québec,

Bernard