var QuestionCheckerBoard = Class.create({
TEXTE_TEXTE: 0,
TEXTE_IMAGE: 1,
IMAGE_TEXTE: 2,
IMAGE_IMAGE: 3,
NONE: 0,
LETTERS: 1,
NUMBERS: 2,
//AUTRES VARIABLE (MIS EN COMMENTAIRES, DOIVENT ALLER DANS initialize()
//sChoixA: new Array(),
//sChoixB: new Array(),
//bFound: new Array(),
//iChoixOrder: new Array(),
//sLogo: new Array(),
iType: 0,
iAffichage: 0,
sBkgA: "FFFFFF",
sBkgB: "FFFFFF",
feedback: "",
checkerBoard: null,
//VARIABLE COMMUNE
ponderation: 1,
sDecDelimiter: ",",
iLabelType: 0,
currentScore: 0,
status: 0,
triesCount: 0,
questionNb: 0,
//Mandatory functions
initialize: function(quiz, page, questionNb){
this.quiz = quiz;
this.page = page;
this.questionNb = questionNb;
this.checkerBoard = getNewCheckerBoard();
this.checkerBoard.owner = this;
//REGLE BOGUE DOUBLONS SOLUTION
this.sChoixA = new Array();
this.sChoixB = new Array();
this.bFound = new Array();
this.iChoixOrder = new Array();
this.sLogo = new Array();
this.status = this.quiz.statusToDo;
this.checkerBoard.onPairFound = this.setBrotherhoodFound;
},
save: function(){
},
display: function(){
this.checkerBoard.display($('question'));
},
validate: function(){
var feedbackHTML = "";
var currentScore = 0;
var goodAnswerCount = 0;
this.triesCount++;
for(var i = 0;i < this.bFound.length;i++){
if(this.bFound[i]){
goodAnswerCount++;
}
}
this.currentScore = (goodAnswerCount / this.bFound.length) * this.ponderation;
this.status = this.quiz.statusToRedo;
if (goodAnswerCount == this.bFound.length){
if(this.currentScore == this.ponderation){
feedbackHTML = '' + this.quiz.goodAnswerLabel + '
';
feedbackHTML += '
' + this.feedback + '';
this.status = this.quiz.statusCompleted;
}
}else{
feedbackHTML = '' + this.quiz.incompleteAnswerLabel + '
';
}
setFeedback(feedbackHTML);
openFeedback();
return currentScore;
},
showSolution: function(){
var feedbackHTML = "";
var sEti = "";
var iNbCol = 3;
//feedbackHTML = "
" + this.sChoixA[i] + " | "; }else{ feedbackHTML += ""; var temp = new Element('div'); temp.appendChild(nq4_buildImageObject(this.sChoixA[i],110,145,this.quiz.mediasFolder)); //115,115 feedbackHTML += temp.innerHTML; feedbackHTML += " | "; } //Choix if(this.iType == this.TEXTE_TEXTE || this.iType == this.IMAGE_TEXTE){ feedbackHTML += "" + this.sChoixB[i] + " | "; }else{ feedbackHTML += ""; var temp = new Element('div'); temp.appendChild(nq4_buildImageObject(this.sChoixB[i],110,145,this.quiz.mediasFolder)); feedbackHTML += temp.innerHTML; feedbackHTML += " | "; } feedbackHTML += "