Widget:ExamObjDefinition: Difference between revisions

Jump to navigation Jump to search
Matt Pijoan (talk | contribs)
No edit summary
Matt Pijoan (talk | contribs)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
<script type="text/javascript">
<script type="text/javascript">
var exam = {
var exam = {
init : function (id, timestamp, username, questions, isTimed) {
        this.countdownTimer = null;
this.id = id;
this.countdownCurrent = null;
this.timestamp = timestamp;
this.id = id;
this.username = username;
this.timestamp = null;
this.questions = null;
this.username = mw.user.name();
this.questions = null;
        this.isPatientHistory = null;
        this.examType = null;
 
        setCountdown : function(time){
        this.countdownCurrent = parseInt(time) * 6000
        }
 
        isPatientHistory : function(isPatientHistory){
        this.isPatientHistory = isPatientHistory;
        }
 
        setExamType : function(examType){
        this.examType = examType;
        }
 
        questionAdd : function(question) {
        this.questions[] = question;
        }
questionCache : function (questions) {
$.each(questions, function (index, value) {
$.each(questions, function (index, value) {
this.questions[value.pagename] = getQuestionMembers(value.pagename);
this.questions[value.pagename] = getQuestionMembers(value.pagename);
//can define other question array member properties as null here as needed.
//can define other question array member properties as null here as needed.
});
});
if (isTimed) {
}
this.countdownTimer = null;
}
this.countdownCurrent = null;
        timerOn : function(duration) {
 
$.getScript("http://wikidoc.org/includes/jquery.timer.js", function () {
$.getScript("http://wikidoc.org/includes/jquery.timer.js", function () {
countdownTimer = $.timer(function () {
this.countdownTimer = $.timer(function () {
var min = parseInt(countdownCurrent / 6000);
var min = parseInt(this.countdownCurrent / 6000);
var sec = parseInt(countdownCurrent / 100) - (min * 60);
var sec = parseInt(this.countdownCurrent / 100) - (min * 60);
var micro = pad(countdownCurrent - (sec * 100) - (min * 6000), 2);
var micro = pad(this.countdownCurrent - (sec * 100) - (min * 6000), 2);
var output = "00";
var output = "00";
if (min > 0) {
if (min > 0) {
output = pad(min, 2);
output = pad(min, 2);
}
}
$('.countdowntime').html(output + ":" + pad(sec, 2));
$interface.updateClock(output + ":" + pad(sec, 2));
if (countdownCurrent == 0) {
if (this.countdownCurrent == 0) {
countdownTimer.stop();
this.countdownTimer.stop();
endExam();
endExam();
} else {
} else {
countdownCurrent -= 7;
this.countdownCurrent -= 7;
if (countdownCurrent < 0) {
if (this.countdownCurrent < 0) {
countdownCurrent = 0;
this.countdownCurrent = 0;
}
}
}
}
}, 70, false);
}, 70, false);
        }
}


});
var interface = {
}
    init : function (){
}//End Init
            var welcomeScreen = "<a href='#' id='beginexam'><img src='http://www.wikidoc.org/images/d/da/Click_here_to_answer_questions.png' /></a><br />";
            welcomeScreen += "<div id='queslink'></div>";
            welcomeScreen += "<a href='http://www.wikidoc.org/index.php/Board_Review_Help'><img src='http://static.wikidoc.org/4/48/Click_here_for_help.png' /></a></div>";
            $.("#wbrcontent").html(welcomeScreen);
            }
    stepTwo : function (){
            $.("#wbrcontent").html(" ");
var examPicker = "
            }
}
}
var question = {
              //Define all question members in here. Shouldn't be too many member methods.
              }
function getQuestionMembers(pagename) {
function getQuestionMembers(pagename) {
var result = null;
var result = null;
Line 59: Line 95:


</script>
</script>
<div id="wbrcontent" style="position:relative;width:100%;height:100%;"></div>
</includeonly>
</includeonly>

Latest revision as of 21:25, 27 June 2013