Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Modified scorm module to allow remote packages updating

  • Loading branch information...
commit 456f5e6e4319911972603c6a498d7452d6e9fa01 1 parent 75b4cb6
authored January 17, 2007
8  mod/scorm/lib.php
@@ -40,7 +40,9 @@ function scorm_add_instance($scorm) {
40 40
     } else {
41 41
         global $CFG;
42 42
         $scorm->timemodified = time();
43  
-
  43
+		if(substr($scorm->reference,0,7)== 'http://'){
  44
+			$scorm->md5_result=md5_file($scorm->reference);
  45
+		}
44 46
         $scorm = scorm_option2text($scorm);
45 47
         $scorm->width = str_replace('%','',$scorm->width);
46 48
         $scorm->height = str_replace('%','',$scorm->height);
@@ -110,7 +112,9 @@ function scorm_update_instance($scorm) {
110 112
 
111 113
     $scorm->timemodified = time();
112 114
     $scorm->id = $scorm->instance;
113  
-
  115
+	if(substr($scorm->reference,0,7)== 'http://'){
  116
+			$scorm->md5_result=md5_file($scorm->reference);
  117
+	}
114 118
     $scorm = scorm_option2text($scorm);
115 119
     $scorm->width = str_replace('%','',$scorm->width);
116 120
     $scorm->height = str_replace('%','',$scorm->height);
15  mod/scorm/locallib.php
@@ -687,9 +687,14 @@ function scorm_validate($data) {
687 687
         //
688 688
         // SCORM Update
689 689
         //
690  
-            if (($validation->launch != -1) && is_file($reference)) {
  690
+			if (($validation->launch != -1) && (is_file($reference) || (substr($reference,0,7) == 'http://'))){
691 691
                 $fp = fopen($reference,"r");
692  
-                $fstat = fstat($fp);
  692
+                if (substr($reference,0,7) != 'http://') {
  693
+					$fstat = fstat($fp);
  694
+				}
  695
+				else if(substr($reference,0,7) == 'http://'){
  696
+					$mdcheck=md5_file($reference);
  697
+				}
693 698
                 fclose($fp);
694 699
                 if ($scorm = get_record("scorm","id",$scormid)) {
695 700
                     if ($scorm->reference[0] == '#') {
@@ -701,9 +706,11 @@ function scorm_validate($data) {
701 706
                         }
702 707
                     } else if (substr($reference,0,7) != 'http://') {
703 708
                         $oldreference = $CFG->dataroot.'/'.$courseid.'/'.$scorm->reference;
704  
-                    }
  709
+                    } else{
  710
+						$oldreference = $scorm->reference;
  711
+					}
705 712
                     $validation->launch = $scorm->launch;
706  
-                    if ((($scorm->timemodified < $fstat["mtime"]) && ($oldreference == $reference)) || ($oldreference != $reference)) {
  713
+                     if ((($scorm->timemodified < $fstat["mtime"]) && ($oldreference == $reference) && (substr($reference,0,7) != 'http://')) || ($oldreference != $reference) || ((substr($reference,0,7) == 'http://') && ($mdcheck != $scorm->md5_result)&& ($oldreference == $reference))) {
707 714
                         // This is a new or a modified package
708 715
                         $validation->launch = 0;
709 716
                     } else {

0 notes on commit 456f5e6

Please sign in to comment.
Something went wrong with that request. Please try again.