mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 18:06:51 +02:00
Tabs are out.
Please don't use tabs in source code. Set your editor to 4 cc per tab.!
This commit is contained in:
parent
87dddc1445
commit
5e5b6b7f19
16 changed files with 2799 additions and 2799 deletions
|
@ -10,61 +10,61 @@ if (confirm_sesskey()) {
|
|||
$courseid = $_GET["id"];
|
||||
$launch = 0;
|
||||
if (isset($_GET["instance"])) {
|
||||
$scormid = $_GET["instance"];
|
||||
if (is_file($CFG->dataroot.'/'.$courseid.'/'.$reference)) {
|
||||
$scormid = $_GET["instance"];
|
||||
if (is_file($CFG->dataroot.'/'.$courseid.'/'.$reference)) {
|
||||
$fp = fopen($CFG->dataroot.'/'.$courseid.'/'.$reference,"r");
|
||||
$fstat = fstat($fp);
|
||||
fclose($fp);
|
||||
if ($scorm = get_record("scorm","id",$scormid)) {
|
||||
$launch = $scorm->launch;
|
||||
$launch = $scorm->launch;
|
||||
if ((($scorm->timemodified < $fstat["mtime"]) && ($scorm->reference == $reference)) || ($scorm->reference != $reference)) {
|
||||
// This is a new package
|
||||
$launch = 0;
|
||||
$launch = 0;
|
||||
} else {
|
||||
// Old package already validated
|
||||
$validation->result = 'found';
|
||||
if (strpos($scorm->version,'AICC') !== false) {
|
||||
$validation->pkgtype = 'AICC';
|
||||
} else {
|
||||
$validation->pkgtype = 'SCORM';
|
||||
}
|
||||
}
|
||||
$validation->result = 'found';
|
||||
if (strpos($scorm->version,'AICC') !== false) {
|
||||
$validation->pkgtype = 'AICC';
|
||||
} else {
|
||||
$validation->result = 'badinstance';
|
||||
$launch = -1;
|
||||
}
|
||||
$validation->pkgtype = 'SCORM';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$validation->result = 'badinstance';
|
||||
$launch = -1;
|
||||
}
|
||||
} else {
|
||||
$validation->result = 'badreference';
|
||||
$launch = -1;
|
||||
}
|
||||
$validation->result = 'badreference';
|
||||
$launch = -1;
|
||||
}
|
||||
}
|
||||
//$launch = 0;
|
||||
if ($launch == 0) {
|
||||
//
|
||||
// Package must be validated
|
||||
//
|
||||
|
||||
|
||||
// Create a temporary directory to unzip package and validate package
|
||||
$tempdir = '';
|
||||
$scormdir = '';
|
||||
if ($scormdir = make_upload_directory("$courseid/$CFG->moddata/scorm")) {
|
||||
if ($tempdir = scorm_datadir($scormdir)) {
|
||||
copy ("$CFG->dataroot/$courseid/$reference", $tempdir."/".basename($reference));
|
||||
$ext = strtolower(substr(basename($reference),strrpos(basename($reference),'.')));
|
||||
if (($ext == '.zip') || ($ext == '.pif')) {
|
||||
unzip_file($tempdir."/".basename($reference), $tempdir, false);
|
||||
$validation = scorm_validate($tempdir);
|
||||
} else {
|
||||
$validation->result = "packagefile";
|
||||
}
|
||||
} else {
|
||||
$validation->result = "packagedir";
|
||||
}
|
||||
} else {
|
||||
$validation->result = "datadir";
|
||||
}
|
||||
if (($validation->result != "regular") && ($validation->result != "found")) {
|
||||
$validation->result = get_string($validation->result,'scorm');
|
||||
if ($scormdir = make_upload_directory("$courseid/$CFG->moddata/scorm")) {
|
||||
if ($tempdir = scorm_datadir($scormdir)) {
|
||||
copy ("$CFG->dataroot/$courseid/$reference", $tempdir."/".basename($reference));
|
||||
$ext = strtolower(substr(basename($reference),strrpos(basename($reference),'.')));
|
||||
if (($ext == '.zip') || ($ext == '.pif')) {
|
||||
unzip_file($tempdir."/".basename($reference), $tempdir, false);
|
||||
$validation = scorm_validate($tempdir);
|
||||
} else {
|
||||
$validation->result = "packagefile";
|
||||
}
|
||||
} else {
|
||||
$validation->result = "packagedir";
|
||||
}
|
||||
} else {
|
||||
$validation->result = "datadir";
|
||||
}
|
||||
if (($validation->result != "regular") && ($validation->result != "found")) {
|
||||
$validation->result = get_string($validation->result,'scorm');
|
||||
if (is_dir($tempdir)) {
|
||||
// Delete files and temporary directory
|
||||
scorm_delete_files($tempdir);
|
||||
|
@ -82,19 +82,19 @@ if (confirm_sesskey()) {
|
|||
echo 'result=' . $validation->result . "\n";
|
||||
echo 'launch=' . $launch . "\n";
|
||||
if (isset($validation->pkgtype)) {
|
||||
echo 'pkgtype=' . $validation->pkgtype . "\n";
|
||||
echo 'pkgtype=' . $validation->pkgtype . "\n";
|
||||
}
|
||||
if (isset($datadir)) {
|
||||
echo 'datadir=' . $datadir . "\n";
|
||||
echo 'datadir=' . $datadir . "\n";
|
||||
}
|
||||
if (isset($validation->errors[1])) {
|
||||
echo 'errorlogs='."\n";
|
||||
foreach($validation->errors as $error) {
|
||||
echo get_string($error->type,"scorm",$error->data) . "\n";
|
||||
}
|
||||
echo 'errorlogs='."\n";
|
||||
foreach($validation->errors as $error) {
|
||||
echo get_string($error->type,"scorm",$error->data) . "\n";
|
||||
}
|
||||
}
|
||||
/*if ($validation->pkgtype == 'AICC') {
|
||||
scorm_parse_aicc("$CFG->dataroot/$courseid/$CFG->moddata/scorm$datadir",$scormid);
|
||||
scorm_parse_aicc("$CFG->dataroot/$courseid/$CFG->moddata/scorm$datadir",$scormid);
|
||||
}*/
|
||||
} else {
|
||||
echo 'result=' . get_string('badrequest','scorm') . "\n";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue