Java and Moodle Integration/Interaction

Java and Moodle Integration/Interaction

por Ming-Han Lee -
Número de respostas: 8
Hi everyone,

I have been googling a bit trying to find ways to have Java applications (using Web Start) interact with Moodle, either directly or via some PHP code hacking. So far the consensus seems to be that the two don't play particularly nice with each other. However, does that suggest it is nevertheless doable? This is what I'd like to do for a university project; perhaps some of you could point me to some good places to get started:

On our Moodle platform the students could click on a link and start an external Java application via Java Web Start. They could watch animations as well as answer some simple quiz questions through pop-up windows.

If I want to keep track of each student's scores on these quizzes and have them saved in a Moodle database so that individual student could easily view his or her scores (e.g. in a block called scoreboard), what are the steps I'll need to take?

Any suggestion is appreciated; thanks!

M.







Média das avaliações:  -
Em resposta à Ming-Han Lee

Re: Java and Moodle Integration/Interaction

por sam marshall -
Imagem de Core developers Imagem de Peer reviewers Imagem de Plugin developers
Hi,

You could make a new module that manages the link to your JNLP file etc., and also includes custom php scripts that your WebStart application will contact in order to save scores. Obviously you will need to think carefully about security here (some degree of lax security is inevitable but it would be nice if at least, the php script was secured against altering a different user's score, and was only capable of altering the score that 'belongs' to that instance of the module and not some other score).

Rather than use new database tables and UI, I would suggest making the students' score go into the Moodle gradebook! See e.g. forum for examples of how a module can save grades. It is not exactly 'easy' but not all that difficult either.

(I am about to go on holiday, woo sorriso so won't be able to comment further on this, sorry. Hopefully this might get you started, or elicit other suggestions.)

--sam


Média das avaliações: Useful (1)
Em resposta à sam marshall

Re: Java and Moodle Integration/Interaction

por Ming-Han Lee -
Thanks Sam; I'll look into how to make new Moodle modules and definitely the gradebook. It's good to know where to get started.

Have a super awesome holiday!smile

M.
Em resposta à Ming-Han Lee

Re: Java and Moodle Integration/Interaction

por Alan Trick -
This is certainly possible. You would need to make some sort of web service api. Also, you would need to handle authentication, but you should be able to do that by hijacking the browser's session.

Also, there shouldn't be any need for lax security.
Média das avaliações: Useful (1)
Em resposta à Alan Trick

Re: Java and Moodle Integration/Interaction

por Ming-Han Lee -
Hey there Alan,

Would you care to elaborate more on security? If I'm not mistaken, Moodle could be configured to either use cookies or sessions to authenticate users. What would be a suitable configuration (easier to code and more secure) for my purpose?

M.
Em resposta à Ming-Han Lee

Re: Java and Moodle Integration/Interaction

por Matt Bury -
Imagem de Particularly helpful Moodlers Imagem de Plugin developers
Hi M.

I've already been down the same path as you when I started the SWF Activity Module. The only difference is that this one is for Flash while yours is for Java. It's open source so you're free to download and use it in any way you like. I think it may even be possible to adapt it for use with Java apps.

I'm using Flash Remoting to communicate with Moodle which I believe is similar to JSON. Java has been around for longer than Flash so there must be an established protocol for DB communcation with it.

http://code.google.com/p/moodle-swf/

If you have any questions, don't hesitate to contact me.

Matt
Em resposta à Matt Bury

Re: Java and Moodle Integration/Interaction

por Ming-Han Lee -
Hey there Matt,

Thanks so much for sharing your hard work. I'm fairly new to ActionScript, so this is a great opportunity to look at somebody's code and learn to write my own. I'll play with the SWF Activity Module a bit and definitely come back to you later...with loads of questions smile

Have a great day!

M.
Em resposta à Ming-Han Lee

Re: Java and Moodle Integration/Interaction

por Alan Trick -
A session is actually uses cookies, it's not an either/or thing. The way it works is that a 'session' is created on the webserver. This is a file that contains the user's data. The user is given a cookie that identifies which session is his.

You can access the browser's cookie from within the applet. Then, when you make HTTP requests to fetch grade information, send the cookie along. Moodle will recognise that and connect the request with your session.
Em resposta à Alan Trick

Re: Java and Moodle Integration/Interaction

por Matt Bury -
Imagem de Particularly helpful Moodlers Imagem de Plugin developers

You can access the browser's cookie from within the applet. Then, when you make HTTP requests to fetch grade information, send the cookie along. Moodle will recognise that and connect the request with your session.

Flash handles this automatically sorriso