//----------------------- // WBT User Class // by Caspar Noetzli / Andy Häberli // www.crealogix.com // vs. 0.6 2005-07-21 // ---------------------- // //--------------------------- // WBT_User Constructor //--------------------------- WBT_User = function (objRef) { // objRef ist eine Referenz zum WBT-Controller-Object bzw. zum aufrufenden Object this.objRef = objRef; this.version = "v2005-07-21-002_clx"; }; //--------------------------- // WBT_User getVersion //--------------------------- WBT_User.prototype.getVersion = function(objRef) { return ("WBT User Class Version: "+this.version); }; //--------------------------- // WBT_User init //--------------------------- WBT_User.prototype.init = function() { this.id = "ID nicht gesetzt"; this.name = "name nicht gesetzt"; this.vorname = "vorname nicht gesetzt"; this.setLocation(0,0,0); this.lessonStatus = "not attempted"; this.attempt = 0; this.time = 0; // Beispiele für User-Prefs this.prefData = new Object(); this.prefData.language = "sprache nicht gesetzt"; this.prefData.soundVolume = "soundVolume nicht gesetzt"; // Erstelle einen leeren Tracking-Data-Array, welche der Daten-Struktur des WBT-Contents entspricht this.setEmptyTrackingData(); }; //--------------------------- // WBT_User setID //--------------------------- WBT_User.prototype.setID = function(whichID) { this.id = whichID; }; //--------------------------- // WBT_User getID //--------------------------- WBT_User.prototype.getID = function() { return this.id; }; //--------------------------- // WBT_User setName //--------------------------- WBT_User.prototype.setName = function(whichName) { this.name = whichName; }; //--------------------------- // WBT_User getName //--------------------------- WBT_User.prototype.getName = function() { return this.name; }; //--------------------------- // WBT_User setVorname //--------------------------- WBT_User.prototype.setVorname = function(whichVorname) { this.vorname = whichVorname; }; //--------------------------- // WBT_User getVorname //--------------------------- WBT_User.prototype.getVorname = function() { return this.vorname; }; //--------------------------- // WBT_User setPrefData //--------------------------- WBT_User.prototype.setPrefData = function(whichPref, whichValue) { this.prefData[whichPref] = whichValue; }; //--------------------------- // WBT_User getPrefData //--------------------------- WBT_User.prototype.getPrefData = function(whichPref) { return this.prefData[whichPref]; }; //--------------------------- // WBT_User setLocation //--------------------------- WBT_User.prototype.setLocation = function(whichChapter, whichSubchapter, whichItem) { this.location = new Object; this.location.chapter = whichChapter; this.location.subchapter= whichSubchapter; this.location.item = whichItem; }; //--------------------------- // WBT_User getLocation //--------------------------- WBT_User.prototype.getLocation = function() { return this.location }; //--------------------------- // WBT_User setTime //--------------------------- WBT_User.prototype.setTime = function(whichTime) { this.time = whichTime }; //--------------------------- // WBT_User setStatus //--------------------------- WBT_User.prototype.setStatus = function(whichStatus) { this.lessonStatus = whichStatus; }; //--------------------------- // WBT_User getStatus //--------------------------- WBT_User.prototype.getStatus = function() { return this.lessonStatus; }; //--------------------------- // WBT_User setAttempt //--------------------------- WBT_User.prototype.setAttempt = function(whichAttempt) { this.attempt = whichAttempt; }; //--------------------------- // WBT_User getAttempt //--------------------------- WBT_User.prototype.getAttempt = function() { return this.attempt; }; //--------------------------- // WBT_User getTime //--------------------------- WBT_User.prototype.getTime = function() { return this.time }; //--------------------------- // WBT_User setEmptyTrackingData //--------------------------- WBT_User.prototype.setEmptyTrackingData = function() { // Erstelle einen 'leeren' Tracking-Data Array, welche der Struktur des Contents entspricht. this.trackingData = new Array(); var tNumOfChapters = this.objRef.getNumberOfChapters(); for (var i = 0; i 0) { tScoreTotalPercent = Math.round(100/tScoreMax*tScoreTotal); } tScoreObject = new Object(); tScoreObject.scoreTotal = tScoreTotal; tScoreObject.scoreMin = tScoreMin; tScoreObject.scoreMax = tScoreMax; tScoreObject.scoreCutvaluePercent = tCutvaluePercent; tScoreObject.scoreTotalPercent = tScoreTotalPercent; return tScoreObject; }; //--------------------------- // WBT_User getScore //--------------------------- WBT_User.prototype.getScore = function(whichChapter, whichSubchapter, whichItem, whichData) { tScore+= this.getTrackingData(whichChapter,whichSubchapter,whichItem, "score") return tScore }; //--------------------------- // WBT_User traceTrackingData //--------------------------- WBT_User.prototype.traceTrackingData = function(){ xtrace( "TRACKING DATA < start -----------------------------------------------") for (var i=0; i