Moodle | Uploading Scorm Package and some internal function calls

|
| By Webner

1.Uploading a scorm package (.zip) in moodle:

a. Log-in to moodle, navigate to your course and “turn editing on”:
1
b. Click “Add an activity or resource” link:
2
c. Select Scorm package from list and click Add button:
3
d.Add basic information about the SCORM package that you are uploading. Then choose the file (.zip) to upload and save. On save Moodle Form (mod_form.php) calls function.

scorm_add_instance($scorm, $mform=null) (“/mymoodle/mod/scorm/lib.php”) //$scorm an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance:

$scorm contain:
stdClass Object
(
[name] => s3
[mform_isexpanded_id_packagehdr] => 1
[scormtype] => local
[packagefile] => 133660316
[updatefreq] => 0
[popup] => 0
[width] => 100
[height] => 500
[displayactivityname] => 1
[skipview] => 0
[hidebrowse] => 0
[displaycoursestructure] => 0
[hidetoc] => 0
[nav] => 1
[navpositionleft] => -100
[navpositiontop] => -100
[displayattemptstatus] => 1
[timeopen] => 0
[timeclose] => 0
[grademethod] => 1
[maxgrade] => 100
[maxattempt] => 0
[whatgrade] => 0
[forcenewattempt] => 0
[lastattemptlock] => 0
[forcecompleted] => 0
[auto] => 0
[autocommit] => 0
[masteryoverride] => 1
[datadir] =>
[pkgtype] =>
[launch] =>
[redirect] => no
[redirecturl] => ../mod/scorm/view.php?id=
[visible] => 1
[cmidnumber] =>
[groupmode] => 0
[groupingid] => 0
[availabilityconditionsjson] => {"op":"&","c":[],"showc":[]}
[tags] =>
[course] => 3
[coursemodule] => 28
[section] => 0
[module] => 18
[modulename] => scorm
[instance] =>
[add] => scorm
[update] => 0
[return] => 0
[sr] => 0
[competency_rule] => 0
[submitbutton2] => Save and return to course
[completion] => 0
[completionview] => 0
[completionexpected] => 0
[completiongradeitemnumber] =>
[conditiongradegroup] => Array
(
)

[conditionfieldgroup] => Array
(
)

[intro] =>
[introformat] => 1
)

This function stores the package in scorm table of moodle. In scorm table column “sha1hash” define the location of uploaded package on server.

For example: “e4011f5293963ef8428cdfece45bdf623b0e164d” – first 4 characters create the path where uploaded package is located, like this “/var/www/mymoodledata/filedir/e4/01”.

2. Reading the imsmanifest.xml to make the appropriate Table of contents

Moodle sets up SCORM 1.2/2004 packages using the manifest file:

Moodle calls function scorm_parse_scorm(&$scorm, $manifest) (from “/mymoodle/mod/scorm/datamodels/scormlib.php”)

Where $manifest – path to manifest file or stored_file:

$manifest contains:
stored_file Object
(
[fs:stored_file:private] => file_storage Object
(
[filedir:file_storage:private] => /var/www/mymoodledata/filedir
[trashdir:file_storage:private] => /var/www/mymoodledata/trashdir
[tempdir:file_storage:private] => /var/www/mymoodledata/temp/filestorage
[dirpermissions:file_storage:private] => 511
[filepermissions:file_storage:private] => 438
[unoconvformats:file_storage:private] =>
)

[file_record:stored_file:private] => stdClass Object
(
[id] => 1750
[contenthash] => 8353842d3fb4694026181524e59a6be2ae6e3cf3
[pathnamehash] => 7ba30b18aae3d442cd64f8b55e816cdf121c8710
[contextid] => 110
[component] => mod_scorm
[filearea] => content
[itemid] => 0
[filepath] => /
[filename] => imsmanifest.xml
[userid] =>
[filesize] => 12353
[mimetype] => application/xml
[status] => 0
[source] =>
[author] =>
[license] =>
[timecreated] => 1472648288
[timemodified] => 1472648288
[sortorder] => 0
[referencefileid] =>
[repositoryid] =>
[reference] =>
[referencelastsync] =>
)

[filedir:stored_file:private] => /var/www/mymoodledata/filedir
[repository:stored_file:private] =>
)

This function saves Table of content in scorm_scoes moodle table.

3. Launching the content:
Moodle uses /mymoodle/mod/scorm/loadSCO.php and /mymoodle/mod/scorm/player.php file to load content.

4. Track user:
Moodle uses scorm_scoes_track table to store the track information.
All function related to scorm are in file “/mymoodle/mod/scorm/locallib.php”.

Leave a Reply

Your email address will not be published. Required fields are marked *