Myquizpoll is a nice plugin that does exactly what the name suggests, it’s a plugin that allows you to create various quizes, tests etc.
Here is a simple TypoScript code that will display table with quiz results (from myquizpoll plugin) for currently logged in user.
plugin.myquizpoll_results >
plugin.myquizpoll_results = COA_INT
plugin.myquizpoll_results {
# get current user
15 >
15 = LOAD_REGISTER
15 {
current_uidvaluex >
current_uidvaluex.cObject = CONTENT
current_uidvaluex.cObject {
table = fe_users
select {
pidInList = 5 # page ID of storage folder
recursive = 1 # search in sub folders
where.wrap = username = '|'
where.data = TSFE:fe_user|user|username
orderBy = name ASC
}
renderObj = TEXT
renderObj.field = uid
}
tablebody >
tablebody.cObject = CONTENT
tablebody.cObject {
wrap = <table style="width: 100%;"><tr><td><h2>Test name</h2></td><td><h2>Number of questions</h2></td><td><h2>Correct</h2></td><td><h2>% correct</h2></td></tr>|</table>
table = tx_myquizpoll_result
select {
selectFields = tx_myquizpoll_result.fe_uid, tx_myquizpoll_result.o_percent, tx_myquizpoll_category.name, tx_myquizpoll_result.p_or_a, tx_myquizpoll_result.o_max
leftjoin = tx_myquizpoll_category ON(tx_myquizpoll_category.uid=tx_myquizpoll_result.lastcat)
where = tx_myquizpoll_result.fe_uid = ###current_uidvaluex###
pidInList = 16 # page ID with myquizpoll records
recursive = 1 # search in sub folders
markers { # replace markers with current user ID
current_uidvaluex = TEXT
current_uidvaluex.data = register:current_uidvaluex
}
}
renderObj.wrap = <tr>|</tr>
renderObj = COA
renderObj {
## The header
10 = HTML
10 {
value.field = name
value.wrap = <td>|</td>
}
20 = HTML
20 {
value.field = o_max
value.wrap = <td>|</td>
}
30 = HTML
30 {
value.field = p_or_a
value.wrap = <td>|</td>
}
40 = HTML
40 {
value.field = o_percent
value.wrap = <td>|</td>
}
}
}
}
20 = TEXT
20.data = register:tablebody
20.wrap = <div class="results" title="Results">|</div>
}
One thing that should be modified is pidInList that should point to your pages with data. If you keep getting old or weird results try to disable cache on that page…