65 Replies
Steve Flowers

You can build your own JavaScript triggers so it's possible to connect your Storyline outputs to a database using a variety of methods. There aren't any built-in publishing options to connect to a database other than SCORM / AICC. If you know your way around JavaScript and a server side language you should be golden.

antonio carlos

Steve thanks for your answer, let me explain, i need to make course  of computer like windows 7, microsoft word for example, but this course will work on desktop computer, and our software is im mysql, we need to save all data of all students, but do you recomend me any elearning plataform tha can work off line and after synchronize online?

thanks

Dave Cordova

Hi RS,

I think what you can do is use PHP to get the user account info, then send the user account to a JavaScript script in storyline.  This way storyline has your variable.  Then, as you probably want, use some kind of JavaScript to php script to store the progress of that user in mysql.  I am also looking for help with this situation, with a little more data being sent to mysql.

Dave

Jean-Luc Derrien

Hi

I'm actually working on this problem, and here is my today result. it's working for writing in db

1. the user must connect on web site, so php authorization process get an user id from db.

2. this user id is integrated as a javascript variable by php process in the web page wich start SL player

3. This process use jquery framework, so it must be loaded by the calling web page : <script src="story_content/jquery.min.js" type="text/javascript"></script>

4. i update the onBWEvent function in story.js. I include the following lines in the "case "BW_StoreQuestionResult":" switch before the break line :

$.ajax(

             {

             url:"http://localhost/test/quiz/test.php", 

             data:{unUser:user_id, unId:strId, unQuizId:strQuizId, unQuizName:strQuizName, unType:strType, uneReponseCorrecte: strCorrectResponse, unStatut:strStatus, unPoint:nPoints, unPoids:nWeight, uneDescription:strDescription, uneReponse:strUserResponse, unNumeroQuestion:nQuestionNumber}, 

             type: 'GET',

             async:false

                  }

      })

user_id is the javascript variable integrate in 2

strId, strQuizId, strQuizname.... are SL javascript variables defined some lines before in story.js

data are transmit by ajax process to the destination page defined in url parameter. This is an url transmission, destination page (tes.php) collect data with a GET process and then integrated them in db

This way has been inspired by the code provided by Michiel Van Der Bronk in : http://community.articulate.com/forums/p/11060/66190.aspx#66190

jl

Jean-Luc Derrien

Oups sorry for delay !

2. I have a php process wich builds the page where the storyline flash module is inserted. This page is "story.html" page based with modifications for integration in our graphic template. At the end of the page, the process inject an hidden DIV tag wiich contains user_id. Example : 

12345

So user_id is always available in the web page. In the nBWEvent function in story.js ( "case "BW_StoreQuestionResult") before ajax code, i call a custom JS function (stored in user.js) wich read the previous DIV value en store it in a JS variable 

in user.js : 

function GetUserId()

{

var user_id = null;

user_id = document.getElementById("div_user");

return user_id.innerHTML;

}

in story.js :

      var idUser = GetUserId;

      $.ajax(

       {

       url:"http://localhost/test/_process_ajax/test.php", 

       data:{unUser:idUser, unId:strId, unQuizId:strQuizId, unType:strType, uneReponseCorrecte: strCorrectResponse, unStatut:strStatus, unPoint:nPoints, unPoids:nWeight, uneDescription:strDescription, uneReponse:strUserResponse, unNumeroQuestion:nQuestionNumber}, 

       type: 'GET',

       async:false,

       success: function(data) {alert('Load was performed.');}

       }

       )

With this code, i can send all data i need to my db via ajax process : user id + quizz data 

5. the test.php page on web server looks like this :

mysql_select_db($base, $db_link);

$user = $_GET['unUser'];

$id = $_GET['unId'];

$type = $_GET['unType'];

$reponse = $_GET['uneReponse'];

$reponse_correcte = $_GET['uneReponseCorrecte'];

$numero = $_GET['unNumeroQuestion'];

$statut = $_GET['unStatut']; 

$points = $_GET['unPoint'];

$poids = $_GET['unPoids'];

$description = $_GET['uneDescription'];

$quiz_id = $_GET['unQuizId'];

$quiz_name = $_GET['unQuizName'];

 $sql = "INSERT INTO test (id, quiz_id, quiz_name,type, reponse, numero, reponse_correcte, statut, points, poids, description, user_id) VALUES ('$id','$quiz_id','$quiz_name','$type','$reponse','$numero','$reponse_correcte','$statut','$points','$poids','$description','$user')";

$req = mysql_query($sql);

?>

may complicated but it work's

jl

Berno van Soest

Steve,

Parse is great! I've been looking at the Amazon and Google stuff but this much more comprehensible for me.

They have a Javascript SDK which I use to store user names and scores for the movie quiz I'm working on.

The only thing is that some of the access keys are exposed in the JS.

You can control access on object / operation level but still.

For the time being this is of no concern as I'm still in prototype stage.

David Richmond

Would you be so kind as to post a zip file of your work?  I am coming from the captivate community and I did the exact same thing by hijacking their "email" function in javascript to send results and submit directly to a mysql database.  I'm also using php and I totally understand the jist of what you are doing but I think I could save myself a few hours with a zipfile of a sample project.

Thank you very much!

David

Berno van Soest

@Kenneth: using parse you can both get and put info. Parse acts as your database. If you're using some other database the protocol will probably be different but you'd still be using javascript. 

@ David: I posted the zip. After modifying and publishing the storyline file make sure you copy the (altered) files in post-publish to your published output. the story.html i've used in this example might be outdated. You can update a recent story.html with a reference to the javascript file.

good luck!

David Richmond

Thanks to all for this post, I have now created a 100% home grown LMS which takes a url and parameter string like:

myproject.com/mydir/story.html?studentid=34&courseid=3

and lets them go through and take the course and submit the results to the database via ajax while displaying a custom certificate for them to print (fantastic very happy!)

Here is my only problem which is mobile/html5 in nature.

story.hml detects html5 compliance and redirects to story_html5.html

Of course on the redirect my parameter string doesn't follow it so  I went in and hacked story.html javascript to be:

var g_parms = window.location.search;

Then on all the redirects to story_html5.html:

var strLocation = "story_html5.html";

     location.replace(strLocation + g_parms);   

problem is this doesn't work on android browser, my chrome browser or some tablets.

When it does work I have a further problem.  I take variables from the articulate player and put them on the certificate.  Well in HTML5 its not a flash player how do i get at the system variables of articulate in pure html5?

Thanks!

David

Rob Verzera

I know this thread is old - but working on something similar - I have not tested it but wouldnt this work.

If you have a php login page that does authentication - assuming the user authenticates ok - you set some data in a session variable.  Couldnt you use an ajax call to php to grab that session data at a later time vs worry about having to pass it in?