QUIZ EXAMPLE TEMPLATE

You need jQuery for this example. This example uses the extension t3jquery. The design of this example is from here: http://net.tutsplus.com/demos/test_poll/ http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-dynamic-poll-with-jquery-and-php/ Test it with this TypoScript:

plugin.tx_myquizpoll_pi1.isPoll = 1
plugin.tx_myquizpoll_pi1.templateFile = EXT:myquizpoll/examples/template_poll_jquery.html
plugin.tx_myquizpoll_pi1.myVars.answers {
  input_id = 1
  input_label = 1
}

includeLibs.t3jquery = EXT:t3jquery/class.tx_t3jquery.php
page.11 = USER
page.11.userFunc = tx_t3jquery->addJqJS

Note: no breaks allowed in the question. Breaks: JavaScript-Errors...
And use this CSS:

.graph {
  width: 600px;
  position: relative;
}
.bar-title {
  clear:both;
  position: relative;
  float: left;
  width: 150px;
  line-height: 20px;
  margin-right: 17px;
  font-weight: bold;
  text-align: right;
}
.bar-container {
  position: relative;
  float: left;
  width: 250px;
  height: 20px;
  margin: 0px 0px 15px;
}

.bar-container div {
  background-color:#006B04;
  height: 20px;
}
.bar-container strong {
  position: absolute;
  right: -2px;
  top: 0px;
  overflow: hidden;
}

Templates for whole sites

Questions page:
1. Empty or reference to TEMPLATE_CAPTCHA_NOT_OK.
2. Reference to TEMPLATE_QUIZ_TIME_LIMIT. REF_QUIZ_LIMIT will be empty if "quizTimeMinutes = 0".
3. Reference to TEMPLATE_PAGE_TIME_LIMIT. REF_PAGE_LIMIT will be empty if "pageTimeSeconds = 0".
4. Multiple reference to TEMPLATE_QUESTION.
5. Reference to TEMPLATE_QUIZ_USER_TO_SUBMIT (dontShowUserData = 0), to TEMPLATE_SUBMIT (dontShowUserData = 1) or to TEMPLATE_NO_SUBMIT (if no rights)
6. Dont delete the marker HIDDENFIELDS !!!!!!!
7. Reference to TEMPLATE_HIGHSCORE_URL. REF_HIGHSCORE_URL will be empty if is poll or dontShowHighscoreLink = 1 !!!
Optional: ###REF_POLLRESULT_URL### = Reference to TEMPLATE_POLLRESULT_URL. REF_POLLRESULT_URL will be empty if is quiz or showPollResultLink = 0 !!!

###REF_ERRORS### ###REF_QUIZ_LIMIT### ###REF_PAGE_LIMIT###
###REF_QUESTIONS### ###REF_SUBMIT_FIELDS### ###HIDDENFIELDS###

Result page:
1. Empty or reference to TEMPLATE_CHEATING.
2. Reference to TEMPLATE_POLL_SUBMITED (poll) or to TEMPLATE_QUIZ_USER_SUBMITED (quiz; if "dontShowUserData=0" and "dontShowUserResult=0", else empty).
3. Multiple reference to TEMPLATE_QRESULT (empty if is poll or "dontShowCorrectAnswers=1").
4. Reference to TEMPLATE_RESULT_POINTS or TEMPLATE_RESULT_POINTS_TOTAL (if is quiz and "dontShowPoints=0", else empty)
5. Reference to TEMPLATE_NEXT (if "showAnswersSeparate=1" and is quiz, else empty)
6. Reference to TEMPLATE_POLLRESULT (if is poll and "dontShowPollResult=0", else empty)
Optional: Reference to TEMPLATE_POLLRESULT_URL. REF_POLLRESULT_URL will be empty if is quiz or showPollResultLink = 0 !!!

###REF_RES_ERRORS### ###REF_INTRODUCTION### ###REF_QRESULT### ###REF_QPOINTS### ###REF_NEXT### ###REF_POLLRESULT###

Template-Snippets

###REF_QUESTION_IMAGE_BEGIN###
###VAR_QUESTION_TITLE###
###VAR_QUESTION_NAME### ###P1######VAR_ANSWER_POINTS######P2###
###VAR_QUESTION_ANSWER###
###REF_QUESTION_IMAGE_END### ###REF_DELIMITER###
###VAR_QUESTION_IMAGE###  

You can use this marker too: ###REF_QR_ANSWER_CORR###
###VAR_QUESTION_TITLE###
###VAR_QUESTION_NAME###
###REF_QR_ANSWER_CORR_ANSW### ###REF_QR_ANSWER_CORR_NOTANSW### ###REF_QR_ANSWER_NOTCORR_NOTANSW### ###REF_QR_ANSWER_NOTCORR_ANSW### ###REF_QR_EXPLANATION### ###REF_QR_POINTS### ###REF_DELIMITER###
###VAR_QUESTION_ANSWER### ###P1######VAR_ANSWER_POINTS######P2###
###VAR_QUESTION_ANSWER### ###P1###+###VAR_ANSWER_POINTS######P2###
###VAR_QUESTION_ANSWER### ###P1######NO_POINTS######P2###
###VAR_QUESTION_ANSWER### ###P1###-###VAR_ANSWER_POINTS######P2###
###VAR_QUESTION_ANSWER### ###P1######NO_POINTS######P2###
###RES_QUESTION_POINTS###: ###VAR_QUESTION_POINTS### / ###VAR_MAX_QUESTION_POINTS###
###EXPLANATION###: ###VAR_EXPLANATION###

###RESULT_POINTS###: ###VAR_RESULT_POINTS### / ###VAR_MAX_POINTS###


###RESULT_POINTS###: ###VAR_RESULT_POINTS### / ###VAR_MAX_POINTS### (###TOTAL_POINTS###: ###VAR_TOTAL_POINTS### / ###VAR_TMAX_POINTS###)




###NO_SUBMIT###

###DOUBLE_ENTRY###

###NOT_LOGGEDIN###

###CHEATING###

No more questions. You can use here these Markers too: ###RESTART_QUIZ###, ###RESULT_POINTS###: ###VAR_RESULT_POINTS### / ###VAR_MAX_POINTS### (###TOTAL_POINTS###: ###VAR_TOTAL_POINTS### / ###VAR_TMAX_POINTS###)

###NO_MORE###

###VAR_QUESTION_TITLE###
###VAR_QUESTION_NAME###
###REF_QR_ANSWER_CORR### ###REF_QR_EXPLANATION### ###REF_DELIMITER###

###POLLRESULT_URL###

###THANK_YOU### ###QUESTION_NAME### ###VAR_QUESTION_NAME###
###USER_ANSWER### ###VAR_USER_ANSWER###

Bitte warten oder JavaScript einschalten...
Insgesamt haben bisher ###VAR_VOTES### Leute ihre Stimme abgegeben.

You can use ###VAR_LINKTAG### too.

###VAR_TITLE###