From: csantossaenz <csantossaenz>
Date: Thu, 31 May 2007 16:24:53 +0000 (+0000)
Subject: Fixed a problem with cmi.interactions.n.objectives.n.id duplicated ids
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3b2c6f99b624ebdc198acded829d215ec1302f6b;p=moodle.git

Fixed a problem with cmi.interactions.n.objectives.n.id duplicated ids
---

diff --git a/mod/scorm/datamodels/scorm_13.js.php b/mod/scorm/datamodels/scorm_13.js.php
index c735ee76e4..acfd99a642 100644
--- a/mod/scorm/datamodels/scorm_13.js.php
+++ b/mod/scorm/datamodels/scorm_13.js.php
@@ -561,6 +561,51 @@ alert('element = '+element+"\nsubelement = "+subelement+"\nparentmodel = "+paren
                                                          diagnostic = "Write Once Violation";
                                                      }
                                                  }
+                                                 
+                                                 if (elementmodel=='cmi.interactions.n.objectives.n.id') {
+ 
+                                                    elementIndexesSubindexes = element.split('.');
+                                                    elementFirstindex = elementIndexesSubindexes [2];
+	                                                longit = elementFirstindex.length;
+	
+	                                                longit--;
+	                                                if (longit == 1){
+	 
+	                                                    ind = elementFirstindex.substring(1);
+	                                                }
+                                                    else{
+	                                                    ind = elementFirstindex.substring(1,longit);
+	                                                }
+	
+	                                                elementSubindex = elementIndexesSubindexes [4];
+	                                                longit2 = elementSubindex.length;
+	 
+	                                                longit2--;
+	                                                if (longit2 == 1){
+	     
+		                                               subind = elementSubindex.substring(1);
+		
+		                                            }
+		                                            else{
+    
+	                                                   subind = elementSubindex.substring(1,longit2);
+	                                                }
+	
+	                                                i=0;
+	                                                while (i<parseInt(subind)){
+		                                                elem = 'cmi.interactions.N'+ind+'.objectives.N'+i+'.id';
+		                                                if (eval(elem)==value){
+		                                                    errorCode = "351";
+                                                            diagnostic = "Write Once Violation";
+		                                                }
+	                                                    i++;
+	                                                }
+                      
+  
+												
+
+												}
+                                                 
                                                 if (elementmodel=='cmi.interactions.n.learner_response') {
                                                     if (typeof eval(subelement+'.type') == "undefined") {
                                                         errorCode="408";