Wp-Pro-Quiz - Version 0.5

Version Description

  • New choice: "Matrix Sorting" choice
  • Result text now can be graduated
  • CSS Bugfix
Download this release

Release Info

Developer xeno010
Plugin Icon 128x128 Wp-Pro-Quiz
Version 0.5
Comparing to
See all releases

Code changes from version 0.4 to 0.5

css/wpProQuiz_front.css CHANGED
@@ -32,11 +32,21 @@
32
  margin-bottom: 5px;
33
  }
34
 
 
 
 
 
 
35
  .wpProQuiz_questionListItem:last-child {
36
  padding: 3px;
37
  margin-bottom: 0;
38
  }
39
 
 
 
 
 
 
40
  .wpProQuiz_questionList {
41
  margin-bottom: 10px;
42
  background: #F8FAF5;
@@ -44,11 +54,6 @@
44
  padding: 5px;
45
  list-style: none;
46
  }
47
- .wpProQuiz_list, wpProQuiz_listItem {
48
- list-style: none;
49
- padding: 0;
50
- margin: 0;
51
- }
52
  .wpProQuiz_listItem {
53
  position: relative;
54
  }
@@ -88,7 +93,7 @@
88
  margin-right: 5px;
89
  display: none;
90
  }
91
- .wpProQuiz_sortable {
92
  padding: 5px;
93
  border: 1px solid lightGrey;
94
  box-shadow: 2px 2px 1px #EEE;
@@ -127,4 +132,45 @@
127
  box-shadow: 2px 2px 5px 0px #313131;
128
  z-index: 99999;
129
  display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  }
32
  margin-bottom: 5px;
33
  }
34
 
35
+ .wpProQuiz_questionListItem > table{
36
+ border-collapse: collapse;
37
+ width: 100%
38
+ }
39
+
40
  .wpProQuiz_questionListItem:last-child {
41
  padding: 3px;
42
  margin-bottom: 0;
43
  }
44
 
45
+ .wpProQuiz_list, wpProQuiz_listItem, .wpProQuiz_questionList, .wpProQuiz_sortStringList, .wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion, .wpProQuiz_resultsList {
46
+ list-style: none;
47
+ padding: 0;
48
+ margin: 0;
49
+ }
50
  .wpProQuiz_questionList {
51
  margin-bottom: 10px;
52
  background: #F8FAF5;
54
  padding: 5px;
55
  list-style: none;
56
  }
 
 
 
 
 
57
  .wpProQuiz_listItem {
58
  position: relative;
59
  }
93
  margin-right: 5px;
94
  display: none;
95
  }
96
+ .wpProQuiz_sortable, .wpProQuiz_sortStringItem {
97
  padding: 5px;
98
  border: 1px solid lightGrey;
99
  box-shadow: 2px 2px 1px #EEE;
132
  box-shadow: 2px 2px 5px 0px #313131;
133
  z-index: 99999;
134
  display: none;
135
+ }
136
+ .wpProQuiz_matrixSortString, .wpProQuiz_matrixSortString > h3{
137
+ margin-bottom: 10px;
138
+ margin-top: 0;
139
+ }
140
+ .wpProQuiz_matrixSortString {
141
+ background: #F8FAF5;
142
+ border: 1px solid #C3D1A3;
143
+ padding: 5px;
144
+ }
145
+ .wpProQuiz_sortStringList {
146
+ padding: 10px;
147
+ }
148
+ .wpProQuiz_sortStringList > li {
149
+ float: left;
150
+ margin-left: 5px;
151
+ margin-right: 5px;
152
+ margin-bottom: 5px;
153
+ }
154
+ .wpProQuiz_sortStringItem {
155
+ margin: 0;
156
+ }
157
+ .wpProQuiz_maxtrixSortCriterion {
158
+ padding: 10px;
159
+ }
160
+ .wpProQuiz_placehold {
161
+ background-color: #FFFFC2;
162
+ padding: 5px;
163
+ height: 30px;
164
+ min-width: 50px;
165
+ }
166
+ .wpProQuiz_maxtrixSortText {
167
+ padding: 5px;
168
+ }
169
+ .wpProQuiz_mextrixTr > td {
170
+ border: 1px solid #D1D1D1;
171
+ padding: 5px;
172
+ vertical-align: middle;
173
+ }
174
+ .wpProQuiz_resultsList > li {
175
+ display: none;
176
  }
css/wpProQuiz_front.min.css CHANGED
@@ -1 +1 @@
1
- .wpProQuiz_content{margin-top:10px;margin-bottom:10px;}.wpProQuiz_content h2{margin-bottom:10px;}.wpProQuiz_content input[type=button],.wpProQuiz_content input[type=button]:hover{margin:0;padding:5px 10px;background:#13455B;border-radius:11px;color:#FFF;font-weight:700;border:1px solid #13455B;box-shadow:1px 1px 1px #333;text-shadow:none;}.wpProQuiz_question_page{margin-bottom:10px;}.wpProQuiz_question_page span{font-weight:700;}.wpProQuiz_questionListItem{padding:3px;margin-bottom:5px;}.wpProQuiz_questionListItem:last-child{padding:3px;margin-bottom:0;}.wpProQuiz_questionList{margin-bottom:10px;background:#F8FAF5;border:1px solid #C3D1A3;padding:5px;list-style:none;}.wpProQuiz_list,wpProQuiz_listItem{list-style:none;padding:0;margin:0;}.wpProQuiz_listItem{position:relative;}.wpProQuiz_response{display:none;background:#F8FAF5;border:1px solid #C4C4C4;padding:5px;margin-bottom:15px;box-shadow:1px 1px 2px #AAA;}.wpProQuiz_response span{font-weight:700;}.wpProQuiz_quiz,.wpProQuiz_correct,.wpProQuiz_incorrect,.wpProQuiz_results,.wpProQuiz_time_limit,.wpProQuiz_QuestionButton{display:none;}.wpProQuiz_answerCorrect{background:#6DB46D;font-weight:700;}.wpProQuiz_answerIncorrect{background:#FF9191;font-weight:700;}.wpProQuiz_sort{width:25px;}.wpProQuiz_results h3{margin-bottom:10px;}.wpProQuiz_sort_correct_answer{font-weight:700;margin-right:5px;display:none;}.wpProQuiz_sortable{padding:5px;border:1px solid #D3D3D3;box-shadow:2px 2px 1px #EEE;background-color:#F8FAF5;cursor:move;}.wpProQuiz_time_limit .time{font-weight:700;margin-top:5px;margin-bottom:5px;}.wpProQuiz_time_limit .progress{height:10px;width:46%;background-color:blue;margin-bottom:5px;}.wpProQuiz_time_limit_expired{display:none;font-weight:700;font-size:15px;text-align:center;}.wpProQuiz_question_text{margin-bottom:10px;}.wpProQuiz_tipp{padding:10px;background-color:#DDECFF;border:1px dotted #363636;border-radius:10px;position:absolute;bottom:35px;left:5px;right:5px;box-shadow:2px 2px 5px 0 #313131;z-index:99999;display:none;}
1
+ .wpProQuiz_content{margin-top:10px;margin-bottom:10px;}.wpProQuiz_content h2{margin-bottom:10px;}.wpProQuiz_content input[type=button],.wpProQuiz_content input[type=button]:hover{margin:0;padding:5px 10px;background:#13455B;border-radius:11px;color:#FFF;font-weight:700;border:1px solid #13455B;box-shadow:1px 1px 1px #333;text-shadow:none;}.wpProQuiz_question_page{margin-bottom:10px;}.wpProQuiz_question_page span{font-weight:700;}.wpProQuiz_questionListItem{padding:3px;margin-bottom:5px;}.wpProQuiz_questionListItem > table{border-collapse:collapse;width:100%;}.wpProQuiz_questionListItem:last-child{padding:3px;margin-bottom:0;}.wpProQuiz_list,wpProQuiz_listItem,.wpProQuiz_questionList,.wpProQuiz_sortStringList,.wpProQuiz_sortStringList,.wpProQuiz_maxtrixSortCriterion,.wpProQuiz_resultsList{list-style:none;padding:0;margin:0;}.wpProQuiz_questionList{margin-bottom:10px;background:#F8FAF5;border:1px solid #C3D1A3;padding:5px;list-style:none;}.wpProQuiz_listItem{position:relative;}.wpProQuiz_response{display:none;background:#F8FAF5;border:1px solid #C4C4C4;padding:5px;margin-bottom:15px;box-shadow:1px 1px 2px #AAA;}.wpProQuiz_response span{font-weight:700;}.wpProQuiz_quiz,.wpProQuiz_correct,.wpProQuiz_incorrect,.wpProQuiz_results,.wpProQuiz_time_limit,.wpProQuiz_QuestionButton{display:none;}.wpProQuiz_answerCorrect{background:#6DB46D;font-weight:700;}.wpProQuiz_answerIncorrect{background:#FF9191;font-weight:700;}.wpProQuiz_sort{width:25px;}.wpProQuiz_results h3{margin-bottom:10px;}.wpProQuiz_sort_correct_answer{font-weight:700;margin-right:5px;display:none;}.wpProQuiz_sortable,.wpProQuiz_sortStringItem{padding:5px;border:1px solid #D3D3D3;box-shadow:2px 2px 1px #EEE;background-color:#F8FAF5;cursor:move;}.wpProQuiz_time_limit .time{font-weight:700;margin-top:5px;margin-bottom:5px;}.wpProQuiz_time_limit .progress{height:10px;width:46%;background-color:blue;margin-bottom:5px;}.wpProQuiz_time_limit_expired{display:none;font-weight:700;font-size:15px;text-align:center;}.wpProQuiz_question_text{margin-bottom:10px;}.wpProQuiz_tipp{padding:10px;background-color:#DDECFF;border:1px dotted #363636;border-radius:10px;position:absolute;bottom:35px;left:5px;right:5px;box-shadow:2px 2px 5px 0 #313131;z-index:99999;display:none;}.wpProQuiz_matrixSortString,.wpProQuiz_matrixSortString > h3{margin-bottom:10px;margin-top:0;}.wpProQuiz_matrixSortString{background:#F8FAF5;border:1px solid #C3D1A3;padding:5px;}.wpProQuiz_sortStringList{padding:10px;}.wpProQuiz_sortStringList > li{float:left;margin-left:5px;margin-right:5px;margin-bottom:5px;}.wpProQuiz_sortStringItem{margin:0;}.wpProQuiz_maxtrixSortCriterion{padding:10px;}.wpProQuiz_placehold{background-color:#FFFFC2;padding:5px;height:30px;min-width:50px;}.wpProQuiz_maxtrixSortText{padding:5px;}.wpProQuiz_mextrixTr > td{border:1px solid #D1D1D1;padding:5px;vertical-align:middle;}.wpProQuiz_resultsList > li{display:none;}
js/wpProQuiz_admin.js CHANGED
@@ -16,6 +16,23 @@ jQuery(document).ready(function($) {
16
  init();
17
  };
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  $.fn.wpProQuiz_questionEdit = function() {
20
 
21
  var setup = function() {
@@ -46,6 +63,9 @@ jQuery(document).ready(function($) {
46
  case 'sort_answer':
47
  formListener.displaySortAnswer();
48
  break;
 
 
 
49
  }
50
  });
51
 
@@ -61,7 +81,7 @@ jQuery(document).ready(function($) {
61
  return validate();
62
  });
63
 
64
- $('.sort_answer ul, .classic_answer ul').sortable({
65
  handle: '.wpProQuiz_move',
66
  update: function(event, ui) {
67
  formListener.setValueClassicAnswer();
@@ -99,6 +119,10 @@ jQuery(document).ready(function($) {
99
  displaySortAnswer: function() {
100
  $('.sort_answer').css('display', 'block');
101
  },
 
 
 
 
102
 
103
  addAnswer: function(obj) {
104
  $(obj).siblings('ul').children().first()
@@ -119,10 +143,20 @@ jQuery(document).ready(function($) {
119
  },
120
 
121
  setValueClassicAnswer: function() {
122
- i = 0;
123
  $('input[name="answerJson[classic_answer][correct][]"]').each(function() {
124
  this.value = i++;
125
  });
 
 
 
 
 
 
 
 
 
 
126
  }
127
  };
128
 
@@ -162,6 +196,27 @@ jQuery(document).ready(function($) {
162
  }
163
  });
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  if(!findChecked) {
166
  alert(wpProQuizLocalize.no_answer_msg);
167
  return false;
@@ -173,6 +228,7 @@ jQuery(document).ready(function($) {
173
  };
174
 
175
  var isEmpty = function(str) {
 
176
  return (!str || 0 === str.length);
177
  };
178
 
@@ -242,6 +298,108 @@ jQuery(document).ready(function($) {
242
  };
243
 
244
  $.fn.wpProQuiz_quizEdit = function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  var init = function() {
246
  $('#statistics_on').change(function() {
247
  if(this.checked) {
@@ -251,15 +409,52 @@ jQuery(document).ready(function($) {
251
  }
252
  });
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  $('#statistics_on').change();
 
255
  };
256
 
257
  init();
258
  };
 
259
 
260
  if($('.wpProQuiz_quizOverall').length)
261
  $('.wpProQuiz_quizOverall').wpProQuiz_preview();
262
 
 
 
 
 
263
  if($('.wpProQuiz_quizEdit').length)
264
  $('.wpProQuiz_quizEdit').wpProQuiz_quizEdit();
265
 
16
  init();
17
  };
18
 
19
+ $.fn.wpProQuiz_quizOverall = function() {
20
+ var init = function() {
21
+ $('.wpProQuiz_delete').click(function(e) {
22
+ var b = confirm(wpProQuizLocalize.delete_msg);
23
+
24
+ if(!b) {
25
+ e.preventDefault();
26
+ return false;
27
+ }
28
+
29
+ return true;
30
+ });
31
+ };
32
+
33
+ init();
34
+ };
35
+
36
  $.fn.wpProQuiz_questionEdit = function() {
37
 
38
  var setup = function() {
63
  case 'sort_answer':
64
  formListener.displaySortAnswer();
65
  break;
66
+ case 'matrix_sort_answer':
67
+ formListener.displayMatrixSortAnswer();
68
+ break;
69
  }
70
  });
71
 
81
  return validate();
82
  });
83
 
84
+ $('.sort_answer ul, .classic_answer ul, .matrix_sort_answer ul').sortable({
85
  handle: '.wpProQuiz_move',
86
  update: function(event, ui) {
87
  formListener.setValueClassicAnswer();
119
  displaySortAnswer: function() {
120
  $('.sort_answer').css('display', 'block');
121
  },
122
+
123
+ displayMatrixSortAnswer: function() {
124
+ $('.matrix_sort_answer').show();
125
+ },
126
 
127
  addAnswer: function(obj) {
128
  $(obj).siblings('ul').children().first()
143
  },
144
 
145
  setValueClassicAnswer: function() {
146
+ var i = 0;
147
  $('input[name="answerJson[classic_answer][correct][]"]').each(function() {
148
  this.value = i++;
149
  });
150
+
151
+ i = 0;
152
+ $('input[name="answerJson[answer_matrix_sort][sort_string_html][]"]').each(function() {
153
+ this.value = i++;
154
+ });
155
+
156
+ i = 0;
157
+ $('input[name="answerJson[answer_matrix_sort][answer_html][]"]').each(function() {
158
+ this.value = i++;
159
+ });
160
  }
161
  };
162
 
196
  }
197
  });
198
 
199
+ if(!findChecked) {
200
+ alert(wpProQuizLocalize.no_answer_msg);
201
+ return false;
202
+ }
203
+ } else if(type.val() == 'matrix_sort_answer') {
204
+ var findChecked = false;
205
+ $('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function() {
206
+ if(isEmpty($(this).val())) {
207
+ findChecked |= false;
208
+ } else {
209
+
210
+ var $sortString = $(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');
211
+
212
+ if(isEmpty($sortString.val())) {
213
+ findChecked |= false;
214
+ } else {
215
+ findChecked = true;
216
+ }
217
+ }
218
+ });
219
+
220
  if(!findChecked) {
221
  alert(wpProQuizLocalize.no_answer_msg);
222
  return false;
228
  };
229
 
230
  var isEmpty = function(str) {
231
+ str = $.trim(str);
232
  return (!str || 0 === str.length);
233
  };
234
 
298
  };
299
 
300
  $.fn.wpProQuiz_quizEdit = function() {
301
+
302
+ var methode = {
303
+ addResult: function() {
304
+ $('#resultList').children().each(function() {
305
+ if($(this).css('display') == 'none') {
306
+
307
+ var $this = $(this);
308
+ var id = $this.find('textarea[name="resultTextGrade[text][]"]').attr('id');
309
+
310
+ $this.find('input[name="resultTextGrade[prozent][]"]').val('0');
311
+ $this.find('input[name="resultTextGrade[activ][]"]').val('1').keyup();
312
+
313
+ tinymce.editors[id].setContent('');
314
+
315
+ tinyMCE.execCommand('mceRemoveControl', false, id);
316
+
317
+ $this.parent().children(':visible').last().after($this);
318
+
319
+ tinyMCE.execCommand('mceAddControl', false, id);
320
+
321
+ $(this).show();
322
+
323
+ return false;
324
+ }
325
+ });
326
+ },
327
+
328
+ deleteResult: function(e) {
329
+ $(e).parent().parent().hide();
330
+ $(e).siblings('input[name="resultTextGrade[activ][]"]').val('0');
331
+ },
332
+
333
+ changeResult: function(e) {
334
+ var $this = $(e);
335
+
336
+ if(methode.validResultInput($this.val())) {
337
+ $this.siblings('.resultProzent').text($this.val());
338
+ $this.removeAttr('style');
339
+ return true;
340
+ }
341
+
342
+ $this.css('background-color', '#FF9696');
343
+
344
+ return false;
345
+ },
346
+
347
+ validResultInput: function(input) {
348
+
349
+ if(isEmpty(input))
350
+ return false;
351
+
352
+ input = input.replace(/\,/, '.');
353
+
354
+ if(!isNaN(input) && Number(input) <= 100 && Number(input) >= 0) {
355
+ if(input.match(/\./) != null)
356
+ return input.split('.')[1].length < 3;
357
+
358
+ return true;
359
+ }
360
+
361
+ return false;
362
+ },
363
+
364
+ validInput: function() {
365
+ if(isEmpty($('#wpProQuiz_title').val())) {
366
+ alert(wpProQuizLocalize.no_title_msg);
367
+ return false;
368
+ }
369
+
370
+ if(isEmpty(tinymce.editors.text.getContent())) {
371
+ alert(wpProQuizLocalize.no_quiz_start_msg);
372
+ return false;
373
+ }
374
+
375
+ if($('#wpProQuiz_resultGradeEnabled:checked').length) {
376
+ var rCheck = true;
377
+ console.debug("hier");
378
+ $('#resultList').children().each(function() {
379
+ if($(this).is(':visible')) {
380
+ if(!methode.validResultInput($(this).find('input[name="resultTextGrade[prozent][]"]').val())) {
381
+ rCheck = false;
382
+ return false;
383
+ }
384
+ }
385
+ });
386
+
387
+ if(!rCheck) {
388
+ alert(wpProQuizLocalize.fail_grade_result);
389
+ return false;
390
+ }
391
+ }
392
+
393
+ return true;
394
+ }
395
+
396
+ };
397
+
398
+ var isEmpty = function(str) {
399
+ str = $.trim(str);
400
+ return (!str || 0 === str.length);
401
+ };
402
+
403
  var init = function() {
404
  $('#statistics_on').change(function() {
405
  if(this.checked) {
409
  }
410
  });
411
 
412
+ $('.addResult').click(function() {
413
+ methode.addResult();
414
+ });
415
+
416
+ $('.deleteResult').click(function (e) {
417
+ methode.deleteResult(this);
418
+ });
419
+
420
+ $('input[name="resultTextGrade[prozent][]"]').keyup(function(event) {
421
+ methode.changeResult(this);
422
+ }).keydown(function(event) {
423
+ if(event.which == 13) {
424
+ event.preventDefault();
425
+ }
426
+ });
427
+
428
+ $('#wpProQuiz_resultGradeEnabled').change(function() {
429
+ if(this.checked) {
430
+ $('#resultGrade').show();
431
+ $('#resultNormal').hide();
432
+ } else {
433
+ $('#resultGrade').hide();
434
+ $('#resultNormal').show();
435
+ }
436
+ });
437
+
438
+ $('#wpProQuiz_save').click(function(e) {
439
+ if(!methode.validInput())
440
+ e.preventDefault();
441
+ });
442
+
443
  $('#statistics_on').change();
444
+ $('#wpProQuiz_resultGradeEnabled').change();
445
  };
446
 
447
  init();
448
  };
449
+
450
 
451
  if($('.wpProQuiz_quizOverall').length)
452
  $('.wpProQuiz_quizOverall').wpProQuiz_preview();
453
 
454
+ if($('.wpProQuiz_quizOverall').length) {
455
+ $('.wpProQuiz_quizOverall').wpProQuiz_quizOverall();
456
+ }
457
+
458
  if($('.wpProQuiz_quizEdit').length)
459
  $('.wpProQuiz_quizEdit').wpProQuiz_quizEdit();
460
 
js/wpProQuiz_admin.min.js CHANGED
@@ -1,9 +1,14 @@
1
- jQuery(document).ready(function(a){a.fn.wpProQuiz_preview=function(){var b={openPreview:function(b){window.open(a(b).attr("href"),"wpProQuizPreview","width=900,height=900")}};a(".wpProQuiz_prview").click(function(a){b.openPreview(this);a.preventDefault()})};a.fn.wpProQuiz_questionEdit=function(){var b={setup:function(){a('input[name="answerType"]').click(function(){a(".answer_felder").children().css("display","none");switch(this.value){case "single":b.displaySingle("radio");break;case "multiple":b.displaySingle("checkbox");
2
- break;case "free_answer":b.displayFreeAnswer();break;case "sort_answer":b.displaySortAnswer()}});a(".addAnswer").click(function(){b.addAnswer(this)});a(".deleteAnswer").click(function(){b.deleteAnswer(this)});a("#saveQuestion").click(function(){return c()});a(".sort_answer ul, .classic_answer ul").sortable({handle:".wpProQuiz_move",update:function(){b.setValueClassicAnswer()}});a("#wpProQuiz_correctSameText").change(function(){this.checked?a("#wpProQuiz_incorrectMassageBox").hide():a("#wpProQuiz_incorrectMassageBox").show()});
3
- a("#wpProQuiz_tip").change(function(){this.checked?a("#wpProQuiz_tipBox").show():a("#wpProQuiz_tipBox").hide()})},displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display","block")},displaySortAnswer:function(){a(".sort_answer").css("display",
4
- "block")},addAnswer:function(c){a(c).siblings("ul").children().first().clone().css("display","block").appendTo(a(c).siblings("ul"));b.setValueClassicAnswer();a(".deleteAnswer").click(function(){b.deleteAnswer(this)})},deleteAnswer:function(c){a(c).parent("li").remove();b.setValueClassicAnswer()},setValueClassicAnswer:function(){i=0;a('input[name="answerJson[classic_answer][correct][]"]').each(function(){this.value=i++})}},c=function(){var b=tinymce.editors.question.getContent(),c=a('input[name="answerType"]:checked');
5
- if(!b||0===b.length)return alert(wpProQuizLocalize.no_question_msg),!1;if("single"==c.val()||"multiple"==c.val()){var d=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){d=""!=a.trim(a(this).parent().siblings("textarea").val())?d&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!d)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("sort_answer"==c.val()&&(d=!1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){var b=
6
- a(this).val();d=!b||0===b.length?d|0:!0}),!d))return alert(wpProQuizLocalize.no_answer_msg),!1;return!0};b.setup();1>a('input[name="answerType"][checked="checked"]').size()&&a('input[name="answerType"][value="single"]').attr({checked:"checked"});a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change();a("#wpProQuiz_tip").change()};a.fn.wpProQuiz_questionOverall=function(){var b={saveSort:function(){var c={action:"wp_pro_quiz_update_sort",sort:b.parseSortArray()},e=(window.location.pathname+
7
- window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(e,c,function(b){console.debug(b);a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var b=[];a("tbody tr").each(function(){b.push(this.id.replace("wpProQuiz_questionId_",""))});return b},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",
8
- update:b.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();b.saveSort()});console.debug(a)};a.fn.wpProQuiz_quizEdit=function(){a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a("#statistics_on").change()};a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();
9
- a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall()});
 
 
 
 
 
1
+ jQuery(document).ready(function(a){a.fn.wpProQuiz_preview=function(){var c={openPreview:function(c){window.open(a(c).attr("href"),"wpProQuizPreview","width=900,height=900")}};a(".wpProQuiz_prview").click(function(a){c.openPreview(this);a.preventDefault()})};a.fn.wpProQuiz_quizOverall=function(){a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0})};a.fn.wpProQuiz_questionEdit=function(){var c={setup:function(){a('input[name="answerType"]').click(function(){a(".answer_felder").children().css("display",
2
+ "none");switch(this.value){case "single":c.displaySingle("radio");break;case "multiple":c.displaySingle("checkbox");break;case "free_answer":c.displayFreeAnswer();break;case "sort_answer":c.displaySortAnswer();break;case "matrix_sort_answer":c.displayMatrixSortAnswer()}});a(".addAnswer").click(function(){c.addAnswer(this)});a(".deleteAnswer").click(function(){c.deleteAnswer(this)});a("#saveQuestion").click(function(){return e()});a(".sort_answer ul, .classic_answer ul, .matrix_sort_answer ul").sortable({handle:".wpProQuiz_move",
3
+ update:function(){c.setValueClassicAnswer()}});a("#wpProQuiz_correctSameText").change(function(){this.checked?a("#wpProQuiz_incorrectMassageBox").hide():a("#wpProQuiz_incorrectMassageBox").show()});a("#wpProQuiz_tip").change(function(){this.checked?a("#wpProQuiz_tipBox").show():a("#wpProQuiz_tipBox").hide()})},displaySingle:function(b){a(".classic_answer").find('input[name="answerJson[classic_answer][correct][]"]').each(function(){a("<input type="+b+" />").attr({name:this.name,value:this.value,checked:this.checked}).insertBefore(this)}).remove();
4
+ a(".classic_answer").css("display","block")},displayFreeAnswer:function(){a(".free_answer").css("display","block")},displaySortAnswer:function(){a(".sort_answer").css("display","block")},displayMatrixSortAnswer:function(){a(".matrix_sort_answer").show()},addAnswer:function(b){a(b).siblings("ul").children().first().clone().css("display","block").appendTo(a(b).siblings("ul"));c.setValueClassicAnswer();a(".deleteAnswer").click(function(){c.deleteAnswer(this)})},deleteAnswer:function(b){a(b).parent("li").remove();
5
+ c.setValueClassicAnswer()},setValueClassicAnswer:function(){var b=0;a('input[name="answerJson[classic_answer][correct][]"]').each(function(){this.value=b++});b=0;a('input[name="answerJson[answer_matrix_sort][sort_string_html][]"]').each(function(){this.value=b++});b=0;a('input[name="answerJson[answer_matrix_sort][answer_html][]"]').each(function(){this.value=b++})}},e=function(){var c=tinymce.editors.question.getContent(),e=a('input[name="answerType"]:checked');if(b(c))return alert(wpProQuizLocalize.no_question_msg),
6
+ !1;if("single"==e.val()||"multiple"==e.val()){var d=!0;if(1>a('input[name="answerJson[classic_answer][correct][]"]:checked').each(function(){d=""!=a.trim(a(this).parent().siblings("textarea").val())?d&1:!1}).size())return alert(wpProQuizLocalize.no_correct_msg),!1;if(!d)return alert(wpProQuizLocalize.no_answer_msg),!1}else if("sort_answer"==e.val()){if(d=!1,a('textarea[name="answerJson[answer_sort][answer][]"]').each(function(){d=b(a(this).val())?d|0:!0}),!d)return alert(wpProQuizLocalize.no_answer_msg),
7
+ !1}else if("matrix_sort_answer"==e.val()&&(d=!1,a('textarea[name="answerJson[answer_matrix_sort][answer][]"]').each(function(){if(b(a(this).val()))d|=0;else{var c=a(this).parent().parent().find('textarea[name="answerJson[answer_matrix_sort][sort_string][]"]');d=b(c.val())?d|0:!0}}),!d))return alert(wpProQuizLocalize.no_answer_msg),!1;return!0},b=function(b){b=a.trim(b);return!b||0===b.length};c.setup();1>a('input[name="answerType"][checked="checked"]').size()&&a('input[name="answerType"][value="single"]').attr({checked:"checked"});
8
+ a('input[name="answerType"]:checked').click();a("#wpProQuiz_correctSameText").change();a("#wpProQuiz_tip").change()};a.fn.wpProQuiz_questionOverall=function(){var c={saveSort:function(){var e={action:"wp_pro_quiz_update_sort",sort:c.parseSortArray()},b=(window.location.pathname+window.location.search).replace("admin.php","admin-ajax.php")+"&action=save_sort";a.post(b,e,function(b){console.debug(b);a("#sortMsg").show(400).delay(1E3).hide(400)})},parseSortArray:function(){var c=[];a("tbody tr").each(function(){c.push(this.id.replace("wpProQuiz_questionId_",
9
+ ""))});return c},sortUpdate:function(){a(".wpProQuiz_questionOverall tbody").children().each(function(){$t=a(this).children().first().text(a(this).index()+1)})}};a(".wp-list-table tbody").sortable({handle:".wpProQuiz_move",update:c.sortUpdate});a(".wpProQuiz_delete").click(function(a){return!confirm(wpProQuizLocalize.delete_msg)?(a.preventDefault(),!1):!0});a("#wpProQuiz_saveSort").click(function(a){a.preventDefault();c.saveSort()});console.debug(a)};a.fn.wpProQuiz_quizEdit=function(){var c={addResult:function(){a("#resultList").children().each(function(){if("none"==
10
+ a(this).css("display")){var b=a(this),c=b.find('textarea[name="resultTextGrade[text][]"]').attr("id");b.find('input[name="resultTextGrade[prozent][]"]').val("0");b.find('input[name="resultTextGrade[activ][]"]').val("1").keyup();tinymce.editors[c].setContent("");tinyMCE.execCommand("mceRemoveControl",!1,c);b.parent().children(":visible").last().after(b);tinyMCE.execCommand("mceAddControl",!1,c);a(this).show();return!1}})},deleteResult:function(b){a(b).parent().parent().hide();a(b).siblings('input[name="resultTextGrade[activ][]"]').val("0")},
11
+ changeResult:function(b){b=a(b);if(c.validResultInput(b.val()))return b.siblings(".resultProzent").text(b.val()),b.removeAttr("style"),!0;b.css("background-color","#FF9696");return!1},validResultInput:function(a){if(e(a))return!1;a=a.replace(/\,/,".");return!isNaN(a)&&100>=Number(a)&&0<=Number(a)?null!=a.match(/\./)?3>a.split(".")[1].length:!0:!1},validInput:function(){if(e(a("#wpProQuiz_title").val()))return alert(wpProQuizLocalize.no_title_msg),!1;if(e(tinymce.editors.text.getContent()))return alert(wpProQuizLocalize.no_quiz_start_msg),
12
+ !1;if(a("#wpProQuiz_resultGradeEnabled:checked").length){var b=!0;console.debug("hier");a("#resultList").children().each(function(){if(a(this).is(":visible")&&!c.validResultInput(a(this).find('input[name="resultTextGrade[prozent][]"]').val()))return b=!1});if(!b)return alert(wpProQuizLocalize.fail_grade_result),!1}return!0}},e=function(b){b=a.trim(b);return!b||0===b.length};a("#statistics_on").change(function(){this.checked?a("#statistics_ip_lock_tr").show():a("#statistics_ip_lock_tr").hide()});a(".addResult").click(function(){c.addResult()});
13
+ a(".deleteResult").click(function(){c.deleteResult(this)});a('input[name="resultTextGrade[prozent][]"]').keyup(function(){c.changeResult(this)}).keydown(function(a){13==a.which&&a.preventDefault()});a("#wpProQuiz_resultGradeEnabled").change(function(){this.checked?(a("#resultGrade").show(),a("#resultNormal").hide()):(a("#resultGrade").hide(),a("#resultNormal").show())});a("#wpProQuiz_save").click(function(a){c.validInput()||a.preventDefault()});a("#statistics_on").change();a("#wpProQuiz_resultGradeEnabled").change()};
14
+ a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_preview();a(".wpProQuiz_quizOverall").length&&a(".wpProQuiz_quizOverall").wpProQuiz_quizOverall();a(".wpProQuiz_quizEdit").length&&a(".wpProQuiz_quizEdit").wpProQuiz_quizEdit();a(".wpProQuiz_questionEdit").length&&a(".wpProQuiz_questionEdit").wpProQuiz_questionEdit();a(".wpProQuiz_questionOverall").length&&a(".wpProQuiz_questionOverall").wpProQuiz_questionOverall()});
js/wpProQuiz_front.js CHANGED
@@ -43,6 +43,11 @@
43
  $element.find('.wpProQuiz_listItem').first().fadeIn(200);
44
 
45
  $element.find('.wpProQuiz_sortable').parent().parent().sortable().disableSelection();
 
 
 
 
 
46
  },
47
 
48
  reStartQuiz: function() {
@@ -55,11 +60,25 @@
55
  $element.find('.wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer')
56
  .hide();
57
  $element.find('.wpProQuiz_quiz').children().first().children().hide();
58
- $element.find('.wpProQuiz_sortable').removeAttr('style');
59
  $element.find('input[name="check"]').hide();
60
  $element.find('input[name="next"]').hide();
61
  $element.find('input[name="question"]').removeAttr('disabled').removeAttr('checked');
62
  $element.find('input[name="question"][type="text"]').removeAttr('value');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  },
64
 
65
  setTimeLimit: function() {
@@ -124,10 +143,17 @@
124
  }
125
  });
126
 
 
127
  $(this).find('.wpProQuiz_sortable').each(function() {
128
  $(this).data('correct', j.correct[ii++]);
129
  });
130
 
 
 
 
 
 
 
131
  i++;
132
  });
133
  },
@@ -202,8 +228,33 @@
202
  } else {
203
  checked.parent().parent().addClass('wpProQuiz_answerIncorrect');
204
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  }
206
-
207
  $(btn).hide();
208
  checked.attr('disabled', 'disabled');
209
 
@@ -260,9 +311,33 @@
260
  $element.find('.wpProQuiz_results').show();
261
  $element.find('.wpProQuiz_time_limit').hide();
262
  plugin.methode.setQuizTime();
 
 
 
 
 
 
 
263
  plugin.methode.sendStatistics();
264
  },
265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  sendStatistics: function() {
267
  if(!config.statisticsOn)
268
  return;
@@ -325,6 +400,9 @@
325
  plugin.init = function() {
326
  points = 0;
327
 
 
 
 
328
  $element.find('.wpProQuiz_quiz, .wpProQuiz_results').hide();
329
 
330
  var li = $element.find('.wpProQuiz_quiz').children().first().children();
43
  $element.find('.wpProQuiz_listItem').first().fadeIn(200);
44
 
45
  $element.find('.wpProQuiz_sortable').parent().parent().sortable().disableSelection();
46
+
47
+ $element.find('.wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion').sortable({
48
+ connectWith: '.wpProQuiz_maxtrixSortCriterion:not(:has(li)), .wpProQuiz_sortStringList',
49
+ placeholder: 'wpProQuiz_placehold'
50
+ }).disableSelection();
51
  },
52
 
53
  reStartQuiz: function() {
60
  $element.find('.wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer')
61
  .hide();
62
  $element.find('.wpProQuiz_quiz').children().first().children().hide();
63
+ $element.find('.wpProQuiz_sortable, .wpProQuiz_sortStringItem').removeAttr('style');
64
  $element.find('input[name="check"]').hide();
65
  $element.find('input[name="next"]').hide();
66
  $element.find('input[name="question"]').removeAttr('disabled').removeAttr('checked');
67
  $element.find('input[name="question"][type="text"]').removeAttr('value');
68
+ $element.find('.wpProQuiz_resultsList').children().hide();
69
+
70
+ plugin.methode.resetMatrix();
71
+ },
72
+
73
+ resetMatrix: function() {
74
+ $element.find('.wpProQuiz_question').each(function() {
75
+ var $tq = $(this);
76
+ var $list = $tq.find('.wpProQuiz_sortStringList');
77
+
78
+ $tq.find('.wpProQuiz_sortStringItem').each(function() {
79
+ $list.append($(this));
80
+ });
81
+ });
82
  },
83
 
84
  setTimeLimit: function() {
143
  }
144
  });
145
 
146
+ ii = 0;
147
  $(this).find('.wpProQuiz_sortable').each(function() {
148
  $(this).data('correct', j.correct[ii++]);
149
  });
150
 
151
+ ii = 0;
152
+ $(this).parent().find('.wpProQuiz_sortStringList').children().each(function() {
153
+ $(this).data('correct', j.correct[ii++]);
154
+ console.debug($(this));
155
+ });
156
+
157
  i++;
158
  });
159
  },
228
  } else {
229
  checked.parent().parent().addClass('wpProQuiz_answerIncorrect');
230
  }
231
+ } else if(type == 'matrix_sort_answer') {
232
+ var check = true;
233
+ var $qList = $question.find('.wpProQuiz_questionList').children();
234
+
235
+ $qList.each(function() {
236
+ var index = $(this).index();
237
+ var $par = $(this).find('.wpProQuiz_maxtrixSortCriterion');
238
+ var item = $par.children().first();
239
+
240
+ if(item.data('correct') == index) {
241
+ check &= true;
242
+ $par.addClass('wpProQuiz_answerCorrect');
243
+ } else {
244
+ check = false;
245
+ $par.addClass('wpProQuiz_answerIncorrect');
246
+ }
247
+ });
248
+
249
+ $question.find('.wpProQuiz_sortStringItem').each(function() {
250
+ $qList.eq($(this).data('correct')).find('.wpProQuiz_maxtrixSortCriterion').append(this);
251
+ }).css({'box-shadow': '0 0', 'cursor': 'auto'});
252
+
253
+ $question.find('.wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion').sortable("destroy");
254
+
255
+ correct = check;
256
  }
257
+
258
  $(btn).hide();
259
  checked.attr('disabled', 'disabled');
260
 
311
  $element.find('.wpProQuiz_results').show();
312
  $element.find('.wpProQuiz_time_limit').hide();
313
  plugin.methode.setQuizTime();
314
+
315
+ var index = plugin.methode.findResultIndex(Math.round(points / count * 100 * 100) / 100);
316
+
317
+ if(index > -1) {
318
+ $element.find('.wpProQuiz_resultsList').children().eq(index).show();
319
+ }
320
+
321
  plugin.methode.sendStatistics();
322
  },
323
 
324
+ findResultIndex: function(p) {
325
+ var r = config.resultsGrade;
326
+ var index = -1;
327
+ var diff = 999999;
328
+
329
+ for(var i = 0; i < r.length; i++){
330
+ var v = r[i];
331
+
332
+ if((p >= v) && ((p-v) < diff)) {
333
+ diff = p-v;
334
+ index = i;
335
+ }
336
+ }
337
+
338
+ return index;
339
+ },
340
+
341
  sendStatistics: function() {
342
  if(!config.statisticsOn)
343
  return;
400
  plugin.init = function() {
401
  points = 0;
402
 
403
+ if(config.resultsGrade == undefined)
404
+ config.resultsGrade = [0];
405
+
406
  $element.find('.wpProQuiz_quiz, .wpProQuiz_results').hide();
407
 
408
  var li = $element.find('.wpProQuiz_quiz').children().first().children();
js/wpProQuiz_front.min.js CHANGED
@@ -1,14 +1,17 @@
1
- (function(b){b.wpProQuizFront=function(l,e){var a=b(l),c=this,k=0,m=0,h=0,n=0,i={};c.methode={startQuiz:function(){i={};e.questionRandom&&c.methode.questionRandom();e.answerRandom?c.methode.answerRandom(".wpProQuiz_questionList"):c.methode.answerRandom(a.find(".wpProQuiz_sortable").parent().parent());e.timeLimit&&c.methode.setTimeLimit();k=0;n=new Date;e.checkAnswer?a.find('input[name="check"]').show():a.find('input[name="next"]').show();a.find(".wpProQuiz_text").hide();a.find(".wpProQuiz_quiz").show();
2
- a.find(".wpProQuiz_listItem").first().fadeIn(200);a.find(".wpProQuiz_sortable").parent().parent().sortable().disableSelection()},reStartQuiz:function(){a.find(".wpProQuiz_answerCorrect").removeClass("wpProQuiz_answerCorrect");a.find(".wpProQuiz_answerIncorrect").removeClass("wpProQuiz_answerIncorrect");a.find('.wpProQuiz_text, input[name="tip"]').show();a.find(".wpProQuiz_quiz, .wpProQuiz_results, .wpProQuiz_response, .wpProQuiz_correct, .wpProQuiz_incorrect").hide();a.find(".wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer").hide();
3
- a.find(".wpProQuiz_quiz").children().first().children().hide();a.find(".wpProQuiz_sortable").removeAttr("style");a.find('input[name="check"]').hide();a.find('input[name="next"]').hide();a.find('input[name="question"]').removeAttr("disabled").removeAttr("checked");a.find('input[name="question"][type="text"]').removeAttr("value")},setTimeLimit:function(){var f=a.find(".wpProQuiz_time_limit"),d=f.find("span"),b=e.timeLimit;f.css({width:"100%",display:"block"});d.html(c.methode.parseTime(b));f.find(".progress").css("width",
4
- "100%").animate({width:"0%"},1E3*e.timeLimit);h=setInterval(function(){d.html(c.methode.parseTime(b--));0>b&&(clearInterval(h),h=0,f.find(".progress").clearQueue().stop(),a.find('input[name="check"]').click().parent().hide(),a.find(".wpProQuiz_time_limit_expired").show(),c.methode.showResult())},1E3)},parseTime:function(a){var d=parseInt(a%60),b=parseInt(a/60%60),a=parseInt(a/3600%24);return(9<a?"":"0")+a+":"+((9<b?"":"0")+b)+":"+((9<d?"":"0")+d)},setQuizTime:function(){var b=((new Date).getTime()-
5
- n.getTime())/1E3;a.find(".wpProQuiz_quiz_time span").first().html(c.methode.parseTime(b))},setData:function(){var f=0;a.find(".wpProQuiz_questionList").each(function(){var d=e.json[f],a=0;b(this).parent().parent().data("type",d.answer_type).data("questionId",d.id);b(this).find('input[name="question"]').each(function(){switch(d.answer_type){case "single":case "multiple":0<=b.inArray(this.value,d.correct)?b(this).data("correct","1"):b(this).data("correct","0");break;case "free_answer":b(this).data("correct",
6
- d.correct)}});b(this).find(".wpProQuiz_sortable").each(function(){b(this).data("correct",d.correct[a++])});f++})},checkAnswer:function(a){var d=b(a).parent(),c=!1,e=d.find('input[name="question"]'),j=d.data("type");d.find('input[name="tip"]').hide();if("multiple"==j||"single"==j){var g=!0;e.each(function(){"1"==b(this).data("correct")?(b(this).parent().parent().addClass("wpProQuiz_answerCorrect"),g=this.checked?g&1:g&0):this.checked&&(b(this).parent().parent().addClass("wpProQuiz_answerIncorrect"),
7
- g&=0)});c=g}else if("sort_answer"==j){g=!0;d.find(".wpProQuiz_sortable").each(function(){var a=b(this),d=a.parent().index();a.data("correct")==d?(a.parent().addClass("wpProQuiz_answerCorrect"),g&=1):(a.parent().addClass("wpProQuiz_answerIncorrect"),g=!1);a.css({"box-shadow":"0 0",cursor:"auto"})});var h=d.find(".wpProQuiz_sortable").parent().parent(),c=h.children("li");h.sortable("destroy");c.sort(function(a,d){return b(a).children("div").data("correct")>b(d).children("div").data("correct")});b.each(c,
8
- function(a,d){h.append(d)});c=g}else"free_answer"==j&&(j=b.trim(e.val()).toLowerCase(),0<=b.inArray(j,e.data("correct"))?(c=!0,e.parent().parent().addClass("wpProQuiz_answerCorrect")):e.parent().parent().addClass("wpProQuiz_answerIncorrect"));b(a).hide();e.attr("disabled","disabled");void 0==i[d.data("questionId")]&&(i[d.data("questionId")]={});i[d.data("questionId")].correct=Number(c);d.find(".wpProQuiz_response").show();c?(d.find(".wpProQuiz_correct").show(),k++):d.find(".wpProQuiz_incorrect").show();
9
- d.find('input[name="next"]').show()},nextQuestion:function(f){var f=b(f).parent(),d=f.next();f.hide();d.length?(d.show(),e.backButton&&!e.checkAnswer&&d.find('input[name="back"]').show()):(e.checkAnswer||a.find('input[name="check"]').click(),c.methode.showResult())},backQuestion:function(a){var a=b(a).parent(),d=a.prev();a.hide();d.show()},showResult:function(){clearInterval(h);a.find(".wpProQuiz_time_limit .progress").clearQueue().stop();a.find(".wpProQuiz_points").html(k);a.find(".wpProQuiz_points_prozent").html("("+
10
- Math.round(100*(k/m))+"%)");a.find(".wpProQuiz_results").show();a.find(".wpProQuiz_time_limit").hide();c.methode.setQuizTime();c.methode.sendStatistics()},sendStatistics:function(){e.statisticsOn&&b.ajax({url:e.url,type:"POST",cache:!1,data:{action:"wp_pro_quiz_statistics_save",results:i,quizId:e.quizId}})},reShowQuestion:function(){a.find('input[name="next"], input[name="check"], input[name="back"]').hide();a.find(".wpProQuiz_quiz").children().first().children().show()},answerRandom:function(c){a.find(c).each(function(){var a=
11
- b(this).children(),a=a.sort(function(){return Math.round(Math.random())-0.5}).slice(0,a.length);b(a).appendTo(a[0].parentNode).show()})},questionRandom:function(){var c=a.find(".wpProQuiz_quiz ol").children(),c=c.sort(function(){return Math.round(Math.random())-0.5}).slice(0,c.length);b(c).appendTo(c[0].parentNode);var d=1;b(c).each(function(){b(this).find(".wpProQuiz_question_page span").eq(0).html(d);b(this).find("h3 span").html(d++)})},showTip:function(a){$tip=b(a).siblings(".wpProQuiz_tipp");
12
- $par=b(a).parent();void 0==i[$par.data("questionId")]&&(i[$par.data("questionId")]={});i[$par.data("questionId")].tip=1;$tip.toggle("fast")}};c.init=function(){k=0;a.find(".wpProQuiz_quiz, .wpProQuiz_results").hide();var e=a.find(".wpProQuiz_quiz").children().first().children();e.hide();m=e.length;c.methode.setData();a.find('input[name="startQuiz"]').click(function(a){a.preventDefault();c.methode.startQuiz()});a.find('input[name="check"]').click(function(a){a.preventDefault();c.methode.checkAnswer(this)});
13
- a.find('input[name="next"]').click(function(a){a.preventDefault();c.methode.nextQuestion(this)});a.find('input[name="restartQuiz"]').click(function(a){a.preventDefault();c.methode.reStartQuiz()});a.find('input[name="reShowQuestion"]').click(function(a){a.preventDefault();c.methode.reShowQuestion(this)});a.find('input[name="back"]').click(function(){c.methode.backQuestion(this)});a.find('input[name="tip"]').click(function(){c.methode.showTip(this)});b(document).mouseup(function(b){var c=a.find(".wpProQuiz_tipp"),
14
- e=a.find('input[name="tip"]');!c.is(b.target)&&(0==c.has(b.target).length&&!e.is(b.target))&&c.hide("fast")})};c.init()};b.fn.wpProQuizFront=function(l){return this.each(function(){void 0==b(this).data("wpProQuizFront")&&b(this).data("wpProQuizFront",new b.wpProQuizFront(this,l))})}})(jQuery);
 
 
 
1
+ (function(b){b.wpProQuizFront=function(j,f){var a=b(j),e=this,k=0,l=0,h=0,m=0,i={};e.methode={startQuiz:function(){i={};f.questionRandom&&e.methode.questionRandom();f.answerRandom?e.methode.answerRandom(".wpProQuiz_questionList"):e.methode.answerRandom(a.find(".wpProQuiz_sortable").parent().parent());f.timeLimit&&e.methode.setTimeLimit();k=0;m=new Date;f.checkAnswer?a.find('input[name="check"]').show():a.find('input[name="next"]').show();a.find(".wpProQuiz_text").hide();a.find(".wpProQuiz_quiz").show();
2
+ a.find(".wpProQuiz_listItem").first().fadeIn(200);a.find(".wpProQuiz_sortable").parent().parent().sortable().disableSelection();a.find(".wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion").sortable({connectWith:".wpProQuiz_maxtrixSortCriterion:not(:has(li)), .wpProQuiz_sortStringList",placeholder:"wpProQuiz_placehold"}).disableSelection()},reStartQuiz:function(){a.find(".wpProQuiz_answerCorrect").removeClass("wpProQuiz_answerCorrect");a.find(".wpProQuiz_answerIncorrect").removeClass("wpProQuiz_answerIncorrect");
3
+ a.find('.wpProQuiz_text, input[name="tip"]').show();a.find(".wpProQuiz_quiz, .wpProQuiz_results, .wpProQuiz_response, .wpProQuiz_correct, .wpProQuiz_incorrect").hide();a.find(".wpProQuiz_time_limit, .wpProQuiz_time_limit_expired, .wpProQuiz_sort_correct_answer").hide();a.find(".wpProQuiz_quiz").children().first().children().hide();a.find(".wpProQuiz_sortable, .wpProQuiz_sortStringItem").removeAttr("style");a.find('input[name="check"]').hide();a.find('input[name="next"]').hide();a.find('input[name="question"]').removeAttr("disabled").removeAttr("checked");
4
+ a.find('input[name="question"][type="text"]').removeAttr("value");a.find(".wpProQuiz_resultsList").children().hide();e.methode.resetMatrix()},resetMatrix:function(){a.find(".wpProQuiz_question").each(function(){var d=b(this),c=d.find(".wpProQuiz_sortStringList");d.find(".wpProQuiz_sortStringItem").each(function(){c.append(b(this))})})},setTimeLimit:function(){var d=a.find(".wpProQuiz_time_limit"),c=d.find("span"),b=f.timeLimit;d.css({width:"100%",display:"block"});c.html(e.methode.parseTime(b));d.find(".progress").css("width",
5
+ "100%").animate({width:"0%"},1E3*f.timeLimit);h=setInterval(function(){c.html(e.methode.parseTime(b--));0>b&&(clearInterval(h),h=0,d.find(".progress").clearQueue().stop(),a.find('input[name="check"]').click().parent().hide(),a.find(".wpProQuiz_time_limit_expired").show(),e.methode.showResult())},1E3)},parseTime:function(d){var c=parseInt(d%60),b=parseInt(d/60%60),d=parseInt(d/3600%24);return(9<d?"":"0")+d+":"+((9<b?"":"0")+b)+":"+((9<c?"":"0")+c)},setQuizTime:function(){var d=((new Date).getTime()-
6
+ m.getTime())/1E3;a.find(".wpProQuiz_quiz_time span").first().html(e.methode.parseTime(d))},setData:function(){var d=0;a.find(".wpProQuiz_questionList").each(function(){var c=f.json[d],a=0;b(this).parent().parent().data("type",c.answer_type).data("questionId",c.id);b(this).find('input[name="question"]').each(function(){switch(c.answer_type){case "single":case "multiple":0<=b.inArray(this.value,c.correct)?b(this).data("correct","1"):b(this).data("correct","0");break;case "free_answer":b(this).data("correct",
7
+ c.correct)}});a=0;b(this).find(".wpProQuiz_sortable").each(function(){b(this).data("correct",c.correct[a++])});a=0;b(this).parent().find(".wpProQuiz_sortStringList").children().each(function(){b(this).data("correct",c.correct[a++]);console.debug(b(this))});d++})},checkAnswer:function(d){var c=b(d).parent(),a=!1,e=c.find('input[name="question"]'),f=c.data("type");c.find('input[name="tip"]').hide();if("multiple"==f||"single"==f){var g=!0;e.each(function(){"1"==b(this).data("correct")?(b(this).parent().parent().addClass("wpProQuiz_answerCorrect"),
8
+ g=this.checked?g&1:g&0):this.checked&&(b(this).parent().parent().addClass("wpProQuiz_answerIncorrect"),g&=0)});a=g}else if("sort_answer"==f){g=!0;c.find(".wpProQuiz_sortable").each(function(){var a=b(this),c=a.parent().index();a.data("correct")==c?(a.parent().addClass("wpProQuiz_answerCorrect"),g&=1):(a.parent().addClass("wpProQuiz_answerIncorrect"),g=!1);a.css({"box-shadow":"0 0",cursor:"auto"})});var h=c.find(".wpProQuiz_sortable").parent().parent(),a=h.children("li");h.sortable("destroy");a.sort(function(a,
9
+ c){return b(a).children("div").data("correct")>b(c).children("div").data("correct")});b.each(a,function(a,c){h.append(c)});a=g}else if("free_answer"==f)f=b.trim(e.val()).toLowerCase(),0<=b.inArray(f,e.data("correct"))?(a=!0,e.parent().parent().addClass("wpProQuiz_answerCorrect")):e.parent().parent().addClass("wpProQuiz_answerIncorrect");else if("matrix_sort_answer"==f){var g=!0,j=c.find(".wpProQuiz_questionList").children();j.each(function(){var a=b(this).index(),c=b(this).find(".wpProQuiz_maxtrixSortCriterion");
10
+ c.children().first().data("correct")==a?(g&=1,c.addClass("wpProQuiz_answerCorrect")):(g=!1,c.addClass("wpProQuiz_answerIncorrect"))});c.find(".wpProQuiz_sortStringItem").each(function(){j.eq(b(this).data("correct")).find(".wpProQuiz_maxtrixSortCriterion").append(this)}).css({"box-shadow":"0 0",cursor:"auto"});c.find(".wpProQuiz_sortStringList, .wpProQuiz_maxtrixSortCriterion").sortable("destroy");a=g}b(d).hide();e.attr("disabled","disabled");void 0==i[c.data("questionId")]&&(i[c.data("questionId")]=
11
+ {});i[c.data("questionId")].correct=Number(a);c.find(".wpProQuiz_response").show();a?(c.find(".wpProQuiz_correct").show(),k++):c.find(".wpProQuiz_incorrect").show();c.find('input[name="next"]').show()},nextQuestion:function(d){var d=b(d).parent(),c=d.next();d.hide();c.length?(c.show(),f.backButton&&!f.checkAnswer&&c.find('input[name="back"]').show()):(f.checkAnswer||a.find('input[name="check"]').click(),e.methode.showResult())},backQuestion:function(a){var a=b(a).parent(),c=a.prev();a.hide();c.show()},
12
+ showResult:function(){clearInterval(h);a.find(".wpProQuiz_time_limit .progress").clearQueue().stop();a.find(".wpProQuiz_points").html(k);a.find(".wpProQuiz_points_prozent").html("("+Math.round(100*(k/l))+"%)");a.find(".wpProQuiz_results").show();a.find(".wpProQuiz_time_limit").hide();e.methode.setQuizTime();var b=e.methode.findResultIndex(Math.round(1E4*(k/l))/100);-1<b&&a.find(".wpProQuiz_resultsList").children().eq(b).show();e.methode.sendStatistics()},findResultIndex:function(a){for(var c=f.resultsGrade,
13
+ b=-1,e=999999,h=0;h<c.length;h++){var g=c[h];a>=g&&a-g<e&&(e=a-g,b=h)}return b},sendStatistics:function(){f.statisticsOn&&b.ajax({url:f.url,type:"POST",cache:!1,data:{action:"wp_pro_quiz_statistics_save",results:i,quizId:f.quizId}})},reShowQuestion:function(){a.find('input[name="next"], input[name="check"], input[name="back"]').hide();a.find(".wpProQuiz_quiz").children().first().children().show()},answerRandom:function(d){a.find(d).each(function(){var a=b(this).children(),a=a.sort(function(){return Math.round(Math.random())-
14
+ 0.5}).slice(0,a.length);b(a).appendTo(a[0].parentNode).show()})},questionRandom:function(){var d=a.find(".wpProQuiz_quiz ol").children(),d=d.sort(function(){return Math.round(Math.random())-0.5}).slice(0,d.length);b(d).appendTo(d[0].parentNode);var c=1;b(d).each(function(){b(this).find(".wpProQuiz_question_page span").eq(0).html(c);b(this).find("h3 span").html(c++)})},showTip:function(a){$tip=b(a).siblings(".wpProQuiz_tipp");$par=b(a).parent();void 0==i[$par.data("questionId")]&&(i[$par.data("questionId")]=
15
+ {});i[$par.data("questionId")].tip=1;$tip.toggle("fast")}};e.init=function(){k=0;void 0==f.resultsGrade&&(f.resultsGrade=[0]);a.find(".wpProQuiz_quiz, .wpProQuiz_results").hide();var d=a.find(".wpProQuiz_quiz").children().first().children();d.hide();l=d.length;e.methode.setData();a.find('input[name="startQuiz"]').click(function(a){a.preventDefault();e.methode.startQuiz()});a.find('input[name="check"]').click(function(a){a.preventDefault();e.methode.checkAnswer(this)});a.find('input[name="next"]').click(function(a){a.preventDefault();
16
+ e.methode.nextQuestion(this)});a.find('input[name="restartQuiz"]').click(function(a){a.preventDefault();e.methode.reStartQuiz()});a.find('input[name="reShowQuestion"]').click(function(a){a.preventDefault();e.methode.reShowQuestion(this)});a.find('input[name="back"]').click(function(){e.methode.backQuestion(this)});a.find('input[name="tip"]').click(function(){e.methode.showTip(this)});b(document).mouseup(function(b){var d=a.find(".wpProQuiz_tipp"),e=a.find('input[name="tip"]');!d.is(b.target)&&(0==
17
+ d.has(b.target).length&&!e.is(b.target))&&d.hide("fast")})};e.init()};b.fn.wpProQuizFront=function(j){return this.each(function(){void 0==b(this).data("wpProQuizFront")&&b(this).data("wpProQuizFront",new b.wpProQuizFront(this,j))})}})(jQuery);
languages/wp-pro-quiz-de_DE.mo CHANGED
Binary file
languages/wp-pro-quiz-de_DE.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wp-Pro-Quiz\n"
4
- "POT-Creation-Date: 2012-11-20 20:52+0100\n"
5
- "PO-Revision-Date: 2012-11-20 20:52+0100\n"
6
  "Last-Translator: Julius Fischer <julius.f@gmx.net>\n"
7
  "Language-Team: Julius Fischer\n"
8
  "Language: German\n"
@@ -34,6 +34,14 @@ msgstr "Keine korrekte Antwort markiert!"
34
  msgid "No answer deposited!"
35
  msgstr "Keine Antwort hinterlegt!"
36
 
 
 
 
 
 
 
 
 
37
  #: lib/controller/WpProQuiz_Controller_Question.php:9
38
  #: lib/controller/WpProQuiz_Controller_Question.php:19
39
  #: lib/controller/WpProQuiz_Controller_Quiz.php:42
@@ -70,95 +78,102 @@ msgstr "Frage hinzugefügt"
70
  msgid "Edit quiz"
71
  msgstr "Quiz bearbeiten"
72
 
73
- #: lib/controller/WpProQuiz_Controller_Quiz.php:51
74
  msgid "Quiz edited"
75
  msgstr "Quiz bearbeitet"
76
 
77
- #: lib/controller/WpProQuiz_Controller_Quiz.php:56
78
- #: lib/controller/WpProQuiz_Controller_Quiz.php:79
79
  msgid "Quiz title or quiz description are not filled"
80
  msgstr "Quiz Titel oder Quiz Beschreibung nicht ausgefüllt"
81
 
82
- #: lib/controller/WpProQuiz_Controller_Quiz.php:67
83
- #: lib/controller/WpProQuiz_Controller_Quiz.php:73
84
  msgid "Create quiz"
85
  msgstr "Quiz erstellen"
86
 
87
- #: lib/controller/WpProQuiz_Controller_Quiz.php:91
88
  msgid "Quiz deleted"
89
  msgstr "Quiz gelöscht"
90
 
91
- #: lib/view/WpProQuiz_View_FrontQuiz.php:52
92
  msgid "Start quiz"
93
  msgstr "Quiz starten"
94
 
95
- #: lib/view/WpProQuiz_View_FrontQuiz.php:56
96
  msgid "Results"
97
  msgstr "Ergebnis"
98
 
99
- #: lib/view/WpProQuiz_View_FrontQuiz.php:58
100
  #, php-format
101
  msgid "%s of %s questions answered correctly"
102
  msgstr "%s von %s Frage korrekt beantwortet"
103
 
104
- #: lib/view/WpProQuiz_View_FrontQuiz.php:61
105
  msgid "Time has elapsed"
106
  msgstr "Zeit ist abgelaufen"
107
 
108
- #: lib/view/WpProQuiz_View_FrontQuiz.php:64
109
  msgid "Your time: <span></span>"
110
  msgstr "Ihre Zeit: <span></span>"
111
 
112
- #: lib/view/WpProQuiz_View_FrontQuiz.php:70
113
  msgid "Restart quiz"
114
  msgstr "Quiz erneut starten"
115
 
116
- #: lib/view/WpProQuiz_View_FrontQuiz.php:71
117
  msgid "View question"
118
  msgstr "Frage ansehen"
119
 
120
- #: lib/view/WpProQuiz_View_FrontQuiz.php:75
121
  #: lib/view/WpProQuiz_View_QuizEdit.php:72
122
  #: lib/view/WpProQuiz_View_QuizEdit.php:77
123
  msgid "Time limit"
124
  msgstr "Zeitlimit"
125
 
126
- #: lib/view/WpProQuiz_View_FrontQuiz.php:87
127
  #, php-format
128
  msgid "Question %s of %s"
129
  msgstr "Frage %s von %s"
130
 
131
- #: lib/view/WpProQuiz_View_FrontQuiz.php:89
132
  #: lib/view/WpProQuiz_View_QuestionEdit.php:26
133
  #: lib/view/WpProQuiz_View_Statistics.php:19
134
  msgid "Question"
135
  msgstr "Frage"
136
 
137
- #: lib/view/WpProQuiz_View_FrontQuiz.php:133
 
 
 
 
 
 
 
138
  #: lib/view/WpProQuiz_View_Statistics.php:21
139
  msgid "Correct"
140
  msgstr "Korrekt"
141
 
142
- #: lib/view/WpProQuiz_View_FrontQuiz.php:141
143
  #: lib/view/WpProQuiz_View_Statistics.php:20
144
  msgid "Incorrect"
145
  msgstr "Inkorrekt"
146
 
147
- #: lib/view/WpProQuiz_View_FrontQuiz.php:157
148
- #: lib/view/WpProQuiz_View_FrontQuiz.php:167
149
  #: lib/view/WpProQuiz_View_QuestionEdit.php:62
150
  msgid "Hint"
151
  msgstr "Tipp"
152
 
153
- #: lib/view/WpProQuiz_View_FrontQuiz.php:164
154
  msgid "Check"
155
  msgstr "Prüfen"
156
 
157
- #: lib/view/WpProQuiz_View_FrontQuiz.php:165
158
  msgid "Back"
159
  msgstr "Zurück"
160
 
161
- #: lib/view/WpProQuiz_View_FrontQuiz.php:169
162
  msgid "Next exercise"
163
  msgstr "Nächste Frage"
164
 
@@ -190,7 +205,7 @@ msgstr ""
190
  "Titel leer gelassen, wird ein Titel generiert."
191
 
192
  #: lib/view/WpProQuiz_View_QuestionEdit.php:26
193
- #: lib/view/WpProQuiz_View_QuestionEdit.php:106
194
  #: lib/view/WpProQuiz_View_QuizEdit.php:12
195
  #: lib/view/WpProQuiz_View_QuizEdit.php:167
196
  msgid "(required)"
@@ -256,19 +271,23 @@ msgstr "\"Free\" choice"
256
  msgid "\"Sorting\" choice"
257
  msgstr "\"Sorting\" choice"
258
 
259
- #: lib/view/WpProQuiz_View_QuestionEdit.php:106
 
 
 
 
260
  msgid "Answers"
261
  msgstr "Antworten"
262
 
263
- #: lib/view/WpProQuiz_View_QuestionEdit.php:111
264
  #: lib/view/WpProQuiz_View_QuestionEdit.php:115
 
265
  msgid ""
266
  "correct answers (one per line) (answers will be converted to lower case)"
267
  msgstr ""
268
  "Korrekte Antworten (eine pro Zeile ) (Antworten werden in Kleinbuchstaben "
269
  "umgewandelt)"
270
 
271
- #: lib/view/WpProQuiz_View_QuestionEdit.php:121
272
  msgid ""
273
  "Please sort the answers in right order with the \"Move\" - Button. The "
274
  "answers will be displayed randomly."
@@ -276,47 +295,74 @@ msgstr ""
276
  "Bitte Antworten mit dem \"Verschiebe\"-Button in die richtige Reihenfolge "
277
  "bringen. Die Antworten werden später immer zufällig ausgegeben."
278
 
279
- #: lib/view/WpProQuiz_View_QuestionEdit.php:127
280
- #: lib/view/WpProQuiz_View_QuestionEdit.php:139
281
- #: lib/view/WpProQuiz_View_QuestionEdit.php:149
282
- #: lib/view/WpProQuiz_View_QuestionEdit.php:168
283
- #: lib/view/WpProQuiz_View_QuestionEdit.php:184
284
- #: lib/view/WpProQuiz_View_QuestionEdit.php:198
 
 
 
285
  msgid "Delete answer"
286
  msgstr "Antwort löschen"
287
 
288
- #: lib/view/WpProQuiz_View_QuestionEdit.php:128
289
- #: lib/view/WpProQuiz_View_QuestionEdit.php:140
290
- #: lib/view/WpProQuiz_View_QuestionEdit.php:150
291
- #: lib/view/WpProQuiz_View_QuestionEdit.php:169
292
- #: lib/view/WpProQuiz_View_QuestionEdit.php:185
293
- #: lib/view/WpProQuiz_View_QuestionEdit.php:199
 
 
 
294
  #: lib/view/WpProQuiz_View_QuestionOverall.php:29
295
  msgid "Move"
296
  msgstr "Verschieben"
297
 
298
- #: lib/view/WpProQuiz_View_QuestionEdit.php:130
299
- #: lib/view/WpProQuiz_View_QuestionEdit.php:142
300
- #: lib/view/WpProQuiz_View_QuestionEdit.php:152
301
- #: lib/view/WpProQuiz_View_QuestionEdit.php:171
302
- #: lib/view/WpProQuiz_View_QuestionEdit.php:187
303
- #: lib/view/WpProQuiz_View_QuestionEdit.php:201
 
 
 
 
 
 
304
  msgid "Allow HTML"
305
  msgstr "HTML erlauben"
306
 
307
- #: lib/view/WpProQuiz_View_QuestionEdit.php:158
308
- #: lib/view/WpProQuiz_View_QuestionEdit.php:207
 
309
  msgid "Add new answer"
310
  msgstr "Neue Antwort hinzufügen"
311
 
312
- #: lib/view/WpProQuiz_View_QuestionEdit.php:166
313
- #: lib/view/WpProQuiz_View_QuestionEdit.php:182
314
- #: lib/view/WpProQuiz_View_QuestionEdit.php:196
315
  msgid "correct?"
316
  msgstr "Korrekt?"
317
 
318
- #: lib/view/WpProQuiz_View_QuestionEdit.php:211
319
- #: lib/view/WpProQuiz_View_QuizEdit.php:188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  msgid "Save"
321
  msgstr "Speichern"
322
 
@@ -473,6 +519,59 @@ msgstr ""
473
  "Dieser Text wird beim Beenden (im Ergebnis) des Quizes angezeigt (Dieser "
474
  "Text ist optional)"
475
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476
  #: lib/view/WpProQuiz_View_QuizOverall.php:8
477
  msgid "Quiz overview"
478
  msgstr "Quiz Übersicht"
@@ -531,9 +630,6 @@ msgstr "Statistik zurücksetzen"
531
  #~ msgid "Tip"
532
  #~ msgstr "Tipp"
533
 
534
- #~ msgid "Delete question"
535
- #~ msgstr "Frage löschen"
536
-
537
  #, fuzzy
538
  #~ msgid "Statistics activate"
539
  #~ msgstr "Statistik aktivieren"
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wp-Pro-Quiz\n"
4
+ "POT-Creation-Date: 2012-11-24 11:09+0100\n"
5
+ "PO-Revision-Date: 2012-11-24 11:09+0100\n"
6
  "Last-Translator: Julius Fischer <julius.f@gmx.net>\n"
7
  "Language-Team: Julius Fischer\n"
8
  "Language: German\n"
34
  msgid "No answer deposited!"
35
  msgstr "Keine Antwort hinterlegt!"
36
 
37
+ #: lib/controller/WpProQuiz_Controller_Admin.php:40
38
+ msgid "No quiz description filled!"
39
+ msgstr "Quiz-Beschreibung nicht ausgefüllt!"
40
+
41
+ #: lib/controller/WpProQuiz_Controller_Admin.php:41
42
+ msgid "The percent values in result text are incorrect."
43
+ msgstr "Die Prozentwerte im Ergebnistext stimmen nicht."
44
+
45
  #: lib/controller/WpProQuiz_Controller_Question.php:9
46
  #: lib/controller/WpProQuiz_Controller_Question.php:19
47
  #: lib/controller/WpProQuiz_Controller_Quiz.php:42
78
  msgid "Edit quiz"
79
  msgstr "Quiz bearbeiten"
80
 
81
+ #: lib/controller/WpProQuiz_Controller_Quiz.php:57
82
  msgid "Quiz edited"
83
  msgstr "Quiz bearbeitet"
84
 
85
+ #: lib/controller/WpProQuiz_Controller_Quiz.php:66
86
+ #: lib/controller/WpProQuiz_Controller_Quiz.php:94
87
  msgid "Quiz title or quiz description are not filled"
88
  msgstr "Quiz Titel oder Quiz Beschreibung nicht ausgefüllt"
89
 
90
+ #: lib/controller/WpProQuiz_Controller_Quiz.php:77
91
+ #: lib/controller/WpProQuiz_Controller_Quiz.php:88
92
  msgid "Create quiz"
93
  msgstr "Quiz erstellen"
94
 
95
+ #: lib/controller/WpProQuiz_Controller_Quiz.php:106
96
  msgid "Quiz deleted"
97
  msgstr "Quiz gelöscht"
98
 
99
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:67
100
  msgid "Start quiz"
101
  msgstr "Quiz starten"
102
 
103
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:71
104
  msgid "Results"
105
  msgstr "Ergebnis"
106
 
107
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:73
108
  #, php-format
109
  msgid "%s of %s questions answered correctly"
110
  msgstr "%s von %s Frage korrekt beantwortet"
111
 
112
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:76
113
  msgid "Time has elapsed"
114
  msgstr "Zeit ist abgelaufen"
115
 
116
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:79
117
  msgid "Your time: <span></span>"
118
  msgstr "Ihre Zeit: <span></span>"
119
 
120
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:93
121
  msgid "Restart quiz"
122
  msgstr "Quiz erneut starten"
123
 
124
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:94
125
  msgid "View question"
126
  msgstr "Frage ansehen"
127
 
128
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:98
129
  #: lib/view/WpProQuiz_View_QuizEdit.php:72
130
  #: lib/view/WpProQuiz_View_QuizEdit.php:77
131
  msgid "Time limit"
132
  msgstr "Zeitlimit"
133
 
134
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:111
135
  #, php-format
136
  msgid "Question %s of %s"
137
  msgstr "Frage %s von %s"
138
 
139
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:113
140
  #: lib/view/WpProQuiz_View_QuestionEdit.php:26
141
  #: lib/view/WpProQuiz_View_Statistics.php:19
142
  msgid "Question"
143
  msgstr "Frage"
144
 
145
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:120
146
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:222
147
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:260
148
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:295
149
+ msgid "Sort elements"
150
+ msgstr "Sortierelemente"
151
+
152
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:186
153
  #: lib/view/WpProQuiz_View_Statistics.php:21
154
  msgid "Correct"
155
  msgstr "Korrekt"
156
 
157
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:194
158
  #: lib/view/WpProQuiz_View_Statistics.php:20
159
  msgid "Incorrect"
160
  msgstr "Inkorrekt"
161
 
162
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:210
163
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:220
164
  #: lib/view/WpProQuiz_View_QuestionEdit.php:62
165
  msgid "Hint"
166
  msgstr "Tipp"
167
 
168
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:217
169
  msgid "Check"
170
  msgstr "Prüfen"
171
 
172
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:218
173
  msgid "Back"
174
  msgstr "Zurück"
175
 
176
+ #: lib/view/WpProQuiz_View_FrontQuiz.php:222
177
  msgid "Next exercise"
178
  msgstr "Nächste Frage"
179
 
205
  "Titel leer gelassen, wird ein Titel generiert."
206
 
207
  #: lib/view/WpProQuiz_View_QuestionEdit.php:26
208
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:110
209
  #: lib/view/WpProQuiz_View_QuizEdit.php:12
210
  #: lib/view/WpProQuiz_View_QuizEdit.php:167
211
  msgid "(required)"
271
  msgid "\"Sorting\" choice"
272
  msgstr "\"Sorting\" choice"
273
 
274
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:105
275
+ msgid "\"Matrix Sorting\" choice"
276
+ msgstr "\"Matrix Sorting\" choice"
277
+
278
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:110
279
  msgid "Answers"
280
  msgstr "Antworten"
281
 
 
282
  #: lib/view/WpProQuiz_View_QuestionEdit.php:115
283
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:119
284
  msgid ""
285
  "correct answers (one per line) (answers will be converted to lower case)"
286
  msgstr ""
287
  "Korrekte Antworten (eine pro Zeile ) (Antworten werden in Kleinbuchstaben "
288
  "umgewandelt)"
289
 
290
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:125
291
  msgid ""
292
  "Please sort the answers in right order with the \"Move\" - Button. The "
293
  "answers will be displayed randomly."
295
  "Bitte Antworten mit dem \"Verschiebe\"-Button in die richtige Reihenfolge "
296
  "bringen. Die Antworten werden später immer zufällig ausgegeben."
297
 
298
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:131
299
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:143
300
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:153
301
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:172
302
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:188
303
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:202
304
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:250
305
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:288
306
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:323
307
  msgid "Delete answer"
308
  msgstr "Antwort löschen"
309
 
310
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:132
311
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:144
312
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:154
313
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:173
314
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:189
315
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:203
316
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:249
317
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:287
318
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:322
319
  #: lib/view/WpProQuiz_View_QuestionOverall.php:29
320
  msgid "Move"
321
  msgstr "Verschieben"
322
 
323
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:134
324
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:146
325
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:156
326
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:175
327
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:191
328
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:205
329
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:236
330
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:242
331
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:274
332
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:280
333
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:309
334
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:315
335
  msgid "Allow HTML"
336
  msgstr "HTML erlauben"
337
 
338
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:162
339
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:211
340
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:327
341
  msgid "Add new answer"
342
  msgstr "Neue Antwort hinzufügen"
343
 
344
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:170
345
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:186
346
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:200
347
  msgid "correct?"
348
  msgstr "Korrekt?"
349
 
350
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:215
351
+ msgid ""
352
+ "In this mode, not a list have to be sorted, but elements must be assigned to "
353
+ "matching criterion."
354
+ msgstr ""
355
+ "In diesem Modus muss nicht eine Liste sortiert werden, sondern die "
356
+ "Sortierelemente müssen zu den passenden Kriterium zugeordnet werden."
357
+
358
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:221
359
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:259
360
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:294
361
+ msgid "Criterion"
362
+ msgstr "Kriterium"
363
+
364
+ #: lib/view/WpProQuiz_View_QuestionEdit.php:331
365
+ #: lib/view/WpProQuiz_View_QuizEdit.php:243
366
  msgid "Save"
367
  msgstr "Speichern"
368
 
519
  "Dieser Text wird beim Beenden (im Ergebnis) des Quizes angezeigt (Dieser "
520
  "Text ist optional)"
521
 
522
+ #: lib/view/WpProQuiz_View_QuizEdit.php:185
523
+ msgid "Activate graduation"
524
+ msgstr "Abstufungen aktivieren"
525
+
526
+ #: lib/view/WpProQuiz_View_QuizEdit.php:191
527
+ msgid "Hint:"
528
+ msgstr "Hinweis:"
529
+
530
+ #: lib/view/WpProQuiz_View_QuizEdit.php:193
531
+ msgid "Maximal 15 levels"
532
+ msgstr "Maximal 15 Stufen"
533
+
534
+ #: lib/view/WpProQuiz_View_QuizEdit.php:194
535
+ msgid "One question is one point"
536
+ msgstr "Eine Frage ist 1 Punkt"
537
+
538
+ #: lib/view/WpProQuiz_View_QuizEdit.php:195
539
+ msgid "Values can also be mixed up"
540
+ msgstr "Werte können auch durcheinander sein"
541
+
542
+ #: lib/view/WpProQuiz_View_QuizEdit.php:196
543
+ msgid "10,15% or 10.15% allowed (max. two digits after the decimal point)"
544
+ msgstr "10,15% oder 10.15% erlaubt (maximal 2 Stellen nach dem Komma)"
545
+
546
+ #: lib/view/WpProQuiz_View_QuizEdit.php:212
547
+ #: lib/view/WpProQuiz_View_QuizEdit.php:223
548
+ msgid "from:"
549
+ msgstr "Ab:"
550
+
551
+ #: lib/view/WpProQuiz_View_QuizEdit.php:212
552
+ #: lib/view/WpProQuiz_View_QuizEdit.php:223
553
+ msgid "percent"
554
+ msgstr "Prozent"
555
+
556
+ #: lib/view/WpProQuiz_View_QuizEdit.php:212
557
+ #: lib/view/WpProQuiz_View_QuizEdit.php:223
558
+ #, php-format
559
+ msgid ""
560
+ "(Will be displayed, when result-percent is >= <span class=\"resultProzent\">"
561
+ "%s</span>%%)"
562
+ msgstr ""
563
+ "(Wird angezeigt wenn Ergebnis-Prozent >= <span class=\"resultProzent\">%s</"
564
+ "span>%% ist)"
565
+
566
+ #: lib/view/WpProQuiz_View_QuizEdit.php:213
567
+ #: lib/view/WpProQuiz_View_QuizEdit.php:224
568
+ msgid "Delete graduation"
569
+ msgstr "Stufe löschen"
570
+
571
+ #: lib/view/WpProQuiz_View_QuizEdit.php:231
572
+ msgid "Add graduation"
573
+ msgstr "Stufe hinzufügen"
574
+
575
  #: lib/view/WpProQuiz_View_QuizOverall.php:8
576
  msgid "Quiz overview"
577
  msgstr "Quiz Übersicht"
630
  #~ msgid "Tip"
631
  #~ msgstr "Tipp"
632
 
 
 
 
633
  #, fuzzy
634
  #~ msgid "Statistics activate"
635
  #~ msgstr "Statistik aktivieren"
lib/controller/WpProQuiz_Controller_Admin.php CHANGED
@@ -36,7 +36,9 @@ class WpProQuiz_Controller_Admin {
36
  'no_title_msg' => __('Title is not filled!', 'wp-pro-quiz'),
37
  'no_question_msg' => __('No question deposited!', 'wp-pro-quiz'),
38
  'no_correct_msg' => __('Correct answer was not selected!', 'wp-pro-quiz'),
39
- 'no_answer_msg' => __('No answer deposited!', 'wp-pro-quiz')
 
 
40
  );
41
 
42
  wp_localize_script('wpProQuiz_admin_javascript', 'wpProQuizLocalize', $translation_array);
36
  'no_title_msg' => __('Title is not filled!', 'wp-pro-quiz'),
37
  'no_question_msg' => __('No question deposited!', 'wp-pro-quiz'),
38
  'no_correct_msg' => __('Correct answer was not selected!', 'wp-pro-quiz'),
39
+ 'no_answer_msg' => __('No answer deposited!', 'wp-pro-quiz'),
40
+ 'no_quiz_start_msg' => __('No quiz description filled!', 'wp-pro-quiz'),
41
+ 'fail_grade_result' => __('The percent values in result text are incorrect.', 'wp-pro-quiz')
42
  );
43
 
44
  wp_localize_script('wpProQuiz_admin_javascript', 'wpProQuizLocalize', $translation_array);
lib/controller/WpProQuiz_Controller_Question.php CHANGED
@@ -123,12 +123,20 @@ class WpProQuiz_Controller_Question extends WpProQuiz_Controller_Controller {
123
  case 'multiple':
124
  unset($post['answerJson']['answer_sort']);
125
  unset($post['answerJson']['free_answer']);
 
126
  break;
127
  case 'free_answer':
128
  unset($post['answerJson']['answer_sort']);
129
  unset($post['answerJson']['classic_answer']);
 
130
  break;
131
  case 'sort_answer':
 
 
 
 
 
 
132
  unset($post['answerJson']['free_answer']);
133
  unset($post['answerJson']['classic_answer']);
134
  break;
123
  case 'multiple':
124
  unset($post['answerJson']['answer_sort']);
125
  unset($post['answerJson']['free_answer']);
126
+ unset($post['answerJson']['matrix_sort_answer']);
127
  break;
128
  case 'free_answer':
129
  unset($post['answerJson']['answer_sort']);
130
  unset($post['answerJson']['classic_answer']);
131
+ unset($post['answerJson']['matrix_sort_answer']);
132
  break;
133
  case 'sort_answer':
134
+ unset($post['answerJson']['free_answer']);
135
+ unset($post['answerJson']['classic_answer']);
136
+ unset($post['answerJson']['matrix_sort_answer']);
137
+ break;
138
+ case 'matrix_sort_answer':
139
+ unset($post['answerJson']['answer_sort']);
140
  unset($post['answerJson']['free_answer']);
141
  unset($post['answerJson']['classic_answer']);
142
  break;
lib/controller/WpProQuiz_Controller_Quiz.php CHANGED
@@ -44,13 +44,23 @@ class WpProQuiz_Controller_Quiz extends WpProQuiz_Controller_Controller {
44
  }
45
 
46
  if(isset($this->_post['submit'])) {
 
 
 
 
 
47
  $this->view->quiz = new WpProQuiz_Model_Quiz($this->_post);
48
  $this->view->quiz->setId($id);
49
-
50
  if($this->checkValidit($this->_post)) {
 
51
  WpProQuiz_View_View::admin_notices(__('Quiz edited', 'wp-pro-quiz'), 'info');
 
52
  $this->view->quiz->getMapper()->save($this->view->quiz);
 
 
53
  $this->showAction();
 
54
  return;
55
  } else {
56
  WpProQuiz_View_View::admin_notices(__('Quiz title or quiz description are not filled', 'wp-pro-quiz'));
@@ -67,6 +77,11 @@ class WpProQuiz_Controller_Quiz extends WpProQuiz_Controller_Controller {
67
  $this->view->header = __('Create quiz', 'wp-pro-quiz');
68
 
69
  if(isset($this->_post['submit'])) {
 
 
 
 
 
70
  $this->view->quiz = new WpProQuiz_Model_Quiz($this->_post);
71
 
72
  if($this->checkValidit($this->_post)) {
@@ -95,4 +110,16 @@ class WpProQuiz_Controller_Quiz extends WpProQuiz_Controller_Controller {
95
  private function checkValidit($post) {
96
  return (isset($post['name']) && !empty($post['name']) && isset($post['text']) && !empty($post['text']));
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
44
  }
45
 
46
  if(isset($this->_post['submit'])) {
47
+
48
+ if(isset($this->_post['resultGradeEnabled'])) {
49
+ $this->_post['result_text'] = $this->filterResultTextGrade($this->_post);
50
+ }
51
+
52
  $this->view->quiz = new WpProQuiz_Model_Quiz($this->_post);
53
  $this->view->quiz->setId($id);
54
+
55
  if($this->checkValidit($this->_post)) {
56
+
57
  WpProQuiz_View_View::admin_notices(__('Quiz edited', 'wp-pro-quiz'), 'info');
58
+
59
  $this->view->quiz->getMapper()->save($this->view->quiz);
60
+
61
+
62
  $this->showAction();
63
+
64
  return;
65
  } else {
66
  WpProQuiz_View_View::admin_notices(__('Quiz title or quiz description are not filled', 'wp-pro-quiz'));
77
  $this->view->header = __('Create quiz', 'wp-pro-quiz');
78
 
79
  if(isset($this->_post['submit'])) {
80
+
81
+ if(isset($this->_post['resultGradeEnabled'])) {
82
+ $this->_post['result_text'] = $this->filterResultTextGrade($this->_post);
83
+ }
84
+
85
  $this->view->quiz = new WpProQuiz_Model_Quiz($this->_post);
86
 
87
  if($this->checkValidit($this->_post)) {
110
  private function checkValidit($post) {
111
  return (isset($post['name']) && !empty($post['name']) && isset($post['text']) && !empty($post['text']));
112
  }
113
+
114
+ private function filterResultTextGrade($post) {
115
+ $activ = array_keys($post['resultTextGrade']['activ'], '1');
116
+ $result = array();
117
+
118
+ foreach($activ as $k) {
119
+ $result['text'][] = $post['resultTextGrade']['text'][$k];
120
+ $result['prozent'][] = (float)str_replace(',', '.', $post['resultTextGrade']['prozent'][$k]);
121
+ }
122
+
123
+ return $result;
124
+ }
125
  }
lib/helper/WpProQuiz_Helper_DbUpgrade.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  class WpProQuiz_Helper_DbUpgrade {
3
 
4
- const WPPROQUIZ_DB_VERSION = 5;
5
 
6
  private $_wpdb;
7
  private $_prefix;
@@ -53,6 +53,7 @@ class WpProQuiz_Helper_DbUpgrade {
53
  `name` varchar(200) NOT NULL,
54
  `text` text NOT NULL,
55
  `result_text` text NOT NULL,
 
56
  `title_hidden` tinyint(1) NOT NULL,
57
  `question_random` tinyint(1) NOT NULL,
58
  `answer_random` tinyint(1) NOT NULL,
@@ -149,7 +150,7 @@ class WpProQuiz_Helper_DbUpgrade {
149
  private function upgradeDbV4() {
150
 
151
  $this->_wpdb->query('
152
- ALTER TABLE `wp_wp_pro_quiz_question`
153
  ADD `tip_enabled` TINYINT( 1 ) NOT NULL AFTER `incorrect_count` ,
154
  ADD `tip_msg` TEXT NOT NULL AFTER `tip_enabled` ,
155
  ADD `tip_count` INT NOT NULL AFTER `tip_msg`
@@ -157,4 +158,36 @@ class WpProQuiz_Helper_DbUpgrade {
157
 
158
  return 5;
159
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  }
1
  <?php
2
  class WpProQuiz_Helper_DbUpgrade {
3
 
4
+ const WPPROQUIZ_DB_VERSION = 6;
5
 
6
  private $_wpdb;
7
  private $_prefix;
53
  `name` varchar(200) NOT NULL,
54
  `text` text NOT NULL,
55
  `result_text` text NOT NULL,
56
+ `result_grade_enabled` tinyint(1) NOT NULL,
57
  `title_hidden` tinyint(1) NOT NULL,
58
  `question_random` tinyint(1) NOT NULL,
59
  `answer_random` tinyint(1) NOT NULL,
150
  private function upgradeDbV4() {
151
 
152
  $this->_wpdb->query('
153
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_question`
154
  ADD `tip_enabled` TINYINT( 1 ) NOT NULL AFTER `incorrect_count` ,
155
  ADD `tip_msg` TEXT NOT NULL AFTER `tip_enabled` ,
156
  ADD `tip_count` INT NOT NULL AFTER `tip_msg`
158
 
159
  return 5;
160
  }
161
+
162
+ private function upgradeFixDbV4() {
163
+ if($this->_wpdb->prefix != 'wp_') {
164
+ $this->_wpdb->query('SELECT * FROM `'.$this->_wpdb->prefix.'wp_pro_quiz_question` LIMIT 0,1');
165
+
166
+ $names = $this->_wpdb->get_col_info('name');
167
+
168
+ if(!in_array('tip_enabled', $names)) {
169
+ $this->_wpdb->query('ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_question` ADD `tip_enabled` TINYINT( 1 ) NOT NULL AFTER `incorrect_count`');
170
+ }
171
+
172
+ if(!in_array('tip_msg', $names)) {
173
+ $this->_wpdb->query('ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_question` ADD `tip_msg` TEXT NOT NULL AFTER `tip_enabled`');
174
+ }
175
+
176
+ if(!in_array('tip_count', $names)) {
177
+ $this->_wpdb->query('ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_question` ADD `tip_count` INT NOT NULL AFTER `tip_msg`');
178
+ }
179
+ }
180
+ }
181
+
182
+ private function upgradeDbV5() {
183
+
184
+ $this->upgradeFixDbV4();
185
+
186
+ $this->_wpdb->query('
187
+ ALTER TABLE `'.$this->_wpdb->prefix.'wp_pro_quiz_master`
188
+ ADD `result_grade_enabled` TINYINT( 1 ) NOT NULL AFTER `result_text`
189
+ ');
190
+
191
+ return 6;
192
+ }
193
  }
lib/model/WpProQuiz_Model_Quiz.php CHANGED
@@ -13,6 +13,7 @@ class WpProQuiz_Model_Quiz extends WpProQuiz_Model_Model {
13
  protected $_checkAnswer;
14
  protected $_statisticsOn;
15
  protected $_statisticsIpLock;
 
16
 
17
  public function getId() {
18
  return $this->_id;
@@ -121,4 +122,13 @@ class WpProQuiz_Model_Quiz extends WpProQuiz_Model_Model {
121
  public function getStatisticsIpLock() {
122
  return $this->_statisticsIpLock;
123
  }
 
 
 
 
 
 
 
 
 
124
  }
13
  protected $_checkAnswer;
14
  protected $_statisticsOn;
15
  protected $_statisticsIpLock;
16
+ protected $_resultGradeEnabled = false;
17
 
18
  public function getId() {
19
  return $this->_id;
122
  public function getStatisticsIpLock() {
123
  return $this->_statisticsIpLock;
124
  }
125
+
126
+ public function setResultGradeEnabled($_resultGradeEnabled) {
127
+ $this->_resultGradeEnabled = (bool)$_resultGradeEnabled;
128
+ return $this;
129
+ }
130
+
131
+ public function isResultGradeEnabled() {
132
+ return $this->_resultGradeEnabled;
133
+ }
134
  }
lib/model/WpProQuiz_Model_QuizMapper.php CHANGED
@@ -32,6 +32,9 @@ class WpProQuiz_Model_QuizMapper extends WpProQuiz_Model_Mapper
32
  ARRAY_A
33
  );
34
 
 
 
 
35
  return new WpProQuiz_Model_Quiz($results);
36
  }
37
 
@@ -41,6 +44,10 @@ class WpProQuiz_Model_QuizMapper extends WpProQuiz_Model_Mapper
41
  $results = $this->_wpdb->get_results("SELECT * FROM {$this->_table}", ARRAY_A);
42
 
43
  foreach ($results as $row) {
 
 
 
 
44
  $r[] = new WpProQuiz_Model_Quiz($row);
45
  }
46
 
@@ -49,10 +56,16 @@ class WpProQuiz_Model_QuizMapper extends WpProQuiz_Model_Mapper
49
 
50
  public function save(WpProQuiz_Model_Quiz $data) {
51
 
 
 
 
 
 
 
52
  $set = array(
53
  'name' => $data->getName(),
54
  'text' => $data->getText(),
55
- 'result_text' => $data->getResultText(),
56
  'title_hidden' => (int)$data->isTitleHidden(),
57
  'question_random' => (int)$data->isQuestionRandom(),
58
  'answer_random' => (int)$data->isAnswerRandom(),
@@ -60,7 +73,8 @@ class WpProQuiz_Model_QuizMapper extends WpProQuiz_Model_Mapper
60
  'check_answer' => (int) $data->isCheckAnswer(),
61
  'time_limit' => (int)$data->getTimeLimit(),
62
  'statistics_on' => (int)$data->isStatisticsOn(),
63
- 'statistics_ip_lock' => (int)$data->getStatisticsIpLock()
 
64
  );
65
 
66
  if($data->getId() != 0) {
@@ -69,12 +83,12 @@ class WpProQuiz_Model_QuizMapper extends WpProQuiz_Model_Mapper
69
  array(
70
  'id' => $data->getId()
71
  ),
72
- array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'),
73
  array('%d'));
74
  } else {
75
  return $this->_wpdb->insert($this->_table,
76
  $set,
77
- array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'));
78
  }
79
  }
80
  }
32
  ARRAY_A
33
  );
34
 
35
+ if($results['result_grade_enabled'])
36
+ $results['result_text'] = unserialize($results['result_text']);
37
+
38
  return new WpProQuiz_Model_Quiz($results);
39
  }
40
 
44
  $results = $this->_wpdb->get_results("SELECT * FROM {$this->_table}", ARRAY_A);
45
 
46
  foreach ($results as $row) {
47
+
48
+ if($row['result_grade_enabled'])
49
+ $row['result_text'] = unserialize($row['result_text']);
50
+
51
  $r[] = new WpProQuiz_Model_Quiz($row);
52
  }
53
 
56
 
57
  public function save(WpProQuiz_Model_Quiz $data) {
58
 
59
+ if($data->isResultGradeEnabled()) {
60
+ $resultText = serialize($data->getResultText());
61
+ } else {
62
+ $resultText = $data->getResultText();
63
+ }
64
+
65
  $set = array(
66
  'name' => $data->getName(),
67
  'text' => $data->getText(),
68
+ 'result_text' => $resultText,
69
  'title_hidden' => (int)$data->isTitleHidden(),
70
  'question_random' => (int)$data->isQuestionRandom(),
71
  'answer_random' => (int)$data->isAnswerRandom(),
73
  'check_answer' => (int) $data->isCheckAnswer(),
74
  'time_limit' => (int)$data->getTimeLimit(),
75
  'statistics_on' => (int)$data->isStatisticsOn(),
76
+ 'statistics_ip_lock' => (int)$data->getStatisticsIpLock(),
77
+ 'result_grade_enabled' => (int)$data->isResultGradeEnabled()
78
  );
79
 
80
  if($data->getId() != 0) {
83
  array(
84
  'id' => $data->getId()
85
  ),
86
+ array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'),
87
  array('%d'));
88
  } else {
89
  return $this->_wpdb->insert($this->_table,
90
  $set,
91
+ array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'));
92
  }
93
  }
94
  }
lib/view/WpProQuiz_View_FrontQuiz.php CHANGED
@@ -24,6 +24,9 @@ class WpProQuiz_View_FrontQuiz extends WpProQuiz_View_View {
24
  $t = explode("\n", $t);
25
  $a['correct'] = array_values(array_filter(array_map('trim', $t)));
26
  break;
 
 
 
27
  }
28
 
29
  $r[] = $a;
@@ -38,6 +41,18 @@ class WpProQuiz_View_FrontQuiz extends WpProQuiz_View_View {
38
 
39
  $json = json_encode($this->parseJson($this->question));
40
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ?>
42
 
43
  <div class="wpProQuiz_content" id="wpProQuiz_<?php echo $this->quiz->getId(); ?>">
@@ -64,7 +79,15 @@ class WpProQuiz_View_FrontQuiz extends WpProQuiz_View_View {
64
  <?php _e('Your time: <span></span>', 'wp-pro-quiz') ?>
65
  </p>
66
  <div>
67
- <?php echo do_shortcode(apply_filters('comment_text', $this->quiz->getResultText())); ?>
 
 
 
 
 
 
 
 
68
  </div>
69
  <p>
70
  <input type="button" name="restartQuiz" value="<?php _e('Restart quiz', 'wp-pro-quiz'); ?>" >
@@ -80,7 +103,8 @@ class WpProQuiz_View_FrontQuiz extends WpProQuiz_View_View {
80
  <?php
81
  $index = 0;
82
  foreach($this->question as $question) {
83
- $index++;
 
84
  ?>
85
  <li class="wpProQuiz_listItem">
86
  <div class="wpProQuiz_question_page">
@@ -91,10 +115,21 @@ class WpProQuiz_View_FrontQuiz extends WpProQuiz_View_View {
91
  <div class="wpProQuiz_question_text">
92
  <?php echo do_shortcode(apply_filters('comment_text', $question->getQuestion())); ?>
93
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  <ul class="wpProQuiz_questionList">
95
  <?php
96
- $answerArray = $question->getAnswerJson();
97
-
98
  if($question->getAnswerType() === 'single' || $question->getAnswerType() === 'multiple') {
99
  $answer_index = 1;
100
  foreach($answerArray['classic_answer']['answer'] as $k => $v) {
@@ -124,7 +159,25 @@ class WpProQuiz_View_FrontQuiz extends WpProQuiz_View_View {
124
  <input type="text" name="question" style="width: 300px;">
125
  </label>
126
  </li>
127
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  </ul>
129
  </div>
130
  <div class="wpProQuiz_response">
@@ -185,6 +238,7 @@ jQuery(document).ready(function($) {
185
  quizId: <?php echo (int)$this->quiz->getId(); ?>,
186
  statisticsOn: <?php echo $preview ? 0 : (int)$this->quiz->isStatisticsOn(); ?>,
187
  url: '<?php echo admin_url('admin-ajax.php'); ?>',
 
188
  json: <?php echo $json; ?>
189
  });
190
  });
24
  $t = explode("\n", $t);
25
  $a['correct'] = array_values(array_filter(array_map('trim', $t)));
26
  break;
27
+ case 'matrix_sort_answer':
28
+ $a['correct'] = array_keys(array_values($j['answer_matrix_sort']['sort_string']));
29
+ break;
30
  }
31
 
32
  $r[] = $a;
41
 
42
  $json = json_encode($this->parseJson($this->question));
43
 
44
+ $result = $this->quiz->getResultText();
45
+
46
+ if(!$this->quiz->isResultGradeEnabled()) {
47
+ $r = array();
48
+ $r['text'][] = $result;
49
+ $r['prozent'][] = 0;
50
+
51
+ $result = $r;
52
+ }
53
+
54
+ $resultsProzent = json_encode($result['prozent']);
55
+
56
  ?>
57
 
58
  <div class="wpProQuiz_content" id="wpProQuiz_<?php echo $this->quiz->getId(); ?>">
79
  <?php _e('Your time: <span></span>', 'wp-pro-quiz') ?>
80
  </p>
81
  <div>
82
+ <ul class="wpProQuiz_resultsList">
83
+ <?php foreach($result['text'] as $resultText) { ?>
84
+ <li>
85
+ <div>
86
+ <?php echo do_shortcode(apply_filters('comment_text', $resultText)); ?>
87
+ </div>
88
+ </li>
89
+ <?php } ?>
90
+ </ul>
91
  </div>
92
  <p>
93
  <input type="button" name="restartQuiz" value="<?php _e('Restart quiz', 'wp-pro-quiz'); ?>" >
103
  <?php
104
  $index = 0;
105
  foreach($this->question as $question) {
106
+ $index++;
107
+ $answerArray = $question->getAnswerJson();
108
  ?>
109
  <li class="wpProQuiz_listItem">
110
  <div class="wpProQuiz_question_page">
115
  <div class="wpProQuiz_question_text">
116
  <?php echo do_shortcode(apply_filters('comment_text', $question->getQuestion())); ?>
117
  </div>
118
+ <?php if($question->getAnswerType() === 'matrix_sort_answer') { ?>
119
+ <div class="wpProQuiz_matrixSortString">
120
+ <h3><?php _e('Sort elements', 'wp-pro-quiz'); ?></h3>
121
+ <ul class="wpProQuiz_sortStringList">
122
+ <?php
123
+ foreach($answerArray['answer_matrix_sort']['sort_string'] as $k => $v) {
124
+ ?>
125
+ <li class="wpProQuiz_sortStringItem"><?php echo (isset($answerArray['answer_matrix_sort']['sort_string_html']) && in_array($k, $answerArray['answer_matrix_sort']['sort_string_html'])) ? $v : esc_html($v); ?></li>
126
+ <?php } ?>
127
+ </ul>
128
+ <div style="clear: both;"></div>
129
+ </div>
130
+ <?php } ?>
131
  <ul class="wpProQuiz_questionList">
132
  <?php
 
 
133
  if($question->getAnswerType() === 'single' || $question->getAnswerType() === 'multiple') {
134
  $answer_index = 1;
135
  foreach($answerArray['classic_answer']['answer'] as $k => $v) {
159
  <input type="text" name="question" style="width: 300px;">
160
  </label>
161
  </li>
162
+ <?php } else if($question->getAnswerType() === 'matrix_sort_answer') {
163
+ foreach($answerArray['answer_matrix_sort']['answer'] as $k => $v) {
164
+ $ma = $answerArray['answer_matrix_sort'];
165
+ ?>
166
+
167
+ <li class="wpProQuiz_questionListItem">
168
+ <table>
169
+ <tbody>
170
+ <tr class="wpProQuiz_mextrixTr">
171
+ <td width="20%"><div class="wpProQuiz_maxtrixSortText" ><?php echo (isset($ma['answer_html']) && in_array($k, $ma['answer_html'])) ? $v : esc_html($v); ?></div></td>
172
+ <td width="80%" >
173
+ <ul class="wpProQuiz_maxtrixSortCriterion"></ul>
174
+ </td>
175
+ </tr>
176
+ </tbody>
177
+ </table>
178
+ </li>
179
+
180
+ <?php } } ?>
181
  </ul>
182
  </div>
183
  <div class="wpProQuiz_response">
238
  quizId: <?php echo (int)$this->quiz->getId(); ?>,
239
  statisticsOn: <?php echo $preview ? 0 : (int)$this->quiz->isStatisticsOn(); ?>,
240
  url: '<?php echo admin_url('admin-ajax.php'); ?>',
241
+ resultsGrade: <?php echo $resultsProzent; ?>,
242
  json: <?php echo $json; ?>
243
  });
244
  });
lib/view/WpProQuiz_View_QuestionEdit.php CHANGED
@@ -100,6 +100,10 @@ jQuery(document).ready(function($) {
100
  <input type="radio" name="answerType" value="sort_answer" <?php echo ($type === 'sort_answer') ? 'checked="checked"' : ''; ?>>
101
  <?php _e('"Sorting" choice', 'wp-pro-quiz'); ?>
102
  </label>
 
 
 
 
103
  </div>
104
  </div>
105
  <div class="postbox">
@@ -206,6 +210,122 @@ jQuery(document).ready(function($) {
206
  </ul>
207
  <input type="button" class="button-primary addAnswer" value="<?php _e('Add new answer', 'wp-pro-quiz'); ?>">
208
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  </div>
210
  </div>
211
  <input type="submit" name="submit" id="saveQuestion" class="button-primary" value="<?php _e('Save', 'wp-pro-quiz'); ?>">
100
  <input type="radio" name="answerType" value="sort_answer" <?php echo ($type === 'sort_answer') ? 'checked="checked"' : ''; ?>>
101
  <?php _e('"Sorting" choice', 'wp-pro-quiz'); ?>
102
  </label>
103
+ <label style="padding-right: 10px;">
104
+ <input type="radio" name="answerType" value="matrix_sort_answer" <?php echo ($type === 'matrix_sort_answer') ? 'checked="checked"' : ''; ?>>
105
+ <?php _e('"Matrix Sorting" choice', 'wp-pro-quiz'); ?>
106
+ </label>
107
  </div>
108
  </div>
109
  <div class="postbox">
210
  </ul>
211
  <input type="button" class="button-primary addAnswer" value="<?php _e('Add new answer', 'wp-pro-quiz'); ?>">
212
  </div>
213
+ <div class="matrix_sort_answer">
214
+ <p class="description">
215
+ <?php _e('In this mode, not a list have to be sorted, but elements must be assigned to matching criterion.', 'wp-pro-quiz'); ?>
216
+ </p>
217
+ <ul>
218
+ <li style="border-bottom:1px dotted #ccc; padding-bottom: 5px; display:none; background-color: whiteSmoke;">
219
+ <table style="width: 100%; margin-bottom: 10px;">
220
+ <thead>
221
+ <td><?php _e('Criterion', 'wp-pro-quiz'); ?></td>
222
+ <td><?php _e('Sort elements', 'wp-pro-quiz'); ?></td>
223
+ </thead>
224
+ <tbody>
225
+ <tr>
226
+ <td>
227
+ <textarea rows="4" name="answerJson[answer_matrix_sort][answer][]" style="width: 100%; resize:none;"></textarea>
228
+ </td>
229
+ <td>
230
+ <textarea rows="4" name="answerJson[answer_matrix_sort][sort_string][]" style="width: 100%; resize:none;"></textarea>
231
+ </td>
232
+ </tr>
233
+ <tr>
234
+ <td>
235
+ <label>
236
+ <?php _e('Allow HTML', 'wp-pro-quiz'); ?>
237
+ <input type="checkbox" name="answerJson[answer_matrix_sort][answer_html][]" value="0">
238
+ </label>
239
+ </td>
240
+ <td>
241
+ <label>
242
+ <?php _e('Allow HTML', 'wp-pro-quiz'); ?>
243
+ <input type="checkbox" name="answerJson[answer_matrix_sort][sort_string_html][]" value="0">
244
+ </label>
245
+ </td>
246
+ </tr>
247
+ </tbody>
248
+ </table>
249
+ <a href="#" class="button-secondary wpProQuiz_move" style="cursor: move;"><?php _e('Move', 'wp-pro-quiz'); ?></a>
250
+ <input type="button" name="submit" class="button-primary deleteAnswer" value="<?php _e('Delete answer', 'wp-pro-quiz'); ?>">
251
+ </li>
252
+ <?php if($type === 'matrix_sort_answer') {
253
+ foreach($qa['answer_matrix_sort']['answer'] as $k => $v) {
254
+ $ms = $qa['answer_matrix_sort'];
255
+ ?>
256
+ <li style="border-bottom:1px dotted #ccc; padding-bottom: 5px; background-color: whiteSmoke;">
257
+ <table style="width: 100%; margin-bottom: 10px;">
258
+ <thead>
259
+ <td><?php _e('Criterion', 'wp-pro-quiz'); ?></td>
260
+ <td><?php _e('Sort elements', 'wp-pro-quiz'); ?></td>
261
+ </thead>
262
+ <tbody>
263
+ <tr>
264
+ <td>
265
+ <textarea rows="4" name="answerJson[answer_matrix_sort][answer][]" style="width: 100%; resize:none;"><?php echo $v; ?></textarea>
266
+ </td>
267
+ <td>
268
+ <textarea rows="4" name="answerJson[answer_matrix_sort][sort_string][]" style="width: 100%; resize:none;"><?php echo $ms['sort_string'][$k]; ?></textarea>
269
+ </td>
270
+ </tr>
271
+ <tr>
272
+ <td>
273
+ <label>
274
+ <?php _e('Allow HTML', 'wp-pro-quiz'); ?>
275
+ <input type="checkbox" name="answerJson[answer_matrix_sort][answer_html][]" value="<?php echo $k; ?>" <?php echo (isset($ms['answer_html']) && in_array($k, $ms['answer_html'])) ? 'checked="checked"' : ''; ?>>
276
+ </label>
277
+ </td>
278
+ <td>
279
+ <label>
280
+ <?php _e('Allow HTML', 'wp-pro-quiz'); ?>
281
+ <input type="checkbox" name="answerJson[answer_matrix_sort][sort_string_html][]" value="<?php echo $k; ?>" <?php echo (isset($ms['sort_string_html']) && in_array($k, $ms['sort_string_html'])) ? 'checked="checked"' : ''; ?>>
282
+ </label>
283
+ </td>
284
+ </tr>
285
+ </tbody>
286
+ </table>
287
+ <a href="#" class="button-secondary wpProQuiz_move" style="cursor: move;"><?php _e('Move', 'wp-pro-quiz'); ?></a>
288
+ <input type="button" name="submit" class="button-primary deleteAnswer" value="<?php _e('Delete answer', 'wp-pro-quiz'); ?>">
289
+ </li>
290
+ <?php } } else { ?>
291
+ <li style="border-bottom:1px dotted #ccc; padding-bottom: 5px; background-color: whiteSmoke;">
292
+ <table style="width: 100%; margin-bottom: 10px;">
293
+ <thead>
294
+ <th><?php _e('Criterion', 'wp-pro-quiz'); ?></th>
295
+ <th><?php _e('Sort elements', 'wp-pro-quiz'); ?></th>
296
+ </thead>
297
+ <tbody>
298
+ <tr>
299
+ <td>
300
+ <textarea rows="4" name="answerJson[answer_matrix_sort][answer][]" style="width: 100%; resize:vertical;"></textarea>
301
+ </td>
302
+ <td>
303
+ <textarea rows="4" name="answerJson[answer_matrix_sort][sort_string][]" style="width: 100%; resize:vertical;"></textarea>
304
+ </td>
305
+ </tr>
306
+ <tr>
307
+ <td>
308
+ <label>
309
+ <?php _e('Allow HTML', 'wp-pro-quiz'); ?>
310
+ <input type="checkbox" name="answerJson[answer_matrix_sort][answer_html][]" value="1">
311
+ </label>
312
+ </td>
313
+ <td>
314
+ <label>
315
+ <?php _e('Allow HTML', 'wp-pro-quiz'); ?>
316
+ <input type="checkbox" name="answerJson[answer_matrix_sort][sort_string_html][]" value="1">
317
+ </label>
318
+ </td>
319
+ </tr>
320
+ </tbody>
321
+ </table>
322
+ <a href="#" class="button-secondary wpProQuiz_move" style="cursor: move;"><?php _e('Move', 'wp-pro-quiz'); ?></a>
323
+ <input type="button" name="submit" class="button-primary deleteAnswer" value="<?php _e('Delete answer', 'wp-pro-quiz'); ?>">
324
+ </li>
325
+ <?php } ?>
326
+ </ul>
327
+ <input type="button" class="button-primary addAnswer" value="<?php _e('Add new answer', 'wp-pro-quiz'); ?>">
328
+ </div>
329
  </div>
330
  </div>
331
  <input type="submit" name="submit" id="saveQuestion" class="button-primary" value="<?php _e('Save', 'wp-pro-quiz'); ?>">
lib/view/WpProQuiz_View_QuizEdit.php CHANGED
@@ -11,7 +11,7 @@ class WpProQuiz_View_QuizEdit extends WpProQuiz_View_View {
11
  <div class="postbox">
12
  <h3 class="hndle"><?php _e('Quiz title', 'wp-pro-quiz'); ?> <?php _e('(required)', 'wp-pro-quiz'); ?></h3>
13
  <div class="inside">
14
- <input name="name" type="text" class="regular-text" value="<?php echo $this->quiz->getName(); ?>">
15
  </div>
16
  </div>
17
  <div class="postbox">
@@ -180,12 +180,67 @@ class WpProQuiz_View_QuizEdit extends WpProQuiz_View_View {
180
  <p class="description">
181
  <?php _e('This text will be displayed at the end of the quiz (in results). (this text is optional)', 'wp-pro-quiz'); ?>
182
  </p>
183
- <?php
184
- wp_editor($this->quiz->getResultText(), "resultText");
185
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  </div>
187
  </div>
188
- <input type="submit" name="submit" class="button-primary" value="<?php _e('Save', 'wp-pro-quiz'); ?>">
189
  </div>
190
  </form>
191
  </div>
11
  <div class="postbox">
12
  <h3 class="hndle"><?php _e('Quiz title', 'wp-pro-quiz'); ?> <?php _e('(required)', 'wp-pro-quiz'); ?></h3>
13
  <div class="inside">
14
+ <input name="name" id="wpProQuiz_title" type="text" class="regular-text" value="<?php echo $this->quiz->getName(); ?>">
15
  </div>
16
  </div>
17
  <div class="postbox">
180
  <p class="description">
181
  <?php _e('This text will be displayed at the end of the quiz (in results). (this text is optional)', 'wp-pro-quiz'); ?>
182
  </p>
183
+ <div style="padding-top: 10px; padding-bottom: 10px;">
184
+ <label for="wpProQuiz_resultGradeEnabled">
185
+ <?php _e('Activate graduation', 'wp-pro-quiz'); ?>
186
+ <input type="checkbox" name="resultGradeEnabled" id="wpProQuiz_resultGradeEnabled" value="1" <?php echo $this->quiz->isResultGradeEnabled() ? 'checked="checked"' : ''; ?>>
187
+ </label>
188
+ </div>
189
+ <div style="display: none;" id="resultGrade">
190
+ <div>
191
+ <strong><?php _e('Hint:', 'wp-pro-quiz'); ?></strong>
192
+ <ul style="list-style-type: square; padding: 5px; margin-left: 20px; margin-top: 0;">
193
+ <li><?php _e('Maximal 15 levels', 'wp-pro-quiz'); ?></li>
194
+ <li><?php _e('One question is one point', 'wp-pro-quiz'); ?></li>
195
+ <li><?php _e('Values can also be mixed up', 'wp-pro-quiz'); ?></li>
196
+ <li><?php _e('10,15% or 10.15% allowed (max. two digits after the decimal point)', 'wp-pro-quiz'); ?></li>
197
+ </ul>
198
+
199
+ </div>
200
+ <div>
201
+ <ul id="resultList">
202
+ <?php
203
+ $resultText = $this->quiz->getResultText();
204
+
205
+ for($i = 0; $i < 15; $i++) {
206
+
207
+ if($this->quiz->isResultGradeEnabled() && isset($resultText['text'][$i])) {
208
+ ?>
209
+ <li style="padding: 5px; border: 1; border: 1px dotted;">
210
+ <div style="margin-bottom: 5px;"><?php wp_editor($resultText['text'][$i], 'resultText_'.$i, array('textarea_rows' => 3, 'textarea_name' => 'resultTextGrade[text][]')); ?></div>
211
+ <div style="margin-bottom: 5px;background-color: rgb(207, 207, 207);padding: 10px;">
212
+ <?php _e('from:', 'wp-pro-quiz'); ?> <input type="text" name="resultTextGrade[prozent][]" class="small-text" value="<?php echo $resultText['prozent'][$i]?>"> <?php _e('percent', 'wp-pro-quiz'); ?> <?php printf(__('(Will be displayed, when result-percent is >= <span class="resultProzent">%s</span>%%)', 'wp-pro-quiz'), $resultText['prozent'][$i]); ?>
213
+ <input type="button" style="float: right;" class="button-primary deleteResult" value="<?php _e('Delete graduation', 'wp-pro-quiz'); ?>">
214
+ <div style="clear: right;"></div>
215
+ <input type="hidden" value="1" name="resultTextGrade[activ][]">
216
+ </div>
217
+ </li>
218
+
219
+ <?php } else { ?>
220
+ <li style="padding: 5px; border: 1; border: 1px dotted; <?php echo $i ? 'display:none;' : '' ?>">
221
+ <div style="margin-bottom: 5px;"><?php wp_editor('', 'resultText_'.$i, array('textarea_rows' => 3, 'textarea_name' => 'resultTextGrade[text][]')); ?></div>
222
+ <div style="margin-bottom: 5px;background-color: rgb(207, 207, 207);padding: 10px;">
223
+ <?php _e('from:', 'wp-pro-quiz'); ?> <input type="text" name="resultTextGrade[prozent][]" class="small-text" value="0"> <?php _e('percent', 'wp-pro-quiz'); ?> <?php printf(__('(Will be displayed, when result-percent is >= <span class="resultProzent">%s</span>%%)', 'wp-pro-quiz'), '0'); ?>
224
+ <input type="button" style="float: right;" class="button-primary deleteResult" value="<?php _e('Delete graduation', 'wp-pro-quiz'); ?>">
225
+ <div style="clear: right;"></div>
226
+ <input type="hidden" value="<?php echo $i ? '0' : '1' ?>" name="resultTextGrade[activ][]">
227
+ </div>
228
+ </li>
229
+ <?php } } ?>
230
+ </ul>
231
+ <input type="button" class="button-primary addResult" value="<?php _e('Add graduation', 'wp-pro-quiz'); ?>">
232
+ </div>
233
+ </div>
234
+ <div id="resultNormal">
235
+ <?php
236
+
237
+ $resultText = is_array($resultText) ? '' : $resultText;
238
+ wp_editor($resultText, 'resultText', array('textarea_rows' => 10));
239
+ ?>
240
+ </div>
241
  </div>
242
  </div>
243
+ <input type="submit" name="submit" class="button-primary" id="wpProQuiz_save" value="<?php _e('Save', 'wp-pro-quiz'); ?>">
244
  </div>
245
  </form>
246
  </div>
lib/view/WpProQuiz_View_Statistics.php CHANGED
@@ -7,7 +7,7 @@ class WpProQuiz_View_Statistics extends WpProQuiz_View_View {
7
  <h2><?php printf(__('Quiz: %s - Statistics', 'wp-pro-quiz'), $this->quiz->getName()); ?></h2>
8
  <p><a class="button-secondary" href="admin.php?page=wpProQuiz"><?php _e('back to overview', 'wp-pro-quiz'); ?></a></p>
9
  <?php if(!$this->quiz->isStatisticsOn()) { ?>
10
- <p style="padding: 30px; background: #F7E4E4; border: 1px dotted; width: 260px;">
11
  <span style="font-weight: bold; padding-right: 10px;"><?php _e('Stats not enabled', 'wp-pro-quiz'); ?></span>
12
  <a class="button-secondary" href="admin.php?page=wpProQuiz&action=edit&id=<?php echo $this->quiz->getId(); ?>"><?php _e('Activate statistics', 'wp-pro-quiz'); ?></a>
13
  </p>
7
  <h2><?php printf(__('Quiz: %s - Statistics', 'wp-pro-quiz'), $this->quiz->getName()); ?></h2>
8
  <p><a class="button-secondary" href="admin.php?page=wpProQuiz"><?php _e('back to overview', 'wp-pro-quiz'); ?></a></p>
9
  <?php if(!$this->quiz->isStatisticsOn()) { ?>
10
+ <p style="padding: 30px; background: #F7E4E4; border: 1px dotted; width: 300px;">
11
  <span style="font-weight: bold; padding-right: 10px;"><?php _e('Stats not enabled', 'wp-pro-quiz'); ?></span>
12
  <a class="button-secondary" href="admin.php?page=wpProQuiz&action=edit&id=<?php echo $this->quiz->getId(); ?>"><?php _e('Activate statistics', 'wp-pro-quiz'); ?></a>
13
  </p>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: xeno010
3
  Tags: quiz
4
  Requires at least: 3.3
5
  Tested up to: 3.4.2
6
- Stable tag: 0.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -18,13 +18,15 @@ A powerful and beautiful quiz plugin for WordPress.
18
  * Multiple Choice
19
  * "Sorting" Choice
20
  * "Free" Choice
 
21
  * Timelimit
22
  * Random Answer (optional)
23
  * Random Question (optional)
24
  * HTML in questions and answers is allowed (optional)
25
  * Multimedia in questions
26
- * Back-Button (optional)
27
  * Correct / incorrect response message for all questions (optional)
 
28
  * Preview-function
29
  * Statistics
30
  * Hints
@@ -72,4 +74,9 @@ http://www.it-gecko.de/wp-pro-quiz-quiz-plugin-fuer-wordpress.html (scroll to "D
72
  = 0.4 =
73
  * added hint support
74
  * bug in sort choice were fixed
75
- * mistranslations were fixed
 
 
 
 
 
3
  Tags: quiz
4
  Requires at least: 3.3
5
  Tested up to: 3.4.2
6
+ Stable tag: 0.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
18
  * Multiple Choice
19
  * "Sorting" Choice
20
  * "Free" Choice
21
+ * "Matrix Sorting" Choice
22
  * Timelimit
23
  * Random Answer (optional)
24
  * Random Question (optional)
25
  * HTML in questions and answers is allowed (optional)
26
  * Multimedia in questions
27
+ * Back-Button (optional)
28
  * Correct / incorrect response message for all questions (optional)
29
+ * Result text with gradations (optional)
30
  * Preview-function
31
  * Statistics
32
  * Hints
74
  = 0.4 =
75
  * added hint support
76
  * bug in sort choice were fixed
77
+ * mistranslations were fixed
78
+
79
+ = 0.5 =
80
+ * New choice: "Matrix Sorting" choice
81
+ * Result text now can be graduated
82
+ * CSS Bugfix
wp-pro-quiz.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: WP-Pro-Quiz
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
5
  Description: A powerful and beautiful quiz plugin for WordPress.
6
- Version: 0.4
7
  Author: Julius Fischer
8
  Author URI: http://www.it-gecko.de
9
  */
10
 
11
- define('WPPROQUIZ_VERSION', '0.4');
12
 
13
  include_once 'lib/controller/WpProQuiz_Controller_Admin.php';
14
  include_once 'lib/helper/WpProQuiz_Helper_DbUpgrade.php';
3
  Plugin Name: WP-Pro-Quiz
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-pro-quiz
5
  Description: A powerful and beautiful quiz plugin for WordPress.
6
+ Version: 0.5
7
  Author: Julius Fischer
8
  Author URI: http://www.it-gecko.de
9
  */
10
 
11
+ define('WPPROQUIZ_VERSION', '0.5');
12
 
13
  include_once 'lib/controller/WpProQuiz_Controller_Admin.php';
14
  include_once 'lib/helper/WpProQuiz_Helper_DbUpgrade.php';