Skip to content
Snippets Groups Projects

Flashcards revisited

Merged Andreas Gärtner requested to merge flashcards-revisited into master
Viewing commit 8e09fd46
Show latest version
3 files
+ 69
7
Compare changes
  • Side-by-side
  • Inline
Files
3
  • 8e09fd46
    Added export button for answers · 8e09fd46
    Robin Drangmeister authored
    Added a button for speakers to download the answers as a csv file. The
    button is located in the panels where the answers can be looked at.
    Excluded Hotspot-Questions.
@@ -154,9 +154,8 @@ Ext.define('ARSnova.view.speaker.QuestionStatisticChart', {
docked: 'top',
ui: 'light',
title: Ext.util.Format.htmlEncode(this.questionObj.subject),
items: [
this.backButton,
this.answerCounter, {
items: [this.backButton,
this.answerCounter, {
xtype: 'button',
align: 'right',
iconCls: 'icon-check',
@@ -165,7 +164,36 @@ Ext.define('ARSnova.view.speaker.QuestionStatisticChart', {
handler: this.toggleCorrectHandler,
hidden: !hasCorrectAnswers() || this.questionObj.questionType === 'grid' ||
(ARSnova.app.userRole === ARSnova.app.USER_ROLE_STUDENT && !this.questionObj.showAnswer)
}]
},{
xtype: 'button',
text: Messages.QUESTIONS_CSV_EXPORT_ANSWERS_BUTTON,
align: 'right',
handler: function(){
//Format
var exp="data:text/csv;charset=utf-8,";
//Subeject and Question
exp+=Messages.QUESTION_SUBJECT+": "+me.questionObj.subject+";"+Messages.QUESTION+": "+me.questionObj.text;
//Table header
exp+="\n"+Messages.ANSWERS+";"
+Messages.FIRST_ROUND+" "+Messages.GRID_LABEL_RELATIVE+";"+Messages.FIRST_ROUND+" "+Messages.GRID_LABEL_ABSOLUTE+";"
+Messages.SECOND_ROUND+" "+Messages.GRID_LABEL_RELATIVE+";"+Messages.SECOND_ROUND+" "+Messages.GRID_LABEL_ABSOLUTE;
//Table contents (answers)
me.questionStore.each(function (record) {
exp+="\n"+record.get('text')+";"+record.get('percent-round1')+";"+record.get('value-round1')+";"+record.get('percent-round2')+";"+record.get('value-round2');
});
//Download file
//stackoverflow.com/questions/14964035/
var encodedUri = encodeURI(exp);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", me.questionObj.subject+"_"+me.questionObj.text+"-Answers.csv");
document.body.appendChild(link); // Required for FF
link.click();
},
hidden: (ARSnova.app.userRole === ARSnova.app.USER_ROLE_STUDENT||me.questionObj.questionType==='grid')
}
]
});
this.piToolbar = Ext.create('Ext.Toolbar', {
@@ -981,4 +1009,4 @@ Ext.define('ARSnova.view.speaker.QuestionStatisticChart', {
return lighterColors;
}
});
});
\ No newline at end of file