Reputation: 141
I've tried to search for this info, but I struggle to find specific information about creating an LRS / LMS from scratch.
The thing I want to do is very simple, I have a set of courses (compatible with SCROM / xAPI), and I want to track the $user_ID that completes them.
My site is running ezpublish 4.xx at the moment, and I just want a simple custom DB with course_ID and user_ID to track who did what.
I've toyed around with the TinCan Prototypes, and Learninglocker, and have managed to hook things up and store information.
But all this seems very complicated, the xAPI and Learninglocker is designed to do so much more than what I am trying to accomplish, and I wanted to ask here if there is any easier method of simply gathering this information myself.
Upvotes: 1
Views: 3740
Reputation: 1
I know this is a very old thread, but it kept on coming up as 1st result in my searches, for a very similar ask.. So I wanted to provide a possible solution for anyone else looking..
Using PHP on Apache, the following PHP script provides the very basic functionality of an xAPI LRS (worked for my purposes). It:
Disclaimer(s):
The .htaccess file in the Apache folder contains:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php
The index.php contains:
<?php
// Receive the xAPI input / statement
$xapi = file_get_contents("php://input");
$headers = getallheaders();
// Extract the xAPI statement ID from JSON for confirmation of receipt
$getRidOf = array ('"','[','{','id:');
$LRSResponse = str_replace($getRidOf,"",$xapi);
$LRSResponse = substr($LRSResponse,0,strpos($LRSResponse,","));
// Log to a TXT file
$file = 'xapi.log';
$fd = fopen($file, "a");
if ($fd) {
// Start the log output, for this event
fwrite($fd, "Event for " . date("Y-m-d h:m:s",time()) . " (GMT):" . "\r\n");
fwrite($fd, "Headers:" . "\r\n");
foreach($headers as $key=>$val){
fwrite($fd, " - " . $key . ': ' . $val ."\r\n" );
//Grab xAPI version
if ($key == "X-Experience-API-Version") {
$xapiVersion = $val;
}
}
fwrite($fd, "Body:" . "\r\n");
fwrite($fd, $xapi . "\r\n");
fwrite($fd, 'My LRSs Response: ["' . $LRSResponse . '"]' . "\r\n");
// not used, but additional debugging
//fwrite($fd,'--- Full debug dump follows: ---' . '\n');
//fwrite($fd,json_encode(apache_request_headers()) . '\n');
//fwrite($fd,json_encode($_REQUEST) . '\n');
fwrite($fd,"\r\n" . "=================================" . "\r\n");
fclose($fd);
};
// Prepare HTTPS response to xAPI statement (to mimic an LRS)
// Setup required Headers
// ======================
if (empty($xapiVersion)) {
$xapiVersion= "1.0.0";
};
$xapiHeader = "X-Experience-API-Version: " . $xapiVersion;
header($xapiHeader);
header("Content-Type: application/json; charset=utf-8");
// Setup response Body
// ===================
// Return the statements ID, to confirm it was processed.
$LRSResponse = '["' . $LRSResponse. '"]';
// For some reason the above line added a bunch of junk, so clean it
$LRSResponse = preg_replace("/[\x0D]/", "", $LRSResponse);
$LRSResponse = preg_replace("/[\x0A]/", "", $LRSResponse);
$LRSResponse = str_replace(" ","",$LRSResponse);
echo $LRSResponse;
?>
Upvotes: 0
Reputation: 3750
This is a good open-source LRS TRAX LRS. Developed with PHP/Laravel and you can easily deploy this one on any simple development server.
Fork it and extend it if you need.
This is certified by ADL as well.
Disclaimer: When writing the comment, I still didn't use it, but I intend to use in an LMS I am going to build.
Upvotes: 2
Reputation: 2274
Note this is purely opinion, but I think the answer is "no". SCORM and xAPI just aren't designed to provide this information in as simple a manner as you describe. For xAPI you'll run into a number of issues, not the least of which is that content can decide on its own how to report what "completion" looks like. This improves a little with cmi5, but that is still a moving target and there aren't any full implementations of it yet. There is also the issue of Learning Locker not providing any support for SCORM.
For SCORM the concept of complete is simpler (to a degree) but the amount of other stuff you need sitting around it (read the content player) gets far more complicated. The rest of the structure you need just so the content could even approach a point of reporting the completion value.
Having said all of that, SCORM Cloud provides an API that can enable you to do the things you mention fairly quickly and easily and supports the learning standards you suggest and has at least some rudimentary handling of known completion handling for xAPI. It is the fastest way I know of to set up simple LMS like functionality without a full blown LMS and includes a built in LRS. For more info: http://scorm.com/scorm-solved/scorm-cloud-features/
Upvotes: 2