mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Removed field datadir form scorm table
Fixed a validation problem.
This commit is contained in:
parent
346b77a53f
commit
1daed920e4
@ -45,7 +45,6 @@
|
||||
fwrite ($bf,full_tag("REFERENCE",4,false,$scorm->reference));
|
||||
fwrite ($bf,full_tag("MAXGRADE",4,false,$scorm->reference));
|
||||
fwrite ($bf,full_tag("GRADEMETHOD",4,false,$scorm->reference));
|
||||
fwrite ($bf,full_tag("DATADIR",4,false,$scorm->datadir));
|
||||
fwrite ($bf,full_tag("LAUNCH",4,false,$scorm->launch));
|
||||
fwrite ($bf,full_tag("SUMMARY",4,false,$scorm->summary));
|
||||
fwrite ($bf,full_tag("AUTO",4,false,$scorm->auto));
|
||||
|
@ -47,10 +47,10 @@ function scorm_upgrade($oldversion) {
|
||||
modify_database('',"ALTER TABLE prefix_scorm_scoes ADD timelimitaction SET('exit,message','exit,no message','continue,message','continue,no message') DEFAULT '' AFTER `maxtimeallowed`");
|
||||
table_column("scorm_scoes", "", "masteryscore", "VARCHAR", "200", "", "", "NOT NULL", "datafromlms");
|
||||
|
||||
$oldScoesData = get_records_select("scorm_scoes","1","id ASC");
|
||||
$oldscoes = get_records_select("scorm_scoes","1","id ASC");
|
||||
modify_database('',"ALTER TABLE prefix_scorm_scoes CHANGE type scormtype SET('sco','asset') DEFAULT '' NOT NULL");
|
||||
if(!empty($oldScoesData)) {
|
||||
foreach ($oldScoesData as $sco) {
|
||||
if(!empty($oldscoes)) {
|
||||
foreach ($oldscoes as $sco) {
|
||||
$sco->scormtype = $sco->type;
|
||||
unset($sco->type);
|
||||
update_record("scorm_scoes",$sco);
|
||||
@ -70,23 +70,23 @@ function scorm_upgrade($oldversion) {
|
||||
KEY id (id)
|
||||
) TYPE=MyISAM;",false);
|
||||
|
||||
$oldTrackingData = get_records_select("scorm_sco_users","1","id ASC");
|
||||
$oldElementArray = array ('cmi_core_lesson_location','cmi_core_lesson_status','cmi_core_exit','cmi_core_total_time','cmi_core_score_raw','cmi_suspend_data');
|
||||
$oldtrackingdata = get_records_select("scorm_sco_users","1","id ASC");
|
||||
$oldelements = array ('cmi_core_lesson_location','cmi_core_lesson_status','cmi_core_exit','cmi_core_total_time','cmi_core_score_raw','cmi_suspend_data');
|
||||
|
||||
if(!empty($oldTrackingData)) {
|
||||
foreach ($oldTrackingData as $oldTrack) {
|
||||
$newTrack = '';
|
||||
$newTrack->userid = $oldTrack->userid;
|
||||
$newTrack->scormid = $oldTrack->scormid;
|
||||
$newTrack->scoid = $oldTrack->scoid;
|
||||
if(!empty($oldtrackingdata)) {
|
||||
foreach ($oldtrackingdata as $oldtrack) {
|
||||
$newtrack = '';
|
||||
$newtrack->userid = $oldtrack->userid;
|
||||
$newtrack->scormid = $oldtrack->scormid;
|
||||
$newtrack->scoid = $oldtrack->scoid;
|
||||
|
||||
foreach ( $oldElementArray as $element) {
|
||||
$newTrack->element = $element;
|
||||
$newTrack->value = $oldTrack->$element;
|
||||
if ($newTrack->value == NULL) {
|
||||
$newTrack->value = '';
|
||||
foreach ( $oldelements as $element) {
|
||||
$newtrack->element = $element;
|
||||
$newtrack->value = $oldtrack->$element;
|
||||
if ($newtrack->value == NULL) {
|
||||
$newtrack->value = '';
|
||||
}
|
||||
insert_record("scorm_scoes_track",$newTrack,false);
|
||||
insert_record("scorm_scoes_track",$newtrack,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,6 +118,19 @@ function scorm_upgrade($oldversion) {
|
||||
table_column("scorm_scoes", "scormtype", "scormtype", "VARCHAR", "5", "", "", "NOT NULL");
|
||||
}
|
||||
|
||||
if ($oldversion < 2005041500) {
|
||||
if ($scorms = get_records_select("scorm","1","id ASC")) {
|
||||
foreach ($scorms as $scorm) {
|
||||
if (strlen($scorm->datadir) == 14) {
|
||||
$basedir = $CFG->dataroot.'/'.$scorm->course;
|
||||
$scormdir = '/moddata/scorm';
|
||||
rename($basedir.$scormdir.$scorm->datadir,$basedir.$scormdir.'/'.$scorm->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
execute_sql('ALTER TABLE `'.$CFG->prefix.'scorm` DROP `datadir`'); // Old field
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ CREATE TABLE prefix_scorm (
|
||||
reference varchar(255) NOT NULL default '',
|
||||
maxgrade float(3) NOT NULL default '0',
|
||||
grademethod tinyint(2) NOT NULL default '0',
|
||||
datadir varchar(255) NOT NULL default '',
|
||||
launch int(10) unsigned NOT NULL default 0,
|
||||
summary text NOT NULL,
|
||||
auto tinyint(1) unsigned NOT NULL default '0',
|
||||
|
@ -47,10 +47,10 @@ function scorm_upgrade($oldversion) {
|
||||
table_column("scorm_scoes", "", "timelimitaction", "VARCHAR", "19", "", "", "NOT NULL", "maxtimeallowed");
|
||||
table_column("scorm_scoes", "", "masteryscore", "VARCHAR", "200", "", "", "NOT NULL", "datafromlms");
|
||||
|
||||
$oldScoesData = get_records_select("scorm_scoes",null,"id ASC");
|
||||
$oldscoes = get_records_select("scorm_scoes",null,"id ASC");
|
||||
table_column("scorm_scoes", "type", "scormtype", "VARCHAR", "5", "", "", "NOT NULL");
|
||||
if(!empty($oldScoesData)) {
|
||||
foreach ($oldScoesData as $sco) {
|
||||
if(!empty($oldscoes)) {
|
||||
foreach ($oldscoes as $sco) {
|
||||
$sco->scormtype = $sco->type;
|
||||
unset($sco->type);
|
||||
update_record("scorm_scoes",$sco);
|
||||
@ -70,23 +70,23 @@ function scorm_upgrade($oldversion) {
|
||||
|
||||
modify_database('','CREATE INDEX prefix_scorm_scoes_track_userdata_idx ON prefix_scorm_scoes_track (userid, scormid, scoid);');
|
||||
|
||||
$oldTrackingData = get_records_select("scorm_sco_users",null,"id ASC");
|
||||
$oldElementArray = array ('cmi_core_lesson_location','cmi_core_lesson_status','cmi_core_exit','cmi_core_total_time','cmi_core_score_raw','cmi_suspend_data');
|
||||
$oldtracking = get_records_select('scorm_sco_users',null,'id ASC');
|
||||
$oldelements = array ('cmi_core_lesson_location','cmi_core_lesson_status','cmi_core_exit','cmi_core_total_time','cmi_core_score_raw','cmi_suspend_data');
|
||||
|
||||
if(!empty($oldTrackingData)) {
|
||||
foreach ($oldTrackingData as $oldTrack) {
|
||||
$newTrack = '';
|
||||
$newTrack->userid = $oldTrack->userid;
|
||||
$newTrack->scormid = $oldTrack->scormid;
|
||||
$newTrack->scoid = $oldTrack->scoid;
|
||||
if(!empty($oldtrackings)) {
|
||||
foreach ($oldtrackings as $oldtrack) {
|
||||
$newtrack = '';
|
||||
$newtrack->userid = $oldtrack->userid;
|
||||
$newtrack->scormid = $oldtrack->scormid;
|
||||
$newtrack->scoid = $oldtrack->scoid;
|
||||
|
||||
foreach ( $oldElementArray as $element) {
|
||||
$newTrack->element = $element;
|
||||
$newTrack->value = $oldTrack->$element;
|
||||
if ($newTrack->value == NULL) {
|
||||
$newTrack->value = '';
|
||||
foreach ( $oldelements as $element) {
|
||||
$newtrack->element = $element;
|
||||
$newtrack->value = $oldtrack->$element;
|
||||
if ($newtrack->value == NULL) {
|
||||
$newtrack->value = '';
|
||||
}
|
||||
insert_record("scorm_scoes_track",$newTrack,false);
|
||||
insert_record('scorm_scoes_track',$newtrack,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -100,12 +100,32 @@ function scorm_upgrade($oldversion) {
|
||||
}
|
||||
|
||||
if ($oldversion < 2005040400) {
|
||||
table_column("scorm_scoes", "", "parameters", "VARCHAR", "255", "", "", "NOT NULL", "launch");
|
||||
table_column('scorm_scoes', '', 'parameters', 'VARCHAR', '255', '', '', 'NOT NULL', 'launch');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005040700) {
|
||||
execute_sql("DROP INDEX {$CFG->prefix}scorm_scoes_track_userid_idx;",false);
|
||||
modify_database('','CREATE INDEX prefix_scorm_scoes_track_userdata_idx ON prefix_scorm_scoes_track (userid, scormid, scoid);');
|
||||
//execute_sql('DROP PRIMARY KEY '.$CFG->prefix.'scorm_scoes_track_pkey;',false);
|
||||
execute_sql('DROP INDEX '.$CFG->prefix.'scorm_scoes_track_userdata_idx;',false);
|
||||
execute_sql('DROP INDEX '.$CFG->prefix.'scorm_scoes_track_userid_key;',false);
|
||||
modify_database('','CREATE UNIQUE INDEX prefix_scorm_scoes_track_track_idx ON prefix_scorm_scoes_track (userid, scormid, scoid, element);');
|
||||
execute_sql('ALTER TABLE '.$CFG->prefix.'scorm_scoes_track ADD PRIMARY KEY ("id");',false);
|
||||
modify_database('','CREATE INDEX prefix_scorm_scoes_track_scormid_idx ON prefix_scorm_scoes_track (scormid);');
|
||||
modify_database('','CREATE INDEX prefix_scorm_scoes_track_userid_idx ON prefix_scorm_scoes_track (userid);');
|
||||
modify_database('','CREATE INDEX prefix_scorm_scoes_track_scoid_idx ON prefix_scorm_scoes_track (scoid);');
|
||||
modify_database('','CREATE INDEX prefix_scorm_scoes_track_element_idx ON prefix_scorm_scoes_track (element);');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005041500) {
|
||||
if ($scorms = get_records_select('scorm','1','id ASC')) {
|
||||
foreach ($scorms as $scorm) {
|
||||
if (strlen($scorm->datadir) == 14) {
|
||||
$basedir = $CFG->dataroot.'/'.$scorm->course;
|
||||
$scormdir = '/moddata/scorm';
|
||||
rename($basedir.$scormdir.$scorm->datadir,$basedir.$scormdir.'/'.$scorm->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
execute_sql('ALTER TABLE '.$CFG->prefix.'scorm DROP datadir'); // Old field
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -9,7 +9,6 @@ CREATE TABLE prefix_scorm (
|
||||
reference varchar(255) NOT NULL default '',
|
||||
maxgrade real NOT NULL default '0',
|
||||
grademethod integer NOT NULL default '0',
|
||||
datadir varchar(255) NOT NULL default '',
|
||||
launch integer NOT NULL default '0',
|
||||
summary text NOT NULL default '',
|
||||
auto integer NOT NULL default '0',
|
||||
|
@ -7,22 +7,22 @@ define('VALUESCOES', '0');
|
||||
define('VALUEHIGHEST', '1');
|
||||
define('VALUEAVERAGE', '2');
|
||||
define('VALUESUM', '3');
|
||||
$SCORM_GRADE_METHOD = array (VALUESCOES => get_string("gradescoes", "scorm"),
|
||||
VALUEHIGHEST => get_string("gradehighest", "scorm"),
|
||||
VALUEAVERAGE => get_string("gradeaverage", "scorm"),
|
||||
VALUESUM => get_string("gradesum", "scorm"));
|
||||
$SCORM_GRADE_METHOD = array (VALUESCOES => get_string('gradescoes', 'scorm'),
|
||||
VALUEHIGHEST => get_string('gradehighest', 'scorm'),
|
||||
VALUEAVERAGE => get_string('gradeaverage', 'scorm'),
|
||||
VALUESUM => get_string('gradesum', 'scorm'));
|
||||
|
||||
if (!isset($CFG->scorm_validate)) {
|
||||
$scorm_validate = 'none';
|
||||
$scormvalidate = 'none';
|
||||
//I've commented this out for Moodle 1.4, as I've seen errors in
|
||||
//SCORM packages even though the actual package worked fine. -- Martin Dougiamas
|
||||
if (extension_loaded('domxml') && version_compare(phpversion(),'5.0.0','<')) {
|
||||
$scorm_validate = 'domxml';
|
||||
$scormvalidate = 'domxml';
|
||||
}
|
||||
if (version_compare(phpversion(),'5.0.0','>=')) {
|
||||
$scorm_validate = 'php5';
|
||||
$scormvalidate = 'php5';
|
||||
}
|
||||
set_config('scorm_validate', $scorm_validate);
|
||||
set_config('scorm_validate', $scormvalidate);
|
||||
}
|
||||
|
||||
function scorm_add_instance($scorm) {
|
||||
@ -38,14 +38,19 @@ function scorm_add_instance($scorm) {
|
||||
|
||||
$id = insert_record('scorm', $scorm);
|
||||
|
||||
//
|
||||
// Rename temp scorm dir to scorm id
|
||||
//
|
||||
|
||||
$basedir = $CFG->dataroot.'/'.$scorm->course;
|
||||
$scormdir = '/moddata/scorm';
|
||||
rename($basedir.$scormdir.$scorm->datadir,$basedir.$scormdir.'/'.$id);
|
||||
//
|
||||
// Parse scorm manifest
|
||||
//
|
||||
if ($scorm->launch == 0) {
|
||||
$basedir = $CFG->dataroot."/".$scorm->course;
|
||||
$scormdir = "/moddata/scorm";
|
||||
$scorm->launch = scorm_parse($basedir,$scormdir.$scorm->datadir."/imsmanifest.xml",$id);
|
||||
set_field("scorm","launch",$scorm->launch,"id",$id);
|
||||
$scorm->launch = scorm_parse($basedir,$scormdir.'/'.$id.'/imsmanifest.xml',$id);
|
||||
set_field('scorm','launch',$scorm->launch,'id',$id);
|
||||
}
|
||||
|
||||
return $id;
|
||||
@ -68,9 +73,9 @@ function scorm_update_instance($scorm) {
|
||||
// Check if scorm manifest needs to be reparsed
|
||||
//
|
||||
if ($scorm->launch == 0) {
|
||||
$basedir = $CFG->dataroot."/".$scorm->course;
|
||||
$scormdir = "/moddata/scorm";
|
||||
$scorm->launch = scorm_parse($basedir,$scormdir.$scorm->datadir."/imsmanifest.xml",$scorm->id);
|
||||
$basedir = $CFG->dataroot.'/'.$scorm->course;
|
||||
$scormdir = '/moddata/scorm/';
|
||||
$scorm->launch = scorm_parse($basedir,$scormdir.$scorm->id.'/imsmanifest.xml',$scorm->id);
|
||||
}
|
||||
|
||||
return update_record('scorm', $scorm);
|
||||
@ -91,7 +96,7 @@ function scorm_delete_instance($id) {
|
||||
$result = true;
|
||||
|
||||
# Delete any dependent files #
|
||||
scorm_delete_files($CFG->dataroot.'/'.$scorm->course.'/moddata/scorm'.$scorm->datadir);
|
||||
scorm_delete_files($CFG->dataroot.'/'.$scorm->course.'/moddata/scorm'.$scorm->id);
|
||||
|
||||
# Delete any dependent records here #
|
||||
if (! delete_records('scorm_scoes_track', 'scormid', $scorm->id)) {
|
||||
@ -150,7 +155,7 @@ function scorm_grades($scormid) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if (!$scorm = get_record("scorm", "id", $scormid)) {
|
||||
if (!$scorm = get_record('scorm', 'id', $scormid)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -160,24 +165,24 @@ function scorm_grades($scormid) {
|
||||
}
|
||||
|
||||
$return->grades = NULL;
|
||||
if ($sco_users=get_records_select('scorm_scoes_track', "scormid='$scormid' GROUP BY userid")) {
|
||||
foreach ($sco_users as $sco_user) {
|
||||
$user_data=get_records_select('scorm_scoes_track',"scormid='$scormid' AND userid='$sco_user->userid' AND element='cmi_core_lesson_status'");
|
||||
if ($scousers=get_records_select('scorm_scoes_track', "scormid='$scormid' GROUP BY userid")) {
|
||||
foreach ($scousers as $scouser) {
|
||||
$userdata=get_records_select('scorm_scoes_track',"scormid='$scormid' AND userid='$scouser->userid' AND element='cmi_core_lesson_status'");
|
||||
$scores->completed=0;
|
||||
$scores->browsed=0;
|
||||
$scores->incomplete=0;
|
||||
$scores->failed=0;
|
||||
$scores->notattempted=0;
|
||||
$result='';
|
||||
$data = current($user_data);
|
||||
foreach ($user_data as $data) {
|
||||
$data = current($userdata);
|
||||
foreach ($userdata as $data) {
|
||||
if ($data->value=='passed')
|
||||
$scores->completed++;
|
||||
else
|
||||
$scores->{scorm_remove_spaces($data->value)}++;
|
||||
}
|
||||
if ($scores->completed)
|
||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/completed.gif\" alt=\"".get_string('completed','scorm')."\" title=\"".get_string('completed','scorm')."\" /> $scores->completed ";
|
||||
$result.='<img src="'.$CFG->wwwroot.'/mod/scorm/pix/completed.gif" alt="'.get_string('completed','scorm').'" title="'.get_string('completed','scorm').'" /> '.$scores->completed;
|
||||
if ($scores->incomplete)
|
||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/incomplete.gif\" alt=\"".get_string('incomplete','scorm')."\" title=\"".get_string('incomplete','scorm')."\" /> $scores->incomplete ";
|
||||
if ($scores->failed)
|
||||
@ -187,12 +192,12 @@ function scorm_grades($scormid) {
|
||||
if ($scores->notattempted)
|
||||
$result.="<img src=\"$CFG->wwwroot/mod/scorm/pix/notattempted.gif\" alt=\"".get_string('notattempted','scorm')."\" title=\"".get_string('notattempted','scorm')."\" /> $scores->notattempted ";
|
||||
|
||||
$return->grades[$sco_user->userid]=$result;
|
||||
$return->grades[$scouser->userid]=$result;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$grades = get_records_select("scorm_scoes_track", "scormid=$scormid AND element='cmi_core_score_raw' AND value<>''","","id,userid,value");
|
||||
$grades = get_records_select('scorm_scoes_track', "scormid=$scormid AND element='cmi_core_score_raw' AND value<>''",'','id,userid,value');
|
||||
//$grades = get_records_menu("scorm_scoes_track", "scormid",$scormid,"","userid,cmi_core_score_raw");
|
||||
$valutations = array();
|
||||
foreach ($grades as $grade) {
|
||||
@ -254,7 +259,7 @@ function scorm_randstring($len = '8')
|
||||
}
|
||||
|
||||
|
||||
function scorm_datadir($strPath, $existingdir='', $prefix = 'SCORM')
|
||||
function scorm_datadir($strPath, $existingdir='')
|
||||
{
|
||||
global $CFG;
|
||||
|
||||
@ -263,7 +268,7 @@ function scorm_datadir($strPath, $existingdir='', $prefix = 'SCORM')
|
||||
|
||||
if (is_dir($strPath)) {
|
||||
do {
|
||||
$datadir='/'.$prefix.scorm_randstring();
|
||||
$datadir='/'.scorm_randstring();
|
||||
} while (file_exists($strPath.$datadir));
|
||||
mkdir($strPath.$datadir, $CFG->directorypermissions);
|
||||
@chmod($strPath.$datadir, $CFG->directorypermissions); // Just in case mkdir didn't do it
|
||||
@ -289,12 +294,12 @@ function scorm_validate($manifest)
|
||||
if (is_file ($manifest)) {
|
||||
if (file_exists($manifest)) {
|
||||
if ($CFG->scorm_validate == 'domxml') {
|
||||
$manifest_string = file_get_contents($manifest);
|
||||
$manifeststring = file_get_contents($manifest);
|
||||
|
||||
/* Elimino i caratteri speciali di spaziatura e ritorno a capo dal file xml */
|
||||
|
||||
$spec = array('\n', '\r', '\t', '\0', '\x0B');
|
||||
$content = str_replace($spec, '', $manifest_string);
|
||||
$content = str_replace($spec, '', $manifeststring);
|
||||
|
||||
if ($xmldoc = domxml_open_mem($content)) {
|
||||
$root = $xmldoc->document_element();
|
||||
@ -582,7 +587,7 @@ function scorm_get_tracks($scoid,$userid) {
|
||||
/// Gets all tracks of specified sco and user
|
||||
global $CFG;
|
||||
|
||||
if ($tracks = get_records_select("scorm_scoes_track","userid=$userid AND scoid=$scoid")) {
|
||||
if ($tracks = get_records_select('scorm_scoes_track',"userid=$userid AND scoid=$scoid")) {
|
||||
$user_tracks->userid = $userid;
|
||||
$user_tracks->scoid = $scoid;
|
||||
$user_tracks->score_raw = '';
|
||||
@ -590,15 +595,15 @@ function scorm_get_tracks($scoid,$userid) {
|
||||
foreach ($tracks as $track) {
|
||||
$element = str_replace('.','_',$track->element);
|
||||
switch ($element) {
|
||||
case "cmi_core_lesson_status":
|
||||
case "cmi_completition_status":
|
||||
case 'cmi_core_lesson_status':
|
||||
case 'cmi_completition_status':
|
||||
if ($track->value == 'not attempted') {
|
||||
$track->value = 'notattempted';
|
||||
}
|
||||
$user_tracks->status = $track->value;
|
||||
break;
|
||||
case "cmi_core_score_raw":
|
||||
case "cmi_score_raw":
|
||||
case 'cmi_core_score_raw':
|
||||
case 'cmi_score_raw':
|
||||
$user_tracks->score_raw = $track->value;
|
||||
break;
|
||||
default:
|
||||
@ -639,7 +644,7 @@ function scorm_remove_spaces($sourcestr) {
|
||||
function scorm_string_round($stringa, $len=11) {
|
||||
// Crop a string to $len character and set an anchor title to the full string
|
||||
if ( strlen($stringa)>$len ) {
|
||||
return "<a name=\"none\" title=\"$stringa\">".substr($stringa,0,$len-4).'...'.substr($stringa,strlen($stringa)-1,1).'</a>';
|
||||
return '<a name="none" title="'.$stringa.'">'.substr($stringa,0,$len-4).'...'.substr($stringa,strlen($stringa)-1,1).'</a>';
|
||||
} else
|
||||
return $stringa;
|
||||
}
|
||||
@ -664,18 +669,18 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod
|
||||
|
||||
echo "<ul id='0' class='$liststyle'>";
|
||||
$incomplete = false;
|
||||
$organizationSQL = '';
|
||||
$organizationsql = '';
|
||||
if (empty($currentorg)) {
|
||||
//
|
||||
} else {
|
||||
$organizationSQL = "AND organization='$currentorg'";
|
||||
$organizationsql = "AND organization='$currentorg'";
|
||||
}
|
||||
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationSQL order by id ASC")){
|
||||
if ($scoes = get_records_select('scorm_scoes',"scorm='$scorm->id' $organizationsql order by id ASC")){
|
||||
$level=0;
|
||||
$sublist=1;
|
||||
$previd = 0;
|
||||
$nextid = 0;
|
||||
$parents[$level]="/";
|
||||
$parents[$level]='/';
|
||||
foreach ($scoes as $sco) {
|
||||
if ($parents[$level]!=$sco->parent) {
|
||||
if ($level>0 && $parents[$level-1]==$sco->parent) {
|
||||
@ -689,7 +694,7 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod
|
||||
$i--;
|
||||
}
|
||||
if (($i == 0) && ($sco->parent != $currentorg)) {
|
||||
echo "\t\t<li><ul id='".$sublist."' class='$liststyle'>\n";
|
||||
echo "\t\t<li><ul id='$sublist' class='$liststyle'>\n";
|
||||
$level++;
|
||||
} else {
|
||||
echo $closelist;
|
||||
@ -702,9 +707,9 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod
|
||||
$nextsco = next($scoes);
|
||||
if (($nextsco !== false) && ($sco->parent != $nextsco->parent) && (($level==0) || (($level>0) && ($nextsco->parent == $sco->identifier)))) {
|
||||
$sublist++;
|
||||
echo "<a href='#' onClick='expandCollide(img".$sublist.",".$sublist.");'><img id='img".$sublist."' src='pix/minus.gif' alt='$strexpand' title='$strexpand'/></a>";
|
||||
echo '<a href="#" onClick="expandCollide(img'.$sublist.','.$sublist.');"><img id="img'.$sublist.'" src="pix/minus.gif" alt="'.$strexpand.'" title="'.$strexpand.'"/></a>';
|
||||
} else {
|
||||
echo "<img src='pix/spacer.gif' />";
|
||||
echo '<img src="pix/spacer.gif" />';
|
||||
}
|
||||
|
||||
if ($sco->launch) {
|
||||
@ -723,18 +728,18 @@ function scorm_display_structure($scorm,$liststyle,$currentorg='',$scoid='',$mod
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
}
|
||||
if ($user_tracks->score_raw != "") {
|
||||
if ($user_tracks->score_raw != '') {
|
||||
$score = '('.get_string('score','scorm').': '.$user_tracks->score_raw.')';
|
||||
}
|
||||
} else {
|
||||
if ($play && ($mode != 'normal') && empty($scoid)) {
|
||||
if ($play && empty($scoid)) {
|
||||
$scoid = $sco->id;
|
||||
}
|
||||
if ($sco->scormtype == 'sco') {
|
||||
echo "<img src='pix/notattempted.gif' alt='".get_string('notattempted','scorm')."' />";
|
||||
echo '<img src="pix/notattempted.gif" alt="'.get_string('notattempted','scorm').'" />';
|
||||
$incomplete = true;
|
||||
} else {
|
||||
echo "<img src='pix/asset.gif' alt='".get_string('asset','scorm')."' />";
|
||||
echo '<img src="pix/asset.gif" alt="'.get_string('asset','scorm').'" />';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,9 @@
|
||||
$result = $sco->launch;
|
||||
} else {
|
||||
if ($CFG->slasharguments) {
|
||||
$result = $CFG->wwwroot.'/file.php/'.$scorm->course.'/moddata/scorm'.$scorm->datadir.'/'.$sco->launch.$connector.$sco->parameters;
|
||||
$result = $CFG->wwwroot.'/file.php/'.$scorm->course.'/moddata/scorm'.$scorm->id.'/'.$sco->launch.$connector.$sco->parameters;
|
||||
} else {
|
||||
$result = $CFG->wwwroot.'/file.php?file=/'.$scorm->course.'/moddata/scorm'.$scorm->datadir.'/'.$sco->launch.$connector.$sco->parameters;
|
||||
$result = $CFG->wwwroot.'/file.php?file=/'.$scorm->course.'/moddata/scorm'.$scorm->id.'/'.$sco->launch.$connector.$sco->parameters;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -24,14 +24,18 @@
|
||||
if (empty($form->grademethod)) {
|
||||
$form->grademethod = "0";
|
||||
}
|
||||
$scormid ='';
|
||||
$scormid = '';
|
||||
if (!empty($form->instance)) {
|
||||
$scormid = '&instance='.$form->instance;
|
||||
}
|
||||
$datadir ='';
|
||||
$datadir = '';
|
||||
if (!empty($form->datadir)) {
|
||||
$datadir = '&datadir='.$form->datadir;
|
||||
}
|
||||
$sessionkey = '';
|
||||
if (!empty($form->sesskey)) {
|
||||
$sessionkey = '&sesskey='.$form->sesskey;
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript" src="<?php p($CFG->wwwroot) ?>/mod/scorm/request.js" >
|
||||
@ -40,7 +44,7 @@
|
||||
function validate_scorm(theform,filename) {
|
||||
//alert(filename);
|
||||
var myRequest = NewHttpReq();
|
||||
result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/validate.php","id=<?php p($form->course) ?>&reference="+filename+"<?php echo $scormid.$datadir ?>");
|
||||
result = DoRequest(myRequest,"<?php p($CFG->wwwroot) ?>/mod/scorm/validate.php","id=<?php p($form->course) ?>&reference="+filename+"<?php echo $sessionkey.$scormid.$datadir ?>");
|
||||
//alert(result);
|
||||
results = result.split('\n');
|
||||
if ((results[0] == "found") || (results[0] == "regular")) {
|
||||
|
@ -24,7 +24,12 @@ function DoRequest(httpReq,url,param) {
|
||||
//
|
||||
// httpReq.open (Method("get","post"), URL(string), Asyncronous(true,false))
|
||||
//
|
||||
httpReq.open("post", url,false);
|
||||
httpReq.send(param);
|
||||
return httpReq.responseText;
|
||||
httpReq.open("get", url+'?'+param,false);
|
||||
//httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
httpReq.send(null);
|
||||
if (httpReq.status == 200) {
|
||||
return httpReq.responseText;
|
||||
} else {
|
||||
return httpReq.status;
|
||||
}
|
||||
}
|
@ -49,7 +49,6 @@
|
||||
$scorm->reference = backup_todb($info['MOD']['#']['REFERENCE']['0']['#']);
|
||||
$scorm->reference = backup_todb($info['MOD']['#']['MAXGRADE']['0']['#']);
|
||||
$scorm->reference = backup_todb($info['MOD']['#']['GRADEMETHOD']['0']['#']);
|
||||
$scorm->datadir = backup_todb($info['MOD']['#']['DATADIR']['0']['#']);
|
||||
$scorm->launch = backup_todb($info['MOD']['#']['LAUNCH']['0']['#']);
|
||||
$scorm->summary = backup_todb($info['MOD']['#']['SUMMARY']['0']['#']);
|
||||
$scorm->auto = backup_todb($info['MOD']['#']['AUTO']['0']['#']);
|
||||
@ -67,7 +66,7 @@
|
||||
$mod->id, $newid);
|
||||
|
||||
//Now copy moddata associated files
|
||||
$status = scorm_restore_files ($scorm->datadir, $restore);
|
||||
$status = scorm_restore_files ($scorm, $restore);
|
||||
|
||||
if ($status)
|
||||
$status = scorm_scoes_restore_mods ($newid,$info,$restore);
|
||||
@ -206,7 +205,7 @@
|
||||
|
||||
//This function copies the scorm related info from backup temp dir to course moddata folder,
|
||||
//creating it if needed
|
||||
function scorm_restore_files ($packagedir, $restore) {
|
||||
function scorm_restore_files ($package, $restore) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
@ -237,7 +236,7 @@
|
||||
//Now locate the temp dir we are restoring from
|
||||
if ($status) {
|
||||
$temp_path = $CFG->dataroot."/temp/backup/".$restore->backup_unique_code.
|
||||
"/moddata/scorm/".$packagedir;
|
||||
"/moddata/scorm/".$package->id;
|
||||
//Check it exists
|
||||
if (is_dir($temp_path)) {
|
||||
$todo = true;
|
||||
@ -247,7 +246,7 @@
|
||||
//If todo, we create the neccesary dirs in course moddata/scorm
|
||||
if ($status and $todo) {
|
||||
//Make scorm package directory path
|
||||
$this_scorm_path = $scorm_path."/".$packagedir;
|
||||
$this_scorm_path = $scorm_path."/".$package->id;
|
||||
|
||||
$status = backup_copy_file($temp_path, $this_scorm_path);
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
<?php // $Id$
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
require_login();
|
||||
|
||||
|
||||
$reference = clean_param($_POST["reference"], PARAM_PATH);
|
||||
$courseid = $_POST["id"];
|
||||
require_login();
|
||||
|
||||
if (confirm_sesskey()) {
|
||||
$reference = clean_param($_GET["reference"], PARAM_PATH);
|
||||
$courseid = $_GET["id"];
|
||||
$datadir = '';
|
||||
if (isset($_POST["datadir"])) {
|
||||
$datadir = $_POST["datadir"];
|
||||
if (isset($_GET["datadir"])) {
|
||||
$datadir = $_GET["datadir"];
|
||||
}
|
||||
|
||||
$scormid = 0;
|
||||
$launch = 0;
|
||||
$result = '';
|
||||
$errorlogs = '';
|
||||
if (isset($_POST["instance"])) {
|
||||
$scormid = $_POST["instance"];
|
||||
if (isset($_GET["instance"])) {
|
||||
$scormid = $_GET["instance"];
|
||||
$launch = 1;
|
||||
$fp = fopen($CFG->dataroot.'/'.$courseid.'/'.$reference,"r");
|
||||
$fstat = fstat($fp);
|
||||
@ -80,5 +80,8 @@
|
||||
if ($errorlogs != '') {
|
||||
echo $errorlogs;
|
||||
}
|
||||
} else {
|
||||
print_string('badrequest','scorm');
|
||||
}
|
||||
?>
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2005040700; // The (date) version of this module
|
||||
$module->version = 2005041500; // The (date) version of this module
|
||||
$module->requires = 2005021600; // The version of Moodle that is required
|
||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user